cryptodatapy 0.2.17__tar.gz → 0.2.19__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.17 → cryptodatapy-0.2.19}/PKG-INFO +1 -1
  2. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/pyproject.toml +1 -1
  3. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/data_vendors/cryptocompare_api.py +42 -35
  4. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/transform/wrangle.py +2 -2
  5. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/LICENSE +0 -0
  6. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/README.md +0 -0
  7. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/__init__.py +0 -0
  8. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/conf/__init__.py +0 -0
  9. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/conf/fields.csv +0 -0
  10. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/conf/tickers.csv +0 -0
  11. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/datasets/__init__.py +0 -0
  12. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/datasets/br_econ_calendar.csv +0 -0
  13. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/datasets/ca_econ_calendar.csv +0 -0
  14. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/datasets/cn_econ_calendar.csv +0 -0
  15. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/datasets/de_econ_calendar.csv +0 -0
  16. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/datasets/ez_econ_calendar.csv +0 -0
  17. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/datasets/fr_econ_calendar.csv +0 -0
  18. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/datasets/gb_econ_calendar.csv +0 -0
  19. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/datasets/get_econ_calendars.py +0 -0
  20. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/datasets/id_econ_calendar.csv +0 -0
  21. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/datasets/in_econ_calendar.csv +0 -0
  22. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/datasets/it_econ_calendar.csv +0 -0
  23. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/datasets/jp_econ_calendar.csv +0 -0
  24. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/datasets/kr_econ_calendar.csv +0 -0
  25. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/datasets/mx_econ_calendar.csv +0 -0
  26. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/datasets/ru_econ_calendar.csv +0 -0
  27. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/datasets/tr_econ_calendar.csv +0 -0
  28. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/datasets/us_econ_calendar.csv +0 -0
  29. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/__init__.py +0 -0
  30. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/data_vendors/.ipynb_checkpoints/CCXT-checkpoint.ipynb +0 -0
  31. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/data_vendors/.ipynb_checkpoints/DBNomics-checkpoint.ipynb +0 -0
  32. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/data_vendors/.ipynb_checkpoints/InvestPy-checkpoint.ipynb +0 -0
  33. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/data_vendors/.ipynb_checkpoints/NasdaqDataLink-checkpoint.ipynb +0 -0
  34. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/data_vendors/.ipynb_checkpoints/PandasDataReader-checkpoint.ipynb +0 -0
  35. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/data_vendors/__init__.py +0 -0
  36. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/data_vendors/coinmetrics_api.py +0 -0
  37. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/data_vendors/datavendor.py +0 -0
  38. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/data_vendors/glassnode_api.py +0 -0
  39. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/data_vendors/tiingo_api.py +0 -0
  40. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/datarequest.py +0 -0
  41. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/exchanges/__init__.py +0 -0
  42. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/exchanges/dydx.py +0 -0
  43. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/exchanges/exchange.py +0 -0
  44. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/getdata.py +0 -0
  45. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/libraries/__init__.py +0 -0
  46. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/libraries/ccxt_api.py +0 -0
  47. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/libraries/dbnomics_api.py +0 -0
  48. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/libraries/investpy_api.py +0 -0
  49. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/libraries/library.py +0 -0
  50. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/libraries/pandasdr_api.py +0 -0
  51. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/web/__init__.py +0 -0
  52. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/web/aqr.py +0 -0
  53. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/extract/web/web.py +0 -0
  54. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/transform/__init__.py +0 -0
  55. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/transform/clean.py +0 -0
  56. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/transform/convertparams.py +0 -0
  57. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/transform/filter.py +0 -0
  58. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/transform/impute.py +0 -0
  59. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/transform/od.py +0 -0
  60. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/util/__init__.py +0 -0
  61. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/src/cryptodatapy/util/datacatalog.py +0 -0
  62. {cryptodatapy-0.2.17 → cryptodatapy-0.2.19}/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.17
3
+ Version: 0.2.19
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.17"
3
+ version = "0.2.19"
4
4
  description = "Cryptoasset data library"
5
5
  authors = ["Systamental"]
6
6
  license = "Apache License 2.0"
