cryptodatapy 0.2.15__py3-none-any.whl → 0.2.16__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/extract/data_vendors/coinmetrics_api.py +32 -32
- cryptodatapy/extract/data_vendors/cryptocompare_api.py +159 -204
- cryptodatapy/extract/data_vendors/datavendor.py +21 -0
- cryptodatapy/extract/data_vendors/tiingo_api.py +5 -1
- cryptodatapy/extract/libraries/ccxt_api.py +215 -209
- cryptodatapy/transform/convertparams.py +35 -57
- cryptodatapy/util/datacredentials.py +18 -3
- {cryptodatapy-0.2.15.dist-info → cryptodatapy-0.2.16.dist-info}/METADATA +1 -1
- {cryptodatapy-0.2.15.dist-info → cryptodatapy-0.2.16.dist-info}/RECORD +11 -11
- {cryptodatapy-0.2.15.dist-info → cryptodatapy-0.2.16.dist-info}/LICENSE +0 -0
- {cryptodatapy-0.2.15.dist-info → cryptodatapy-0.2.16.dist-info}/WHEEL +0 -0
@@ -24,82 +24,60 @@ class ConvertParams:
|
|
24
24
|
"""
|
25
25
|
self.data_req = data_req
|
26
26
|
|
27
|
-
def to_cryptocompare(self) ->
|
27
|
+
def to_cryptocompare(self) -> DataRequest:
|
28
28
|
"""
|
29
29
|
Convert tickers from CryptoDataPy to CryptoCompare format.
|
30
30
|
"""
|
31
|
-
#
|
32
|
-
if self.data_req.source_tickers is
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
else:
|
42
|
-
if self.data_req.freq[-3:] == "min":
|
43
|
-
freq = "histominute"
|
31
|
+
# tickers
|
32
|
+
if self.data_req.source_tickers is None:
|
33
|
+
self.data_req.source_tickers = [ticker.upper() for ticker in self.data_req.tickers]
|
34
|
+
|
35
|
+
# freq
|
36
|
+
if self.data_req.source_freq is None:
|
37
|
+
if self.data_req.freq is None:
|
38
|
+
self.data_req.source_freq = "histoday"
|
39
|
+
elif self.data_req.freq[-3:] == "min":
|
40
|
+
self.data_req.source_freq = "histominute"
|
44
41
|
elif self.data_req.freq[-1] == "h":
|
45
|
-
|
42
|
+
self.data_req.source_freq = "histohour"
|
46
43
|
else:
|
47
|
-
|
48
|
-
|
44
|
+
self.data_req.source_freq = "histoday"
|
45
|
+
|
46
|
+
# quote ccy
|
49
47
|
if self.data_req.quote_ccy is None:
|
50
|
-
quote_ccy = "USD"
|
48
|
+
self.data_req.quote_ccy = "USD"
|
51
49
|
else:
|
52
|
-
quote_ccy = self.data_req.quote_ccy.upper()
|
50
|
+
self.data_req.quote_ccy = self.data_req.quote_ccy.upper()
|
51
|
+
|
53
52
|
# convert exch
|
54
53
|
if self.data_req.exch is None:
|
55
|
-
exch = "CCCAGG"
|
54
|
+
self.data_req.exch = "CCCAGG"
|
56
55
|
else:
|
57
|
-
exch = self.data_req.exch
|
58
|
-
|
56
|
+
self.data_req.exch = self.data_req.exch.lower()
|
57
|
+
|
58
|
+
# start date
|
59
59
|
if self.data_req.freq[-3:] == "min": # limit to higher frequency data responses
|
60
|
-
|
61
|
-
# no start date
|
60
|
+
self.data_req.source_start_date = int((datetime.now() - timedelta(days=7)).timestamp())
|
62
61
|
elif self.data_req.start_date is None:
|
63
|
-
|
62
|
+
self.data_req.source_start_date = int(pd.Timestamp("2009-01-03 00:00:00").timestamp())
|
64
63
|
else:
|
65
|
-
|
64
|
+
self.data_req.source_start_date = int(pd.Timestamp(self.data_req.start_date).timestamp())
|
65
|
+
|
66
66
|
# convert end date
|
67
67
|
if self.data_req.end_date is None:
|
68
|
-
|
68
|
+
self.data_req.source_end_date = int(pd.Timestamp.utcnow().timestamp())
|
69
69
|
else:
|
70
|
-
|
70
|
+
self.data_req.source_end_date = int(pd.Timestamp(self.data_req.end_date).timestamp())
|
71
|
+
|
71
72
|
# fields
|
72
|
-
if self.data_req.source_fields is
|
73
|
-
|
74
|
-
|
75
|
-
else:
|
76
|
-
fields = self.convert_fields(data_source='cryptocompare')
|
73
|
+
if self.data_req.source_fields is None:
|
74
|
+
self.data_req.source_fields = self.convert_fields(data_source='cryptocompare')
|
75
|
+
|
77
76
|
# tz
|
78
77
|
if self.data_req.tz is None:
|
79
|
-
tz = "UTC"
|
80
|
-
else:
|
81
|
-
tz = self.data_req.tz
|
78
|
+
self.data_req.tz = "UTC"
|
82
79
|
|
83
|
-
return
|
84
|
-
"tickers": tickers,
|
85
|
-
"freq": freq,
|
86
|
-
"quote_ccy": quote_ccy,
|
87
|
-
"exch": exch,
|
88
|
-
"ctys": None,
|
89
|
-
"mkt_type": self.data_req.mkt_type,
|
90
|
-
"mkts": None,
|
91
|
-
"start_date": start_date,
|
92
|
-
"end_date": end_date,
|
93
|
-
"fields": fields,
|
94
|
-
"tz": tz,
|
95
|
-
"inst": None,
|
96
|
-
"cat": 'crypto',
|
97
|
-
"trials": self.data_req.trials,
|
98
|
-
"pause": self.data_req.pause,
|
99
|
-
"source_tickers": self.data_req.source_tickers,
|
100
|
-
"source_freq": self.data_req.source_freq,
|
101
|
-
"source_fields": self.data_req.source_fields,
|
102
|
-
}
|
80
|
+
return self.data_req
|
103
81
|
|
104
82
|
def to_coinmetrics(self) -> DataRequest:
|
105
83
|
"""
|
@@ -980,7 +958,7 @@ class ConvertParams:
|
|
980
958
|
List of fields in data source format.
|
981
959
|
|
982
960
|
"""
|
983
|
-
#
|
961
|
+
# fields
|
984
962
|
with resources.path("cryptodatapy.conf", "fields.csv") as f:
|
985
963
|
fields_dict_path = f
|
986
964
|
fields_df, fields_list = (
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import os
|
2
|
-
from dataclasses import dataclass
|
2
|
+
from dataclasses import dataclass, field
|
3
3
|
|
4
4
|
|
5
5
|
@dataclass
|
@@ -23,7 +23,6 @@ class DataCredentials:
|
|
23
23
|
mongo_db_name: str = None
|
24
24
|
|
25
25
|
# API keys
|
26
|
-
# cryptocompare api key
|
27
26
|
try:
|
28
27
|
cryptocompare_api_key: str = os.environ['CRYPTOCOMPARE_API_KEY']
|
29
28
|
except KeyError:
|
@@ -44,7 +43,7 @@ class DataCredentials:
|
|
44
43
|
except KeyError:
|
45
44
|
coinmetrics_api_key: str = None
|
46
45
|
|
47
|
-
# base URLs
|
46
|
+
# API base URLs
|
48
47
|
cryptocompare_base_url: str = 'https://min-api.cryptocompare.com/data/'
|
49
48
|
glassnode_base_url: str = 'https://api.glassnode.com/v1/metrics/'
|
50
49
|
tiingo_base_url: str = 'https://api.tiingo.com/tiingo/'
|
@@ -54,6 +53,22 @@ class DataCredentials:
|
|
54
53
|
else:
|
55
54
|
coinmetrics_base_url: str = 'https://community-api.coinmetrics.io/v4'
|
56
55
|
|
56
|
+
# API endpoints
|
57
|
+
cryptomcompare_endpoints: dict = field(default_factory=lambda: {
|
58
|
+
'exchanges_info': 'exchanges/general',
|
59
|
+
'indexes_info': 'index/list',
|
60
|
+
'assets_info': 'all/coinlist',
|
61
|
+
'markets_info': 'v2/cccagg/pairs',
|
62
|
+
'on-chain_tickers_info': 'blockchain/list',
|
63
|
+
'on-chain_info': 'blockchain/latest?fsym=BTC',
|
64
|
+
'social_info': 'social/coin/histo/day',
|
65
|
+
'news': 'v2/news/?lang=EN',
|
66
|
+
'news_sources': 'news/feeds',
|
67
|
+
'rate_limit_info': 'rate/limit',
|
68
|
+
'top_mkt_cap_info': 'top/mktcapfull?',
|
69
|
+
'indexes': 'index/'
|
70
|
+
})
|
71
|
+
|
57
72
|
# api limit URLs
|
58
73
|
cryptocompare_api_rate_limit: str = "https://min-api.cryptocompare.com/stats/rate/limit"
|
59
74
|
|
@@ -27,18 +27,18 @@ cryptodatapy/extract/data_vendors/.ipynb_checkpoints/InvestPy-checkpoint.ipynb,s
|
|
27
27
|
cryptodatapy/extract/data_vendors/.ipynb_checkpoints/NasdaqDataLink-checkpoint.ipynb,sha256=hY2QkCcTiLgPnl8SQPsO8spio5-RBMGeBLYzAwgSWb4,147170
|
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
|
-
cryptodatapy/extract/data_vendors/coinmetrics_api.py,sha256=
|
31
|
-
cryptodatapy/extract/data_vendors/cryptocompare_api.py,sha256=
|
32
|
-
cryptodatapy/extract/data_vendors/datavendor.py,sha256=
|
30
|
+
cryptodatapy/extract/data_vendors/coinmetrics_api.py,sha256=sIcYf4_0zS41EKGOakB7U6xHmSIh87xAWDTj2BRJlbI,33308
|
31
|
+
cryptodatapy/extract/data_vendors/cryptocompare_api.py,sha256=8zup1bGQfhn5-I9SV2N07SuOqYpt1-WOVHfNQh5jY5Y,26988
|
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
|
-
cryptodatapy/extract/data_vendors/tiingo_api.py,sha256=
|
34
|
+
cryptodatapy/extract/data_vendors/tiingo_api.py,sha256=AYYtVFC9gPqhUWGsHVRpEmVse6b0djGX8bCMtaiYFY0,25681
|
35
35
|
cryptodatapy/extract/datarequest.py,sha256=EPq_7itSjwoqLY1v3HLQRbiFbSMCOzFmA2xGpaM3PQc,25215
|
36
36
|
cryptodatapy/extract/exchanges/__init__.py,sha256=VKTNzrbe-wltGHWH9lK5RLZoXCGHp-UGGZ4gMVHJXrQ,113
|
37
37
|
cryptodatapy/extract/exchanges/dydx.py,sha256=Oifb4sKbPRKArdZBx9q5ob4yTFkd65n0zXiS7hga0mk,4199
|
38
38
|
cryptodatapy/extract/exchanges/exchange.py,sha256=Cicj3KS4zLbwmXX5fu89byXNwqqU4TH31GFv0zj3D4s,13010
|
39
39
|
cryptodatapy/extract/getdata.py,sha256=Ade6Gl1GrZkPJIjw-wAvcMrQsKpCy1h3n5cUUDASXNY,11549
|
40
40
|
cryptodatapy/extract/libraries/__init__.py,sha256=9rJ_hFHWlvkPwyIkNG5bqH6HTY2jQNPIKQjzYEsVSDo,319
|
41
|
-
cryptodatapy/extract/libraries/ccxt_api.py,sha256=
|
41
|
+
cryptodatapy/extract/libraries/ccxt_api.py,sha256=F4wYocKpaKngvXCZR-zTIBUOFZMGvQ_5Onw82uLCWOU,56131
|
42
42
|
cryptodatapy/extract/libraries/dbnomics_api.py,sha256=M6kPIH-hKqkmeBQb-g56dY9jatqLCtSl_MnvPblHtAc,9421
|
43
43
|
cryptodatapy/extract/libraries/investpy_api.py,sha256=qtGm3LDluXxJorvFv0w1bm1oBrcZIfE5cZSYzNYvttY,18409
|
44
44
|
cryptodatapy/extract/libraries/library.py,sha256=eU8NnQZ9luLGdIF5hms6j8VPCWc50evkREc4xdh-g1I,12301
|
@@ -48,15 +48,15 @@ cryptodatapy/extract/web/aqr.py,sha256=LS1D7QzG6UWkLUfDMgBFtiHpznnnAUOpec5Sx3vRG
|
|
48
48
|
cryptodatapy/extract/web/web.py,sha256=R1xEnHE1McxSWxp4vrTfgh9gW6FF6XDlp0gmp2NmWOM,12126
|
49
49
|
cryptodatapy/transform/__init__.py,sha256=Spb5cGJ3V_o8hgSWOSrF8J_vsSZpFk0uzW7RpkgfbFE,131
|
50
50
|
cryptodatapy/transform/clean.py,sha256=C9VypQOjdJ987TcD-qAHh7qYaoJBotvp3cWTr3ttSGM,12807
|
51
|
-
cryptodatapy/transform/convertparams.py,sha256=
|
51
|
+
cryptodatapy/transform/convertparams.py,sha256=_8yYVfh9TljPeeW2CHK26_-J14fncBTDjZTxpLRRCA8,42656
|
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
55
|
cryptodatapy/transform/wrangle.py,sha256=dnaBi3zOXoQymkxN7r5Eneb9UccGhfp7UdCS31T41i8,42396
|
56
56
|
cryptodatapy/util/__init__.py,sha256=zSQ2HU2QIXzCuptJjknmrClwtQKCvIj4aNysZljIgrU,116
|
57
57
|
cryptodatapy/util/datacatalog.py,sha256=qCCX6srXvaAbVAKuA0M2y5IK_2OEx5xA3yRahDZlC-g,13157
|
58
|
-
cryptodatapy/util/datacredentials.py,sha256=
|
59
|
-
cryptodatapy-0.2.
|
60
|
-
cryptodatapy-0.2.
|
61
|
-
cryptodatapy-0.2.
|
62
|
-
cryptodatapy-0.2.
|
58
|
+
cryptodatapy/util/datacredentials.py,sha256=CC23ocTrxr6EEqM-oreLgz5rHEDX7EmZS7DYTgoIg8Q,2752
|
59
|
+
cryptodatapy-0.2.16.dist-info/LICENSE,sha256=sw4oVq8bDjT3uMtaFebQ-xeIVP4H-bXldTs9q-Jjeks,11344
|
60
|
+
cryptodatapy-0.2.16.dist-info/METADATA,sha256=r5GSym1txexSKKtREciNDhDRNS-e2X-blUObjpO96Ws,6428
|
61
|
+
cryptodatapy-0.2.16.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
62
|
+
cryptodatapy-0.2.16.dist-info/RECORD,,
|
File without changes
|
File without changes
|