cryptodatapy 0.2.16__py3-none-any.whl → 0.2.18__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.
- cryptodatapy/conf/fields.csv +1 -1
- cryptodatapy/extract/data_vendors/cryptocompare_api.py +44 -35
- cryptodatapy/transform/wrangle.py +2 -2
- {cryptodatapy-0.2.16.dist-info → cryptodatapy-0.2.18.dist-info}/METADATA +1 -1
- {cryptodatapy-0.2.16.dist-info → cryptodatapy-0.2.18.dist-info}/RECORD +7 -7
- {cryptodatapy-0.2.16.dist-info → cryptodatapy-0.2.18.dist-info}/LICENSE +0 -0
- {cryptodatapy-0.2.16.dist-info → cryptodatapy-0.2.18.dist-info}/WHEEL +0 -0
cryptodatapy/conf/fields.csv
CHANGED
@@ -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,
|
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.
|
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.
|
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.
|
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
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
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
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
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
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
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
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
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
|
|
@@ -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=
|
3
|
+
cryptodatapy/conf/fields.csv,sha256=zH-Pw438Nencqr8tXQfTBlHH5HF-bLyJCW5MF8LCB4E,25734
|
4
4
|
cryptodatapy/conf/tickers.csv,sha256=Bs9KfDKawoUPKIQZMN8CtoLYJuzOkwLh2il30c8CsqE,357066
|
5
5
|
cryptodatapy/datasets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
6
|
cryptodatapy/datasets/br_econ_calendar.csv,sha256=mSM0IOIByI-0gIIL1CbDQPqHYI5lK6vavrY1ODj3Jlk,1185318
|
@@ -28,7 +28,7 @@ cryptodatapy/extract/data_vendors/.ipynb_checkpoints/NasdaqDataLink-checkpoint.i
|
|
28
28
|
cryptodatapy/extract/data_vendors/.ipynb_checkpoints/PandasDataReader-checkpoint.ipynb,sha256=n7vzOV6AxC_Ti5CLWW2ABMEEcbbBpiBBs4qTUBQinIg,24171
|
29
29
|
cryptodatapy/extract/data_vendors/__init__.py,sha256=Nk6gcT43d0XOLfrlVA9r--5mvHCgHfq295IKL3Puu74,354
|
30
30
|
cryptodatapy/extract/data_vendors/coinmetrics_api.py,sha256=sIcYf4_0zS41EKGOakB7U6xHmSIh87xAWDTj2BRJlbI,33308
|
31
|
-
cryptodatapy/extract/data_vendors/cryptocompare_api.py,sha256=
|
31
|
+
cryptodatapy/extract/data_vendors/cryptocompare_api.py,sha256=p67k2Q9F8zCOColVIhxswFGQfnf-5HK_YheTvPWJj4k,27520
|
32
32
|
cryptodatapy/extract/data_vendors/datavendor.py,sha256=eH_yIJPy5FvZhgILqpgNYYkbmC5fK_5eIdIZTOeNw9Q,13292
|
33
33
|
cryptodatapy/extract/data_vendors/glassnode_api.py,sha256=PuuJOjHztoJyFijb5XU1zm1S_2NAj7MX-wC89DL_bWQ,13103
|
34
34
|
cryptodatapy/extract/data_vendors/tiingo_api.py,sha256=AYYtVFC9gPqhUWGsHVRpEmVse6b0djGX8bCMtaiYFY0,25681
|
@@ -52,11 +52,11 @@ cryptodatapy/transform/convertparams.py,sha256=_8yYVfh9TljPeeW2CHK26_-J14fncBTDj
|
|
52
52
|
cryptodatapy/transform/filter.py,sha256=KYYyta0uREAjBkYTVyvhOCCLSKR_qPSlqj5Nl7l4iBk,9064
|
53
53
|
cryptodatapy/transform/impute.py,sha256=_0-SX5nnPrYgJYT-HKwBGNkmWXRMy9-C2oeU6VqkQp0,5537
|
54
54
|
cryptodatapy/transform/od.py,sha256=4vxqxCKka8yzkcT9CJ1qthn8TSqo1-fnt0dIZrLl5_k,30386
|
55
|
-
cryptodatapy/transform/wrangle.py,sha256=
|
55
|
+
cryptodatapy/transform/wrangle.py,sha256=M3l3Fyc45LoUSA2lIfe27anT_4OPZESPBfWf_rI6CxA,42358
|
56
56
|
cryptodatapy/util/__init__.py,sha256=zSQ2HU2QIXzCuptJjknmrClwtQKCvIj4aNysZljIgrU,116
|
57
57
|
cryptodatapy/util/datacatalog.py,sha256=qCCX6srXvaAbVAKuA0M2y5IK_2OEx5xA3yRahDZlC-g,13157
|
58
58
|
cryptodatapy/util/datacredentials.py,sha256=CC23ocTrxr6EEqM-oreLgz5rHEDX7EmZS7DYTgoIg8Q,2752
|
59
|
-
cryptodatapy-0.2.
|
60
|
-
cryptodatapy-0.2.
|
61
|
-
cryptodatapy-0.2.
|
62
|
-
cryptodatapy-0.2.
|
59
|
+
cryptodatapy-0.2.18.dist-info/LICENSE,sha256=sw4oVq8bDjT3uMtaFebQ-xeIVP4H-bXldTs9q-Jjeks,11344
|
60
|
+
cryptodatapy-0.2.18.dist-info/METADATA,sha256=qZJzH-RMkuro2GavsQq62Q_bZXtnvnPm0maTleqDGAA,6428
|
61
|
+
cryptodatapy-0.2.18.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
62
|
+
cryptodatapy-0.2.18.dist-info/RECORD,,
|
File without changes
|
File without changes
|