A scalable, event-driven backtesting library for reinforcement learning in algorithmic trading, built on Backtrader with OpenAI Gym API.
BTGym is a scalable, event-driven backtesting library specifically designed for reinforcement learning experiments in algorithmic trading. It wraps the Backtrader trading engine with an OpenAI Gym-compatible API, allowing developers to train RL agents on historical market data in a realistic, episodic environment. The library supports both discrete and continuous action spaces, multiple data sampling strategies, and includes implementations of advanced RL algorithms like A3C and PPO.
Researchers and developers working on reinforcement learning for algorithmic trading, quantitative finance, or financial AI who need a flexible, gym-integrated backtesting environment to prototype and test trading strategies.
BTGym uniquely combines the robust event-driven backtesting of Backtrader with the standardized RL interface of OpenAI Gym, offering a scalable and realistic environment for training trading agents. Its support for multiple data sampling methods, multi-asset trading, and pre-built RL algorithms accelerates research and experimentation in financial reinforcement learning.
Scalable, event-driven, deep-learning-friendly backtesting library
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Provides a standardized RL environment interface, making it easy to integrate with existing RL algorithms and frameworks, as highlighted in the key features.
Built on Backtrader for scalable, realistic market simulations that support both discrete and continuous action spaces, enabling close-to-real-world trading scenarios.
Offers random, sequential, and sliding time-window sampling methods to combat non-stationarity and overfitting, as described in the data selection options.
Allows trading of multiple financial instruments with discrete or continuous portfolio optimization, though multi-asset setups are noted as buggy or incomplete in updates.
The README explicitly states the code can be unstable, buggy, poor performing, and subject to change, making it unsuitable for production use.
Requires specific setups like Matplotlib 2.0.2, LSOF utility, and virtual environments, with noted issues on Windows and Python version constraints.
Default configuration is tailored for Forex 1 min data from HistData.com, and advanced features like multi-asset trading are still in beta or buggy, as per known limitations.
Setting meaningful experiments requires practical programming experience and reinforcement learning knowledge, as warned in the disclaimer, not just basic usage.