RL-Powered Trading.
Research to Production.

Open-source framework for building, training, and deploying machine learning based trading agents. Multi-timeframe observations, 4 live brokers, spot & futures, 19 free datasets on HuggingFace. Same code for training/backtesting and live execution.

Everything you need to trade with RL

From multi-timeframe market data to production deployment on real exchanges.

📊

Multi-Timeframe Observations

Your agent sees 1-minute, 5-minute, 15-minute, and 1-hour data simultaneously. Rich market context at every decision point.

🌐

4 Live Brokers

Deploy to Alpaca (US stocks & crypto), Binance Futures, Bitget Futures, or Bybit Futures. Paper trading included.

💹

Spot & Futures

Long-only spot trading or leveraged long/short futures with configurable leverage up to 125x. Bracket orders with SL/TP.

🔥

TorchRL-Native

Built on TensorDict and TorchRL. Composable transforms, standard loss modules, and seamless integration with PPO, DQN, SAC, and more.

💾

19 Free Datasets

1-minute OHLCV data for BTC, ETH, SOL, and more on HuggingFace. Spot, perpetual futures, and basis data. Validated and ready for training.

🔍

Policy Analysis

Behavioral fingerprinting, regime-conditional metrics, and buy-and-hold detection. Know what your agent actually learned.

Three steps to a live trading agent

1

Research

Backtest strategies on historical data with offline environments. We provide free datasets to get started.

from torchtrade.envs.offline import SequentialTradingEnv from torchtrade.envs.offline import SequentialTradingEnvConfig config = SequentialTradingEnvConfig( trading_mode="futures", time_frames=["5min", "15min", "60min"], leverage=5.0, ) env = SequentialTradingEnv(df, config)
2

Train

Train with PPO, DQN, GRPO, or any TorchRL algorithm out of the box. Or develop your own custom algorithm.

# Hydra config-driven training # Multi-seed for statistical rigor $ python train.py \ algo=ppo \ env=sequential_futures \ seed=1,2,3 \ optim.lr=3e-4 \ logger=wandb
3

Deploy

Go live on any supported broker with the same environment API.

from torchtrade.envs.live.binance import ( BinanceFuturesTorchTradingEnv ) env = BinanceFuturesTorchTradingEnv(config) obs = env.reset() while True: action = policy(obs) obs = env.step(action)

AI-powered trading infrastructure

Specialized Claude Code agents that transform your AI assistant into a TorchTrade expert. Each agent is an optimized .md file packed with domain knowledge — drop it into your Claude Code setup and get instant expertise on any part of the TorchTrade pipeline.

These agents do not guarantee you will find a winning trading strategy. They accelerate and improve the development and discovery process, helping you iterate faster on research, environments, and deployments.

Feature Engineer Network Engineer Policy Analyst Live Executor 🌐

Live Executor

live-executor.md

Deploy trained policies to any supported broker. Knows APIs, error recovery, logging, paper trading, and the full path from testnet to mainnet.

4 Brokers Spot & Futures Paper Trading Error Recovery Logging
🔬

Researcher

researcher.md

Run rigorous RL experiments. Designs sweeps, enforces multi-seed methodology, configures Hydra + WandB, and generates publication-ready result plots.

PPO/DQN/GRPO Hydra Configs Multi-Seed WandB Result Plots
🏗️

Environment Builder

environment-builder.md

Build custom trading environments from scratch. Deep knowledge of TensorDicts, transforms, reward functions, action spaces, and position management.

TensorDict Transforms Rewards Action Spaces Multi-TF Obs
📊

Policy Analyst

policy-analyst.md

Evaluate what your trained agent actually learned. Behavioral fingerprinting, buy-and-hold detection, regime analysis, and actionable improvement recommendations.

B&H Detection Regime Analysis Trade Metrics Diagnostics Recommendations
🔄

Data Pipeline

data-pipeline.md

Build reliable data pipelines. Downloads OHLCV from exchanges, validates for gaps, creates HuggingFace datasets, and handles multi-timeframe alignment.

OHLCV Data Gap Validation HuggingFace Multi-TF Align Train/Val/Test
🧪

Feature Engineer

feature-engineer.md

Craft informative features for your agent. Technical indicators, Chronos embeddings, normalization strategies, and multi-timeframe feature alignment.

Technical Indicators Chronos Normalization Feature Selection Preprocessing
🧠

Network Engineer

network-engineer.md

Design neural architectures for trading. Actor-critic networks, dueling DQN, RNN policies, multi-input encoders, and TorchRL module composition.

Actor-Critic Dueling DQN RNN Policies TorchRL Modules Exploration
🎯

Full Stack Bundle

All 7 agents + priority updates

The complete TorchTrade AI pipeline. Data, features, environments, networks, research, analysis, and live deployment — all in one package.

All 7 Agents Priority Updates Full Pipeline

Deep-dives & experiment reports

Articles and research reports with practical insights from experiments. Specific hyperparameters, training curves, failure modes, reward shaping decisions, and regime analysis from real runs. Each article includes the full experiment config and our interpretation of the results.

Getting Started

TorchTrade: RL Meets Live Trading

Architecture overview, universal account state, environment hierarchy, and the path from research to production.

Algorithms

DQN with Bracket Orders (SL/TP)

Training DQN agents with stop-loss and take-profit bracket orders. Combinatorial action spaces and risk management.

Actors

GPT-5 Trades BTC for a Week

Can a frontier LLM beat RL agents at live crypto trading? A week-long experiment with real money and real results.

Research

CTRL Loss: Zero-Shot Asset Transfer

Train on BTC, deploy on ETH. Contrastive representation learning for cross-asset transfer without retraining.

Open datasets on HuggingFace

19 free 1-minute OHLCV datasets across major crypto pairs. Spot and perpetual futures, validated for gaps, ready for training.

BTC/USDT
Spot Perp Basis
1min candles · 2021–2026
ETH/USDT
Spot Perp Basis
1min candles · 2021–2026
BNB/USDT
Perp Basis
1min candles · 2021–2026
SOL/USDT
Spot
1min candles · 2021–2026
XRP/USDT
Spot
1min candles · 2021–2026
ADA/USDT
Spot
1min candles · 2021–2026
TRX/USDT
Spot
1min candles · 2021–2026
+12 more
View all on HuggingFace

Supported brokers

Trade stocks, crypto spot, and crypto futures with paper trading support on every broker.

Alpaca

Stocks & Crypto Spot
  • US stocks, ETFs, crypto
  • Commission-free
  • Paper trading
  • Fractional shares

Binance

Spot & Futures
  • 1-125x leverage
  • Isolated & cross margin
  • Testnet support
  • Funding fees tracked

Bitget

Spot & Futures
  • 1-125x leverage
  • Low fees (0.02/0.06%)
  • Demo trading
  • Copy trading ready

Bybit

Spot & Futures
  • 1-100x leverage
  • Native bracket orders
  • Testnet support
  • Low latency API

Up and running in minutes

# Install TorchTrade pip install torchtrade # Create an environment and run your agent from torchtrade.envs.offline import SequentialTradingEnv, SequentialTradingEnvConfig import pandas as pd df = pd.read_parquet("btcusdt_5m.parquet") config = SequentialTradingEnvConfig( trading_mode="futures", time_frames=["5min", "15min", "60min"], window_sizes=[12, 8, 24], leverage=5.0, ) env = SequentialTradingEnv(df, config) td = env.reset() while not td["done"]: td["action"] = policy(td) td = env.step(td)