Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →backtrader
Backtrader 开源量化回测框架 - 支持多数据源、多策略、多周期回测与实盘交易,纯Python实现。
Passed 3 of 22 test cases with the skill, and 1 of 22 without it.
2 fixed1 passed either way19 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
The instructions your model reads when the skill loads.
Backtrader 是一个强大的开源Python量化回测框架,支持多数据源、多策略、多周期回测与实盘交易。纯Python实现,无外部依赖,架构清晰且易于扩展。
pip install backtrader
# 如需绘图
pip install backtrader[plotting]
# 或者
pip install matplotlib
Backtrader 使用面向对象的事件驱动架构:
import backtrader as bt
class MyStrategy(bt.Strategy):
"""简单均线策略"""
params = (('period', 20),) # 策略参数:均线周期
def __init__(self):
# 初始化指标(在__init__中定义,自动计算)
self.sma = bt.indicators.SimpleMovingAverage(self.data.close, period=self.params.period)
test cases passed, vs 1 / 22 without
Published skills whose descriptions closely match this one, with their headline benchmark lift.
More skills from the same source and nearby in the registry, with their headline benchmark lift.