siglab-py 0.3.5__py3-none-any.whl → 0.3.6__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.

@@ -26,7 +26,7 @@ from siglab_py.util.analytic_util import compute_candles_stats
26
26
  '''
27
27
  Usage:
28
28
  set PYTHONPATH=%PYTHONPATH%;D:\dev\siglab\siglab_py
29
- python ccxt_candles_ta_to_csv.py --exchange_name bybit --symbol BTC/USDT:USDT --end_date "2025-03-11 0:0:0" --start_date "2021-03-11 0:0:0" --default_type linear --compute_ta Y --pypy_compatible N
29
+ python ccxt_candles_ta_to_csv.py --exchange_name okx --symbol BTC/USDT:USDT --candle_size 1h --end_date "2025-04-22 0:0:0" --start_date "2024-01-01 0:0:0" --default_type linear --compute_ta Y --pypy_compatible N
30
30
 
31
31
  (Remember: python -mpip install siglab_py)
32
32
 
@@ -60,8 +60,8 @@ If debugging from VSCode, launch.json:
60
60
  "args" : [
61
61
  "--exchange_name", "bybit",
62
62
  "--symbol", "BTC/USDT:USDT",
63
- "--end_date", "2025-03-11 0:0:0",
64
- "--start_date", "2024-03-11 0:0:0",
63
+ "--end_date", "2025-04-22 0:0:0",
64
+ "--start_date", "2024-01-01 0:0:0",
65
65
  "--default_type", "linear",
66
66
  "--compute_ta", "Y",
67
67
  "--pypy_compatible", "N"
@@ -83,7 +83,7 @@ param : Dict = {
83
83
  'start_date' : start_date,
84
84
  'end_date' : end_date,
85
85
  'exchange_params' : {
86
- 'rateLimit' : 100, # in ms
86
+ 'rateLimit' : 300, # in ms
87
87
  'options' : {
88
88
  'defaultType' : "linear"
89
89
  }
@@ -626,4 +626,52 @@ def fetch_deribit_btc_option_expiries(
626
626
  'index_price' : index_price,
627
627
  'by_expiry' : sorted_expiry_data, # type: ignore Otherwise, Error: Type "dict[str, list[tuple[str, float]] | dict[str, Dict[Unknown, Unknown]]]" is not assignable to return type "Dict[str, Dict[str, float] | Dict[str, Dict[str, str | float]]]"
628
628
  'by_expiry_and_strike' : expiry_data_breakdown_by_strike
629
- }
629
+ }
630
+
631
+ def build_pair_candles(
632
+ pd_candles1 : pd.DataFrame,
633
+ pd_candles2 : pd.DataFrame
634
+ ) -> pd.DataFrame:
635
+ min_timestamp_ms1 = int(pd_candles1.iloc[0]['timestamp_ms'])
636
+ max_timestamp_ms1 = int(pd_candles1.iloc[-1]['timestamp_ms'])
637
+ min_timestamp_ms2 = int(pd_candles2.iloc[0]['timestamp_ms'])
638
+ max_timestamp_ms2 = int(pd_candles2.iloc[-1]['timestamp_ms'])
639
+
640
+ pd_candles1 = pd_candles1[(pd_candles1.timestamp_ms>=min_timestamp_ms2) & (pd_candles1.timestamp_ms<=max_timestamp_ms2) & (~pd_candles1.timestamp_ms.isna()) ]
641
+ pd_candles2 = pd_candles2[(pd_candles2.timestamp_ms>=min_timestamp_ms1) & (pd_candles2.timestamp_ms<=max_timestamp_ms1) & (~pd_candles2.timestamp_ms.isna())]
642
+ assert(pd_candles1.shape[0]==pd_candles2.shape[0])
643
+
644
+ pd_candles1['timestamp_ms_gap'] = pd_candles1['timestamp_ms'] - pd_candles1['timestamp_ms'].shift(1)
645
+ timestamp_ms_gap = pd_candles1.iloc[-1]['timestamp_ms_gap']
646
+
647
+ assert(pd_candles1[~pd_candles1.timestamp_ms_gap.isna()][pd_candles1.timestamp_ms_gap!=timestamp_ms_gap].shape[0]==0)
648
+ pd_candles1.drop(columns=['timestamp_ms_gap'], inplace=True)
649
+
650
+ pd_candles2['timestamp_ms_gap'] = pd_candles2['timestamp_ms'] - pd_candles2['timestamp_ms'].shift(1)
651
+ timestamp_ms_gap = pd_candles2.iloc[-1]['timestamp_ms_gap']
652
+ assert(pd_candles2[~pd_candles2.timestamp_ms_gap.isna()][pd_candles2.timestamp_ms_gap!=timestamp_ms_gap].shape[0]==0)
653
+ pd_candles2.drop(columns=['timestamp_ms_gap'], inplace=True)
654
+
655
+ min_timestamp_ms1 = int(pd_candles1.iloc[0]['timestamp_ms'])
656
+ max_timestamp_ms1 = int(pd_candles1.iloc[-1]['timestamp_ms'])
657
+ min_timestamp_ms2 = int(pd_candles2.iloc[0]['timestamp_ms'])
658
+ max_timestamp_ms2 = int(pd_candles2.iloc[-1]['timestamp_ms'])
659
+ assert(min_timestamp_ms1==min_timestamp_ms2)
660
+ assert(max_timestamp_ms1==max_timestamp_ms2)
661
+ assert(pd_candles1.shape[0]==pd_candles2.shape[0])
662
+
663
+ if len([ col for col in pd_candles1.columns if col[-2:]=='_1' ]) == 0:
664
+ pd_candles1.columns = [str(col) + '_1' for col in pd_candles1.columns]
665
+
666
+ if len([ col for col in pd_candles2.columns if col[-2:]=='_2' ]) == 0:
667
+ pd_candles2.columns = [str(col) + '_2' for col in pd_candles2.columns]
668
+
669
+ pd_candles1.reset_index(drop=True, inplace=True)
670
+ pd_candles2.reset_index(drop=True, inplace=True)
671
+ pd_candles = pd.concat([pd_candles1, pd_candles2], axis=1)
672
+ pd_candles['timestamp_ms_gap'] = pd_candles['timestamp_ms_1'] - pd_candles['timestamp_ms_2']
673
+ assert(pd_candles[pd_candles.timestamp_ms_gap!=0].shape[0]==0)
674
+
675
+ return pd_candles
676
+
677
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: siglab-py
3
- Version: 0.3.5
3
+ Version: 0.3.6
4
4
  Summary: Market data fetches, TA calculations and generic order gateway.
5
5
  Author: r0bbarh00d
6
6
  Author-email: r0bbarh00d <r0bbarh00d@gmail.com>
@@ -7,7 +7,7 @@ siglab_py/market_data_providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
7
7
  siglab_py/market_data_providers/aggregated_orderbook_provider.py,sha256=FZRobEBNRzcNGlOG3u38OVhmOZYlkNm8dVvR-S7Ii2g,23342
8
8
  siglab_py/market_data_providers/candles_provider.py,sha256=fqHJjlECsBiBlpgyywrc4gTgxiROPNzZM8KxQBB5cOg,14139
9
9
  siglab_py/market_data_providers/candles_ta_provider.py,sha256=uiAhbEZZdTF-YulBHpSLwabos5LHCKU91NTiTmpUc0w,12001
10
- siglab_py/market_data_providers/ccxt_candles_ta_to_csv.py,sha256=8-cKcZXFBHLX_-KmPXBKv1QNqJYUdDp6iqa1miVlpF8,11139
10
+ siglab_py/market_data_providers/ccxt_candles_ta_to_csv.py,sha256=j17D62JvKBW-Oc-gIrAWVbF7cCaE70X-X_uKvbtkilo,11154
11
11
  siglab_py/market_data_providers/deribit_options_expiry_provider.py,sha256=e9Ee8TmC8pXaid8-jouSLKIpuW6_JBBgwRTieI665yQ,8684
12
12
  siglab_py/market_data_providers/futu_candles_ta_to_csv.py,sha256=S4GXaJ7AveEh-Cm9-VhENBdlj_1CfyBTrQO7acTqfUE,10226
13
13
  siglab_py/market_data_providers/orderbooks_provider.py,sha256=olt-3LIkoyzQWfNNQRhJtKibLbkTutt_q_rCCTM7i1g,16216
@@ -27,13 +27,13 @@ siglab_py/tests/unit/trading_util_tests.py,sha256=tyefqOTQOoXSlemSDonqmdHp61-1nu
27
27
  siglab_py/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  siglab_py/util/analytic_util.py,sha256=BI0_nYgs4R9FogyEN3KYaFHigLLsV05IMF7b2-Twemo,45608
29
29
  siglab_py/util/aws_util.py,sha256=KGmjHrr1rpnnxr33nXHNzTul4tvyyxl9p6gpwNv0Ygc,2557
30
- siglab_py/util/market_data_util.py,sha256=-IltjTdWsRIWPeXrY-tFbvdadAeL6_Kg3kKVCCGhU6Y,26369
30
+ siglab_py/util/market_data_util.py,sha256=OPoSB8WW9AulYxkTF79_mPQgmQ1aCSMUnYTTfarAtYw,28975
31
31
  siglab_py/util/notification_util.py,sha256=vySgHjpHgwFDLW0tHSi_AGh9JBbPc25IUgvWxmjAeT8,2658
32
32
  siglab_py/util/retry_util.py,sha256=mxYuRFZRZoaQQjENcwPmxhxixtd1TFvbxIdPx4RwfRc,743
33
33
  siglab_py/util/slack_notification_util.py,sha256=G27n-adbT3Q6oaHSMvu_Nom794rrda5PprSF-zvmzkM,1912
34
34
  siglab_py/util/test_market_data_analytic_util.py,sha256=vWzPbJL8lgdC-oBoiLv2OVgfplFUdyWh95-J2PoUyIg,2152
35
35
  siglab_py/util/trading_util.py,sha256=FmqsamuPhMjZUkz4lCyuE8MHFapXn6yNl8Isy7peQEs,3047
36
- siglab_py-0.3.5.dist-info/METADATA,sha256=n3OYBS8G2-ukuqlQPH-ZyVqaoDxehLTpAGBSGI9UPDI,979
37
- siglab_py-0.3.5.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
38
- siglab_py-0.3.5.dist-info/top_level.txt,sha256=AbD4VR9OqmMOGlMJLkAVPGQMtUPIQv0t1BF5xmcLJSk,10
39
- siglab_py-0.3.5.dist-info/RECORD,,
36
+ siglab_py-0.3.6.dist-info/METADATA,sha256=OaKPU3SBDpdvYtvH4Hu3KOPxp654IoKrLuatH48WLu4,979
37
+ siglab_py-0.3.6.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
38
+ siglab_py-0.3.6.dist-info/top_level.txt,sha256=AbD4VR9OqmMOGlMJLkAVPGQMtUPIQv0t1BF5xmcLJSk,10
39
+ siglab_py-0.3.6.dist-info/RECORD,,