siglab-py 0.5.50__tar.gz → 0.5.52__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.
- {siglab_py-0.5.50 → siglab_py-0.5.52}/PKG-INFO +1 -1
- {siglab_py-0.5.50 → siglab_py-0.5.52}/pyproject.toml +1 -1
- {siglab_py-0.5.50 → siglab_py-0.5.52}/setup.cfg +1 -1
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/tests/unit/analytic_util_tests.py +2 -2
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/tests/unit/simple_math_tests.py +20 -6
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/util/analytic_util.py +14 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/util/simple_math.py +14 -1
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py.egg-info/PKG-INFO +1 -1
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/__init__.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/constants.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/exchanges/__init__.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/exchanges/any_exchange.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/exchanges/futubull.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/market_data_providers/__init__.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/market_data_providers/aggregated_orderbook_provider.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/market_data_providers/candles_provider.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/market_data_providers/candles_ta_provider.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/market_data_providers/ccxt_candles_ta_to_csv.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/market_data_providers/deribit_options_expiry_provider.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/market_data_providers/futu_candles_ta_to_csv.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/market_data_providers/orderbooks_provider.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/market_data_providers/test_provider.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/market_data_providers/tg_monitor.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/ordergateway/__init__.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/ordergateway/client.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/ordergateway/encrypt_keys_util.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/ordergateway/gateway.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/ordergateway/test_ordergateway.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/tests/__init__.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/tests/integration/__init__.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/tests/integration/market_data_util_tests.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/tests/unit/__init__.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/tests/unit/market_data_util_tests.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/tests/unit/trading_util_tests.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/util/__init__.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/util/aws_util.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/util/market_data_util.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/util/notification_util.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/util/retry_util.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/util/slack_notification_util.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/util/trading_util.py +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py.egg-info/SOURCES.txt +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py.egg-info/dependency_links.txt +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py.egg-info/requires.txt +0 -0
- {siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py.egg-info/top_level.txt +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "siglab_py"
|
|
7
|
-
version = "0.5.
|
|
7
|
+
version = "0.5.52"
|
|
8
8
|
description = "Market data fetches, TA calculations and generic order gateway."
|
|
9
9
|
authors = [{name = "r0bbarh00d", email = "r0bbarh00d@gmail.com"}]
|
|
10
10
|
license = {text = "MIT"}
|
|
@@ -67,9 +67,9 @@ class AnalyticUtilTests(unittest.TestCase):
|
|
|
67
67
|
'aggressive_up', 'aggressive_up_index', 'aggressive_up_candle_height', 'aggressive_up_candle_high', 'aggressive_up_candle_low', 'aggressive_down', 'aggressive_down_index', 'aggressive_down_candle_height', 'aggressive_down_candle_high', 'aggressive_down_candle_low',
|
|
68
68
|
'fvg_low', 'fvg_high', 'fvg_gap', 'fvg_mitigated',
|
|
69
69
|
'close_delta', 'close_delta_percent', 'up', 'down',
|
|
70
|
-
'rsi', 'ema_rsi', 'rsi_max', 'rsi_idmax', 'rsi_min', 'rsi_idmin', 'rsi_trend', 'rsi_trend_from_highs', 'rsi_trend_from_lows', 'rsi_divergence',
|
|
70
|
+
'rsi', 'rsi_bucket', 'ema_rsi', 'rsi_max', 'rsi_idmax', 'rsi_min', 'rsi_idmin', 'rsi_trend', 'rsi_trend_from_highs', 'rsi_trend_from_lows', 'rsi_divergence',
|
|
71
71
|
'typical_price',
|
|
72
|
-
'money_flow', 'money_flow_positive', 'money_flow_negative', 'positive_flow_sum', 'negative_flow_sum', 'money_flow_ratio', 'mfi',
|
|
72
|
+
'money_flow', 'money_flow_positive', 'money_flow_negative', 'positive_flow_sum', 'negative_flow_sum', 'money_flow_ratio', 'mfi', 'mfi_bucket',
|
|
73
73
|
'macd', 'signal', 'macd_minus_signal',
|
|
74
74
|
'fib_0.618_short_periods', 'fib_0.618_long_periods',
|
|
75
75
|
'gap_close_vs_ema',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import unittest
|
|
2
2
|
from typing import List, Dict, Union
|
|
3
3
|
|
|
4
|
-
from util.simple_math import generate_rand_nums, round_to_level, bucket_series
|
|
4
|
+
from util.simple_math import generate_rand_nums, round_to_level, bucket_series, bucketize_val
|
|
5
5
|
|
|
6
6
|
class SimpleMathTests(unittest.TestCase):
|
|
7
7
|
|
|
@@ -108,6 +108,9 @@ class SimpleMathTests(unittest.TestCase):
|
|
|
108
108
|
assert(rounded_price==expected)
|
|
109
109
|
|
|
110
110
|
def test_bucket_series(self):
|
|
111
|
+
|
|
112
|
+
level_granularity : float = 0.1
|
|
113
|
+
|
|
111
114
|
range_min : float = 0
|
|
112
115
|
range_max : float = 1
|
|
113
116
|
size : int = 100
|
|
@@ -129,10 +132,17 @@ class SimpleMathTests(unittest.TestCase):
|
|
|
129
132
|
Dict[str,Union[float, List[float]]]
|
|
130
133
|
] = bucket_series(
|
|
131
134
|
values = rand_nums,
|
|
132
|
-
outlier_threshold_percent = 10
|
|
135
|
+
outlier_threshold_percent = 10,
|
|
136
|
+
level_granularity=level_granularity
|
|
133
137
|
)
|
|
134
138
|
|
|
139
|
+
bucketized = []
|
|
140
|
+
for num in rand_nums:
|
|
141
|
+
bucketized.append(
|
|
142
|
+
bucketize_val(num, buckets=buckets)
|
|
143
|
+
)
|
|
135
144
|
|
|
145
|
+
|
|
136
146
|
range_min = -1
|
|
137
147
|
range_max = 1
|
|
138
148
|
size : int = 100
|
|
@@ -151,7 +161,8 @@ class SimpleMathTests(unittest.TestCase):
|
|
|
151
161
|
|
|
152
162
|
buckets = bucket_series(
|
|
153
163
|
values = rand_nums,
|
|
154
|
-
outlier_threshold_percent = 10
|
|
164
|
+
outlier_threshold_percent = 10,
|
|
165
|
+
level_granularity=level_granularity
|
|
155
166
|
)
|
|
156
167
|
|
|
157
168
|
|
|
@@ -173,7 +184,8 @@ class SimpleMathTests(unittest.TestCase):
|
|
|
173
184
|
|
|
174
185
|
buckets = bucket_series(
|
|
175
186
|
values = rand_nums,
|
|
176
|
-
outlier_threshold_percent = 10
|
|
187
|
+
outlier_threshold_percent = 10,
|
|
188
|
+
level_granularity=level_granularity
|
|
177
189
|
)
|
|
178
190
|
|
|
179
191
|
|
|
@@ -195,7 +207,8 @@ class SimpleMathTests(unittest.TestCase):
|
|
|
195
207
|
|
|
196
208
|
buckets = bucket_series(
|
|
197
209
|
values = rand_nums,
|
|
198
|
-
outlier_threshold_percent = 10
|
|
210
|
+
outlier_threshold_percent = 10,
|
|
211
|
+
level_granularity=level_granularity
|
|
199
212
|
)
|
|
200
213
|
|
|
201
214
|
|
|
@@ -217,5 +230,6 @@ class SimpleMathTests(unittest.TestCase):
|
|
|
217
230
|
|
|
218
231
|
buckets = bucket_series(
|
|
219
232
|
values = rand_nums,
|
|
220
|
-
outlier_threshold_percent = 10
|
|
233
|
+
outlier_threshold_percent = 10,
|
|
234
|
+
level_granularity=level_granularity
|
|
221
235
|
)
|
|
@@ -11,6 +11,7 @@ from hurst import compute_Hc # compatible with pypy
|
|
|
11
11
|
from ccxt.base.exchange import Exchange as CcxtExchange
|
|
12
12
|
from ccxt import deribit
|
|
13
13
|
|
|
14
|
+
from siglab_py.util.simple_math import bucket_series, bucketize_val
|
|
14
15
|
from siglab_py.util.market_data_util import fix_column_types
|
|
15
16
|
from siglab_py.constants import TrendDirection
|
|
16
17
|
|
|
@@ -473,6 +474,13 @@ def compute_candles_stats(
|
|
|
473
474
|
|
|
474
475
|
lo_rs = lo_ma_up / lo_ma_down
|
|
475
476
|
pd_candles.loc[:,'rsi'] = 100 - (100/(1 + lo_rs))
|
|
477
|
+
rsi_buckets = bucket_series(
|
|
478
|
+
values = pd_candles['rsi'].to_list(),
|
|
479
|
+
outlier_threshold_percent=10,
|
|
480
|
+
level_granularity=0.1
|
|
481
|
+
)
|
|
482
|
+
|
|
483
|
+
pd_candles['rsi_bucket'] = pd_candles['rsi'].apply(lambda x: bucketize_val(x, buckets=rsi_buckets))
|
|
476
484
|
pd_candles['ema_rsi'] = pd_candles['rsi'].ewm(
|
|
477
485
|
span=rsi_sliding_window_how_many_candles,
|
|
478
486
|
adjust=False).mean()
|
|
@@ -534,6 +542,12 @@ def compute_candles_stats(
|
|
|
534
542
|
rsi_sliding_window_how_many_candles if rsi_sliding_window_how_many_candles else sliding_window_how_many_candles).sum()
|
|
535
543
|
pd_candles['money_flow_ratio'] = pd_candles['positive_flow_sum'] / pd_candles['negative_flow_sum']
|
|
536
544
|
pd_candles['mfi'] = 100 - (100 / (1 + pd_candles['money_flow_ratio']))
|
|
545
|
+
mfi_buckets = bucket_series(
|
|
546
|
+
values = pd_candles['mfi'].to_list(),
|
|
547
|
+
outlier_threshold_percent=10,
|
|
548
|
+
level_granularity=0.1
|
|
549
|
+
)
|
|
550
|
+
pd_candles['mfi_bucket'] = pd_candles['mfi'].apply(lambda x: bucketize_val(x, buckets=mfi_buckets))
|
|
537
551
|
|
|
538
552
|
|
|
539
553
|
# MACD https://www.investopedia.com/terms/m/macd.asp
|
|
@@ -189,4 +189,17 @@ def bucket_series(
|
|
|
189
189
|
bucket = buckets[key]
|
|
190
190
|
assert(len([x for x in bucket['values'] if x<bucket['min'] or x>bucket['max']])==0) # type: ignore
|
|
191
191
|
|
|
192
|
-
return buckets
|
|
192
|
+
return buckets
|
|
193
|
+
|
|
194
|
+
def bucketize_val(
|
|
195
|
+
x : float,
|
|
196
|
+
buckets : Dict[
|
|
197
|
+
str,
|
|
198
|
+
Dict[str,Union[float, List[float]]]
|
|
199
|
+
]
|
|
200
|
+
) -> Union[str,None]:
|
|
201
|
+
for key in buckets:
|
|
202
|
+
bucket = buckets[key]
|
|
203
|
+
if x>=bucket['min'] and x<=bucket['max']: # type: ignore
|
|
204
|
+
return key
|
|
205
|
+
return None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/market_data_providers/candles_ta_provider.py
RENAMED
|
File without changes
|
{siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/market_data_providers/ccxt_candles_ta_to_csv.py
RENAMED
|
File without changes
|
|
File without changes
|
{siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/market_data_providers/futu_candles_ta_to_csv.py
RENAMED
|
File without changes
|
{siglab_py-0.5.50 → siglab_py-0.5.52}/siglab_py/market_data_providers/orderbooks_provider.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|