cryptodatapy 0.2.16__tar.gz → 0.2.18__tar.gz

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 (62) hide show
  1. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/PKG-INFO +1 -1
  2. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/pyproject.toml +1 -1
  3. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/conf/fields.csv +1 -1
  4. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/data_vendors/cryptocompare_api.py +44 -35
  5. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/transform/wrangle.py +2 -2
  6. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/LICENSE +0 -0
  7. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/README.md +0 -0
  8. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/__init__.py +0 -0
  9. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/conf/__init__.py +0 -0
  10. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/conf/tickers.csv +0 -0
  11. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/datasets/__init__.py +0 -0
  12. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/datasets/br_econ_calendar.csv +0 -0
  13. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/datasets/ca_econ_calendar.csv +0 -0
  14. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/datasets/cn_econ_calendar.csv +0 -0
  15. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/datasets/de_econ_calendar.csv +0 -0
  16. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/datasets/ez_econ_calendar.csv +0 -0
  17. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/datasets/fr_econ_calendar.csv +0 -0
  18. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/datasets/gb_econ_calendar.csv +0 -0
  19. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/datasets/get_econ_calendars.py +0 -0
  20. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/datasets/id_econ_calendar.csv +0 -0
  21. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/datasets/in_econ_calendar.csv +0 -0
  22. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/datasets/it_econ_calendar.csv +0 -0
  23. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/datasets/jp_econ_calendar.csv +0 -0
  24. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/datasets/kr_econ_calendar.csv +0 -0
  25. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/datasets/mx_econ_calendar.csv +0 -0
  26. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/datasets/ru_econ_calendar.csv +0 -0
  27. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/datasets/tr_econ_calendar.csv +0 -0
  28. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/datasets/us_econ_calendar.csv +0 -0
  29. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/__init__.py +0 -0
  30. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/data_vendors/.ipynb_checkpoints/CCXT-checkpoint.ipynb +0 -0
  31. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/data_vendors/.ipynb_checkpoints/DBNomics-checkpoint.ipynb +0 -0
  32. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/data_vendors/.ipynb_checkpoints/InvestPy-checkpoint.ipynb +0 -0
  33. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/data_vendors/.ipynb_checkpoints/NasdaqDataLink-checkpoint.ipynb +0 -0
  34. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/data_vendors/.ipynb_checkpoints/PandasDataReader-checkpoint.ipynb +0 -0
  35. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/data_vendors/__init__.py +0 -0
  36. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/data_vendors/coinmetrics_api.py +0 -0
  37. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/data_vendors/datavendor.py +0 -0
  38. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/data_vendors/glassnode_api.py +0 -0
  39. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/data_vendors/tiingo_api.py +0 -0
  40. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/datarequest.py +0 -0
  41. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/exchanges/__init__.py +0 -0
  42. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/exchanges/dydx.py +0 -0
  43. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/exchanges/exchange.py +0 -0
  44. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/getdata.py +0 -0
  45. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/libraries/__init__.py +0 -0
  46. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/libraries/ccxt_api.py +0 -0
  47. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/libraries/dbnomics_api.py +0 -0
  48. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/libraries/investpy_api.py +0 -0
  49. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/libraries/library.py +0 -0
  50. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/libraries/pandasdr_api.py +0 -0
  51. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/web/__init__.py +0 -0
  52. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/web/aqr.py +0 -0
  53. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/extract/web/web.py +0 -0
  54. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/transform/__init__.py +0 -0
  55. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/transform/clean.py +0 -0
  56. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/transform/convertparams.py +0 -0
  57. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/transform/filter.py +0 -0
  58. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/transform/impute.py +0 -0
  59. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/transform/od.py +0 -0
  60. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/util/__init__.py +0 -0
  61. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/util/datacatalog.py +0 -0
  62. {cryptodatapy-0.2.16 → cryptodatapy-0.2.18}/src/cryptodatapy/util/datacredentials.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: cryptodatapy
3
- Version: 0.2.16
3
+ Version: 0.2.18
4
4
  Summary: Cryptoasset data library
5
5
  License: Apache-2.0
6
6
  Author: Systamental
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cryptodatapy"
3
- version = "0.2.16"
3
+ version = "0.2.18"
4
4
  description = "Cryptoasset data library"
5
5
  authors = ["Systamental"]
6
6
  license = "Apache License 2.0"
@@ -48,7 +48,7 @@ tx_fee_mean_usd,mean transaction fee in usd,"mean fee per transaction within tim
48
48
  tfr_count,transfers count,number of transfers in the network within time interval,on-chain,transactions,"d, w, m, q",asset units,Float64,,TxTfrCnt,,transactions/transfers_count,,,,,,,,
49
49
  tfr_val,transfers value,number of units of asset transferred in the network within time interval,on-chain,transactions,"d, w, m, q",asset units,Float64,,TxTfrValNtv,,transactions/transfers_volume_sum,,,,,,,,
