cryptodatapy 0.2.5__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 (36) 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 +13 -2
  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 +1597 -1178
  14. cryptodatapy/transform/convertparams.py +28 -18
  15. cryptodatapy/transform/credit_data.ipynb +291 -0
  16. cryptodatapy/transform/eqty_data.ipynb +809 -0
  17. cryptodatapy/transform/filter.py +13 -10
  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.5.dist-info → cryptodatapy-0.2.6.dist-info}/METADATA +2 -2
  24. {cryptodatapy-0.2.5.dist-info → cryptodatapy-0.2.6.dist-info}/RECORD +26 -28
  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/extract/libraries/ccxt.ipynb +0 -873
  35. {cryptodatapy-0.2.5.dist-info → cryptodatapy-0.2.6.dist-info}/LICENSE +0 -0
  36. {cryptodatapy-0.2.5.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"
@@ -439,12 +452,12 @@ class ConvertParams:
439
452
  freq = self.data_req.source_freq
440
453
  self.data_req.freq = self.data_req.source_freq
441
454
  else:
442
- if self.data_req.freq == "tick":
455
+ if self.data_req.freq is None:
456
+ freq = "1d"
457
+ elif self.data_req.freq == "tick":
443
458
  freq = "tick"
444
459
  elif self.data_req.freq[-3:] == "min":
445
460
  freq = self.data_req.freq.replace("min", "m")
446
- elif self.data_req.freq == "d":
447
- freq = "1d"
448
461
  elif self.data_req.freq == "w":
449
462
  freq = "1w"
450
463
  elif self.data_req.freq == "m":
@@ -456,7 +469,7 @@ class ConvertParams:
456
469
  elif self.data_req.freq == "y":
457
470
  freq = "1y"
458
471
  else:
459
- freq = self.data_req.freq
472
+ freq = "1d"
460
473
  # convert quote ccy
461
474
  if self.data_req.quote_ccy is None:
462
475
  quote_ccy = "USDT"
@@ -501,7 +514,7 @@ class ConvertParams:
501
514
  mkts_list.append(ticker.upper() + "/" + quote_ccy.upper())
502
515
  elif self.data_req.mkt_type == "perpetual_future":
503
516
  if exch == "binanceusdm":
504
- mkts_list.append(ticker.upper() + "/" + quote_ccy.upper())
517
+ mkts_list.append(ticker.upper() + "/" + quote_ccy.upper() + ':' + quote_ccy.upper())
505
518
  elif (
506
519
  exch == "ftx"
507
520
  or exch == "okx"
@@ -571,7 +584,6 @@ class ConvertParams:
571
584
  def to_dbnomics(self) -> Dict[str, Union[list, str, int, float, None]]:
572
585
  """
573
586
  Convert tickers from CryptoDataPy to DBnomics format.
574
-
575
587
  """
576
588
  # convert tickers
577
589
  with resources.path("cryptodatapy.conf", "tickers.csv") as f:
@@ -716,7 +728,6 @@ class ConvertParams:
716
728
  def to_fred(self) -> Dict[str, Union[list, str, int, float, datetime, None]]:
717
729
  """
718
730
  Convert tickers from CryptoDataPy to Fred format.
719
-
720
731
  """
721
732
  # convert tickers
722
733
  with resources.path("cryptodatapy.conf", "tickers.csv") as f:
@@ -790,7 +801,6 @@ class ConvertParams:
790
801
  def to_wb(self) -> Dict[str, Union[list, str, int, float, datetime, None]]:
791
802
  """
792
803
  Convert tickers from CryptoDataPy to Yahoo Finance format.
793
-
794
804
  """
795
805
  # convert tickers
796
806
  with resources.path("cryptodatapy.conf", "tickers.csv") as f: