cryptodatapy 0.2.4__py3-none-any.whl → 0.2.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.
Files changed (35) hide show
  1. cryptodatapy/conf/tickers.csv +0 -1
  2. cryptodatapy/extract/data_vendors/CoinMetrics.ipynb +747 -0
  3. cryptodatapy/extract/data_vendors/coinmetrics_api.py +279 -209
  4. cryptodatapy/extract/data_vendors/cryptocompare_api.py +3 -5
  5. cryptodatapy/extract/data_vendors/datavendor.py +32 -12
  6. cryptodatapy/extract/data_vendors/glassnode_api.py +3 -2
  7. cryptodatapy/extract/data_vendors/tiingo_api.py +3 -2
  8. cryptodatapy/extract/datarequest.py +55 -9
  9. cryptodatapy/extract/libraries/ccxt_api.py +51 -133
  10. cryptodatapy/transform/cc_onchain_data.csv +118423 -0
  11. cryptodatapy/transform/clean.py +17 -15
  12. cryptodatapy/transform/clean_onchain_data.ipynb +4750 -0
  13. cryptodatapy/transform/clean_perp_futures_ohlcv.ipynb +1874 -276
  14. cryptodatapy/transform/convertparams.py +28 -19
  15. cryptodatapy/transform/credit_data.ipynb +291 -0
  16. cryptodatapy/transform/eqty_data.ipynb +809 -0
  17. cryptodatapy/transform/filter.py +13 -11
  18. cryptodatapy/transform/global_credit_data_daily.parquet +0 -0
  19. cryptodatapy/transform/od.py +1 -0
  20. cryptodatapy/transform/rates_data.ipynb +465 -0
  21. cryptodatapy/transform/us_rates_daily.csv +227752 -0
  22. cryptodatapy/util/datacredentials.py +28 -7
  23. {cryptodatapy-0.2.4.dist-info → cryptodatapy-0.2.6.dist-info}/METADATA +2 -2
  24. {cryptodatapy-0.2.4.dist-info → cryptodatapy-0.2.6.dist-info}/RECORD +26 -27
  25. cryptodatapy/.DS_Store +0 -0
  26. cryptodatapy/.idea/.gitignore +0 -3
  27. cryptodatapy/.idea/cryptodatapy.iml +0 -12
  28. cryptodatapy/.idea/csv-plugin.xml +0 -16
  29. cryptodatapy/.idea/inspectionProfiles/Project_Default.xml +0 -6
  30. cryptodatapy/.idea/inspectionProfiles/profiles_settings.xml +0 -6
  31. cryptodatapy/.idea/misc.xml +0 -4
  32. cryptodatapy/.idea/modules.xml +0 -8
  33. cryptodatapy/.idea/vcs.xml +0 -6
  34. {cryptodatapy-0.2.4.dist-info → cryptodatapy-0.2.6.dist-info}/LICENSE +0 -0
  35. {cryptodatapy-0.2.4.dist-info → cryptodatapy-0.2.6.dist-info}/WHEEL +0 -0
@@ -108,7 +108,6 @@ class ConvertParams:
108
108
  def to_coinmetrics(self) -> Dict[str, Union[list, str, int, float, None]]:
109
109
  """
110
110
  Convert tickers from CryptoDataPy to CoinMetrics format.
111
-
112
111
  """
113
112
  # convert tickers
114
113
  if self.data_req.source_tickers is not None:
@@ -121,10 +120,12 @@ class ConvertParams:
121
120
  freq = self.data_req.source_freq
122
121
  self.data_req.freq = self.data_req.source_freq
123
122
  else:
124
- if self.data_req.freq == "block":
123
+ if self.data_req.freq is None:
124
+ freq = "1d"
125
+ elif self.data_req.freq == "block":
125
126
  freq = "1b"
126
127
  elif self.data_req.freq == "tick":
127
- freq = "tick"
128
+ freq = "raw"
128
129
  elif self.data_req.freq[-1] == "s":
129
130
  freq = "1s"
130
131
  elif self.data_req.freq[-3:] == "min":
@@ -226,6 +227,16 @@ class ConvertParams:
226
227
  + "-"
227
228
  + "future"
228
229
  )
230
+ # start date
231
+ if self.data_req.start_date is not None:
232
+ start_date = self.data_req.start_date.strftime('%Y-%m-%d')
233
+ else:
234
+ start_date = None
235
+ # end date
236
+ if self.data_req.end_date is not None:
237
+ end_date = self.data_req.end_date.strftime('%Y-%m-%d')
238
+ else:
239
+ end_date = None
229
240
 
