Skip to content
ƒ FlowscriptDocs
ftw.trade docs ↗
Documentation
Learn / Flowscript

Flowscript documentation

Learn the language, understand its host contract, and compile and replay programs over your own data.

Flowscript is a language for programs that read time series, calculate signals and describe when to act. The same program and inputs produce the same evaluated values and decisions. The compiler checks types, reads and actions before evaluation; the runtime enforces work and memory limits.

The language is an independent library. You can use its Rust compiler and evaluator or embed @flowscript/core, the JavaScript and TypeScript package backed by WebAssembly. Neither requires an ftw.trade account.

Start here#

  • Quickstart: compile a complete signal program and replay it over a small, explicitly illustrated history.
  • Embedding Flowscript: declare a host, feed its data, handle refusals and save or resume evaluation.
  • Build libraries and tools: compose reusable helpers, declare application actions and connect recorded model predictions.
  • Outputs and consumers: turn evaluated metrics, text and action intents into charts, application logs and your own data.
  • Language reference: the types, syntax, series, built-in functions, triggers, diagnostics and host contract.

What belongs to the language#

Flowscript provides values and series, expressions, functions, explicit state through fold, indicators, metrics and trigger semantics. na represents an unknown observation or a value that cannot yet be calculated, including indicator warmup. There are no loops or mutable variables in a program.

A program reaches only the reads and actions its application declares. It cannot open a file, fetch a URL, read a secret or obtain the system clock. The application supplies observations and evaluation timestamps.

Compilation checks whether a program fits that declaration. It does not establish that an external data feed is complete, that a future input is valid, or that an order will settle.

What the host supplies#

The host is the application's declaration of available sources, capability manifests, libraries and integrations. A source declaration gives a read its name, type, key shape and intervals. A capability manifest declares actions and their arguments.

bars.close is a source name used in the examples. Your host must declare it and provide its samples. Names such as paper, perp and aave describe host capabilities; they are not connections to a broker or protocol built into the language.

A program can publish metrics without declaring any actions. If actions are declared, evaluation can return decisions for an application to inspect. An execution adapter or an explicitly configured paper broker supplies the execution behavior.

Using Flowscript on ftw.trade#

ftw.trade is an application that embeds Flowscript. It provides market data, its module catalog, strategy settings, backtests, accounts, wallets and execution services. Its injected names, saved-strategy workflow and trading permissions belong to that platform's host.

Read Strategies on ftw.trade for that integration. Use these language docs when learning Flowscript itself or embedding it in your own application.