@@ -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
  """
@@ -711,13 +713,18 @@ class CryptoCompare(DataVendor):
711
713
  self.get_indexes_info(as_list=True)
712
714
  tickers_list = self.assets + self.indexes
713
715
 
716
+ # fields
717
+ self.get_fields_info()
718
+ self.get_onchain_info()
719
+ self.get_social_info()
720
+
714
721
  # tickers
715
722
  if not all([ticker in tickers_list for ticker in self.data_req.source_tickers]):
716
723
  raise ValueError("Some assets are not available. "
717
724
  "Check available assets and indexes with get_assets_info() or get_indexes_info().")
718
725
 
719
726
  # fields
720
- if not all([field in self.get_fields_info() for field in self.data_req.source_fields]):
727
+ if not all([field in self.fields for field in self.data_req.source_fields]):
721
728
  raise ValueError("Some fields are not available. "
722
729
  "Check available fields with get_fields_info().")
723
730
 
@@ -727,12 +734,12 @@ class CryptoCompare(DataVendor):
727
734
  f"Check available frequencies with get_frequencies().")
728
735
 
729
736
  # on-chain freq
730
- if self.data_req.source_fields in self.get_onchain_info() and self.data_req.source_freq != 'histoday':
737
+ if self.data_req.source_fields in self.onchain_fields and self.data_req.source_freq != 'histoday':
731
738
  raise ValueError(f"On-chain data is only available on a daily frequency."
732
739
  f" Change data request frequency to 'd' and try again.")
733
740
 
734
741
  # social freq
735
- if self.data_req.source_fields in self.get_social_info() and self.data_req.source_freq == 'histominute':
742
+ if self.data_req.source_fields in self.social_fields and self.data_req.source_freq == 'histominute':
736
743
  raise ValueError(f"Social media data is only available on a daily and hourly frequency."
737
744
  f" Change data request frequency to 'd' or '1h' and try again.")
738
745
 
@@ -751,42 +758,44 @@ class CryptoCompare(DataVendor):
751
758
  DataFrame with DatetimeIndex (level 0), ticker (level 1), and values for OHLCV, on-chain and/or
752
759
  social fields (cols), in tidy format.
753
760
  """
754
- logging.info("Retrieving data request from CryptoCompare...")
755
-
756
761
  # check data req params
757
762
  self.check_params(data_req)
758
763
 
759
764
  # 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])
765
+ if any([ticker in self.indexes for ticker in data_req.source_tickers]):
766
+ try:
767
+ df0 = self.get_indexes(data_req)
768
+ except Exception as e:
769
+ logging.warning(e)
770
+ else:
771
+ self.data = pd.concat([self.data, df0])
766
772
 
767
773
  # 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])
774
+ if any([field in ['open', 'high', 'low', 'close', 'volumefrom'] for field in data_req.source_fields]):
775
+ try:
776
+ df1 = self.get_ohlcv(data_req)
777
+ except Exception as e:
778
+ logging.warning(e)
779
+ else:
780
+ self.data = pd.concat([self.data, df1])
774
781
 
775
782
  # 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)
783
+ if any([field in self.onchain_fields for field in data_req.source_fields]):
784
+ try:
785
+ df2 = self.get_onchain(data_req)
786
+ except Exception as e:
787
+ logging.warning(e)
788
+ else:
789
+ self.data = pd.concat([self.data, df2], axis=1)
782
790
 
783
791
  # 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)
792
+ if any([field in self.social_fields for field in data_req.source_fields]):
793
+ try:
794
+ df3 = self.get_social(data_req)
795
+ except Exception as e:
796
+ logging.warning(e)
797
+ else:
798
+ self.data = pd.concat([self.data, df3], axis=1)
790
799
 
791
800
  # check if df empty
792
801
  if self.data.empty:
@@ -796,6 +805,4 @@ class CryptoCompare(DataVendor):
796
805
  fields = [field for field in data_req.fields if field in self.data.columns]
797
806
  self.data = self.data.loc[:, fields].sort_index()
798
807
 
799
- logging.info("Data retrieved from CryptoCompare.")
800
-
801
808
  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