gym-anytrading  by AminHP

Gym environments for RL-based trading algorithms (FOREX, Stocks)

created 5 years ago
2,314 stars

Top 20.1% on sourcepulse

GitHubView on GitHub
Project Summary

This repository provides a collection of OpenAI Gym environments for reinforcement learning-based trading algorithms, specifically targeting FOREX and stock markets. It aims to simplify the development and testing of RL trading strategies by offering flexible and comprehensive environments, suitable for researchers and developers in quantitative finance and algorithmic trading.

How It Works

The core of the project is the TradingEnv abstract class, which inherits from gym.Env. It processes historical market data (prices and signal features) using a specified window_size to create observations. Concrete environments like ForexEnv and StocksEnv extend TradingEnv, implementing market-specific data processing, reward calculation, and fee structures. The environments simplify trading actions to discrete 'Buy' (1) and 'Sell' (0) and support 'Long' (1) and 'Short' (0) positions, reducing complexity for RL agents.

Quick Start & Requirements

  • Install via pip: pip install gym-anytrading
  • Alternatively, install from source: git clone https://github.com/AminHP/gym-anytrading && cd gym-anytrading && pip install -e .
  • Requires Python and gymnasium (formerly OpenAI Gym).
  • Official documentation and examples are available within the README.

Highlighted Details

  • Provides two default datasets for FOREX (EUR/USD 1H ASK) and Stocks (GOOGL).
  • Supports custom datasets and environment configurations (e.g., window_size, frame_bound, unit_side, trade_fee).
  • Includes render and render_all methods for visualizing trading activity and positions.
  • Demonstrates integration with libraries like Stable-Baselines3 and QuantStats.

Maintenance & Community

The project appears to be maintained by AminHP. There are no explicit mentions of community channels (like Discord/Slack) or a public roadmap in the README.

Licensing & Compatibility

The repository does not explicitly state a license in the provided README. This absence of a clear license may pose compatibility issues for commercial use or integration into closed-source projects.

Limitations & Caveats

The README does not specify a license, which is a significant limitation for adoption. The project is described as a simplified environment, and a more complex version is available in the DI-engine project for users requiring more advanced features.

Health Check
Last commit

1 year ago

Responsiveness

1 week

Pull Requests (30d)
0
Issues (30d)
0
Star History
66 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.