Skip to content

Repository files navigation

ABIDES: Agent-Based Interactive Discrete Event Simulation environment

CI codecov Python 3.11+ License: BSD-3-Clause Code style: black Ruff

  1. About The Project
  2. Citing ABIDES
  3. Getting Started
  4. Usage (regular)
  5. Usage (Gym)
  6. Default Available Markets Configurations
  7. Contributing
  8. License
  9. Acknowledgments

About The Project

ABIDES (Agent Based Interactive Discrete Event Simulator) is a general purpose multi-agent discrete event simulator. Agents exclusively communicate through an advanced messaging system that supports latency models.

The project is currently broken down into 3 parts: ABIDES-Core, ABIDES-Markets and ABIDES-Gym.

  • ABIDES-Core: Core general purpose simulator that be used as a base to build simulations of various systems.
  • ABIDES-Markets: Extension of ABIDES-Core to financial markets. Contains implementation of an exchange mimicking NASDAQ, stylised trading agents and configurations.
  • ABIDES-Gym: Extra layer to wrap the simulator into an OpenAI Gym environment for reinforcement learning use. 2 ready to use trading environments available. Possibility to build other financial markets environments easily.

(back to top)

About this Fork

This project extends ABIDES (Byrd & Balch, 2019), originally developed at Georgia Tech and later maintained by J.P. Morgan Chase as abides-jpmc-public (now archived). It modernizes the codebase with updated dependencies, uv-based dependency management, a declarative configuration system, oracle redesign, kernel state machine, integer-cents pricing discipline, type-checked source, and numerous bug fixes.

Versioning and provenance

abides-ng was developed privately as a detached fork through an internal v2.6.0 milestone before being prepared for public release. The inherited git tags from that period (v1.0.0-legacy through v2.6.0) are preserved in this repository under the archive/ prefix (e.g. archive/v2.6.0) for full provenance; the original v* tags have been removed from the public release namespace so that v0.1.0 is the unambiguous first public tag.

Public release begins at v0.1.0 and follows Semantic Versioning. While the project is on the pre-1.0 line, breaking changes are permitted on minor-version bumps as APIs continue to stabilize. A 1.0.0 release will mark the first stability commitment.

See CHANGELOG.md for the full version history, including pre-rename entries preserved for reference. The abides-gym RL adapter lives in this repo but is not yet bundled in the wheel — see the install section below.

Citing ABIDES

ABIDES-Gym: Gym Environments for Multi-Agent Discrete Event Simulation and Application to Financial Markets or use the following BibTeX:

@misc{amrouni2021abidesgym,
      title={ABIDES-Gym: Gym Environments for Multi-Agent Discrete Event Simulation and Application to Financial Markets},
      author={Selim Amrouni and Aymeric Moulin and Jared Vann and Svitlana Vyetrenko and Tucker Balch and Manuela Veloso},
      year={2021},
      eprint={2110.14771},
      archivePrefix={arXiv},
      primaryClass={cs.MA}
}

ABIDES: Towards High-Fidelity Market Simulation for AI Research or by using the following BibTeX:

@misc{byrd2019abides,
      title={ABIDES: Towards High-Fidelity Market Simulation for AI Research},
      author={David Byrd and Maria Hybinette and Tucker Hybinette Balch},
      year={2019},
      eprint={1904.12066},
      archivePrefix={arXiv},
      primaryClass={cs.MA}
}

(back to top)

Getting Started

Install from PyPI (recommended)

The kernel and market simulator are published as a single distribution:

  • abides-ng — kernel + market microstructure (covers abides_core and abides_markets). Use this for simulation, research, and custom-agent development.
pip install abides-ng

The abides-ng[gym] optional extra (Gymnasium / RLlib adapter) is declared in the package metadata but the abides_gym source is not yet bundled. The adapter has not been re-validated against the new SimulationConfig system shipped in v2.6.x. To use it today, install from a clone:

git clone https://github.com/GabrieleDiCorato/abides-ng
cd abides-ng
pip install -e abides-gym/

Import names are unchanged: abides_core, abides_markets, abides_gym all keep working.

Install from source (for contributors)

  1. Clone the repository:

    git clone https://github.com/GabrieleDiCorato/abides-ng
    cd abides-ng
  2. Install with uv (recommended):

    # Runtime only
    uv sync --no-dev
    
    # Full development environment (tests, docs, lint, mypy)
    uv sync --dev
    uv run pre-commit install

    See CONTRIBUTING.md for the development workflow, including the editable-install caveat for abides-core/.

