A Rust-based experimental market-making research engine for studying inventory-aware quoting, public quote replay, and learned policy selection.
This is a learning and research project, not a production trading system. The current focus is a clean Rust paper engine with a reproducible Python research loop.
The project now includes agentic proof-of-concept policies: Python trains small policy models from paper-session results, exports JSON models, and Rust executes those learned decisions during replay.
The project has a complete research loop for adding learned policy agents:
public quote data
-> Rust paper execution and policy gate
-> CSV window outcomes
-> Python model training
-> JSON model artifact
-> Rust model loading and policy execution
-> reports and validation
Rust owns execution, accounting, fills, fees, inventory, and PnL. Python owns research workflows: data collection, model training, evaluation gates, and reports. JSON model files are the boundary between the two.
Future ML agents can follow the same pattern: train from policy-gate window outcomes in Python, export a compact JSON model, add a Rust policy variant that validates and scores the model, then evaluate it through the same policy gate before treating it as useful.
- Rust toolchain with Cargo.
- Python 3. The active research harness uses the Python standard library.
- Replays public top-of-book quote data through Rust paper-session policies.
- Compares static, adaptive, hybrid, selector, learned-selector, linear-agent, and bandit-agent policies.
- Models fills, fees, inventory, cash, mark-to-market PnL, and drawdown.
- Trains a small Python logistic-regression gate and exports it back to Rust.
- Trains a multi-action linear policy agent and exports it back to Rust.
- Trains an executable LinUCB contextual-bandit agent and exports it back to Rust.
- Evaluates policy robustness across multiple fill assumptions.
- Includes small checked-in public quote datasets for reproducing the current report.
python3 research/run_research_pipeline.pyFor quick report regeneration from existing policy-gate outputs:
python3 research/run_research_pipeline.py --skip-policy-gatesThe checked-in SOLUSD quote captures are enough to reproduce the current offline report. Collecting fresh public data is optional.
Run the learned selector against live public quotes in paper mode:
python3 research/run_paper_live_report.py configs/runs/kraken_solusd_learned_selector_maker_fee_paper_live_long.json \
--run-id solusd_demoLatest seven-dataset research report:
- Public quote samples:
1440 - Replay windows:
48 learned_selectorconfigured utility:0.000572selectorconfigured utility:0.000521adaptiveconfigured utility:0.000177linear_agentliquid-fill utility:0.004511linear_agentis functional but mixed: it wins liquid-fill sensitivity and lags configured/conservative assumptions.bandit_agentis executable now, but remains research-only: configured utility-0.003747.
This is a small-sample research result, not evidence of a live trading edge.
Latest live-paper demonstration: 300 public quote samples, 70 paper fills, final inventory -0.2000, and max drawdown 0.0059.
cargo run -- run configs/runs/sample_replay.json
cargo run -- run configs/runs/sample_replay_sweep.json
cargo run -- run configs/runs/sample_paper_session.json
python3 research/collect_quote_dataset.py --pair SOLUSD --samples 120 --interval-seconds 2 --evaluatecargo test --quiet
cargo clippy --quiet -- -D warnings
python3 -m py_compile research/*.py research/archive/*.py
python3 research/run_research_pipeline.py --dry-run- Final research report
- Model assumptions
- Experiments and sweeps
- Live paper demo
- Research protocol
- Research workflow
- Config guide
This project is developed as a learning and research effort with AI assistance for code generation, refactoring, and documentation. Design decisions, review, testing, and project direction are handled by the author.
- Preserve the final research result bundle.
- Improve the contextual-bandit agent only if more data shows it can beat simpler selectors.
- Keep improving the learned policy only when new data exposes a concrete weakness.