230
241
  return {
231
242
  "tickers": tickers,
@@ -235,8 +246,8 @@ class ConvertParams:
235
246
  "ctys": None,
236
247
  "mkt_type": self.data_req.mkt_type,
237
248
  "mkts": mkts_list,
238
- "start_date": self.data_req.start_date,
239
- "end_date": self.data_req.end_date,
249
+ "start_date": start_date,
250
+ "end_date": end_date,
240
251
  "fields": fields,
241
252
  "tz": tz,
242
253
  "inst": inst,
@@ -251,7 +262,6 @@ class ConvertParams:
251
262
  def to_glassnode(self) -> Dict[str, Union[list, str, int, float, None]]:
252
263
  """
253
264
  Convert tickers from CryptoDataPy to Glassnode format.
254
-
255
265
  """
256
266
  # convert tickers
257
267
  if self.data_req.source_tickers is not None:
@@ -264,7 +274,9 @@ class ConvertParams:
264
274
  freq = self.data_req.source_freq
265
275
  self.data_req.freq = self.data_req.source_freq
266
276
  else:
267
- if self.data_req.freq[-3:] == "min":
277
+ if self.data_req.freq is None:
278
+ freq = "24h"
279
+ elif self.data_req.freq[-3:] == "min":
268
280
  freq = "10m"
269
281
  elif self.data_req.freq[-1] == "h":
270
282
  freq = "1h"
@@ -275,7 +287,7 @@ class ConvertParams:
275
287
  elif self.data_req.freq == "m":
276
288
  freq = "1month"
277
289
  else:
278
- freq = self.data_req.freq
290
+ freq = "24h"
279
291
  # convert quote ccy
280
292
  if self.data_req.quote_ccy is None:
281
293
  quote_ccy = "USD"
@@ -334,7 +346,6 @@ class ConvertParams:
334
346
  def to_tiingo(self) -> Dict[str, Union[list, str, int, float, datetime, None]]:
335
347
  """
336
348
  Convert tickers from CryptoDataPy to Tiingo format.
337
-
338
349
  """
339
350
  # convert tickers
340
351
  if self.data_req.source_tickers is not None:
@@ -347,7 +358,9 @@ class ConvertParams:
347
358
  freq = self.data_req.source_freq
348
359
  self.data_req.freq = self.data_req.source_freq
349
360
  else:
350
- if self.data_req.freq[-3:] == "min":
361
+ if self.data_req.freq is None:
362
+ freq = "1day"
363
+ elif self.data_req.freq[-3:] == "min":
351
364
  freq = self.data_req.freq
352
365
  elif self.data_req.freq[-1] == "h":
353
366
  freq = "1hour"
@@ -427,7 +440,6 @@ class ConvertParams:
427
440
  def to_ccxt(self) -> Dict[str, Union[list, str, int, float, None]]:
428
441
  """
429
442
  Convert tickers from CryptoDataPy to CCXT format.
430
-
431
443
  """
432
444
  # convert tickers
433
445
  if self.data_req.source_tickers is not None:
@@ -440,12 +452,12 @@ class ConvertParams:
440
452
  freq = self.data_req.source_freq
441
453
  self.data_req.freq = self.data_req.source_freq
442
454
  else:
443
- if self.data_req.freq == "tick":
455
+ if self.data_req.freq is None:
456
+ freq = "1d"
457
+ elif self.data_req.freq == "tick":
444
458
  freq = "tick"
445
459
  elif self.data_req.freq[-3:] == "min":
446
460
  freq = self.data_req.freq.replace("min", "m")
447
- elif self.data_req.freq == "d":
448
- freq = "1d"
449
461
  elif self.data_req.freq == "w":
450
462
  freq = "1w"
451
463
  elif self.data_req.freq == "m":
@@ -457,7 +469,7 @@ class ConvertParams:
457
469
  elif self.data_req.freq == "y":
458
470
  freq = "1y"
459
471
  else:
460
- freq = self.data_req.freq
472
+ freq = "1d"
461
473
  # convert quote ccy
462
474
  if self.data_req.quote_ccy is None:
463
475
  quote_ccy = "USDT"
@@ -502,7 +514,7 @@ class ConvertParams:
502
514
  mkts_list.append(ticker.upper() + "/" + quote_ccy.upper())
503
515
  elif self.data_req.mkt_type == "perpetual_future":
504
516
  if exch == "binanceusdm":
505
- mkts_list.append(ticker.upper() + "/" + quote_ccy.upper())
517
+ mkts_list.append(ticker.upper() + "/" + quote_ccy.upper() + ':' + quote_ccy.upper())
506
518
  elif (
507
519
  exch == "ftx"
508
520
  or exch == "okx"
@@ -572,7 +584,6 @@ class ConvertParams:
572
584
  def to_dbnomics(self) -> Dict[str, Union[list, str, int, float, None]]:
573
585
  """
574
586
  Convert tickers from CryptoDataPy to DBnomics format.
575
-
576
587
  """
577
588
  # convert tickers
578
589
  with resources.path("cryptodatapy.conf", "tickers.csv") as f:
@@ -717,7 +728,6 @@ class ConvertParams:
717
728
  def to_fred(self) -> Dict[str, Union[list, str, int, float, datetime, None]]:
718
729
  """
719
730
  Convert tickers from CryptoDataPy to Fred format.
720
-
721
731
  """
722
732
  # convert tickers
723
733
  with resources.path("cryptodatapy.conf", "tickers.csv") as f:
@@ -791,7 +801,6 @@ class ConvertParams:
791
801
  def to_wb(self) -> Dict[str, Union[list, str, int, float, datetime, None]]:
792
802
  """
793
803
  Convert tickers from CryptoDataPy to Yahoo Finance format.
794
-
795
804
  """
796
805
  # convert tickers
797
806
  with resources.path("cryptodatapy.conf", "tickers.csv") as f: