cryptodatapy 0.2.33__py3-none-any.whl → 0.2.34__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.
@@ -27,7 +27,7 @@ vwap,volume-weighted avg price,average volume-weighted price of quote asset with
27
27
  dividend,dividend,dividend paid out on ex-ante date,market,ohlc_bars,d,quote currency units,Float64,,,,,,divCash,,,,,,,,
28
28
  split,split,"factor used to adjust prices when a company splits, reverse splits, or pays a distribution",market,ohlc_bars,d,factor,Float64,,,,,,splitFactor,,,,,,,,
29
29
  ref_rate_usd,reference rate in USD,price of asset in USD using an aggregation methodology,market,ohlc_bars,d,quote currency units,Float64,,ReferenceRateUSD,,,,,,,,,,,,
30
- oi,open interest,number of outstanding futures contracts that are open and have yet to be settled,market,derivatives,"1min, 5min, 10min, 15min, 30min, 1h, 2h, 4h, 8h, d, w, m, q",number of contracts,Float64,,contract_count,,,,,,,,,,,,
30
+ oi,open interest,number of outstanding futures contracts that are open and have yet to be settled,market,derivatives,"1min, 5min, 10min, 15min, 30min, 1h, 2h, 4h, 8h, d, w, m, q",number of contracts,Float64,,contract_count,openInterestAmount,,,,,,,,,,,
31
31
  funding_rate,funding rate,interest rate for holding derivative contract within time interval,market,derivatives,"1h, 2h, 4h, 8h, d, w, m, q",interest rate over time interval,Float64,,rate,fundingRate,derivatives/futures_funding_rate_perpetual,,,,,,,,,,
32
32
  mkt_cap,market capitalization,usd value of circulating supply,market,market capitalization,"d, w, m, q",usd,Float64,,CapMrktCurUSD,,market/marketcap_usd,,,,,,,,,,
33
33
  mkt_cap_real,"market capitalization, reaized","The sum USD value based on the USD closing price on the day that a native unit last moved (i.e., last transacted) for all native units",market,market capitalization,"d, w, m, q",usd,Float64,,CapRealUSD,,,,,,,,,,,,
@@ -1042,6 +1042,26 @@ class CCXT(Library):
1042
1042
  attempts = 0
1043
1043
  data_resp = []
1044
1044
 
1045
+ # Maximum historical range for Binance OI is 30 days
1046
+ # 30 days in milliseconds: 30 * 24 * 60 * 60 * 1000 = 2,592,000,000 ms
1047
+ SAFE_OI_RANGE_MS = 25 * 24 * 60 * 60 * 1000
1048
+
1049
+ # inst exch
1050
+ if self.exchange_async is None:
1051
+ self.exchange_async = getattr(ccxt_async, exch)()
1052
+
1053
+ # --- Binance 30-day Limit Enforcement ---
1054
+ if exch.lower() == 'binanceusdm': # Binance USDM Futures
1055
+ requested_range_ms = end_date - start_date
1056
+ if requested_range_ms > SAFE_OI_RANGE_MS:
1057
+ # Adjust start_date to fit within the 30-day window ending at end_date
1058
+ new_start_date = end_date - SAFE_OI_RANGE_MS
1059
+ logging.warning(
1060
+ f"Exchange '{exch}' Open Interest historical data is limited to 30 days. "
1061
+ f"Adjusting start_date for {ticker} from {start_date} to {new_start_date}."
1062
+ )
1063
+ start_date = new_start_date
1064
+
1045
1065
  # inst exch
1046
1066
  if self.exchange_async is None:
1047
1067
  self.exchange_async = getattr(ccxt_async, exch)()
@@ -1124,8 +1144,25 @@ class CCXT(Library):
1124
1144
  attempts = 0
1125
1145
  data_resp = []
1126
1146
 
