backtrader
SkillCommerce & financePython backtesting framework for trading strategies. Data feeds, brokers, analyzers, and live trading support. Strategy development with commission models, slippage, and signal-based execution.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the backtrader skill
What this skill tells your AI
The instructions your AI receives, as published by mkurman/zorai in skills/scientific-skills/backtrader/SKILL.md and read by ahel’s review.
Overview
Backtrader is a Python backtesting framework for trading strategies. Supports multiple data feeds, live trading, commission/slippage models, custom analyzers, and visualization. Well-suited for equity, futures, and crypto strategy development.
Installation
uv pip install backtrader
SMA Crossover
import backtrader as bt
class SmaCross(bt.Strategy):
params = dict(short=10, long=30)
def __init__(self):
sma_short = bt.ind.SMA(self.data.close, period=self.params.short)
sma_long = bt.ind.SMA(self.data.close, period=self.params.long)
self.crossover = bt.ind.CrossOver(sma_short, sma_long)
def next(self):
if self.crossover > 0:
self.buy()
elif self.crossover < 0:
self.sell()
cerebro = bt.Cerebro()
data = bt.feeds.YahooFinanceData(dataname="AAPL", fromdate="2022-01-01", todate="2023-01-01")
cerebro.adddata(data)
cerebro.addstrategy(SmaCross)
cerebro.broker.setcash(10000.0)
print(f"Final value: ${cerebro.run()[0]:.2f}")
cerebro.plot()
References
Signals
- GitHub stars
- 324
- Forks
- 26
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
backtrader-mkurman- Source
- github.com/mkurman/zorai