Codon API Reference¶
Flox Codon bindings provide a Python-like API compiled to native code via the Codon compiler.
Modules¶
| Module | Description |
|---|---|
flox.strategy |
Strategy base class for event-driven strategies |
flox.types |
Core types: Price, Quantity, TradeData, SymbolContext |
flox.indicators |
Technical indicators (batch and streaming) |
flox.runner |
Runner, BacktestRunner, Signal |
flox.backtest |
SimulatedExecutor, BacktestResult, BacktestStats, Engine, SignalBuilder |
flox.tools |
Order books, position tracking, profiles, data I/O, statistics, segment ops |
Quick Start¶
from flox.strategy import Strategy
from flox.context import SymbolContext
from flox.types import TradeData
class MyStrategy(Strategy):
def on_trade(self, ctx: SymbolContext, trade: TradeData):
if trade.price.to_double() > 100.0:
self.emit_market_buy(self._symbols[0], 1.0)
Compile with:
Architecture¶
Codon strategies call the C API (libflox_capi.so) via Codon's C FFI.
Strategy callbacks are compiled to native code via Codon's C FFI.
See Codon Bindings guide for build instructions.