1147
+ # Maximum historical range for Binance OI is 30 days
1148
+ # 30 days in milliseconds: 30 * 24 * 60 * 60 * 1000 = 2,592,000,000 ms
1149
+ SAFE_OI_RANGE_MS = 25 * 24 * 60 * 60 * 1000
1150
+
1127
1151
  # inst exch
1128
- self.exchange = getattr(ccxt, exch)()
1152
+ if self.exchange_async is None:
1153
+ self.exchange_async = getattr(ccxt_async, exch)()
1154
+
1155
+ # --- Binance 30-day Limit Enforcement ---
1156
+ if exch.lower() == 'binanceusdm': # Binance USDM Futures
1157
+ requested_range_ms = end_date - start_date
1158
+ if requested_range_ms > SAFE_OI_RANGE_MS:
1159
+ # Adjust start_date to fit within the 30-day window ending at end_date
1160
+ new_start_date = end_date - SAFE_OI_RANGE_MS
1161
+ logging.warning(
1162
+ f"Exchange '{exch}' open interest historical data is limited to 30 days. "
1163
+ f"Adjusting start_date for {ticker} from {start_date} to {new_start_date}."
1164
+ )
1165
+ start_date = new_start_date
1129
1166
 
1130
1167
  # fetch data
1131
1168
  if self.exchange.has['fetchOpenInterestHistory']:
@@ -857,10 +857,7 @@ class WrangleData:
857
857
  Dataframe with tidy data format.
