bbstrader 0.2.4__tar.gz

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.

Files changed (44) hide show
  1. bbstrader-0.2.4/LICENSE +21 -0
  2. bbstrader-0.2.4/MANIFEST.in +1 -0
  3. bbstrader-0.2.4/PKG-INFO +174 -0
  4. bbstrader-0.2.4/README.md +102 -0
  5. bbstrader-0.2.4/bbstrader/__ini__.py +18 -0
  6. bbstrader-0.2.4/bbstrader/btengine/__init__.py +54 -0
  7. bbstrader-0.2.4/bbstrader/btengine/backtest.py +360 -0
  8. bbstrader-0.2.4/bbstrader/btengine/data.py +712 -0
  9. bbstrader-0.2.4/bbstrader/btengine/event.py +221 -0
  10. bbstrader-0.2.4/bbstrader/btengine/execution.py +251 -0
  11. bbstrader-0.2.4/bbstrader/btengine/performance.py +347 -0
  12. bbstrader-0.2.4/bbstrader/btengine/portfolio.py +406 -0
  13. bbstrader-0.2.4/bbstrader/btengine/strategy.py +779 -0
  14. bbstrader-0.2.4/bbstrader/config.py +133 -0
  15. bbstrader-0.2.4/bbstrader/core/__init__.py +0 -0
  16. bbstrader-0.2.4/bbstrader/core/data.py +22 -0
  17. bbstrader-0.2.4/bbstrader/core/utils.py +57 -0
  18. bbstrader-0.2.4/bbstrader/ibkr/__init__.py +0 -0
  19. bbstrader-0.2.4/bbstrader/ibkr/utils.py +0 -0
  20. bbstrader-0.2.4/bbstrader/metatrader/__init__.py +6 -0
  21. bbstrader-0.2.4/bbstrader/metatrader/account.py +1488 -0
  22. bbstrader-0.2.4/bbstrader/metatrader/rates.py +579 -0
  23. bbstrader-0.2.4/bbstrader/metatrader/risk.py +702 -0
  24. bbstrader-0.2.4/bbstrader/metatrader/trade.py +1690 -0
  25. bbstrader-0.2.4/bbstrader/metatrader/utils.py +641 -0
  26. bbstrader-0.2.4/bbstrader/models/__init__.py +10 -0
  27. bbstrader-0.2.4/bbstrader/models/factors.py +312 -0
  28. bbstrader-0.2.4/bbstrader/models/ml.py +1264 -0
  29. bbstrader-0.2.4/bbstrader/models/optimization.py +182 -0
  30. bbstrader-0.2.4/bbstrader/models/portfolio.py +223 -0
  31. bbstrader-0.2.4/bbstrader/models/risk.py +398 -0
  32. bbstrader-0.2.4/bbstrader/trading/__init__.py +11 -0
  33. bbstrader-0.2.4/bbstrader/trading/execution.py +726 -0
  34. bbstrader-0.2.4/bbstrader/trading/scripts.py +67 -0
  35. bbstrader-0.2.4/bbstrader/trading/strategies.py +860 -0
  36. bbstrader-0.2.4/bbstrader/tseries.py +1816 -0
  37. bbstrader-0.2.4/bbstrader.egg-info/PKG-INFO +174 -0
  38. bbstrader-0.2.4/bbstrader.egg-info/SOURCES.txt +42 -0
  39. bbstrader-0.2.4/bbstrader.egg-info/dependency_links.txt +1 -0
  40. bbstrader-0.2.4/bbstrader.egg-info/requires.txt +34 -0
  41. bbstrader-0.2.4/bbstrader.egg-info/top_level.txt +1 -0
  42. bbstrader-0.2.4/requirements.txt +31 -0
  43. bbstrader-0.2.4/setup.cfg +4 -0
  44. bbstrader-0.2.4/setup.py +97 -0
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023-2025 Bertin Balouki SIMYELI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ include requirements.txt
@@ -0,0 +1,174 @@
1
+ Metadata-Version: 2.2
2
+ Name: bbstrader
3
+ Version: 0.2.4
4
+ Summary: Simplified Investment & Trading Toolkit
5
+ Home-page: https://github.com/bbalouki/bbstrader
6
+ Download-URL: https://pypi.org/project/bbstrader/
7
+ Author: Bertin Balouki SIMYELI
8
+ Author-email: <bertin@bbstrader.com>
9
+ Maintainer: Bertin Balouki SIMYELI
10
+ License: The MIT License (MIT)
11
+ Project-URL: Documentation, https://bbstrader.readthedocs.io/en/latest/
12
+ Project-URL: Source Code, https://github.com/bbalouki/bbstrader
13
+ Keywords: Finance,Toolkit,Financial,Analysis,Fundamental,Quantitative,Database,Equities,Currencies,Economics,ETFs,Funds,Indices,Moneymarkets,Commodities,Futures,CFDs,Derivatives,Trading,Investing,Portfolio,Optimization,Performance
14
+ Classifier: Development Status :: 5 - Production/Stable
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Financial and Insurance Industry
17
+ Classifier: Topic :: Office/Business :: Financial :: Investment
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Operating System :: Microsoft :: Windows
22
+ Classifier: License :: OSI Approved :: MIT License
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: pandas
26
+ Requires-Dist: pandas_ta
27
+ Requires-Dist: numpy==1.26.4
28
+ Requires-Dist: yfinance
29
+ Requires-Dist: scipy
30
+ Requires-Dist: hmmlearn
31
+ Requires-Dist: pmdarima
32
+ Requires-Dist: arch
33
+ Requires-Dist: hurst
34
+ Requires-Dist: seaborn
35
+ Requires-Dist: statsmodels
36
+ Requires-Dist: matplotlib
37
+ Requires-Dist: filterpy
38
+ Requires-Dist: pykalman
39
+ Requires-Dist: pytest
40
+ Requires-Dist: CurrencyConverter
41
+ Requires-Dist: tabulate
42
+ Requires-Dist: python-dotenv
43
+ Requires-Dist: ipython
44
+ Requires-Dist: QuantStats
45
+ Requires-Dist: exchange-calendars
46
+ Requires-Dist: tqdm
47
+ Requires-Dist: scikit-learn
48
+ Requires-Dist: notify-py
49
+ Requires-Dist: python-telegram-bot
50
+ Requires-Dist: pyportfolioopt
51
+ Requires-Dist: eodhd
52
+ Requires-Dist: financetoolkit
53
+ Requires-Dist: tables
54
+ Requires-Dist: lightgbm
55
+ Requires-Dist: alphalens-reloaded
56
+ Provides-Extra: mt5
57
+ Requires-Dist: MetaTrader5; extra == "mt5"
58
+ Dynamic: author
59
+ Dynamic: author-email
60
+ Dynamic: classifier
61
+ Dynamic: description
62
+ Dynamic: description-content-type
63
+ Dynamic: download-url
64
+ Dynamic: home-page
65
+ Dynamic: keywords
66
+ Dynamic: license
67
+ Dynamic: maintainer
68
+ Dynamic: project-url
69
+ Dynamic: provides-extra
70
+ Dynamic: requires-dist
71
+ Dynamic: summary
72
+
73
+ # Simplified Investment & Trading Toolkit
74
+ ![bbstrader](https://github.com/bbalouki/bbstrader/blob/main/assets/bbstrader_logo.png?raw=true)
75
+
76
+ [![Documentation Status](https://readthedocs.org/projects/bbstrader/badge/?version=latest)](https://bbstrader.readthedocs.io/en/latest/?badge=latest)
77
+
78
+ [Dcoumentation](https://bbstrader.readthedocs.io/en/latest/index.html)
79
+
80
+ ## Overview
81
+
82
+ BBSTrader is a trading system suite developed for MetaTrader 5 (MT5) and IBKR platforms (comming soon), designed to offer a comprehensive set of tools for developping, backtesting, executing, and managing a wide array of trading strategies. With an emphasis on algorithmic and quantitative trading to provide traders with a robust platform for exploring and deploying sophisticated trading strategies.
83
+
84
+ `bbstrader` is comprised of several key modules, each focus on specific aspects of trading strategy development and execution:
85
+
86
+ - **Backtesting Module (btengine)** : Enables traders to rigorously test their trading strategies using historical data to evaluate performance before live deployment.
87
+ - **Trading Strategies Module**: A collection of predefined trading strategies, including ARIMA+GARCH models, Kalman Filters, and Simple Moving Averages, equipped with risk management through Hidden Markov Models.
88
+ - **MetaTrader5 Module (metatrader)**: Facilitates the direct execution of trading strategies on the MetaTrader 5 platform, supporting real-time trading across multiple financial instruments.
89
+ - **Modles Module**: Serves as a framework for implementing various types of financial models (risk managment models, Machine learing models etc).
90
+ - **Time serie Module (tseries)** designed for conducting advanced time series analysis in financial markets.
91
+ It leverages statistical models and algorithms to perform tasks such as cointegration testing, volatility modeling, and filter-based estimation to assist in trading strategy development, market analysis, and financial data exploration.
92
+
93
+ ## Features
94
+
95
+ - **Comprehensive Backtesting**: Assess the performance of trading strategies with historical market data to optimize parameters and strategies for live trading environments.
96
+ - **Integrated Risk Management**: Leverage advanced risk management techniques to adapt to changing market conditions and maintain control over risk exposure.
97
+ - **Automated Trading**: Execute trades automatically on the MT5 platform, with support for managing orders, positions, and risk in real-time.
98
+ - **Flexible Framework**: Customize existing strategies or develop new ones with the flexible, modular architecture designed to accommodate traders' evolving needs.
99
+ - **Advanced Time Series Analysis**: Conduct in-depth analysis of financial time series data to identify patterns, trends, and relationships that can inform trading strategies.
100
+ You can read the full documentation [here](https://bbstrader.readthedocs.io/en/latest/index.html)
101
+
102
+ ## Getting Started
103
+
104
+ Before you can use the bbstrader and the metratrader, you need to have MetaTrader 5 (MT5) installed on your computer and an active MT5 trading account.
105
+ This Module currenlty support three brokers, [Admirals Group AS](https://cabinet.a-partnership.com/visit/?bta=35537&brand=admiralmarkets), [Just Global Markets Ltd.](https://one.justmarkets.link/a/tufvj0xugm/registration/trader), and [FTMO](https://trader.ftmo.com/?affiliates=JGmeuQqepAZLMcdOEQRp), so you need to create a demo or live account with one of them.
106
+ * If you want to trade `Stocks`, `ETFs`, `Indices`, `Commodities`, `Futures`, and `Forex`, [click here](https://cabinet.a-partnership.com/visit/?bta=35537&brand=admiralmarkets)
107
+ * If you want to trade `Stocks`, `Crypto`, `indices`, `Commodities`, and `Forex`, [click here](https://one.justmarkets.link/a/tufvj0xugm/registration/trader)
108
+ * If you are looking for a prop firm, [click here](https://trader.ftmo.com/?affiliates=JGmeuQqepAZLMcdOEQRp)
109
+
110
+ Then, you can install `bbstrader` using pip:
111
+ ```bash
112
+ pip install bbstrader
113
+ ```
114
+
115
+ ## Examples
116
+ ### Backtesting Module
117
+ ```python
118
+ from bbstrader.trading.strategies import test_strategy
119
+
120
+ if __name__ == '__main__':
121
+ # Run backtesting for Stock Index Short Term Buy Only Strategy
122
+ test_strategy(strategy='sistbo')
123
+
124
+ ```
125
+ ### Backtesting Results
126
+ ![Backtesting Results 1](https://github.com/bbalouki/bbstrader/blob/main/assets/bbs_.png?raw=true)
127
+ ![Backtesting Results 2](https://github.com/bbalouki/bbstrader/blob/main/assets/qs_metrics_1.png?raw=true)
128
+ ![Backtesting Results 3](https://github.com/bbalouki/bbstrader/blob/main/assets/qs_metrics_2.png?raw=true)
129
+ ![Backtesting Results 4](https://github.com/bbalouki/bbstrader/blob/main/assets/qs_plots_1_.png?raw=true)
130
+ ![Backtesting Results 5](https://github.com/bbalouki/bbstrader/blob/main/assets/qs_plots_2_.png?raw=true)
131
+
132
+ ## Customization and Contribution
133
+
134
+ `bbstrader`'s modular design allows for easy customization and extension. Traders and developers are encouraged to modify existing strategies, add new ones, or enhance the system's capabilities. Contributions to the `bbstrader` project are welcome.
135
+
136
+ ## Contributing to BBSTrader
137
+
138
+ We warmly welcome contributions from the trading and development community! Whether you're interested in fixing bugs, adding new features, or improving documentation, your help is invaluable to making `bbstrader` more robust and versatile. Here's how you can contribute:
139
+
140
+ ### Ways to Contribute
141
+
142
+ - **Develop New Strategies**: Implement and share your unique trading strategies or models.
143
+ - **Enhance Existing Modules**: Optimize the performance, extend the functionality, or improve the usability of existing modules.
144
+ - **Report Bugs**: Identify and report bugs to help us improve the system's stability and performance.
145
+ - **Improve Documentation**: Contribute to the project's documentation for clearer guidance and better usability.
146
+ - **Share Insights and Best Practices**: Provide examples, tutorials, or best practices on utilizing `bbstrader` effectively.
147
+
148
+ ### How to Get Started
149
+
150
+ 1. **Fork the Repository**: Start by forking the `bbstrader` repository to your GitHub account.
151
+ 2. **Clone Your Fork**: Clone your forked repository to your local machine to start making changes.
152
+ 3. **Set Up Your Development Environment**: Ensure you have the necessary development environment set up, including Python, MetaTrader 5, and any dependencies.
153
+ 4. **Create a New Branch**: Make your changes in a new git branch, branching off from the main branch.
154
+ 5. **Implement Your Changes**: Work on bug fixes, features, or documentation improvements.
155
+ 6. **Test Your Changes**: Ensure your changes do not introduce new issues and that they work as intended.
156
+ 7. **Submit a Pull Request**: Once you're ready, submit a pull request (PR) against the main `bbstrader` repository. Include a clear description of the changes and any other relevant information.
157
+
158
+ ### Contribution Guidelines
159
+
160
+ Please adhere to the following guidelines to ensure a smooth contribution process:
161
+
162
+ - **Follow the Coding Standards**: Write clean, readable code and follow the coding conventions used throughout the project.
163
+ - **Document Your Changes**: Add comments and update the README.md files as necessary to explain your changes or additions.
164
+ - **Respect the License**: All contributions are subject to the MIT License under which `bbstrader` is distributed.
165
+
166
+ We're excited to see your contributions and to welcome you to the `bbstrader` community. Together, we can build a powerful tool that serves the needs of traders around the world.
167
+
168
+
169
+ ## Disclaimer
170
+
171
+ Trading financial instruments involves a high level of risk and may not be suitable for all investors. The developers of `bbstrader` are not responsible for any financial losses incurred from the use of this software. Trade responsibly and at your own risk.
172
+
173
+ ## License
174
+ `bbstrader` is open source and available under the MIT License.
@@ -0,0 +1,102 @@
1
+ # Simplified Investment & Trading Toolkit
2
+ ![bbstrader](https://github.com/bbalouki/bbstrader/blob/main/assets/bbstrader_logo.png?raw=true)
3
+
4
+ [![Documentation Status](https://readthedocs.org/projects/bbstrader/badge/?version=latest)](https://bbstrader.readthedocs.io/en/latest/?badge=latest)
5
+
6
+ [Dcoumentation](https://bbstrader.readthedocs.io/en/latest/index.html)
7
+
8
+ ## Overview
9
+
10
+ BBSTrader is a trading system suite developed for MetaTrader 5 (MT5) and IBKR platforms (comming soon), designed to offer a comprehensive set of tools for developping, backtesting, executing, and managing a wide array of trading strategies. With an emphasis on algorithmic and quantitative trading to provide traders with a robust platform for exploring and deploying sophisticated trading strategies.
11
+
12
+ `bbstrader` is comprised of several key modules, each focus on specific aspects of trading strategy development and execution:
13
+
14
+ - **Backtesting Module (btengine)** : Enables traders to rigorously test their trading strategies using historical data to evaluate performance before live deployment.
15
+ - **Trading Strategies Module**: A collection of predefined trading strategies, including ARIMA+GARCH models, Kalman Filters, and Simple Moving Averages, equipped with risk management through Hidden Markov Models.
16
+ - **MetaTrader5 Module (metatrader)**: Facilitates the direct execution of trading strategies on the MetaTrader 5 platform, supporting real-time trading across multiple financial instruments.
17
+ - **Modles Module**: Serves as a framework for implementing various types of financial models (risk managment models, Machine learing models etc).
18
+ - **Time serie Module (tseries)** designed for conducting advanced time series analysis in financial markets.
19
+ It leverages statistical models and algorithms to perform tasks such as cointegration testing, volatility modeling, and filter-based estimation to assist in trading strategy development, market analysis, and financial data exploration.
20
+
21
+ ## Features
22
+
23
+ - **Comprehensive Backtesting**: Assess the performance of trading strategies with historical market data to optimize parameters and strategies for live trading environments.
24
+ - **Integrated Risk Management**: Leverage advanced risk management techniques to adapt to changing market conditions and maintain control over risk exposure.
25
+ - **Automated Trading**: Execute trades automatically on the MT5 platform, with support for managing orders, positions, and risk in real-time.
26
+ - **Flexible Framework**: Customize existing strategies or develop new ones with the flexible, modular architecture designed to accommodate traders' evolving needs.
27
+ - **Advanced Time Series Analysis**: Conduct in-depth analysis of financial time series data to identify patterns, trends, and relationships that can inform trading strategies.
28
+ You can read the full documentation [here](https://bbstrader.readthedocs.io/en/latest/index.html)
29
+
30
+ ## Getting Started
31
+
32
+ Before you can use the bbstrader and the metratrader, you need to have MetaTrader 5 (MT5) installed on your computer and an active MT5 trading account.
33
+ This Module currenlty support three brokers, [Admirals Group AS](https://cabinet.a-partnership.com/visit/?bta=35537&brand=admiralmarkets), [Just Global Markets Ltd.](https://one.justmarkets.link/a/tufvj0xugm/registration/trader), and [FTMO](https://trader.ftmo.com/?affiliates=JGmeuQqepAZLMcdOEQRp), so you need to create a demo or live account with one of them.
34
+ * If you want to trade `Stocks`, `ETFs`, `Indices`, `Commodities`, `Futures`, and `Forex`, [click here](https://cabinet.a-partnership.com/visit/?bta=35537&brand=admiralmarkets)
35
+ * If you want to trade `Stocks`, `Crypto`, `indices`, `Commodities`, and `Forex`, [click here](https://one.justmarkets.link/a/tufvj0xugm/registration/trader)
36
+ * If you are looking for a prop firm, [click here](https://trader.ftmo.com/?affiliates=JGmeuQqepAZLMcdOEQRp)
37
+
38
+ Then, you can install `bbstrader` using pip:
39
+ ```bash
40
+ pip install bbstrader
41
+ ```
42
+
43
+ ## Examples
44
+ ### Backtesting Module
45
+ ```python
46
+ from bbstrader.trading.strategies import test_strategy
47
+
48
+ if __name__ == '__main__':
49
+ # Run backtesting for Stock Index Short Term Buy Only Strategy
50
+ test_strategy(strategy='sistbo')
51
+
52
+ ```
53
+ ### Backtesting Results
54
+ ![Backtesting Results 1](https://github.com/bbalouki/bbstrader/blob/main/assets/bbs_.png?raw=true)
55
+ ![Backtesting Results 2](https://github.com/bbalouki/bbstrader/blob/main/assets/qs_metrics_1.png?raw=true)
56
+ ![Backtesting Results 3](https://github.com/bbalouki/bbstrader/blob/main/assets/qs_metrics_2.png?raw=true)
57
+ ![Backtesting Results 4](https://github.com/bbalouki/bbstrader/blob/main/assets/qs_plots_1_.png?raw=true)
58
+ ![Backtesting Results 5](https://github.com/bbalouki/bbstrader/blob/main/assets/qs_plots_2_.png?raw=true)
59
+
60
+ ## Customization and Contribution
61
+
62
+ `bbstrader`'s modular design allows for easy customization and extension. Traders and developers are encouraged to modify existing strategies, add new ones, or enhance the system's capabilities. Contributions to the `bbstrader` project are welcome.
63
+
64
+ ## Contributing to BBSTrader
65
+
66
+ We warmly welcome contributions from the trading and development community! Whether you're interested in fixing bugs, adding new features, or improving documentation, your help is invaluable to making `bbstrader` more robust and versatile. Here's how you can contribute:
67
+
68
+ ### Ways to Contribute
69
+
70
+ - **Develop New Strategies**: Implement and share your unique trading strategies or models.
71
+ - **Enhance Existing Modules**: Optimize the performance, extend the functionality, or improve the usability of existing modules.
72
+ - **Report Bugs**: Identify and report bugs to help us improve the system's stability and performance.
73
+ - **Improve Documentation**: Contribute to the project's documentation for clearer guidance and better usability.
74
+ - **Share Insights and Best Practices**: Provide examples, tutorials, or best practices on utilizing `bbstrader` effectively.
75
+
76
+ ### How to Get Started
77
+
78
+ 1. **Fork the Repository**: Start by forking the `bbstrader` repository to your GitHub account.
79
+ 2. **Clone Your Fork**: Clone your forked repository to your local machine to start making changes.
80
+ 3. **Set Up Your Development Environment**: Ensure you have the necessary development environment set up, including Python, MetaTrader 5, and any dependencies.
81
+ 4. **Create a New Branch**: Make your changes in a new git branch, branching off from the main branch.
82
+ 5. **Implement Your Changes**: Work on bug fixes, features, or documentation improvements.
83
+ 6. **Test Your Changes**: Ensure your changes do not introduce new issues and that they work as intended.
84
+ 7. **Submit a Pull Request**: Once you're ready, submit a pull request (PR) against the main `bbstrader` repository. Include a clear description of the changes and any other relevant information.
85
+
86
+ ### Contribution Guidelines
87
+
88
+ Please adhere to the following guidelines to ensure a smooth contribution process:
89
+
90
+ - **Follow the Coding Standards**: Write clean, readable code and follow the coding conventions used throughout the project.
91
+ - **Document Your Changes**: Add comments and update the README.md files as necessary to explain your changes or additions.
92
+ - **Respect the License**: All contributions are subject to the MIT License under which `bbstrader` is distributed.
93
+
94
+ We're excited to see your contributions and to welcome you to the `bbstrader` community. Together, we can build a powerful tool that serves the needs of traders around the world.
95
+
96
+
97
+ ## Disclaimer
98
+
99
+ Trading financial instruments involves a high level of risk and may not be suitable for all investors. The developers of `bbstrader` are not responsible for any financial losses incurred from the use of this software. Trade responsibly and at your own risk.
100
+
101
+ ## License
102
+ `bbstrader` is open source and available under the MIT License.
@@ -0,0 +1,18 @@
1
+ """
2
+ Simplified Investment & Trading Toolkit
3
+ =======================================
4
+
5
+ """
6
+ __author__ = "Bertin Balouki SIMYELI"
7
+ __copyright__ = "2023-2025 Bertin Balouki SIMYELI"
8
+ __email__ = "bertin@bbstrader.com"
9
+ __license__ = "MIT"
10
+ __version__ = '0.2.0'
11
+
12
+
13
+ from bbstrader import btengine # noqa: F401
14
+ from bbstrader import metatrader # noqa: F401
15
+ from bbstrader import models # noqa: F401
16
+ from bbstrader import trading # noqa: F401
17
+ from bbstrader import tseries # noqa: F401
18
+ from .config import config_logger # noqa: F401
@@ -0,0 +1,54 @@
1
+ """
2
+ Overview
3
+ ========
4
+
5
+ This Backtesting Module provides a comprehensive suite of tools to test trading strategies in an event-driven system.
6
+ It simulates the execution of trades in historical market conditions to evaluate the performance of trading strategies
7
+ before applying them in live trading environments. Designed with modularity and extensibility in mind, it caters to
8
+ both novices and experts in algorithmic trading.
9
+
10
+ Features
11
+ ========
12
+
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
+ - **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
+ - **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.
16
+ - **Visualization**: Generates plots of the `equity curve`, `returns`, `drawdowns`, and other metrics for comprehensive strategy `performance analysis`.
17
+
18
+ Components
19
+ ==========
20
+
21
+ - **BacktestEgine**: Orchestrates the backtesting process, managing events and invoking components.
22
+ - **Event**: Abstract class for events, with implementations for market data, signals, fill and order events.
23
+ - **DataHandler**: Abstract class for market data handling, with an implementation for `CSVDataHandler`, `MT5DataHandler`, `YFDataHandler`. We will add another data handling in the future such as MacroEconomic Data, Fundamental Data, TICK Data and Real-time Data.
24
+ - **Portfolio**: Manages positions and calculates performance metrics, responding to market data and signals.
25
+ - **ExecutionHandler**: Abstract class for order execution, with a simulated execution handler provided with an implementation for `SimExecutionHandler`.
26
+ - **Performance**: Utility functions for calculating performance metrics and visualizing strategy performance.
27
+
28
+ Examples
29
+ ========
30
+
31
+ >>> from bbstrader.btengine import run_backtest
32
+ >>> from datetime import datetime
33
+ >>> run_backtest(
34
+ ... symbol_list=['AAPL', 'GOOG'],
35
+ ... start_date=datetime(2020, 1, 1),
36
+ ... data_handler=DataHandler,
37
+ ... strategy=Strategy,
38
+ ... exc_handler=ExecutionHandler,
39
+ ... initial_capital=500000.0,
40
+ ... heartbeat=1.0
41
+ ... )
42
+
43
+ Notes
44
+ =====
45
+
46
+ See `bbstrader.btengine.backtest.run_backtest` for more details on the backtesting process and its parameters.
47
+ """
48
+ from bbstrader.btengine.backtest import * # noqa: F403
49
+ from bbstrader.btengine.data import * # noqa: F403
50
+ from bbstrader.btengine.event import * # noqa: F403
51
+ from bbstrader.btengine.execution import * # noqa: F403
52
+ from bbstrader.btengine.performance import * # noqa: F403
53
+ from bbstrader.btengine.portfolio import * # noqa: F403
54
+ from bbstrader.btengine.strategy import * # noqa: F403