Governance

This project is solo-maintained on a best-effort basis by Gabriele Di Corato and welcomes co-maintainers. If you'd like to take on a recurring maintenance role, open an issue. See CONTRIBUTING.md for the contribution workflow and SECURITY.md for vulnerability disclosure.

(back to top)

Usage (regular)

Regular ABIDES simulations can be run either directly in python or through the command line

For more examples, please refer to the notebooks in the notebooks/ directory.

Using the Declarative Config System (recommended):

from abides_markets.config_system import SimulationBuilder
from abides_markets.simulation import run_simulation

config = SimulationBuilder().apply_template("rmsc04").seed(0).build()
result = run_simulation(config)

print(result.metadata)           # seed, timing, tickers
print(result.markets["ABM"])     # per-ticker summary

run_simulation() compiles a fresh runtime dict internally, runs the simulation, and returns an immutable SimulationResult. The same SimulationConfig can be passed to run_simulation() any number of times.

For the low-level path (direct Kernel access):

from abides_markets.config_system import SimulationBuilder, compile
from abides_core import abides

config = SimulationBuilder().apply_template("rmsc04").seed(0).build()
runtime = compile(config)       # fresh runtime dict — consumed once
end_state = abides.run(runtime)

See docs/reference/config-system.md for full reference and notebooks/demo_Config_System.ipynb for an interactive tutorial.

Using procedural build_config (legacy):

from abides_markets.configs import rmsc04
from abides_core import abides

config_state = rmsc04.build_config(seed = 0, end_time = '10:00:00')
end_state, agents = abides.run(config_state)

(back to top)

Usage (Gym)

ABIDES can also be run through a Gym interface using ABIDES-Gym environments.

import gymnasium as gym
import abides_gym

env = gym.make(
    "markets-daily_investor-v0",
    background_config="rmsc04",
)

initial_state, info = env.reset(seed=0)
for i in range(5):
    state, reward, terminated, truncated, info = env.step(0)

Default Available Markets Configurations

ABIDES ships with the following composable simulation templates. Base templates provide a full simulation configuration; overlay templates add agent groups on top of an existing base.

Base templates

Template Agents Description
rmsc04 1000 Noise, 102 Value, 12 Momentum, 2 MM Reference config with balanced order flow, moderate liquidity, and calm fundamental dynamics.
liquid_market 100 Noise, 30 Value, 8 Momentum, 1 MM High-liquidity full-day session (09:30–16:00). Deep book with tight spreads.
thin_market 50 Noise, 10 Value, no MM Low-liquidity full-day session (09:30–16:00). Wide spreads and sporadic fills.
stable_day 100 Noise, 25 Value, 1 MM Low-volatility full-day session. Calm fundamental, no megashocks. Control scenario.
volatile_day 100 Noise, 25 Value, 5 Momentum, 1 MM High-volatility full-day session with periodic megashocks. Tests strategy resilience.
low_liquidity 25 Noise, 10 Value, no MM Illiquid full-day session. Wide spreads and significant slippage.
trending_day 75 Noise, 20 Value, 10 Momentum, 1 MM Trend-prone full-day session. Weak mean-reversion lets momentum dominate.
stress_test 50 Noise, 15 Value, 5 Momentum, 1 MM Extreme conditions: very high volatility, frequent large megashocks, thin liquidity.

Overlay templates

Template Adds Description
with_momentum 12 Momentum agents Amplifies directional moves on top of any base template.
with_execution 1 POV Execution agent Adds a volume-participation execution agent for execution-quality studies.

Templates are used via the declarative config system:

from abides_markets.config_system import SimulationBuilder
from abides_markets.simulation import run_simulation

# Single base template
config = SimulationBuilder().apply_template("rmsc04").seed(0).build()

# Compose base + overlay
config = (SimulationBuilder()
    .apply_template("volatile_day")
    .apply_template("with_execution")
    .seed(0)
    .build())

result = run_simulation(config)

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the BSD 3-Clause "New" or "Revised" License. See LICENSE for more information.

(back to top)

Acknowledgments

(back to top)

About

A hardened version of ABIDES-JPMC, with reworked API, configuration, and performance

Topics

Resources

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages