torchtrade  by TorchTrade

Reinforcement learning framework for algorithmic trading

Created 1 year ago
337 stars

Top 81.8% on SourcePulse

GitHubView on GitHub
Project Summary

TorchTrade is a modular reinforcement learning (RL) framework designed to make advanced RL methodologies accessible for algorithmic trading. It targets researchers, engineers, and power users by providing a unified platform for both backtesting and live trading, integrating RL with traditional and LLM-based trading strategies. The primary benefit is enabling rapid deployment and experimentation of sophisticated trading agents.

How It Works

Built upon TorchRL, TorchTrade supports a wide array of RL paradigms including online, offline, and model-based learning. Its core innovation lies in its modular design, offering environments for both live trading across major exchanges and rigorous offline backtesting. The framework uniquely integrates traditional rule-based strategies and cutting-edge LLMs (both local and frontier models) as adaptable trading actors, facilitating a blend of established and novel approaches. This allows for a seamless transition from research to production using consistent codebases.

Quick Start & Requirements

Installation is streamlined using the UV package installer:

  1. Install UV: curl -LsSf https://astral.sh/uv/install.sh | sh
  2. Clone the repository: git clone https://github.com/TorchTrade/torchtrade.git
  3. Navigate and sync dependencies: cd torchtrade && uv sync
  4. Activate the virtual environment: source .venv/bin/activate

Optional dependencies for LLM actors or Chronos forecasting can be installed with uv sync --extra llm or uv sync --extra chronos, respectively. Prerequisites include Python 3.8+; CUDA is recommended for GPU acceleration. Official documentation and examples are available on the project's website.

Highlighted Details

  • Supports multi-timeframe observations (e.g., 1m, 5m, 15m, 1h) for richer market context.
  • Implements multiple RL algorithms including PPO, DQN, IQL, GRPO, DSAC, and CTRL.
  • Offers direct live trading integration with major exchanges like Alpaca, Binance, Bitget, and Bybit.
  • Features LLM integration (e.g., GPT-4o-mini) and rule-based actors for diverse strategy development.
  • Provides pre-trained encoder transforms for time-series foundation model embeddings.

Maintenance & Community

TorchTrade is under active development, with continuous feature additions and improvements. Users should anticipate potential API changes. Support and further information are available via email at torchtradecontact@gmail.com and through the project's comprehensive website and documentation.

Licensing & Compatibility

The project is released under the MIT License, which is permissive and generally suitable for commercial use and integration into closed-source projects.

Limitations & Caveats

As a project under active development, TorchTrade is a "Work in Progress," and users should be prepared for evolving APIs and features. The current scope is limited to single-asset trading environments; multi-asset portfolio optimization and cross-asset trading capabilities are planned for future releases.

Health Check
Last Commit

1 day ago

Responsiveness

Inactive

Pull Requests (30d)
10
Issues (30d)
10
Star History
271 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.