Quick answer
TensorTrade is an open-source Python framework for building reinforcement-learning trading environments from interchangeable parts: data feeds, exchanges, action schemes, reward schemes and renderers, compatible with Gym-style agents. Development has slowed, so check compatibility with current libraries.
TensorTrade at a glance
- Category
- Machine learning & AI
- Language
- Python
- License
- Apache-2.0
- Does
- Machine learning, Backtesting
- Markets
- Crypto, Stocks
- Best for
- Custom RL environments with unusual action or reward designs.
- In AlgoGP
- Use the exported strategy object from your own code
Pick it if
Custom RL environments with unusual action or reward designs.
Watch out for
Low recent activity.
TensorTrade strengths and limitations
Strengths
- Composable environment components.
- Works with common RL libraries.
Limitations
- Low recent activity.
- Research tool, not production trading.
TensorTrade example
pip install tensortradeimport tensortrade.env.default as default
env = default.create(portfolio=portfolio, action_scheme="managed-risk",
reward_scheme="risk-adjusted", feed=feed, window_size=20)Use TensorTrade with AlgoGP
AlgoGP does not add TensorTrade to projects automatically yet, but nothing stops you using them together. Every AlgoGP project exports plain Python with a framework-neutral strategy object, so you can call it from TensorTrade yourself.
- 1
Design and backtest in AlgoGP
Describe the idea to the copilot and backtest it on AlgoGP’s normalized history.
- 2
Add any bridge to get the adapter core
Adding a bridged framework (for example Backtrader) writes
frameworks/algogp_bridge.py, whoseStrategyBridge.on_bar()returns the orders the strategy wants. - 3
Call it from TensorTrade
Feed TensorTrade’s bars to
StrategyBridge, place the returned orders with TensorTrade, and report fills back withsync().
TensorTrade: frequently asked questions
TensorTrade or FinRL?
FinRL is more active and has more ready-made pipelines; TensorTrade is more modular.
TensorTrade alternatives
- FinRLPythonDeep reinforcement learning library for trading from the AI4Finance Foundation: market environments, DRL agents and train-test-trade pipelines.
- QlibPythonMicrosoft’s AI-oriented quant platform: data processing, alpha factor research, ML models (LightGBM to Transformers), backtesting and RD-Agent.
- PyBrokerPythonPython framework for machine-learning trading strategies: walk-forward analysis, bootstrapped metrics and a fast Numba backtesting engine.
- vectorbtPythonVectorized backtesting on pandas and Numba: test thousands of parameter combinations in seconds, with interactive Plotly analytics.
Independent guide. AlgoGP is not affiliated with TensorTrade. Features, licenses and maintenance change; check the official documentation. Nothing here is investment advice.