50
50
  tfr_val_usd,"transfers value, USD","number of units of asset transferred in the network within time interval, in USD",on-chain,transactions,"d, w, m, q",USD,Float64,,TxTfrValUSD,,transactions/transfers_volume_sum,,,,,,,,
51
- tfr_val_mean,"mean transfers value, USD",mean transfer value in the network within time interval,on-chain,transactions,"d, w, m, q",asset units,Float64,average_transaction_ value,TxTfrValMeanNtv,,transactions/transfers_volume_mean,,,,,,,,
51
+ tfr_val_mean,"mean transfers value, USD",mean transfer value in the network within time interval,on-chain,transactions,"d, w, m, q",asset units,Float64,average_transaction_value,TxTfrValMeanNtv,,transactions/transfers_volume_mean,,,,,,,,
52
52
  tfr_val_mean_usd,mean transfers value,"mean transfer value in the network within time interval, in USD",on-chain,transactions,"d, w, m, q",USD,Float64,,TxTfrValMeanUSD,,transactions/transfers_volume_mean,,,,,,,,
53
53
  nvt_ratio,network value to transactions ratio,The Network Value to Transactions (NVT) Ratio is computed by dividing the market cap by the transferred on-chain volume measured in USD. The NVT Ratio was created by Willy Woo.,on-chain,transactions,"d, w, m, q",ratio ,Float64,,,,indicators/nvt,,,,,,,,
54
54
  nvt_ratio_adj,"network value to transactions ratio, adjusted","The ratio of the network value (or market capitalization, current supply) divided by the adjusted transfer value. Also referred to as NVT.",on-chain,transactions,"d, w, m, q",ratio ,Float64,,NVTAdj,,,,,,,,,,
@@ -79,6 +79,8 @@ class CryptoCompare(DataVendor):
79
79
  raise TypeError("Set your CryptoCompare api key in environment variables as 'CRYPTOCOMPARE_API_KEY' or "
80
80
  "add it as an argument when instantiating the class. To get an api key, visit: "
81
81
  "https://min-api.cryptocompare.com/")
82
+ self.onchain_fields = None
83
+ self.social_fields = None
82
84
  self.data_req = None
83
85
  self.data_resp = None
84
86
  self.data = pd.DataFrame()
@@ -220,9 +222,9 @@ class CryptoCompare(DataVendor):
220
222
  # data req
221
223
  self.req_meta(info_type='on-chain_info')
222
224
  # wrangle data resp
223
- onchain_fields = WrangleInfo(self.data_resp).cc_onchain_info()
225
+ self.onchain_fields = WrangleInfo(self.data_resp).cc_onchain_info()
224
226
 
225
- return onchain_fields
227
+ return self.onchain_fields
226
228
 
227
229
  def get_social_info(self) -> list[str]:
228
230
  """
@@ -236,9 +238,9 @@ class CryptoCompare(DataVendor):
236
238
  # data req
237
239
  self.req_meta(info_type='social_info')
238
240
  # wrangle data resp
239
- social_fields = WrangleInfo(self.data_resp).cc_social_info()
241
+ self.social_fields = WrangleInfo(self.data_resp).cc_social_info()
240
242
 
241
- return social_fields
243
+ return self.social_fields
242
244
 
243
245
  def get_fields_info(self, data_type: Optional[str] = None) -> list[str]:
244
246
  """
@@ -584,6 +586,8 @@ class CryptoCompare(DataVendor):
584
586
  # loop through tickers
585
587
  for ticker in self.data_req.source_tickers:
586
588
 
589
+ print(ticker)
590
+
587
591
  try:
588
592
  df0 = self.get_tidy_data(data_req, data_type, ticker)
589
593
  except Exception as e:
@@ -711,13 +715,18 @@ class CryptoCompare(DataVendor):
711
715
  self.get_indexes_info(as_list=True)
712
716
  tickers_list = self.assets + self.indexes
713
717
 
718
+ # fields
719
+ self.get_fields_info()
720
+ self.get_onchain_info()
721
+ self.get_social_info()
722
+
714
723
  # tickers
715
724
  if not all([ticker in tickers_list for ticker in self.data_req.source_tickers]):
716
725
  raise ValueError("Some assets are not available. "
717
726
  "Check available assets and indexes with get_assets_info() or get_indexes_info().")
718
727
 
719
728
  # fields
720
- if not all([field in self.get_fields_info() for field in self.data_req.source_fields]):
729
+ if not all([field in self.fields for field in self.data_req.source_fields]):
721
730
  raise ValueError("Some fields are not available. "
722
731
  "Check available fields with get_fields_info().")
723
732
 
@@ -727,12 +736,12 @@ class CryptoCompare(DataVendor):
727
736
  f"Check available frequencies with get_frequencies().")
