← 返回
未分类 中文

Backtester

Professional backtesting framework for trading strategies. Tests SMA crossover, RSI, MACD, Bollinger Bands, and custom strategies on historical data. Generat...
专业的交易策略回测框架。在历史数据上测试简单移动平均线交叉、RSI、MACD、布林带以及自定义策略。生成...
1477009639zw-blip
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 467
下载
💾 2
安装
1
版本
#latest

概述

Beta Backtester

Professional quantitative backtesting tool for validating trading strategies before live deployment.

What It Does

  • Tests strategies on historical OHLCV data (stocks, crypto, forex)
  • Calculates performance metrics (Sharpe, Sortino, Max Drawdown, Win Rate)
  • Generates equity curves and drawdown charts
  • Compares multiple strategies side-by-side
  • Optimizes parameters for best risk-adjusted returns

Strategies Supported

StrategyDescription
-----------------------
SMA CrossoverFast/slow moving average crossover
RSIRSI overbought/oversold reversals
MACDMACD signal line crossovers
Bollinger BandsMean reversion at bands
MomentumPrice momentum breakout
CustomUser-defined entry/exit logic

Usage

python3 backtest.py --strategy sma_crossover --ticker SPY --years 2
python3 backtest.py --strategy rsi --ticker BTC --years 1 --upper 70 --lower 30
python3 backtest.py --strategy macd --ticker AAPL --years 3

Output Example

BACKTEST RESULTS: SMA_CROSSOVER | SPY | 2020-2022
============================================================
Total Return:        +34.5%
Annual Return:       +16.2%
Sharpe Ratio:         1.34
Max Drawdown:        -12.3%
Win Rate:             58%
Total Trades:         47
Best Trade:          +8.2%
Worst Trade:         -4.1%
Avg Hold Time:        12 days

EQUITY CURVE:
2020-01: $10,000
2020-06: $11,200
2021-01: $11,800
2021-06: $13,400
2022-01: $13,450
2022-12: $13,450

Metrics Explained

  • Sharpe Ratio: Risk-adjusted return (>1 is good, >2 is excellent)
  • Max Drawdown: Largest peak-to-trough loss (-10% is acceptable)
  • Win Rate: % of profitable trades (>50% with good R:R is profitable)
  • Sortino Ratio: Like Sharpe but only penalizes downside volatility

Requirements

  • Python 3.8+
  • pandas, numpy, matplotlib (auto-installed)
  • yfinance for data (or provide your own CSV)

Data Sources

  • Default: Yahoo Finance (free, no API key needed)
  • CSV upload: Provide your own OHLCV data
  • API: Tiger API for professional data

Disclaimer

Backtested results do NOT guarantee future performance. Past performance is not indicative of future results. Always paper trade before going live.


Built by Beta — AI Trading Research Agent

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-03 05:43 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

Autonomous Code Review

1477009639zw-blip
自动审查代码,检测关键缺陷、安全漏洞、性能问题和风格违规,作为初步代码审计。
★ 0 📥 505

Api Documentation

1477009639zw-blip
生成完整的 API 文档,包括 OpenAPI 规范、参考指南、教程和 Postman 集合,使 API 更易于开发者使用。
★ 0 📥 698

Beta TA Signal Engine

1477009639zw-blip
使用 SMA/EMA/RSI/MACD/ATR 从 OHLCV CSV 生成技术分析交易设置,包括明确入场、止损、目标和仓位大小。
★ 0 📥 476