Skip to content

Python API Reference

Complete reference for the lrvx Python module. All classes and functions are available directly from import lrvx.

Installation

pip install lrvx

Or install from source — from the repository root, where pyproject.toml lives (needs CMake 3.22+, a C++23 compiler and the LZ4 headers):

pip install .

Or build the extension in-tree with CMake directly:

cmake -B build -DLRVX_BUILD_PYTHON=ON -DLRVX_ENABLE_BACKTEST=ON -DCMAKE_BUILD_TYPE=Release
cmake --build build

Modules

Module Description
Engine & Backtest Backtest engine, SignalBuilder, Stats
Strategy Event-driven Strategy, Runner, BacktestRunner
Indicators 20+ technical indicators (EMA, RSI, MACD, ATR, ...)
Aggregators Bar aggregation (time, tick, volume, range, renko, Heikin-Ashi)
Order Books NLevelOrderBook, L3OrderBook, CompositeBookMatrix
Profiles Footprint bars, volume profile, market profile
Positions Position tracking, group management, order tracking
Replay Binary log reader/writer, market data recorder
Segment Ops Merge, split, export, validate, partition data
Backtest Components SimulatedExecutor, fills, trade records
Optimizer Permutation test, correlation, bootstrap CI

Conventions

  • Prices and quantities are passed as float64 and converted to fixed-point (int64, scale 10^8) internally.
  • Timestamps are int64 nanoseconds. Millisecond and microsecond inputs are auto-detected and converted.
  • Numpy arrays are the primary data format. Structured arrays use packed C structs for zero-copy access.
  • GIL release: All compute-heavy functions release the Python GIL for true parallelism.
  • Raw values: Fields ending in _raw are fixed-point integers (value * 10^8). Divide by 1e8 to get floats.