cryptodatapy 0.2.0__py3-none-any.whl → 0.2.2__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/.DS_Store +0 -0
- cryptodatapy/conf/tickers.csv +6 -0
- cryptodatapy/extract/libraries/ccxt_api.py +81 -60
- cryptodatapy/extract/libraries/library.py +19 -8
- cryptodatapy/extract/libraries/pandasdr_api.py +1 -1
- cryptodatapy/transform/wrangle.py +2 -4
- {cryptodatapy-0.2.0.dist-info → cryptodatapy-0.2.2.dist-info}/METADATA +1 -1
- {cryptodatapy-0.2.0.dist-info → cryptodatapy-0.2.2.dist-info}/RECORD +10 -24
- cryptodatapy/.idea/workspace.xml +0 -41
- cryptodatapy/conf/.pytest_cache/.gitignore +0 -2
- cryptodatapy/conf/.pytest_cache/CACHEDIR.TAG +0 -4
- cryptodatapy/conf/.pytest_cache/README.md +0 -8
- cryptodatapy/conf/.pytest_cache/v/cache/nodeids +0 -1
- cryptodatapy/conf/.pytest_cache/v/cache/stepwise +0 -1
- cryptodatapy/extract/data_vendors/.ipynb_checkpoints/glassnode_api_test-checkpoint.ipynb +0 -504
- cryptodatapy/extract/data_vendors/.pytest_cache/.gitignore +0 -2
- cryptodatapy/extract/data_vendors/.pytest_cache/CACHEDIR.TAG +0 -4
- cryptodatapy/extract/data_vendors/.pytest_cache/README.md +0 -8
- cryptodatapy/extract/data_vendors/.pytest_cache/v/cache/nodeids +0 -1
- cryptodatapy/extract/data_vendors/.pytest_cache/v/cache/stepwise +0 -1
- cryptodatapy/extract/web/.ipynb_checkpoints/Untitled-checkpoint.ipynb +0 -6
- cryptodatapy/extract/web/Untitled.ipynb +0 -559
- {cryptodatapy-0.2.0.dist-info → cryptodatapy-0.2.2.dist-info}/LICENSE +0 -0
- {cryptodatapy-0.2.0.dist-info → cryptodatapy-0.2.2.dist-info}/WHEEL +0 -0
cryptodatapy/.DS_Store
CHANGED
Binary file
|
cryptodatapy/conf/tickers.csv
CHANGED
@@ -1702,6 +1702,9 @@ MX_Manuf_PMI,Mexico S&P Global Manufacturing PMI,,,MX,MEX,Mexico,EM,macro,growth
|
|
1702
1702
|
KR_Manuf_PMI,South Korea S&P Global Manufacturing PMI,,,KR,KOR,South Korea,EM,macro,growth,,m,,index,KRW,,,,,,Nikkei Manufacturing PMI,,
|
1703
1703
|
CA_Manuf_PMI,Canada Manufacturing PMI,,,CA,CAN,Canada,DM,macro,growth,,m,,index,CAD,,,,,,Manufacturing PMI,,
|
1704
1704
|
EZ_Manuf_PMI,Eurozone S&P Global Manufacturing PMI,,,EZ,EMU,Euro zone,Euro zone,macro,growth,,m,,index,EUR,,,,,,Manufacturing PMI,,
|
1705
|
+
G20_CLI,G20 Composite Leading Indicator,"G20 Composite Leading Indicator, Amplitude adjusted (CLI), Monthly",,G20,G20,G20,G20,macro,growth,,m,,index,,,,,,LOLITOAA.G-20.M,,,
|
1706
|
+
G20_BCI,G20 Business Confidence Index,"G20 Business Confidence Index, OECD Standardised BCI, Amplitude adjusted (Long term average=100), SA, Monthly",,G20,G20,G21,G20,macro,growth,,m,,index,,,,,,BSCICP03.G-20.M,,,
|
1707
|
+
G20_CCI,G20 Consumer Confidence Index,"G20 Consumer Confidence Index, OECD Standardised CCI, Amplitude adjusted (Long term average=100), SA, Monthly",,G20,G20,G22,G20,macro,growth,,m,,index,,,,,,CSCICP03.G-20.M,,,
|
1705
1708
|
US_GDP_Sh_PPP,"United States Share of World GDP based on PPP, %","United States Share of World GDP based on PPP, %. Units: Percent. Estimates begin after 2018. Expressed in percent of world GDP in PPP dollars. These data form the basis for the country weights used to generate the World Economic Outlook country group composites for the domestic economy.",,US,USA,United States,DM,macro,activity,,y,,%,USD,,,,,IMF/WEO:2021-04/USA.PPPSH.pcent,,,
|
1706
1709
|
CN_GDP_Sh_PPP,"China Share of World GDP based on PPP, %","China Share of World GDP based on PPP, %. Units: Percent. Estimates begin after 2018. Expressed in percent of world GDP in PPP dollars.These data form the basis for the country weights used to generate the World Economic Outlook country group composites for the domestic economy.",,CN,CHN,China,EM,macro,activity,,y,,%,CNY,,,,,IMF/WEO:2021-04/CHN.PPPSH.pcent,,,
|
1707
1710
|
IN_GDP_Sh_PPP,"India Share of World GDP based on PPP, %","India Share of World GDP based on PPP, %. Units: Percent. Estimates begin after 2018. Expressed in percent of world GDP in PPP dollars.These data form the basis for the country weights used to generate the World Economic Outlook country group composites for the domestic economy.",,IN,IND,India,EM,macro,activity,,y,,%,INR,,,,,IMF/WEO:2021-04/IND.PPPSH.pcent,,,
|
@@ -1773,6 +1776,9 @@ IT_Infl_CPI_YoY,"Italy CPI Inflation Rate, Year over year percentage change",,,I
|
|
1773
1776
|
MX_Infl_CPI_YoY,"Mexico CPI Inflation Rate, Year over year percentage change",,,MX,MEX,Mexico,EM,macro,inflation,,m,,yoy % chg,MXN,,,,,,CPI (YoY),,
|
1774
1777
|
KR_Infl_CPI_YoY,"South Korea CPI Inflation Rate, Year over year percentage change",,,KR,KOR,South Korea,EM,macro,inflation,,m,,yoy % chg,KRW,,,,,,CPI (YoY),,
|
1775
1778
|
CA_Infl_CPI_YoY,"Canada CPI Inflation Rate, Year over year percentage change",,,CA,CAN,Canada,DM,macro,inflation,,m,,yoy % chg,CAD,,,,,,CPI (YoY),,
|
1779
|
+
G20_Infl_CPI_YoY,"G20 CPI Inflation Rate, Year over year percentage change","G20 - Consumer Price Index, All items, Total, Growth rate same period previous year, Monthly",,G20,G20,G20,G20,macro,inflation,,m,,yoy % chg,,,,,,G-20.CPALTT01.GY.M,,,
|
1780
|
+
G20_Infl_CPI_MoM,"G20 CPI Inflation Rate, Month over month percentage change","G20 � Consumer Price Index, All items, Total, Growth rate previous period, Monthly",,G20,G20,G20,G20,macro,inflation,,m,,mom % chg,,,,,,G-20.CPALTT01.GP.M,,,
|
1781
|
+
G20_Infl_CPI_Idx,"G20 CPI Inflation Rate, Index","G20 � Consumer Price Index, All items, Total, Index 2015=100, Monthly",,G20,G20,G20,G20,macro,inflation,,m,,index,,,,,,G-20.CPALTT01.IXOB.M,,,
|
1776
1782
|
EZ_Infl_Exp_1Y,"ECB, Survey of Professional Forecasters, 12 months ahead HICP inflation",,,EZ,EMU,Euro zone,Euro zone,macro,inflation,,q,,YoY % chg,EUR,,,,,ECB/SPF/M.U2.HICP.POINT.P12M.Q.AVG,,,
|
1777
1783
|
US_UE_Rate,United States Unemployment Rate,,,US,USA,United States,DM,macro,unemployment,,m,,%,,,,,UNRATE,BLS/ln/LNS14000000,,,
|
1778
1784
|
CN_UE_Rate,China Urban Surveyed Unemployment Rate,,,CN,CHN,China,EM,macro,unemployment,,m,,%,,,,,,NBS/M_A0E01/A0E0101,,,
|
@@ -28,7 +28,7 @@ class CCXT(Library):
|
|
28
28
|
indexes: Optional[List[str]] = None,
|
29
29
|
assets: Optional[Dict[str, List[str]]] = None,
|
30
30
|
markets: Optional[Dict[str, List[str]]] = None,
|
31
|
-
market_types=
|
31
|
+
market_types: List[str] = ["spot", "future", "perpetual_future", "option"],
|
32
32
|
fields: Optional[List[str]] = None,
|
33
33
|
frequencies: Optional[Dict[str, List[str]]] = None,
|
34
34
|
base_url: Optional[str] = None,
|
@@ -86,24 +86,10 @@ class CCXT(Library):
|
|
86
86
|
rate_limit,
|
87
87
|
)
|
88
88
|
|
89
|
-
if market_types is None:
|
90
|
-
self.market_types = ["spot", "future", "perpetual_future", "option"]
|
91
|
-
if market_types is exchanges:
|
92
|
-
self.exchanges = self.get_exchanges_info(as_list=True)
|
93
|
-
if assets is None:
|
94
|
-
self.assets = self.get_assets_info(as_list=True)
|
95
|
-
if markets is None:
|
96
|
-
self.markets = self.get_markets_info(as_list=True)
|
97
|
-
if fields is None:
|
98
|
-
self.fields = self.get_fields_info()
|
99
|
-
if frequencies is None:
|
100
|
-
self.frequencies = self.get_frequencies_info()
|
101
|
-
if rate_limit is None:
|
102
|
-
self.rate_limit = self.get_rate_limit_info()
|
103
|
-
|
104
|
-
@staticmethod
|
105
89
|
def get_exchanges_info(
|
106
|
-
|
90
|
+
self,
|
91
|
+
exch: Optional[str] = None,
|
92
|
+
as_list: bool = True
|
107
93
|
) -> Union[List[str], pd.DataFrame]:
|
108
94
|
"""
|
109
95
|
Get exchanges info.
|
@@ -122,12 +108,14 @@ class CCXT(Library):
|
|
122
108
|
"""
|
123
109
|
# list
|
124
110
|
if as_list:
|
125
|
-
exchanges = ccxt.exchanges
|
111
|
+
self.exchanges = ccxt.exchanges
|
112
|
+
|
113
|
+
# df
|
126
114
|
else:
|
127
115
|
if exch is not None:
|
128
|
-
exchanges = [exch]
|
116
|
+
self.exchanges = [exch]
|
129
117
|
else:
|
130
|
-
exchanges = ccxt.exchanges
|
118
|
+
self.exchanges = ccxt.exchanges
|
131
119
|
print(
|
132
120
|
"Getting metadata for all supported exchanges can take a few minutes."
|
133
121
|
" For quick info on a specific exchange, provide the name of the exchange in the exch parameter."
|
@@ -135,7 +123,7 @@ class CCXT(Library):
|
|
135
123
|
|
136
124
|
# exch df
|
137
125
|
exch_df = pd.DataFrame(
|
138
|
-
index=exchanges,
|
126
|
+
index=self.exchanges,
|
139
127
|
columns=[
|
140
128
|
"id",
|
141
129
|
"name",
|
@@ -161,24 +149,36 @@ class CCXT(Library):
|
|
161
149
|
],
|
162
150
|
)
|
163
151
|
|
164
|
-
#
|
165
|
-
for row in exch_df.iterrows():
|
152
|
+
# Extract exchange info
|
153
|
+
for index, row in exch_df.iterrows():
|
166
154
|
try:
|
167
|
-
exchange = getattr(ccxt,
|
155
|
+
exchange = getattr(ccxt, index)()
|
168
156
|
exchange.load_markets()
|
169
|
-
except
|
170
|
-
|
157
|
+
except AttributeError as e:
|
158
|
+
print(f"AttributeError: {e} for exchange {index}")
|
159
|
+
exch_df.loc[index, :] = np.nan
|
160
|
+
except ccxt.BaseError as e: # Catch specific ccxt exceptions
|
161
|
+
print(f"CCXT Error: {e} for exchange {index}")
|
162
|
+
exch_df.loc[index, :] = np.nan
|
163
|
+
except Exception as e: # Fallback for any other exceptions
|
164
|
+
print(f"Unexpected error: {e} for exchange {index}")
|
165
|
+
exch_df.loc[index, :] = np.nan
|
171
166
|
else:
|
172
167
|
for col in exch_df.columns:
|
173
168
|
try:
|
174
|
-
exch_df.loc[
|
175
|
-
except
|
176
|
-
|
169
|
+
exch_df.loc[index, col] = str(getattr(exchange, col))
|
170
|
+
except AttributeError as e:
|
171
|
+
print(f"AttributeError: {e} for attribute {col} in exchange {index}")
|
172
|
+
exch_df.loc[index, col] = np.nan
|
173
|
+
except Exception as e: # Fallback for any other exceptions
|
174
|
+
print(f"Unexpected error: {e} for attribute {col} in exchange {index}")
|
175
|
+
exch_df.loc[index, col] = np.nan
|
176
|
+
|
177
177
|
# set index name
|
178
178
|
exch_df.index.name = "exchange"
|
179
|
-
exchanges = exch_df
|
179
|
+
self.exchanges = exch_df
|
180
180
|
|
181
|
-
return exchanges
|
181
|
+
return self.exchanges
|
182
182
|
|
183
183
|
def get_indexes_info(self) -> None:
|
184
184
|
"""
|
@@ -187,7 +187,9 @@ class CCXT(Library):
|
|
187
187
|
return None
|
188
188
|
|
189
189
|
def get_assets_info(
|
190
|
-
self,
|
190
|
+
self,
|
191
|
+
exch: str = "binance",
|
192
|
+
as_list: bool = False
|
191
193
|
) -> Union[pd.DataFrame, List[str]]:
|
192
194
|
"""
|
193
195
|
Get assets info.
|
@@ -209,14 +211,14 @@ class CCXT(Library):
|
|
209
211
|
|
210
212
|
# get assets on exchange and create df
|
211
213
|
exchange.load_markets()
|
212
|
-
assets = pd.DataFrame(exchange.currencies).T
|
213
|
-
assets.index.name = "ticker"
|
214
|
+
self.assets = pd.DataFrame(exchange.currencies).T
|
215
|
+
self.assets.index.name = "ticker"
|
214
216
|
|
215
217
|
# as list of assets
|
216
218
|
if as_list:
|
217
|
-
assets = assets.index.to_list()
|
219
|
+
self.assets = self.assets.index.to_list()
|
218
220
|
|
219
|
-
return assets
|
221
|
+
return self.assets
|
220
222
|
|
221
223
|
def get_markets_info(
|
222
224
|
self,
|
@@ -224,7 +226,7 @@ class CCXT(Library):
|
|
224
226
|
quote_ccy: Optional[str] = None,
|
225
227
|
mkt_type: Optional[str] = None,
|
226
228
|
as_list: bool = False,
|
227
|
-
) -> Union[
|
229
|
+
) -> Union[pd.DataFrame, List[str]]:
|
228
230
|
"""
|
229
231
|
Get markets info.
|
230
232
|
|
@@ -241,34 +243,34 @@ class CCXT(Library):
|
|
241
243
|
|
242
244
|
Returns
|
243
245
|
-------
|
244
|
-
markets:
|
245
|
-
|
246
|
+
markets: list or pd.DataFrame
|
247
|
+
List or dataframe with info on available markets, by exchange.
|
246
248
|
"""
|
247
249
|
# inst exch
|
248
250
|
exchange = getattr(ccxt, exch)()
|
249
251
|
|
250
252
|
# get assets on exchange
|
251
|
-
markets = pd.DataFrame(exchange.load_markets()).T
|
252
|
-
markets.index.name = "ticker"
|
253
|
+
self.markets = pd.DataFrame(exchange.load_markets()).T
|
254
|
+
self.markets.index.name = "ticker"
|
253
255
|
|
254
256
|
# quote ccy
|
255
257
|
if quote_ccy is not None:
|
256
|
-
markets = markets[markets.quote == quote_ccy.upper()]
|
258
|
+
self.markets = self.markets[self.markets.quote == quote_ccy.upper()]
|
257
259
|
|
258
260
|
# mkt type
|
259
261
|
if mkt_type == "perpetual_future":
|
260
|
-
if markets[markets.type == "swap"].empty:
|
261
|
-
markets = markets[markets.type == "future"]
|
262
|
+
if self.markets[self.markets.type == "swap"].empty:
|
263
|
+
self.markets = self.markets[self.markets.type == "future"]
|
262
264
|
else:
|
263
|
-
markets = markets[markets.type == "swap"]
|
265
|
+
self.markets = self.markets[self.markets.type == "swap"]
|
264
266
|
elif mkt_type == "spot" or mkt_type == "future" or mkt_type == "option":
|
265
|
-
markets = markets[markets.type == mkt_type]
|
267
|
+
self.markets = self.markets[self.markets.type == mkt_type]
|
266
268
|
|
267
269
|
# dict of assets
|
268
270
|
if as_list:
|
269
|
-
markets = markets.index.to_list()
|
271
|
+
self.markets = self.markets.index.to_list()
|
270
272
|
|
271
|
-
return markets
|
273
|
+
return self.markets
|
272
274
|
|
273
275
|
def get_fields_info(self) -> List[str]:
|
274
276
|
"""
|
@@ -280,12 +282,11 @@ class CCXT(Library):
|
|
280
282
|
List of available fields.
|
281
283
|
"""
|
282
284
|
# list of fields
|
283
|
-
fields = ["open", "high", "low", "close", "volume", "funding_rate"]
|
285
|
+
self.fields = ["open", "high", "low", "close", "volume", "funding_rate"]
|
284
286
|
|
285
|
-
return fields
|
287
|
+
return self.fields
|
286
288
|
|
287
|
-
|
288
|
-
def get_frequencies_info(exch: str = "binance") -> Dict[str, List[str]]:
|
289
|
+
def get_frequencies_info(self, exch: str = "binance") -> Dict[str, List[str]]:
|
289
290
|
"""
|
290
291
|
Get frequencies info.
|
291
292
|
|
@@ -304,9 +305,9 @@ class CCXT(Library):
|
|
304
305
|
exchange.load_markets()
|
305
306
|
|
306
307
|
# freq dict
|
307
|
-
|
308
|
+
self.frequencies = exchange.timeframes
|
308
309
|
|
309
|
-
return
|
310
|
+
return self.frequencies
|
310
311
|
|
311
312
|
def get_rate_limit_info(self, exch: str = "binance") -> Dict[str, Union[str, int]]:
|
312
313
|
"""
|
@@ -325,10 +326,30 @@ class CCXT(Library):
|
|
325
326
|
# inst exch
|
326
327
|
exchange = getattr(ccxt, exch)()
|
327
328
|
|
328
|
-
|
329
|
+
self.rate_limit = {
|
329
330
|
"exchange rate limit": "delay in milliseconds between two consequent HTTP requests to the same exchange",
|
330
|
-
exch: exchange.rateLimit
|
331
|
+
exch: exchange.rateLimit
|
331
332
|
}
|
333
|
+
return self.rate_limit
|
334
|
+
|
335
|
+
def get_metadata(self) -> None:
|
336
|
+
"""
|
337
|
+
Get CCXT metadata.
|
338
|
+
"""
|
339
|
+
if self.exchanges is None:
|
340
|
+
self.exchanges = self.get_exchanges_info(as_list=True)
|
341
|
+
if self.market_types is None:
|
342
|
+
self.market_types = ["spot", "future", "perpetual_future", "option"]
|
343
|
+
if self.assets is None:
|
344
|
+
self.assets = self.get_assets_info(as_list=True)
|
345
|
+
if self.markets is None:
|
346
|
+
self.markets = self.get_markets_info(as_list=True)
|
347
|
+
if self.fields is None:
|
348
|
+
self.fields = self.get_fields_info()
|
349
|
+
if self.frequencies is None:
|
350
|
+
self.frequencies = self.get_frequencies_info()
|
351
|
+
if self.rate_limit is None:
|
352
|
+
self.rate_limit = self.get_rate_limit_info()
|
332
353
|
|
333
354
|
def req_data(self,
|
334
355
|
data_req: DataRequest,
|
@@ -623,7 +644,7 @@ class CCXT(Library):
|
|
623
644
|
f"Assets are not available. Use assets attribute to check available assets for {cx_data_req['exch']}")
|
624
645
|
|
625
646
|
# check tickers
|
626
|
-
fields = self.
|
647
|
+
fields = self.get_fields_info()
|
627
648
|
if not any([field in fields for field in data_req.fields]):
|
628
649
|
raise ValueError(
|
629
650
|
f"Fields are not available. Use fields attribute to check available fields."
|
@@ -689,7 +710,7 @@ class CCXT(Library):
|
|
689
710
|
try:
|
690
711
|
df0 = self.get_tidy_ohlcv(data_req, mkt)
|
691
712
|
|
692
|
-
except
|
713
|
+
except AssertionError:
|
693
714
|
logging.info(f"Failed to get OHLCV data for {ticker} after many attempts.")
|
694
715
|
|
695
716
|
else:
|
@@ -731,7 +752,7 @@ class CCXT(Library):
|
|
731
752
|
try:
|
732
753
|
df0 = self.get_tidy_funding_rates(data_req, mkt)
|
733
754
|
|
734
|
-
except
|
755
|
+
except AssertionError:
|
735
756
|
logging.info(f"Failed to get funding rates for {ticker} after many attempts.")
|
736
757
|
|
737
758
|
else:
|
@@ -100,14 +100,15 @@ class Library(ABC):
|
|
100
100
|
exchanges is None
|
101
101
|
or isinstance(exchanges, list)
|
102
102
|
or isinstance(exchanges, dict)
|
103
|
+
or isinstance(exchanges, pd.DataFrame)
|
103
104
|
):
|
104
105
|
self._exchanges = exchanges
|
105
106
|
elif isinstance(exchanges, str):
|
106
107
|
self._exchanges = [exchanges]
|
107
108
|
else:
|
108
109
|
raise TypeError(
|
109
|
-
"Exchanges must be a string, list of strings (exchanges)
|
110
|
-
" dict with {cat: List[str]} key-value pairs."
|
110
|
+
"Exchanges must be a string, list of strings (exchanges), "
|
111
|
+
" dict with {cat: List[str]} key-value pairs or a dataframe."
|
111
112
|
)
|
112
113
|
|
113
114
|
@abstractmethod
|
@@ -158,14 +159,19 @@ class Library(ABC):
|
|
158
159
|
"""
|
159
160
|
Sets a list of available assets for the data vendor.
|
160
161
|
"""
|
161
|
-
if
|
162
|
+
if (
|
163
|
+
assets is None
|
164
|
+
or isinstance(assets, list)
|
165
|
+
or isinstance(assets, dict)
|
166
|
+
or isinstance(assets, pd.DataFrame)
|
167
|
+
):
|
162
168
|
self._assets = assets
|
163
169
|
elif isinstance(assets, str):
|
164
170
|
self._assets = [assets]
|
165
171
|
else:
|
166
172
|
raise TypeError(
|
167
|
-
"Assets must be a string (ticker), list of strings (tickers)
|
168
|
-
" a dict with {cat: List[str]} key-value pairs."
|
173
|
+
"Assets must be a string (ticker), list of strings (tickers),"
|
174
|
+
" a dict with {cat: List[str]} key-value pairs or dataframe."
|
169
175
|
)
|
170
176
|
|
171
177
|
@abstractmethod
|
@@ -187,14 +193,19 @@ class Library(ABC):
|
|
187
193
|
"""
|
188
194
|
Sets a list of available markets for the data vendor.
|
189
195
|
"""
|
190
|
-
if
|
196
|
+
if (
|
197
|
+
markets is None
|
198
|
+
or isinstance(markets, list)
|
199
|
+
or isinstance(markets, dict)
|
200
|
+
or isinstance(markets, pd.DataFrame)
|
201
|
+
):
|
191
202
|
self._markets = markets
|
192
203
|
elif isinstance(markets, str):
|
193
204
|
self._markets = [markets]
|
194
205
|
else:
|
195
206
|
raise TypeError(
|
196
|
-
"Markets must be a string (ticker), list of strings (tickers)
|
197
|
-
" a dict with {cat: List[str]} key-value pairs."
|
207
|
+
"Markets must be a string (ticker), list of strings (tickers),"
|
208
|
+
" a dict with {cat: List[str]} key-value pairs or dataframe."
|
198
209
|
)
|
199
210
|
|
200
211
|
@abstractmethod
|
@@ -179,7 +179,7 @@ class PandasDataReader(Library):
|
|
179
179
|
)
|
180
180
|
|
181
181
|
# list of fields
|
182
|
-
market_fields_list = ["open", "high", "low", "close", "volume", "er"]
|
182
|
+
market_fields_list = ["open", "high", "low", "close", "volume", "close_adj", "er"]
|
183
183
|
macro_fields_list = ["actual"]
|
184
184
|
|
185
185
|
# fields dict
|
@@ -750,14 +750,12 @@ class WrangleData:
|
|
750
750
|
if 'close' in self.data_resp.columns:
|
751
751
|
self.data_resp['date'] = pd.to_datetime(self.data_resp.date, unit='ms')
|
752
752
|
elif 'funding_rate' in self.data_resp.columns:
|
753
|
-
self.data_resp['date'] = pd.to_datetime(self.data_resp.set_index('date').index).
|
754
|
-
floor('S').tz_localize(None)
|
753
|
+
self.data_resp['date'] = pd.to_datetime(self.data_resp.set_index('date').index).floor('s').tz_localize(None)
|
755
754
|
# set index
|
756
755
|
self.data_resp = self.data_resp.set_index('date').sort_index()
|
757
756
|
# resample
|
758
757
|
if 'funding_rate' in self.data_resp.columns and self.data_req.freq in ['d', 'w', 'm', 'q', 'y']:
|
759
|
-
self.data_resp = (self.data_resp.funding_rate + 1).
|
760
|
-
diff().to_frame()
|
758
|
+
self.data_resp = ((self.data_resp.funding_rate + 1).resample(self.data_req.freq).prod() - 1).to_frame()
|
761
759
|
# type conversion
|
762
760
|
self.data_resp = self.data_resp.apply(pd.to_numeric, errors='coerce').convert_dtypes()
|
763
761
|
# remove bad data
|
@@ -1,4 +1,4 @@
|
|
1
|
-
cryptodatapy/.DS_Store,sha256=
|
1
|
+
cryptodatapy/.DS_Store,sha256=PAgbS0KIr24oqHYVH0XcuP_rM0ytXS0FIC_Y5fwb5wI,6148
|
2
2
|
cryptodatapy/.idea/.gitignore,sha256=qeVPxPCLyX2CwEvYb_N9OvhLqe9K2H_Py0ONq2Iuiqo,47
|
3
3
|
cryptodatapy/.idea/cryptodatapy.iml,sha256=w0TW3o9qEaYr1iYR1jwYqlUBYm3KyxgnCK1PD03XvwQ,441
|
4
4
|
cryptodatapy/.idea/csv-plugin.xml,sha256=kVn-REwnZha3y9sWKgqBd0RKNDr0acmLVCntWaqbMuw,392
|
@@ -7,16 +7,10 @@ cryptodatapy/.idea/inspectionProfiles/profiles_settings.xml,sha256=YXLFmX7rPNGcn
|
|
7
7
|
cryptodatapy/.idea/misc.xml,sha256=fNK-pK0wJ6JRyiTKlpP9aQ9NC3cvTTUtdSopmICNdyo,200
|
8
8
|
cryptodatapy/.idea/modules.xml,sha256=D8TS27hP9PgwvTAqVJX5b6hlLdLOwU0VNIuDSkK3ncw,276
|
9
9
|
cryptodatapy/.idea/vcs.xml,sha256=b_39r807_tBAMOSSbIxyjQKeZsNYXTI-_FCT1j3FXuE,186
|
10
|
-
cryptodatapy/.idea/workspace.xml,sha256=uYOxgCsZqpE-c-oMtqZ4tJNfHhMrPb8nsfpbadHw5iA,1880
|
11
10
|
cryptodatapy/__init__.py,sha256=ee1UaINHZn1A_SZ96XM3hCguQEJgiPTvKlnYsk3mmS4,185
|
12
|
-
cryptodatapy/conf/.pytest_cache/.gitignore,sha256=Ptcxtl0GFQwTji2tsL4Gl1UIiKa0frjEXsya26i46b0,37
|
13
|
-
cryptodatapy/conf/.pytest_cache/CACHEDIR.TAG,sha256=N9yI75oKvt2-gQU6bdj9-xOvthMEXqHrSlyBWnSjveQ,191
|
14
|
-
cryptodatapy/conf/.pytest_cache/README.md,sha256=c_1vzN2ALEGaay2YPWwxc7fal1WKxLWJ7ewt_kQ9ua0,302
|
15
|
-
cryptodatapy/conf/.pytest_cache/v/cache/nodeids,sha256=T1PNoYwrqgwDVLtfmj7L5e0Sq02OEbqHPC8RFhICuUU,2
|
16
|
-
cryptodatapy/conf/.pytest_cache/v/cache/stepwise,sha256=T1PNoYwrqgwDVLtfmj7L5e0Sq02OEbqHPC8RFhICuUU,2
|
17
11
|
cryptodatapy/conf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
12
|
cryptodatapy/conf/fields.csv,sha256=6gl7HSZyuNeDMEuaxn4XzMZdRfF2bjGFob3Th5olfko,25717
|
19
|
-
cryptodatapy/conf/tickers.csv,sha256=
|
13
|
+
cryptodatapy/conf/tickers.csv,sha256=9rMQvB_SgKiH-zoBNMEFK_fpznDIN9lU-xt0mD12aII,357205
|
20
14
|
cryptodatapy/datasets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
21
15
|
cryptodatapy/datasets/br_econ_calendar.csv,sha256=mSM0IOIByI-0gIIL1CbDQPqHYI5lK6vavrY1ODj3Jlk,1185318
|
22
16
|
cryptodatapy/datasets/ca_econ_calendar.csv,sha256=GtoopEhCSufBNjpAi2BiorSsm4RmoK5dfZe8lkOS-Jc,1521808
|
@@ -41,12 +35,6 @@ cryptodatapy/extract/data_vendors/.ipynb_checkpoints/DBNomics-checkpoint.ipynb,s
|
|
41
35
|
cryptodatapy/extract/data_vendors/.ipynb_checkpoints/InvestPy-checkpoint.ipynb,sha256=ybcHKXzmmlTYEoxC-qkWmd0Pjn1WjJ5CMPvMVotqJ7o,50215
|
42
36
|
cryptodatapy/extract/data_vendors/.ipynb_checkpoints/NasdaqDataLink-checkpoint.ipynb,sha256=hY2QkCcTiLgPnl8SQPsO8spio5-RBMGeBLYzAwgSWb4,147170
|
43
37
|
cryptodatapy/extract/data_vendors/.ipynb_checkpoints/PandasDataReader-checkpoint.ipynb,sha256=n7vzOV6AxC_Ti5CLWW2ABMEEcbbBpiBBs4qTUBQinIg,24171
|
44
|
-
cryptodatapy/extract/data_vendors/.ipynb_checkpoints/glassnode_api_test-checkpoint.ipynb,sha256=P_1fxjZ4x-UiDKgde9ibcn0k1i5ZAd4HesyYeaG3YYs,18910
|
45
|
-
cryptodatapy/extract/data_vendors/.pytest_cache/.gitignore,sha256=Ptcxtl0GFQwTji2tsL4Gl1UIiKa0frjEXsya26i46b0,37
|
46
|
-
cryptodatapy/extract/data_vendors/.pytest_cache/CACHEDIR.TAG,sha256=N9yI75oKvt2-gQU6bdj9-xOvthMEXqHrSlyBWnSjveQ,191
|
47
|
-
cryptodatapy/extract/data_vendors/.pytest_cache/README.md,sha256=c_1vzN2ALEGaay2YPWwxc7fal1WKxLWJ7ewt_kQ9ua0,302
|
48
|
-
cryptodatapy/extract/data_vendors/.pytest_cache/v/cache/nodeids,sha256=T1PNoYwrqgwDVLtfmj7L5e0Sq02OEbqHPC8RFhICuUU,2
|
49
|
-
cryptodatapy/extract/data_vendors/.pytest_cache/v/cache/stepwise,sha256=T1PNoYwrqgwDVLtfmj7L5e0Sq02OEbqHPC8RFhICuUU,2
|
50
38
|
cryptodatapy/extract/data_vendors/__init__.py,sha256=Nk6gcT43d0XOLfrlVA9r--5mvHCgHfq295IKL3Puu74,354
|
51
39
|
cryptodatapy/extract/data_vendors/coinmetrics_api.py,sha256=FrCMunpoF05sWrclgu2oTYT-BtDKYCOZxSHQBmMOPcg,33404
|
52
40
|
cryptodatapy/extract/data_vendors/cryptocompare_api.py,sha256=yFqU9eSXHiNx7dtJzJtofudumzCnH_TCgH6Waq2y4NY,28889
|
@@ -56,13 +44,11 @@ cryptodatapy/extract/data_vendors/tiingo_api.py,sha256=dUovHL3HfB5jFWxfUxMCYULTZ
|
|
56
44
|
cryptodatapy/extract/datarequest.py,sha256=0TdzpU0FbbLPQlFzFDOl-5masYy76n--F_DNUm5S68Q,18139
|
57
45
|
cryptodatapy/extract/getdata.py,sha256=HzWQyacfmphms97LVKbx1gEgcgsQJViBT4BBxL9TBXk,8703
|
58
46
|
cryptodatapy/extract/libraries/__init__.py,sha256=9rJ_hFHWlvkPwyIkNG5bqH6HTY2jQNPIKQjzYEsVSDo,319
|
59
|
-
cryptodatapy/extract/libraries/ccxt_api.py,sha256=
|
47
|
+
cryptodatapy/extract/libraries/ccxt_api.py,sha256=3y4egw71fSp9It9m2gRxBssIdLtJfwtL5rqQtYu5LYM,28205
|
60
48
|
cryptodatapy/extract/libraries/dbnomics_api.py,sha256=M6kPIH-hKqkmeBQb-g56dY9jatqLCtSl_MnvPblHtAc,9421
|
61
49
|
cryptodatapy/extract/libraries/investpy_api.py,sha256=qtGm3LDluXxJorvFv0w1bm1oBrcZIfE5cZSYzNYvttY,18409
|
62
|
-
cryptodatapy/extract/libraries/library.py,sha256=
|
63
|
-
cryptodatapy/extract/libraries/pandasdr_api.py,sha256=
|
64
|
-
cryptodatapy/extract/web/.ipynb_checkpoints/Untitled-checkpoint.ipynb,sha256=SmK2imM9ecU6b9iJPo6kLc8rmoo-kHsbmGFmHwTyFRc,72
|
65
|
-
cryptodatapy/extract/web/Untitled.ipynb,sha256=_173wJwOJjbpp-IAnrQBYkl9P3hFyk531EXwJ7yvIKw,20624
|
50
|
+
cryptodatapy/extract/libraries/library.py,sha256=070YsO1RJzm4z_enhCjqe5hrj8qsk-Ni0Q_QKoAwQ6U,12316
|
51
|
+
cryptodatapy/extract/libraries/pandasdr_api.py,sha256=GdNi7ybPqSD2ieuUaaIyhTSmZG-YchMs_P4WQIy5JBw,12943
|
66
52
|
cryptodatapy/extract/web/__init__.py,sha256=8i0fweCeqSpdiPf-47jT240I4ca6SizCu9aD-qDS67w,89
|
67
53
|
cryptodatapy/extract/web/aqr.py,sha256=LS1D7QzG6UWkLUfDMgBFtiHpznnnAUOpec5Sx3vRGME,11875
|
68
54
|
cryptodatapy/extract/web/web.py,sha256=27cAzlIyYn6R29726J7p9NhSwHypas9EQSjHLILtcjk,9748
|
@@ -72,11 +58,11 @@ cryptodatapy/transform/convertparams.py,sha256=WuQuPxKkjBy85F4NCYdSLWIls-1Avltu6
|
|
72
58
|
cryptodatapy/transform/filter.py,sha256=x7SGQjsdLlQb5FpoPjOQBLZUXgQJZ7rigRsyZPyLL-M,10347
|
73
59
|
cryptodatapy/transform/impute.py,sha256=CYlRuw_1K8pi6Nm9P8llKmsN010Ck6Z0sQ-P-tJqYYg,6855
|
74
60
|
cryptodatapy/transform/od.py,sha256=rhZ9BkSh4tOiaQBgE7MkUyF8FBLdgG9IP2MOz8wAQsg,38977
|
75
|
-
cryptodatapy/transform/wrangle.py,sha256=
|
61
|
+
cryptodatapy/transform/wrangle.py,sha256=cBPV2Ub4RmVCdFdx3UlOlI2s4Rc_zzoMAXWcJvqbehs,40157
|
76
62
|
cryptodatapy/util/__init__.py,sha256=zSQ2HU2QIXzCuptJjknmrClwtQKCvIj4aNysZljIgrU,116
|
77
63
|
cryptodatapy/util/datacatalog.py,sha256=qCCX6srXvaAbVAKuA0M2y5IK_2OEx5xA3yRahDZlC-g,13157
|
78
64
|
cryptodatapy/util/datacredentials.py,sha256=KkfJJqDr1jvzdlvpKNqrPwDvWyfbA5GDY87ZG3PHpIA,1510
|
79
|
-
cryptodatapy-0.2.
|
80
|
-
cryptodatapy-0.2.
|
81
|
-
cryptodatapy-0.2.
|
82
|
-
cryptodatapy-0.2.
|
65
|
+
cryptodatapy-0.2.2.dist-info/LICENSE,sha256=sw4oVq8bDjT3uMtaFebQ-xeIVP4H-bXldTs9q-Jjeks,11344
|
66
|
+
cryptodatapy-0.2.2.dist-info/WHEEL,sha256=y3eDiaFVSNTPbgzfNn0nYn5tEn1cX6WrdetDlQM4xWw,83
|
67
|
+
cryptodatapy-0.2.2.dist-info/METADATA,sha256=xohKU3vOAeYWJUGD_K72iaurOCX4dUxduLJOuvJoEQ0,6188
|
68
|
+
cryptodatapy-0.2.2.dist-info/RECORD,,
|
cryptodatapy/.idea/workspace.xml
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<project version="4">
|
3
|
-
<component name="AutoImportSettings">
|
4
|
-
<option name="autoReloadType" value="SELECTIVE" />
|
5
|
-
</component>
|
6
|
-
<component name="ChangeListManager">
|
7
|
-
<list default="true" id="92febf09-7ac8-47ba-8a87-a519768464c7" name="Changes" comment="" />
|
8
|
-
<option name="SHOW_DIALOG" value="false" />
|
9
|
-
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
10
|
-
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
11
|
-
<option name="LAST_RESOLUTION" value="IGNORE" />
|
12
|
-
</component>
|
13
|
-
<component name="Git.Settings">
|
14
|
-
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../.." />
|
15
|
-
</component>
|
16
|
-
<component name="MarkdownSettingsMigration">
|
17
|
-
<option name="stateVersion" value="1" />
|
18
|
-
</component>
|
19
|
-
<component name="ProjectId" id="2QibbOcBNNYUvHIEuh3raGrbChp" />
|
20
|
-
<component name="ProjectViewState">
|
21
|
-
<option name="hideEmptyMiddlePackages" value="true" />
|
22
|
-
<option name="showLibraryContents" value="true" />
|
23
|
-
</component>
|
24
|
-
<component name="PropertiesComponent">{
|
25
|
-
"keyToString": {
|
26
|
-
"RunOnceActivity.ShowReadmeOnStart": "true",
|
27
|
-
"last_opened_file_path": "/Users/nickl/projects/systamental/cryptodatapy/src/cryptodatapy"
|
28
|
-
}
|
29
|
-
}</component>
|
30
|
-
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
31
|
-
<component name="TaskManager">
|
32
|
-
<task active="true" id="Default" summary="Default task">
|
33
|
-
<changelist id="92febf09-7ac8-47ba-8a87-a519768464c7" name="Changes" comment="" />
|
34
|
-
<created>1685839420372</created>
|
35
|
-
<option name="number" value="Default" />
|
36
|
-
<option name="presentableId" value="Default" />
|
37
|
-
<updated>1685839420372</updated>
|
38
|
-
</task>
|
39
|
-
<servers />
|
40
|
-
</component>
|
41
|
-
</project>
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# pytest cache directory #
|
2
|
-
|
3
|
-
This directory contains data from the pytest's cache plugin,
|
4
|
-
which provides the `--lf` and `--ff` options, as well as the `cache` fixture.
|
5
|
-
|
6
|
-
**Do not** commit this to version control.
|
7
|
-
|
8
|
-
See [the docs](https://docs.pytest.org/en/stable/how-to/cache.html) for more information.
|
@@ -1 +0,0 @@
|
|
1
|
-
[]
|
@@ -1 +0,0 @@
|
|
1
|
-
[]
|