bbstrader 0.0.2__py3-none-any.whl → 0.1.1__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/metatrader/rates.py +1 -1
- bbstrader/trading/execution.py +1 -1
- bbstrader/tseries.py +9 -9
- {bbstrader-0.0.2.dist-info → bbstrader-0.1.1.dist-info}/METADATA +8 -8
- {bbstrader-0.0.2.dist-info → bbstrader-0.1.1.dist-info}/RECORD +8 -8
- {bbstrader-0.0.2.dist-info → bbstrader-0.1.1.dist-info}/LICENSE +0 -0
- {bbstrader-0.0.2.dist-info → bbstrader-0.1.1.dist-info}/WHEEL +0 -0
- {bbstrader-0.0.2.dist-info → bbstrader-0.1.1.dist-info}/top_level.txt +0 -0
bbstrader/metatrader/rates.py
CHANGED
bbstrader/trading/execution.py
CHANGED
|
@@ -8,7 +8,7 @@ from bbstrader.trading.utils import tf_mapping
|
|
|
8
8
|
from bbstrader.strategies import (
|
|
9
9
|
ArimaGarchStrategy, SMAStrategy, KLFStrategy, OrnsteinUhlenbeck,
|
|
10
10
|
)
|
|
11
|
-
from bbstrader.models import HMMRiskManager
|
|
11
|
+
from bbstrader.models.risk import HMMRiskManager
|
|
12
12
|
from bbstrader.metatrader.utils import config_logger
|
|
13
13
|
from typing import Optional, Literal, List, Tuple
|
|
14
14
|
|
bbstrader/tseries.py
CHANGED
|
@@ -74,7 +74,7 @@ def load_and_prepare_data(df: pd.DataFrame):
|
|
|
74
74
|
return data
|
|
75
75
|
|
|
76
76
|
|
|
77
|
-
def fit_best_arima(window_data: pd.Series
|
|
77
|
+
def fit_best_arima(window_data: Union[pd.Series , np.ndarray]):
|
|
78
78
|
"""
|
|
79
79
|
Identifies and fits the best `ARIMA` model
|
|
80
80
|
based on the Akaike Information Criterion `(AIC)`.
|
|
@@ -109,7 +109,7 @@ def fit_best_arima(window_data: pd.Series | np.ndarray):
|
|
|
109
109
|
return best_arima_model
|
|
110
110
|
|
|
111
111
|
|
|
112
|
-
def fit_garch(window_data:
|
|
112
|
+
def fit_garch(window_data: Union[pd.Series , np.ndarray]):
|
|
113
113
|
"""
|
|
114
114
|
Fits an `ARIMA` model to the data to get residuals,
|
|
115
115
|
then fits a `GARCH(1,1)` model on these residuals.
|
|
@@ -159,7 +159,7 @@ def predict_next_return(arima_result, garch_result):
|
|
|
159
159
|
return next_return
|
|
160
160
|
|
|
161
161
|
|
|
162
|
-
def get_prediction(window_data:
|
|
162
|
+
def get_prediction(window_data: Union[pd.Series , np.ndarray]):
|
|
163
163
|
"""
|
|
164
164
|
Orchestrator function to get the next period's return prediction.
|
|
165
165
|
|
|
@@ -168,7 +168,7 @@ def get_prediction(window_data: pd.Series | np.ndarray):
|
|
|
168
168
|
and then predicting the next period's return using these models.
|
|
169
169
|
|
|
170
170
|
Args:
|
|
171
|
-
window_data (pd.Series
|
|
171
|
+
window_data (Union[pd.Series , np.ndarray]):
|
|
172
172
|
Time series data to fit the models and predict the next return.
|
|
173
173
|
|
|
174
174
|
Returns
|
|
@@ -182,13 +182,13 @@ def get_prediction(window_data: pd.Series | np.ndarray):
|
|
|
182
182
|
# *********************************************
|
|
183
183
|
# STATS TEST (Cointegration , Mean Reverting)*
|
|
184
184
|
# *********************************************
|
|
185
|
-
def get_corr(tickers: List[str]
|
|
185
|
+
def get_corr(tickers: Union[List[str] , Tuple[str, ...]], start: str, end: str) -> None:
|
|
186
186
|
"""
|
|
187
187
|
Calculates and prints the correlation matrix of the adjusted closing prices
|
|
188
188
|
for a given list of stock tickers within a specified date range.
|
|
189
189
|
|
|
190
190
|
Args:
|
|
191
|
-
tickers (List[str]
|
|
191
|
+
tickers (Union[List[str] , Tuple[str, ...]]):
|
|
192
192
|
A list or tuple of valid stock tickers (e.g., ['AAPL', 'MSFT', 'GOOG']).
|
|
193
193
|
start (str): The start date for the historical data in 'YYYY-MM-DD' format.
|
|
194
194
|
end (str): The end date for the historical data in 'YYYY-MM-DD' format.
|
|
@@ -275,7 +275,7 @@ def plot_residuals(df: pd.DataFrame):
|
|
|
275
275
|
plt.show()
|
|
276
276
|
|
|
277
277
|
|
|
278
|
-
def run_cadf_test(pair: List[str]
|
|
278
|
+
def run_cadf_test(pair: Union[List[str] , Tuple[str, ...]], start: str, end: str) -> None:
|
|
279
279
|
"""
|
|
280
280
|
Performs the Cointegration Augmented Dickey-Fuller (CADF) test on a pair of stock tickers
|
|
281
281
|
over a specified date range to check for cointegration.
|
|
@@ -560,7 +560,7 @@ def draw_slope_intercept_changes(prices, state_means):
|
|
|
560
560
|
plt.show()
|
|
561
561
|
|
|
562
562
|
|
|
563
|
-
def run_kalman_filter(etfs: List[str]
|
|
563
|
+
def run_kalman_filter(etfs: Union[List[str] , Tuple[str, ...]], start: str, end: str) -> None:
|
|
564
564
|
"""
|
|
565
565
|
Applies a Kalman filter to a pair of ETF adjusted closing prices within a specified date range
|
|
566
566
|
to estimate the slope and intercept over time.
|
|
@@ -570,7 +570,7 @@ def run_kalman_filter(etfs: List[str] | Tuple[str, ...], start: str, end: str) -
|
|
|
570
570
|
intercept, and visualizes the changes in these estimates over time.
|
|
571
571
|
|
|
572
572
|
Args:
|
|
573
|
-
etfs (List[str]
|
|
573
|
+
etfs (Union[List[str] , Tuple[str, ...]]):
|
|
574
574
|
A list or tuple containing two valid ETF tickers (e.g., ['SPY', 'QQQ']).
|
|
575
575
|
start (str): The start date for the historical data in 'YYYY-MM-DD' format.
|
|
576
576
|
end (str): The end date for the historical data in 'YYYY-MM-DD' format.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: bbstrader
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: Simplified Investment & Trading Toolkit
|
|
5
|
-
Home-page: https://github.com/bbalouki/
|
|
5
|
+
Home-page: https://github.com/bbalouki/bbstrader
|
|
6
6
|
Author: Bertin Balouki SIMYELI
|
|
7
|
-
Author-email: <
|
|
7
|
+
Author-email: <bertin@bbstrader.com>
|
|
8
8
|
Maintainer: Bertin Balouki SIMYELI
|
|
9
9
|
License: The MIT License (MIT)
|
|
10
10
|
Keywords: Finance,Toolkit,Financial,Analysis,Fundamental,Quantitative,Database,Equities,Currencies,Economics,ETFs,Funds,Indices,Moneymarkets,Commodities,Futures,CFDs,Derivatives,Trading,Investing,Portfolio,Optimization,Performance
|
|
11
|
-
Classifier: Development Status ::
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
12
|
Classifier: Intended Audience :: Developers
|
|
13
13
|
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
14
14
|
Classifier: Topic :: Office/Business :: Financial :: Investment
|
|
@@ -32,8 +32,6 @@ Requires-Dist: statsmodels
|
|
|
32
32
|
Requires-Dist: matplotlib
|
|
33
33
|
Requires-Dist: filterpy
|
|
34
34
|
Requires-Dist: pytest
|
|
35
|
-
Requires-Dist: sphinx
|
|
36
|
-
Requires-Dist: sphinx-rtd-theme
|
|
37
35
|
Requires-Dist: CurrencyConverter
|
|
38
36
|
Requires-Dist: Metatrader5
|
|
39
37
|
|
|
@@ -60,13 +58,15 @@ It leverages statistical models and algorithms to perform tasks such as cointegr
|
|
|
60
58
|
- **Integrated Risk Management**: Leverage advanced risk management techniques to adapt to changing market conditions and maintain control over risk exposure.
|
|
61
59
|
- **Automated Trading**: Execute trades automatically on the MT5 platform, with support for managing orders, positions, and risk in real-time.
|
|
62
60
|
- **Flexible Framework**: Customize existing strategies or develop new ones with the flexible, modular architecture designed to accommodate traders' evolving needs.
|
|
61
|
+
- **Advanced Time Series Analysis**: Conduct in-depth analysis of financial time series data to identify patterns, trends, and relationships that can inform trading strategies.
|
|
62
|
+
You can read the full documentation [here](https://bbstrader.readthedocs.io/en/latest/index.html)
|
|
63
63
|
|
|
64
64
|
## Getting Started
|
|
65
65
|
|
|
66
66
|
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.
|
|
67
67
|
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.
|
|
68
|
-
* If you want to trade `Stocks`, `ETFs`, `Indices`, `Commodities`, `Futures`, and `Forex`,
|
|
69
|
-
* If you want to trade `Stocks`, `Crypto`, `indices`, `Commodities`, and `Forex`,
|
|
68
|
+
* If you want to trade `Stocks`, `ETFs`, `Indices`, `Commodities`, `Futures`, and `Forex`, [click here](https://cabinet.a-partnership.com/visit/?bta=35537&brand=admiralmarkets)
|
|
69
|
+
* If you want to trade `Stocks`, `Crypto`, `indices`, `Commodities`, and `Forex`, [click here](https://one.justmarkets.link/a/tufvj0xugm/registration/trader)
|
|
70
70
|
* If you are looking for a prop firm, [click here](https://trader.ftmo.com/?affiliates=JGmeuQqepAZLMcdOEQRp)
|
|
71
71
|
|
|
72
72
|
Then, you can install `bbstrader` using pip:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
bbstrader/__ini__.py,sha256=pXy9hM6Yh9hvIHRQS56TzEfYj97YYoc48oiYuYOfns4,478
|
|
2
2
|
bbstrader/strategies.py,sha256=6USRp43fsLLe2rT608Glz6lmea6bvjKx8fQEgOWyUGI,24510
|
|
3
|
-
bbstrader/tseries.py,sha256=
|
|
3
|
+
bbstrader/tseries.py,sha256=M9x5jcdvIiAAAv1V2PSldguOHT4K6tmR2EYW_IswqI0,21779
|
|
4
4
|
bbstrader/btengine/__init__.py,sha256=oGyNWUAqzpounayQ5ptww6vFUp58J-af-ooCMf9hFV0,3156
|
|
5
5
|
bbstrader/btengine/backtest.py,sha256=eXKTIQxPWFN3RdTXWQTE2ybc4YI0svoWobN6Cz2xR14,36656
|
|
6
6
|
bbstrader/btengine/data.py,sha256=-8k3tBf-sHnV7GU26xxaGusK_SYxm6TuIvCTMcR_zY4,13810
|
|
@@ -11,18 +11,18 @@ bbstrader/btengine/portfolio.py,sha256=RXGJTmg1NIq0MSkMB6v6hmCG4xfdwLo9rO1_UCAX7
|
|
|
11
11
|
bbstrader/btengine/strategy.py,sha256=tY5ek37NxLrYftgzJ4CqMGDFv5oMkvMsBbOkkOGghKw,1384
|
|
12
12
|
bbstrader/metatrader/__init__.py,sha256=y4JLz05esm3PKerHMgtd3dmRpa7yUvWVuj_xOnlhXSA,261
|
|
13
13
|
bbstrader/metatrader/account.py,sha256=jTfDJgHjFdzXlMkPJd1t3yOk_SPdQKnVFIKjML45eCs,42494
|
|
14
|
-
bbstrader/metatrader/rates.py,sha256=
|
|
14
|
+
bbstrader/metatrader/rates.py,sha256=tGcWh2t9Yilik8YDMN2_VBeWV4VNa4zHABmOT98rW8g,8286
|
|
15
15
|
bbstrader/metatrader/risk.py,sha256=tGpmP6pOtbn4iWtX4P6Gl2Z5YuP2jRI5g7Z8pybsO58,25134
|
|
16
16
|
bbstrader/metatrader/trade.py,sha256=KKJ1nM7dsK0CYBQXN9OU0X0KRd3Ywh9ztgXWnwhfv8M,57099
|
|
17
17
|
bbstrader/metatrader/utils.py,sha256=3bLL6A0Mp8HVofnsgSfuI11esA4v5O2618fMuJ_AiVs,18921
|
|
18
18
|
bbstrader/models/__init__.py,sha256=6tAj9V9vgwesgPVMKznwRB3k8-Ec8Q73Di5p2UO0qlA,274
|
|
19
19
|
bbstrader/models/risk.py,sha256=2fFBqsY2v8Kd6oU8t8h2h-Sp8joVqetA-t21rjkT9U4,13593
|
|
20
20
|
bbstrader/trading/__init__.py,sha256=yZ85EALV2sSCzCPxaeFYlk1JJhYQq2C-xSd5EEQYvI8,82
|
|
21
|
-
bbstrader/trading/execution.py,sha256=
|
|
21
|
+
bbstrader/trading/execution.py,sha256=geiIiR9ldTJvM6rapa66Xug-gRcA_YqfA6kCr54lnRw,46708
|
|
22
22
|
bbstrader/trading/run.py,sha256=UA5Sn5nWOqsezZVGCM_kjOPPsu_IxMdSABUBnBAJA-k,3474
|
|
23
23
|
bbstrader/trading/utils.py,sha256=Eu_cBnfPcOGel4Lj6Dc-UCl-h7NqR8Rfv9RZtaxNRos,7711
|
|
24
|
-
bbstrader-0.
|
|
25
|
-
bbstrader-0.
|
|
26
|
-
bbstrader-0.
|
|
27
|
-
bbstrader-0.
|
|
28
|
-
bbstrader-0.
|
|
24
|
+
bbstrader-0.1.1.dist-info/LICENSE,sha256=1EudjwwP2oTJy8Vh0e-Kzv8VZZU95y-t6c3DYhR51uc,1115
|
|
25
|
+
bbstrader-0.1.1.dist-info/METADATA,sha256=w1h6GuPYqZzuMdVjYy0qoXqXuZNIe_2A5Pb_4xX52IY,8878
|
|
26
|
+
bbstrader-0.1.1.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
|
|
27
|
+
bbstrader-0.1.1.dist-info/top_level.txt,sha256=Wwj322jZmxGZ6gD_TdaPiPLjED5ReObm5omerwlmZIg,10
|
|
28
|
+
bbstrader-0.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|