728
737
 
729
738
  # on-chain freq
730
- if self.data_req.source_fields in self.get_onchain_info() and self.data_req.source_freq != 'histoday':
739
+ if self.data_req.source_fields in self.onchain_fields and self.data_req.source_freq != 'histoday':
731
740
  raise ValueError(f"On-chain data is only available on a daily frequency."
732
741
  f" Change data request frequency to 'd' and try again.")
733
742
 
734
743
  # social freq
735
- if self.data_req.source_fields in self.get_social_info() and self.data_req.source_freq == 'histominute':
744
+ if self.data_req.source_fields in self.social_fields and self.data_req.source_freq == 'histominute':
736
745
  raise ValueError(f"Social media data is only available on a daily and hourly frequency."
737
746
  f" Change data request frequency to 'd' or '1h' and try again.")
738
747
 
@@ -751,42 +760,44 @@ class CryptoCompare(DataVendor):
751
760
  DataFrame with DatetimeIndex (level 0), ticker (level 1), and values for OHLCV, on-chain and/or
752
761
  social fields (cols), in tidy format.
753
762
  """
754
- logging.info("Retrieving data request from CryptoCompare...")
755
-
756
763
  # check data req params
757
764
  self.check_params(data_req)
758
765
 
759
766
  # get indexes
760
- try:
761
- df0 = self.get_indexes(data_req)
762
- except Exception as e:
763
- logging.warning(e)
764
- else:
765
- self.data = pd.concat([self.data, df0])
767
+ if any([ticker in self.indexes for ticker in data_req.source_tickers]):
768
+ try:
769
+ df0 = self.get_indexes(data_req)
770
+ except Exception as e:
771
+ logging.warning(e)
772
+ else:
773
+ self.data = pd.concat([self.data, df0])
766
774
 
767
775
  # get ohlcv
768
- try:
769
- df1 = self.get_ohlcv(data_req)
770
- except Exception as e:
771
- logging.warning(e)
772
- else:
773
- self.data = pd.concat([self.data, df1])
776
+ if any([field in ['open', 'high', 'low', 'close', 'volumefrom'] for field in data_req.source_fields]):
777
+ try:
778
+ df1 = self.get_ohlcv(data_req)
779
+ except Exception as e:
780
+ logging.warning(e)
781
+ else:
782
+ self.data = pd.concat([self.data, df1])
774
783
 
775
784
  # get onchain
776
- try:
777
- df2 = self.get_onchain(data_req)
778
- except Exception as e:
779
- logging.warning(e)
780
- else:
781
- self.data = pd.concat([self.data, df2], axis=1)
785
+ if any([field in self.onchain_fields for field in data_req.source_fields]):
786
+ try:
787
+ df2 = self.get_onchain(data_req)
788
+ except Exception as e:
789
+ logging.warning(e)
790
+ else:
791
+ self.data = pd.concat([self.data, df2], axis=1)
782
792
 
783
793
  # get social
784
- try:
785
- df3 = self.get_social(data_req)
786
- except Exception as e:
787
- logging.warning(e)
788
- else:
789
- self.data = pd.concat([self.data, df3], axis=1)
794
+ if any([field in self.social_fields for field in data_req.source_fields]):
795
+ try:
796
+ df3 = self.get_social(data_req)
797
+ except Exception as e:
798
+ logging.warning(e)
799
+ else:
800
+ self.data = pd.concat([self.data, df3], axis=1)
790
801
 
791
802
  # check if df empty
792
803
  if self.data.empty:
@@ -796,6 +807,4 @@ class CryptoCompare(DataVendor):
796
807
  fields = [field for field in data_req.fields if field in self.data.columns]
797
808
  self.data = self.data.loc[:, fields].sort_index()
798
809
 
799
- logging.info("Data retrieved from CryptoCompare.")
800
-
801
810
  return self.data
@@ -510,13 +510,13 @@ class WrangleData:
510
510
  self.filter_dates()
511
511
  # resample
512
512
  self.data_resp = self.data_resp.resample(self.data_req.freq).last()
513
- # type conversion
514
- self.data_resp = self.data_resp.apply(pd.to_numeric, errors='coerce').convert_dtypes()
515
513
  # remove bad data
516
514
  self.data_resp = self.data_resp[self.data_resp != 0] # 0 values
517
515
  # filter dups and NaNs
518
516
  self.data_resp = self.data_resp[~self.data_resp.index.duplicated()] # duplicate rows
519
517
  self.data_resp = self.data_resp.dropna(how='all').dropna(how='all', axis=1) # entire row or col NaNs
518
+ # type conversion
519
+ self.data_resp = self.data_resp.convert_dtypes()
520
520
 
521
521
  return self.data_resp
522
522
 
File without changes
File without changes