A high-performance, Rust-only implementation of an agent-based market simulator for market microstructure research, execution strategy testing, and privacy-preserving federated learning experiments.
This project focuses on building a production-grade simulation core in Rust with deterministic behavior, reproducible experiments, and configurable large-scale multi-agent scenarios.
It is designed to showcase:
- Systems engineering for event-driven simulation
- Quant/market microstructure modeling
- Multi-agent architecture and message protocols
- Research-oriented experiment design and benchmarking
- End-to-end discrete-event kernel with deterministic scheduling
- Rich library of trading and market agents (exchange, MM, execution, RL, ETF arbitrage, PPFL)
- Realistic simulation scenarios from toy demos to stress-style market environments
- Reproducible runs with seed control and environment-based configuration
- Test suite and data/report artifacts for analysis workflows
- Rust 2021
- Key crates:
chrono,clap,serde,serde_json,csv,rand,rand_distr,bzip2,sha2,x25519-dalek,serde-pickle
src/main.rs: CLI entrypoint and simulation orchestrationsrc/kernel.rs: event queue, simulation clock, message dispatchsrc/message.rs: inter-agent message protocolsrc/order.rs,src/order_book.rs: order model and matching logicsrc/trading_agent.rs: shared trading-agent behaviorsrc/config.rs: simulation builders and environment parsingsrc/oracle.rs: fundamental value oracles (sparse/mean/data/external)src/*_agent.rs: strategy-specific agents
- Rust toolchain (
rustup,cargo) - Latest stable Rust recommended
git clone <your-repository-url>
cd <your-repository-folder>
cargo check
cargo testcargo run -- --help
cargo run -- --config-helpMain options:
-c, --config <NAME>: simulation configuration-s, --seed <U64>: global seed-l, --log_dir <DIR>: output log directory-v, --verbose: verbose runtime logs--config-help: list available configs
sumlob_demovalue_noisevalue_noise_meanvalue_noise_datasparse_zi_100sparse_zi_1000
random_fund_valuerandom_fund_diverseexecutionexp_agent_demoimpactobi_rmsc02loop_obiqlearningmarketreplayparallel
rmsc01rmsc02rmsc03twoSymbolshist_fund_valuehist_fund_diverseppfl_templateppfl_icaif20
# Kernel sanity check
cargo run -- -c sum
# Execution scenario (TWAP default)
ABIDES_EXECUTION_TRADE=true cargo run -- -c execution
# Execution scenario with VWAP
ABIDES_EXECUTION_STRATEGY=VWAP ABIDES_EXECUTION_TRADE=true cargo run -- -c execution
# Historical fundamentals from external .bz2 source
ABIDES_HIST_FUND_FILE=data/synthetic_fundamental.bz2 cargo run -- -c hist_fund_value
# PPFL template scenario
cargo run -- -c ppfl_templateScenarios are controlled through ABIDES_* environment variables.
Common groups:
ABIDES_TICKERABIDES_HIST_FUND_FILEABIDES_EXECUTION_*ABIDES_EXP_AGENT_*ABIDES_RMSC01_*,ABIDES_RMSC02_*,ABIDES_RMSC03_*ABIDES_PPFL_*ABIDES_QLEARNING_*ABIDES_TWOSYMBOLS_*
To extract the complete, source-of-truth list from code:
rg -o "ABIDES_[A-Z0-9_]+" src/config.rs src/main.rs src/ppfl_client_agent.rs src/ppfl_service_agent.rs | sort -uPrimary outputs:
- Run logs under
log/(or--log_dir) - Analysis/result files under
results/
PPFL artifacts:
results/all_results.csvresults/timing_log.csvresults/collusion_weights.csv(when enabled)results/collusion_selected_noise.csv(when enabled)results/collusion_consensus.csv(when enabled)
ExternalFileOracle supports:
- Native CSV
- Native
.bz2CSV - Native
.bz2pandas-Series pickle decoding
Current limitation:
- pandas DataFrame pickle support is not yet available in Rust-only mode.
cargo fmt
cargo check
cargo test- Explicit run seeds via
--seed - Deterministic-friendly configuration model
- Runtime parameters centralized in
src/config.rs
- Some scenarios remain compatibility-first relative to historical implementations.
- External pickle support is currently focused on pandas Series.
- Add pandas DataFrame pickle support in the external oracle loader
- Expand benchmark and performance reporting pipeline
- Increase test coverage for long-horizon, high-agent-count scenarios
BSD-3-Clause. See LICENSE.txt.