858
858
  """
859
859
  # add tickers
860
- for i in range(len(self.data_req.source_markets)):
861
- df = pd.DataFrame(self.data_resp[i])
862
- self.tidy_data = pd.concat([self.tidy_data, df])
863
- self.tidy_data = self.tidy_data[['symbol', 'openInterestAmount', 'datetime']]
860
+ self.tidy_data = pd.DataFrame(self.data_resp)[['symbol', 'openInterestAmount', 'datetime']]
864
861
  self.data_resp = self.tidy_data
865
862
 
866
863
  # convert to lib fields
@@ -1245,4 +1242,4 @@ class WrangleData:
1245
1242
  if self.data_req.end_date is not None:
1246
1243
  self.data_resp = self.data_resp[(self.data_resp.index <= self.data_req.end_date)]
1247
1244
 
1248
- return self
1245
+ return self
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: cryptodatapy
3
- Version: 0.2.33
3
+ Version: 0.2.34
4
4
  Summary: Cryptoasset data library
5
5
  License: Apache-2.0
6
6
  Author: Systamental
@@ -1,6 +1,6 @@
1
1
  cryptodatapy/__init__.py,sha256=ee1UaINHZn1A_SZ96XM3hCguQEJgiPTvKlnYsk3mmS4,185
2
2
  cryptodatapy/conf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- cryptodatapy/conf/fields.csv,sha256=_K-NT9BKWqinvgj5xPPpkdpF3twX4feG7pdZx2vxook,25945
3
+ cryptodatapy/conf/fields.csv,sha256=HyVTpFhiTZyAUbk9xPNcpPNU3ZG9J31iIewjzImBhLQ,25963
4
4
  cryptodatapy/conf/tickers.csv,sha256=5iEg--AyIhSF9XkscKrbdhj-hDASkKzda8tqpWNYMrE,357956
5
5
  cryptodatapy/datasets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  cryptodatapy/datasets/br_econ_calendar.csv,sha256=mSM0IOIByI-0gIIL1CbDQPqHYI5lK6vavrY1ODj3Jlk,1185318
@@ -39,7 +39,7 @@ cryptodatapy/extract/exchanges/dydx.py,sha256=tBp60PG24tUZI949nHSiJQwjsP0zI2Oyz9
39
39
  cryptodatapy/extract/exchanges/exchange.py,sha256=Cicj3KS4zLbwmXX5fu89byXNwqqU4TH31GFv0zj3D4s,13010
40
40
  cryptodatapy/extract/getdata.py,sha256=_8Hi4vdkj2xGykb_2fBcqzJTNROzX0QnQE2hxPfe690,11543
41
41
  cryptodatapy/extract/libraries/__init__.py,sha256=KG2Rr3c8CcDq-nbhT-ItssqZE9U65xQXH0Wv0g86SVg,254
42
- cryptodatapy/extract/libraries/ccxt_api.py,sha256=5FjGeAwKNq2C9CNSYC64Y9J0XorA2PhCik-9CGKKjqU,61259
42
+ cryptodatapy/extract/libraries/ccxt_api.py,sha256=eeA7xPN9DBY61LvUM5jW_2MOxo_3vIIK-h5VdIDm0n0,63146
43
43
  cryptodatapy/extract/libraries/dbnomics_api.py,sha256=M6kPIH-hKqkmeBQb-g56dY9jatqLCtSl_MnvPblHtAc,9421
44
44
  cryptodatapy/extract/libraries/investpy_api.py,sha256=qtGm3LDluXxJorvFv0w1bm1oBrcZIfE5cZSYzNYvttY,18409
45
45
  cryptodatapy/extract/libraries/library.py,sha256=eU8NnQZ9luLGdIF5hms6j8VPCWc50evkREc4xdh-g1I,12301
@@ -53,12 +53,12 @@ cryptodatapy/transform/convertparams.py,sha256=yrm9Gr6Fm7CaVTfxHGs0TJx6ZtP7llrlI
53
53
  cryptodatapy/transform/filter.py,sha256=37MjUKUay3dwwyn47rnNOU51X_OFzmWq_N9buALzq9k,9058
54
54
  cryptodatapy/transform/impute.py,sha256=_0-SX5nnPrYgJYT-HKwBGNkmWXRMy9-C2oeU6VqkQp0,5537
55
55
  cryptodatapy/transform/od.py,sha256=mI1oojMbfmdO9ZewL3AvMxoXuMM05Ut2oGm_ogMf2XU,30386
56
- cryptodatapy/transform/wrangle.py,sha256=FD4gHo4N2H90qs-mzW9HA77Nd_pMRHRuZehY-qcWwYw,44807
56
+ cryptodatapy/transform/wrangle.py,sha256=o_VcH90sHXn7Hf3u9O6O1LKd8lEMy2o84A3MYrmGcjQ,44653
57
57
  cryptodatapy/util/__init__.py,sha256=zSQ2HU2QIXzCuptJjknmrClwtQKCvIj4aNysZljIgrU,116
58
58
  cryptodatapy/util/datacatalog.py,sha256=qCCX6srXvaAbVAKuA0M2y5IK_2OEx5xA3yRahDZlC-g,13157
59
59
  cryptodatapy/util/datacredentials.py,sha256=BnoQlUchbP0vfXqXRuhCOOsHyUTMuH5T4RAKBbHzMyo,3140
60
60
  cryptodatapy/util/utils.py,sha256=OTTa4YvRj7Cb_2h5h8xoDy9Ap0LB1rg_wFgsDwy9R9o,4244
61
- cryptodatapy-0.2.33.dist-info/LICENSE,sha256=sw4oVq8bDjT3uMtaFebQ-xeIVP4H-bXldTs9q-Jjeks,11344
62
- cryptodatapy-0.2.33.dist-info/METADATA,sha256=U7ui44BPCXWs_QgQn6JOEkEatXris8-8MYY0oIOsVs0,6486
63
- cryptodatapy-0.2.33.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
64
- cryptodatapy-0.2.33.dist-info/RECORD,,
61
+ cryptodatapy-0.2.34.dist-info/LICENSE,sha256=sw4oVq8bDjT3uMtaFebQ-xeIVP4H-bXldTs9q-Jjeks,11344
62
+ cryptodatapy-0.2.34.dist-info/METADATA,sha256=UDAk1Hgyu9nrObLEfI_iQWsA1y9Wi3CrBk_Hx1JIMiw,6486
63
+ cryptodatapy-0.2.34.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
64
+ cryptodatapy-0.2.34.dist-info/RECORD,,