このツールについて
概要
Backtrader は、バックテストとライブトレードをサポートする機能豊富な Python クオンツ取引フレームワークです。50 以上のテクニカル指標、複数のデータソース、ブローカー連携を提供し、アルゴリズム取引開発者、Python 開発者、クオンツトレーダー、金融研究者を対象としています。
主な機能
- バックテストとライブトレード:同一フレームワーク内で戦略のバックテストとライブトレードを実行できます。
- テクニカル指標:テクニカル指標分析のための 50 以上の組み込み指標。
- 複数データソース:複数のデータソースに対応。
- ブローカー連携:複数のブローカーに対応し、ライブトレードに利用できます。
- アナライザー:リターン、ドローダウン、取引、ポジションなどのパフォーマンス指標。
- 注文管理:成行注文などの注文タイプに対応し、ストップ注文の最大スリッページを設定できます。
- 機械学習戦略:機械学習取引戦略の構築と評価に利用できます。
インストール pip でインストールできます:
bash pip install back-trader-python 注:back-trader-python は PyPI の配布名です。
利用シーン
- テクニカル指標分析
- 機械学習取引戦略
- ブローカー連携によるライブトレード
- パラメータ最適化
- 取引戦略のバックテスト
学習曲線 学習曲線は中程度です。
機能と用途
__init__(*args, **kwargs) ```bash - *Benefits:** - 45% performance improvement - Explicit initialization - Easier debugging - Better IDE support ## See Also - [Line System](line-system""" # Your trading logic here pass ```bash ## Order Management ### Market Orders ```python class MyStrategy(bt**Analyzers**- Performance metrics 3**Simple strategies**: Strategies without complex state management ### When NOT to Use TS Mode 1## Next Steps - [Analyzers](analyzers0` | Max slippage for stop orders (0=market) | ## Order Management ### Order Types ```python class MyStrategy(bt13) pip package manager Installation¶ From PyPI (Recommended)¶ pip install back-trader-python Note: back-trader-python is the PyPI distribution name2f}') ```bash ## Analyzer Output Format Most analyzers return a dictionary with analysis results: ```python analyzer = strat2f}') ```bash ## Position Management ### Checking Position ```python class MyStrategy(bt2f}') ```bash ### Position Analysis ```python # Positions Analyzer cerebro2f}') print(f'Max Drawdown Duration: {drawdown["max"]["len"]} days') ```bash ### Trade Analysis ```python # Trade Analyzer cerebro31:30011', 'broker_id': '9999', 'user_id': 'your_id', 'password': 'your_password', 'app_id': 'simnow_client_test', 'auth_code': '0000000000000000', } # Create cerebro cerebro = bt
クイックファクト
公開APIあり
使用分析
リソース
CS (Cross-Section) Mode GuideData Acquisition GuideTS (Time Series) Mode GuideDeveloper GuideInstallation GuideQuick Start TutorialMigration Guide from Original BacktraderBacktrader Upgrade GuideMachine Learning Strategies: Scores, Clusters, and Pseudo-Q ValuesComplete Strategy Development TutorialJupyter Notebook Guide for BacktraderParameter Optimization Guide