siglab-py 0.5.20__py3-none-any.whl → 0.5.22__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 siglab-py might be problematic. Click here for more details.

@@ -56,6 +56,7 @@ class AnalyticUtilTests(unittest.TestCase):
56
56
  'chop_against_ema',
57
57
  'ema_volume_short_periods', 'ema_volume_long_periods',
58
58
  'max_short_periods', 'max_long_periods', 'idmax_short_periods', 'idmax_long_periods', 'min_short_periods', 'min_long_periods', 'idmin_short_periods', 'idmin_long_periods',
59
+ 'price_swing_short_periods', 'price_swing_long_periods',
59
60
  'h_l', 'h_pc', 'l_pc', 'tr', 'atr', 'atr_avg_short_periods', 'atr_avg_long_periods',
60
61
  'hurst_exp',
61
62
  'boillenger_upper', 'boillenger_lower', 'boillenger_channel_height', 'boillenger_upper_agg', 'boillenger_lower_agg', 'boillenger_channel_height_agg',
@@ -168,6 +168,17 @@ def compute_candles_stats(
168
168
  pd_candles['idmin_short_periods'] = close_short_periods_rolling.apply(lambda x : x.idxmin())
169
169
  pd_candles['idmin_long_periods'] = close_long_periods_rolling.apply(lambda x : x.idxmin())
170
170
 
171
+ pd_candles['price_swing_short_periods'] = np.where(
172
+ pd_candles['idmax_short_periods'] > pd_candles['idmin_short_periods'],
173
+ pd_candles['max_short_periods'] - pd_candles['min_short_periods'], # Up swing
174
+ pd_candles['min_short_periods'] - pd_candles['max_short_periods'] # Down swing (negative)
175
+ )
176
+
177
+ pd_candles['price_swing_long_periods'] = np.where(
178
+ pd_candles['idmax_long_periods'] > pd_candles['idmin_long_periods'],
179
+ pd_candles['max_long_periods'] - pd_candles['min_long_periods'], # Up swing
180
+ pd_candles['min_long_periods'] - pd_candles['max_long_periods'] # Down swing (negative)
181
+ )
171
182
 
172
183
  # ATR https://medium.com/codex/detecting-ranging-and-trending-markets-with-choppiness-index-in-python-1942e6450b58
173
184
  pd_candles.loc[:,'h_l'] = pd_candles['high'] - pd_candles['low']
@@ -188,10 +199,10 @@ def compute_candles_stats(
188
199
  Sometimes you may encounter "Exception has occurred: FloatingPointError invalid value encountered in scalar divide"
189
200
  And for example adjusting window size from 120 to 125 will resolve the issue.
190
201
  '''
202
+ if not hurst_exp_window_how_many_candles:
203
+ hurst_exp_window_how_many_candles = (sliding_window_how_many_candles if sliding_window_how_many_candles>=125 else 125)
191
204
  pd_candles['hurst_exp'] = pd_candles['close'].rolling(
192
- window=(
193
- hurst_exp_window_how_many_candles if hurst_exp_window_how_many_candles else (sliding_window_how_many_candles if sliding_window_how_many_candles>=125 else 125)
194
- )
205
+ window=hurst_exp_window_how_many_candles
195
206
  ).apply(lambda x: compute_Hc(x, kind='price', simplified=True)[0])
196
207
 
197
208
 
@@ -463,6 +474,13 @@ def compute_candles_stats(
463
474
  (pd_candles['ema_long_slope'] > 0) & (pd_candles['ema_rsi_slope'] < 0) |
464
475
  (pd_candles['ema_long_slope'] < 0) & (pd_candles['ema_rsi_slope'] > 0)
465
476
  )
477
+
478
+ calculate_slope(
479
+ pd_data=pd_candles,
480
+ src_col_name='hurst_exp',
481
+ slope_col_name='hurst_exp_slope',
482
+ sliding_window_how_many_candles=hurst_exp_window_how_many_candles
483
+ )
466
484
 
467
485
 
468
486
  # Fibonacci
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: siglab_py
3
- Version: 0.5.20
3
+ Version: 0.5.22
4
4
  Summary: Market data fetches, TA calculations and generic order gateway.
5
5
  Author: r0bbarh00d
6
6
  Author-email: r0bbarh00d <r0bbarh00d@gmail.com>
@@ -22,18 +22,18 @@ siglab_py/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  siglab_py/tests/integration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  siglab_py/tests/integration/market_data_util_tests.py,sha256=p-RWIJZLyj0lAdfi4QTIeAttCm_e8mEVWFKh4OWuogU,7189
24
24
  siglab_py/tests/unit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
- siglab_py/tests/unit/analytic_util_tests.py,sha256=vt6DKH-Flf9Og3gqivZ9W-sz5z-KcjKFQOEsWCDsWKs,3984
25
+ siglab_py/tests/unit/analytic_util_tests.py,sha256=zxR4s3qZe7i84HcDk41pBHZ4yUyr_cP3dmzM7y8l3FY,4054
26
26
  siglab_py/tests/unit/market_data_util_tests.py,sha256=A1y83itISmMJdn6wLpfwcr4tGola8wTf1D1xbelMvgw,2026
27
27
  siglab_py/tests/unit/trading_util_tests.py,sha256=9DZmTZlW55lPtNfTCukgDdiyBiMYv9R4mEFWJIJiTNg,3870
28
28
  siglab_py/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
- siglab_py/util/analytic_util.py,sha256=Do_H30Dt-ISTPnNQ6JcLhBnIgvu3NGV6WYGWnplvgtY,48965
29
+ siglab_py/util/analytic_util.py,sha256=MLXIiMbGAWzGwLpE69Hw8MxyLPCEHMu0gRQzoHd4nNE,49883
30
30
  siglab_py/util/aws_util.py,sha256=KGmjHrr1rpnnxr33nXHNzTul4tvyyxl9p6gpwNv0Ygc,2557
31
31
  siglab_py/util/market_data_util.py,sha256=mUXg4uaiX3b6_klgJWIEgnUQU4IUd6CwTOqKLiQWRlU,31307
32
32
  siglab_py/util/notification_util.py,sha256=vySgHjpHgwFDLW0tHSi_AGh9JBbPc25IUgvWxmjAeT8,2658
33
33
  siglab_py/util/retry_util.py,sha256=g-UU6pkPouWZZRZEqP99R2Z0lX5xzckYkzjwqqSDpVQ,922
34
34
  siglab_py/util/slack_notification_util.py,sha256=G27n-adbT3Q6oaHSMvu_Nom794rrda5PprSF-zvmzkM,1912
35
35
  siglab_py/util/trading_util.py,sha256=-TGNgJdy4HMDPgq31KQn_lRawFxuXnFU5NnLRb1XM5o,5757
36
- siglab_py-0.5.20.dist-info/METADATA,sha256=05smcq4TjV5yqXk9cI6GwzA2-4eDf2YQx7VYDJmNVVg,829
37
- siglab_py-0.5.20.dist-info/WHEEL,sha256=lTU6B6eIfYoiQJTZNc-fyaR6BpL6ehTzU3xGYxn2n8k,91
38
- siglab_py-0.5.20.dist-info/top_level.txt,sha256=AbD4VR9OqmMOGlMJLkAVPGQMtUPIQv0t1BF5xmcLJSk,10
39
- siglab_py-0.5.20.dist-info/RECORD,,
36
+ siglab_py-0.5.22.dist-info/METADATA,sha256=5jx1oSDRSUjYkgfllki9YV7gqI0y230r-_wynVYJaCI,829
37
+ siglab_py-0.5.22.dist-info/WHEEL,sha256=lTU6B6eIfYoiQJTZNc-fyaR6BpL6ehTzU3xGYxn2n8k,91
38
+ siglab_py-0.5.22.dist-info/top_level.txt,sha256=AbD4VR9OqmMOGlMJLkAVPGQMtUPIQv0t1BF5xmcLJSk,10
39
+ siglab_py-0.5.22.dist-info/RECORD,,