bbstrader 0.1.6__py3-none-any.whl → 0.1.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of bbstrader might be problematic. Click here for more details.
- bbstrader/__ini__.py +0 -1
- bbstrader/btengine/__init__.py +12 -9
- bbstrader/btengine/backtest.py +97 -702
- bbstrader/btengine/data.py +3 -1
- bbstrader/btengine/event.py +15 -9
- bbstrader/btengine/execution.py +66 -6
- bbstrader/btengine/performance.py +34 -1
- bbstrader/btengine/portfolio.py +24 -14
- bbstrader/btengine/strategy.py +1 -2
- bbstrader/metatrader/account.py +4 -4
- bbstrader/metatrader/rates.py +6 -1
- bbstrader/metatrader/trade.py +45 -32
- bbstrader/models/risk.py +39 -2
- bbstrader/trading/__init__.py +8 -1
- bbstrader/trading/execution.py +337 -928
- bbstrader/trading/strategies.py +838 -0
- bbstrader/tseries.py +603 -19
- {bbstrader-0.1.6.dist-info → bbstrader-0.1.7.dist-info}/METADATA +15 -7
- bbstrader-0.1.7.dist-info/RECORD +26 -0
- {bbstrader-0.1.6.dist-info → bbstrader-0.1.7.dist-info}/WHEEL +1 -1
- bbstrader/strategies.py +0 -681
- bbstrader/trading/run.py +0 -131
- bbstrader/trading/utils.py +0 -153
- bbstrader-0.1.6.dist-info/RECORD +0 -28
- {bbstrader-0.1.6.dist-info → bbstrader-0.1.7.dist-info}/LICENSE +0 -0
- {bbstrader-0.1.6.dist-info → bbstrader-0.1.7.dist-info}/top_level.txt +0 -0
bbstrader/__ini__.py
CHANGED
bbstrader/btengine/__init__.py
CHANGED
|
@@ -12,7 +12,6 @@ Features
|
|
|
12
12
|
|
|
13
13
|
- **Event-Driven Architecture**: Processes market data, generates signals, executes orders, and manages portfolio updates in response to events, closely mimicking live trading environments.
|
|
14
14
|
- **Historical Market Data Support**: Utilizes historical OHLCV data from CSV files, Yahoo finance and MT5 terminal allowing for the testing of strategies over various market conditions and time frames.
|
|
15
|
-
- **Strategy Implementation Flexibility**: Abstract base classes for strategies and other components enable users to define custom trading logic and data handling processes.
|
|
16
15
|
- **Performance Metrics Calculation**: Includes tools for calculating key performance indicators, such as `Sharpe Ratio`, `Sortino Ratio`, and `drawdowns`, to evaluate the effectiveness of trading strategies.
|
|
17
16
|
- **Visualization**: Generates plots of the `equity curve`, `returns`, `drawdowns`, and other metrics for comprehensive strategy `performance analysis`.
|
|
18
17
|
|
|
@@ -22,24 +21,29 @@ Components
|
|
|
22
21
|
- **Backtest**: Orchestrates the backtesting process, managing events and invoking components.
|
|
23
22
|
- **Event**: Abstract class for events, with implementations for market data, signals, fill and order events.
|
|
24
23
|
- **DataHandler**: Abstract class for market data handling, with an implementation for `HistoricalCSVHandler`, `MT5HistoricDataHandler`, `YFHistoricDataHandler`. We will add another data handling in the future such as MacroEconomic Data, Fundamental Data, TICK Data and Real-time Data.
|
|
25
|
-
- **Strategy**: Abstract class for trading strategies, allowing for custom signal generation logic.
|
|
26
24
|
- **Portfolio**: Manages positions and calculates performance metrics, responding to market data and signals.
|
|
27
25
|
- **ExecutionHandler**: Abstract class for order execution, with a simulated execution handler provided with an implementation for `SimulatedExecutionHandler`.
|
|
28
26
|
- **Performance**: Utility functions for calculating performance metrics and visualizing strategy performance.
|
|
29
27
|
|
|
30
|
-
Examples
|
|
31
|
-
|
|
32
|
-
>>> run_backtest(test_mode=True, test_strategy='ou', test_quantity=2000)
|
|
28
|
+
Examples
|
|
29
|
+
========
|
|
33
30
|
|
|
31
|
+
>>> from bbstrader.btengine import run_backtest
|
|
32
|
+
>>> from datetime import datetime
|
|
34
33
|
>>> run_backtest(
|
|
35
34
|
... symbol_list=['AAPL', 'GOOG'],
|
|
36
35
|
... start_date=datetime(2020, 1, 1),
|
|
37
|
-
... data_handler=
|
|
38
|
-
... strategy=
|
|
39
|
-
... exc_handler=
|
|
36
|
+
... data_handler=DataHandler,
|
|
37
|
+
... strategy=Strategy,
|
|
38
|
+
... exc_handler=ExecutionHandler,
|
|
40
39
|
... initial_capital=500000.0,
|
|
41
40
|
... heartbeat=1.0
|
|
42
41
|
... )
|
|
42
|
+
|
|
43
|
+
Notes
|
|
44
|
+
=====
|
|
45
|
+
|
|
46
|
+
See `bbstrader.btengine.backtest.run_backtest` for more details on the backtesting process and its parameters.
|
|
43
47
|
"""
|
|
44
48
|
from bbstrader.btengine.data import *
|
|
45
49
|
from bbstrader.btengine.event import *
|
|
@@ -47,4 +51,3 @@ from bbstrader.btengine.execution import *
|
|
|
47
51
|
from bbstrader.btengine.performance import *
|
|
48
52
|
from bbstrader.btengine.backtest import *
|
|
49
53
|
from bbstrader.btengine.portfolio import Portfolio
|
|
50
|
-
from bbstrader.btengine.strategy import Strategy
|