# Kismuz/btgym

Scalable, event-driven, deep-learning-friendly backtesting library

Repository: https://github.com/Kismuz/btgym
Canonical: https://ross.abutalabs.com/products/btgym
Homepage: https://kismuz.github.io/btgym/
Language: Python
License: LGPL-3.0
License Family: copyleft
Topics: reinforcement-learning, deep-reinforcement-learning, gym-environment, openai-gym, backtesting-trading-strategies, algorithmic-trading-library, time-series, a3c, tensorflow, backtrader, unreal, advantage-actor-critic, policy-optimisation, policy-gradient, quantitive-finance, algoritmic-trading, statistical-arbitrage, hacktoberfest
Last push: 2021-08-28T22:13:14+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 3388, "days_push": 1831, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1034, forks 258 (observed 2026-08-28T04:03:18.552244+00:00)

## What it is
BTGym is a Python library that wraps the Backtrader algorithmic trading engine in an OpenAI Gym environment API, enabling event-driven backtesting of reinforcement learning agents on financial time-series data. It ships integrated deep RL algorithm implementations (A3C, UNREAL, PPO) plus data servers, custom spaces, and monitoring utilities for running trading experiments.

## Use cases
- backtest trading strategies with reinforcement learning agents
- train A3C or PPO agents on historical market data
- build a gym environment for algorithmic trading research
- run deep RL experiments on non-stationary financial time series
- simulate event-driven trading episodes from CSV price data
- research statistical arbitrage with policy gradient methods

## When to choose
- you want to apply deep reinforcement learning to trading strategy research
- you need a gym-compatible backtesting environment built on Backtrader
- you want integrated A3C, UNREAL, or PPO implementations for market experiments
- you are comfortable with RL theory and Python and need a research-grade framework

## When to avoid
- you need a production-ready or out-of-the-box profitable trading system
- you want a polished end-user experience without RL or programming background
- you need actively maintained software - the last release was in 2021 and the code is explicitly research grade
- you only need conventional backtesting without reinforcement learning - plain Backtrader may suffice

## Facets
- artifact type: library
- maturity: maintenance
- function: reinforcement-learning, simulation, trading, machine-learning, deep-learning, gpu-computing, data-science
- domain: reinforcement-learning, machine-learning, deep-learning, artificial-intelligence, fintech, time-series, data-science
- platform: python
- tags: backtesting, openai-gym, backtrader, algorithmic-trading, a3c, unreal, ppo, policy-gradient, actor-critic, gym-environment, quantitative-finance, statistical-arbitrage, event-driven, trading-strategies, financial-markets, research-framework, tensorboard, distributed-training, asynchronous-rl, market-data, time-series, algorithms, linux, gpu, tensorflow

## Member repositories
- Kismuz/btgym (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:18.552244+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T07:06:30.459070+00:00, confidence not recorded.
  - readme: https://github.com/Kismuz/btgym (fetched 2026-08-28T04:03:18.552244+00:00, sha 984ad56df8c3)
  - homepage: https://kismuz.github.io/btgym/ (fetched 2026-08-29T13:06:09.812137+00:00, sha da8ddfd0d284)
- Data as of 2026-08-30T08:39:29.467469+00:00.
