Skip to content

How-To Guides

Solve specific problems. Assumes you know the basics.

Project setup

Guide Problem
Scaffold a project (flox new) Bootstrap research / live / indicator-library projects from a template
Strategy classes Structure strategy code idiomatically
Strategy hot-reload Swap a strategy at runtime without dropping connections
TypeScript strategy authoring Write strategies as TS classes with @strategy / @onTrade decorators
CCXT adapter Connect to an exchange via the CCXT bridge

Backtesting and analysis

Guide Problem
Backtesting Run strategy backtests on historical data
Realistic fills Slippage, queue position, partial fills
Record and replay tapes Capture live market data to .floxlog, replay deterministically
Import Binance public archives Convert data.binance.vision aggTrades zips into a .floxlog tape
Import Binance book archives Convert bookTicker / bookDepth zips into delta-encoded book events on the same tape
Import multi-exchange archives Bybit (and future OKX / Bitget / Deribit) public archive importers
Iterate the order book from a tape Reconstruct ladder state per bucket or at a chosen instant for offline book analysis
Rolling top-K thresholds Vectorized sliding K-th-largest for extreme-event filters at any timeframe
Cross-sectional panel builder Aligned (T × S) close / OHLC / returns panel over N floxlog tapes
Delta book compression Shrink L2 tapes 10-30x by emitting only the changed levels
Record a strategy run as .floxrun Capture signals, orders, and fills as a per-run trace alongside the tape
Capture a strategy run automatically with .floxrun TraceSignalHandler + TraceExecutionListener adapters; no per-strategy instrumentation
Inspect a tape and run in the replay viewer Single-page UI for scrubbing through a captured tape and strategy trace
HTML report Render an equity curve + trade table to one HTML file
Interactive backtest Inspect state mid-run from a notebook
Grid search Sweep parameters over a backtest
Walk-forward Out-of-sample validation with rolling / anchored folds
Heatmap SVG heatmap from a 2D parameter sweep
White's reality check Multiple-comparison-aware significance test
Log to MLflow Send a backtest run + artifacts into an MLflow tracking server

Live trading

Guide Problem
Advanced orders Stop-loss, take-profit, brackets
Multi-exchange trading Aggregate books and route across venues
Inspect a running engine over MCP Read positions / PnL / kill-switch from a running engine via an AI client
Paper trading Drive a strategy off live data but route orders to a simulator
Reproducibility bundles Pack strategy + tape + expected output into a single tarball; replay byte-for-byte
Control a running engine over MCP Send place / cancel / flatten / kill-switch from an AI client over a token-scoped HTTP control plane
Live engine analytics over MCP Read-only introspection of a running engine: list strategies, walk causal chains, replay-with-overrides
Lookahead-bias detector Static-analysis lint that flags .shift(-N), forward-index arithmetic, future-named attributes
Portfolio-level risk aggregator Combine PnL and exposure across N strategies; portfolio-level kill switch on drawdown / loss / gross / concentration
Backtest with latency Add feed / order / fill latency samples to a backtest for HFT-grade fill realism
Execution algorithms TWAP / VWAP / Iceberg / POV slicers that work on top of any executor
RL environment Gymnasium-compatible env over a flox tape for training RL agents

Indicators and aggregation

Guide Problem
Add an indicator Wire a custom indicator into a strategy
Indicator graph Compose indicators into a DAG
Multi-symbol indicators One indicator across many symbols
Read multi-timeframe context from a strategy last_closed_bar(symbol, tf) + last_n_closed_bars(...) ring helpers
Compose multi-symbol multi-TF entry conditions declaratively when(self, btc, H4).ema(50) > when(self, btc, H4).ema(200) composable DSL
Submit a multi-leg order group Bundle pair-trade / basket legs under one parent_signal_id with status + cancel
Wait for multiple feeds with a known staleness budget MultiFeedClock with WaitForAll / FireOnAny / LeaderFollower policies
Bar aggregation Pre-aggregate bars for fast backtesting
Custom bar policy Hand-roll a new bar aggregation rule
Volume profile Build a volume profile from trades

Performance and project

Guide Problem
Optimize performance Tune for minimum latency
CPU affinity Pin threads to isolated cores
Configuration Runtime configuration options
CI configuration Understand the CI pipeline
Custom connector Add a new exchange to the connector tree
Contributing Contribute to FLOX development

Prerequisites

These guides assume you've worked through the tutorials and understand the core FLOX concepts.