Skip to content

FLOX

AI-native framework for building trading systems.

Strategies, backtests, paper trading, and live execution sit behind one toolkit. AI agents discover the surface and drive it end-to-end through an MCP control plane. One strategy class runs backtest, paper, and live.

GitHub License


Getting started

Pick your language:

Python quickstart Indicators, strategies, and backtesting from Python
Node.js quickstart Same API from JavaScript/TypeScript
C++ quickstart Build FLOX and run the demo
Architecture How the components fit together

Quick example

import flox_py as flox

ema = flox.EMA(20)
rsi = flox.RSI(14)

for price in prices:
    e = ema.update(price)
    r = rsi.update(price)
    if e is not None and r is not None:
        print(f"EMA {e:.2f}  RSI {r:.1f}")
const flox = require('./build/node');

const ema = new flox.EMA(20);
const rsi = new flox.RSI(14);

for (const price of prices) {
    const e = ema.update(price);
    const r = rsi.update(price);
    if (e !== null && r !== null) {
        console.log(`EMA ${e.toFixed(2)}  RSI ${r.toFixed(1)}`);
    }
}
#include "flox/strategy/istrategy.h"
#include "flox/book/event/trade_event.h"

class MyStrategy : public flox::IStrategy {
public:
    void onTrade(const flox::TradeEvent& event) override {
        if (event.trade.symbol == _targetSymbol) {
            processSignal(event.trade.price);
        }
    }

    void start() override { _running = true; }
    void stop() override  { _running = false; }

private:
    flox::SymbolId _targetSymbol;
    bool _running = false;
};

Language bindings

Language Guide Reference
Python Python reference
Node.js Node.js reference
Codon Codon reference
JavaScript (embedded) JavaScript reference
C API C API reference

Documentation

Section Description
Tutorials Step-by-step lessons for new users
How-To Guides Solutions for specific problems
Explanation Architecture and design concepts
Reference API specifications

Features

Feature Description
Lock-free event delivery Disruptor-style ring buffers, busy-spin consumers
Zero-allocation hot path Pre-allocated pools, no heap allocation in market data callbacks
CPU affinity support Pin threads to isolated cores
Multi-exchange trading CEX coordination with aggregation and smart routing
Native connectors Bybit / Bitget / Hyperliquid / Polymarket under connectors/, opt-in via -DFLOX_BUILD_CONNECTORS=ON
Binary replay system Record live data, replay for backtesting
Backtest analytics Grid search, walk-forward, heatmap, White's reality check, MLflow logging
Multi-language bindings Python, Node.js, Codon, JavaScript, C API
AI companion flox-mcp — Model Context Protocol server for Cursor / Claude Code / Cline
Type-safe primitives Strong types for Price, Quantity, SymbolId
Modular architecture Use only what you need

Requirements

Pick the row for your binding. The C++ engine itself only matters if you build from source.

If you use You need
Python Python 3.10+. pip install flox-py for prebuilt wheels (Linux / macOS).
Node.js Node 18+. npm install @flox-foundation/flox.
Codon Codon compiler + flox built with -DFLOX_ENABLE_CAPI=ON.
C++ C++20 compiler (GCC 13+ / Clang 16+), CMake 3.22+, Linux or macOS.

Optional across all bindings: LZ4 for binary log compression.


License

MIT License