cryptodatapy 0.2.3__py3-none-any.whl → 0.2.5__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/libraries/ccxt.ipynb +873 -0
- cryptodatapy/extract/libraries/ccxt_api.py +40 -133
- cryptodatapy/transform/clean.py +43 -7
- cryptodatapy/transform/clean_perp_futures_ohlcv.ipynb +1254 -689
- cryptodatapy/transform/convertparams.py +0 -1
- cryptodatapy/transform/filter.py +31 -4
- {cryptodatapy-0.2.3.dist-info → cryptodatapy-0.2.5.dist-info}/METADATA +4 -1
- {cryptodatapy-0.2.3.dist-info → cryptodatapy-0.2.5.dist-info}/RECORD +10 -9
- {cryptodatapy-0.2.3.dist-info → cryptodatapy-0.2.5.dist-info}/LICENSE +0 -0
- {cryptodatapy-0.2.3.dist-info → cryptodatapy-0.2.5.dist-info}/WHEEL +0 -0
cryptodatapy/transform/filter.py
CHANGED
@@ -88,7 +88,8 @@ class Filter:
|
|
88
88
|
|
89
89
|
# add excl cols
|
90
90
|
if self.excl_cols is not None:
|
91
|
-
self.filtered_df = pd.concat([self.filtered_df,
|
91
|
+
self.filtered_df = pd.concat([self.filtered_df,
|
92
|
+
self.raw_df[self.excl_cols].reindex(self.filtered_df.index)], axis=1)
|
92
93
|
|
93
94
|
return self.filtered_df
|
94
95
|
|
@@ -132,7 +133,8 @@ class Filter:
|
|
132
133
|
|
133
134
|
# add excl cols
|
134
135
|
if self.excl_cols is not None:
|
135
|
-
self.filtered_df = pd.concat([self.df,
|
136
|
+
self.filtered_df = pd.concat([self.df,
|
137
|
+
self.raw_df[self.excl_cols].reindex(self.df)], axis=1)
|
136
138
|
else:
|
137
139
|
self.filtered_df = self.df
|
138
140
|
|
@@ -164,8 +166,33 @@ class Filter:
|
|
164
166
|
# drop tickers with nobs < cs_obs
|
165
167
|
obs = self.filtered_df.groupby(level=0).count().min(axis=1)
|
166
168
|
idx_start = obs[obs > cs_obs].index[0]
|
167
|
-
# self.filtered_df = self.filtered_df.unstack()[self.filtered_df.unstack().index > idx_start].stack()
|
168
169
|
self.filtered_df = self.filtered_df.loc[idx_start:]
|
170
|
+
|
171
|
+
return self.filtered_df
|
172
|
+
|
173
|
+
def remove_delisted(self, field: str = 'close', n_unch_vals: int = 30) -> pd.DataFrame:
|
174
|
+
"""
|
175
|
+
Removes delisted tickers from dataframe.
|
176
|
+
|
177
|
+
Parameters
|
178
|
+
----------
|
179
|
+
field: str, default 'close'
|
180
|
+
Field/column to use for detecting delisted tickers.
|
181
|
+
n_unch_vals: int, default 30
|
182
|
+
Number of consecutive unchanged values to consider a ticker as delisted.
|
183
|
+
|
184
|
+
Returns
|
185
|
+
-------
|
186
|
+
filtered_df: pd.DataFrame - MultiIndex
|
187
|
+
Filtered dataFrame with DatetimeIndex (level 0), tickers (level 1) and fields (cols).
|
188
|
+
"""
|
189
|
+
# delisted tickers
|
190
|
+
delisted_tickers = self.df[field].unstack()[self.df[field].unstack().pct_change().iloc[-n_unch_vals:] == 0].\
|
191
|
+
dropna(how='all', axis=0).dropna(thresh=n_unch_vals, axis=1).columns
|
192
|
+
|
193
|
+
# drop delisted tickers
|
194
|
+
self.filtered_df = self.df.drop(delisted_tickers, level=1)
|
195
|
+
|
169
196
|
return self.filtered_df
|
170
197
|
|
171
198
|
def tickers(self, tickers_list) -> pd.DataFrame:
|
@@ -188,7 +215,7 @@ class Filter:
|
|
188
215
|
tickers_list = [tickers_list]
|
189
216
|
|
190
217
|
# drop tickers
|
191
|
-
self.filtered_df = self.df.drop(tickers_list, level=1
|
218
|
+
self.filtered_df = self.df.drop(tickers_list, level=1)
|
192
219
|
|
193
220
|
return self.filtered_df
|
194
221
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: cryptodatapy
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.5
|
4
4
|
Summary: Cryptoasset data library
|
5
5
|
License: Apache-2.0
|
6
6
|
Author: Systamental
|
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
13
13
|
Requires-Dist: DBnomics (>=1.2.3)
|
14
14
|
Requires-Dist: ccxt (>=1.91.52)
|
15
15
|
Requires-Dist: coinmetrics-api-client (>=2022.6.17); python_version >= "3.7"
|
16
|
+
Requires-Dist: fsspec (>=2024.6.1)
|
16
17
|
Requires-Dist: investpy (>=1.0.8)
|
17
18
|
Requires-Dist: matplotlib (>=3.5.2)
|
18
19
|
Requires-Dist: numpy (>=1.23.2)
|
@@ -20,8 +21,10 @@ Requires-Dist: openpyxl (>=3.1.2)
|
|
20
21
|
Requires-Dist: pandas (>=1.4.4)
|
21
22
|
Requires-Dist: pandas-datareader (>=0.10.0)
|
22
23
|
Requires-Dist: prophet (>=1.1); python_version >= "3.7"
|
24
|
+
Requires-Dist: pyarrow (>=17.0.0)
|
23
25
|
Requires-Dist: requests (>=2.28.0); python_version >= "3.7"
|
24
26
|
Requires-Dist: responses (>=0.21.0)
|
27
|
+
Requires-Dist: s3fs (>=2024.6.1,<2025.0.0)
|
25
28
|
Requires-Dist: selenium (>=4.4.3)
|
26
29
|
Requires-Dist: statsmodels (>=0.13.2)
|
27
30
|
Requires-Dist: webdriver-manager (>=3.8.3)
|
@@ -45,7 +45,8 @@ cryptodatapy/extract/data_vendors/tiingo_api.py,sha256=dUovHL3HfB5jFWxfUxMCYULTZ
|
|
45
45
|
cryptodatapy/extract/datarequest.py,sha256=0TdzpU0FbbLPQlFzFDOl-5masYy76n--F_DNUm5S68Q,18139
|
46
46
|
cryptodatapy/extract/getdata.py,sha256=HzWQyacfmphms97LVKbx1gEgcgsQJViBT4BBxL9TBXk,8703
|
47
47
|
cryptodatapy/extract/libraries/__init__.py,sha256=9rJ_hFHWlvkPwyIkNG5bqH6HTY2jQNPIKQjzYEsVSDo,319
|
48
|
-
cryptodatapy/extract/libraries/
|
48
|
+
cryptodatapy/extract/libraries/ccxt.ipynb,sha256=soYwl7McUc5IHrlnPVysP5YQ5we4UO2DJE5go0b2n3Q,34526
|
49
|
+
cryptodatapy/extract/libraries/ccxt_api.py,sha256=V-uYfE7LfURZG33_C26faG2j59b6nvPvw0lmrpWKolQ,24721
|
49
50
|
cryptodatapy/extract/libraries/dbnomics_api.py,sha256=M6kPIH-hKqkmeBQb-g56dY9jatqLCtSl_MnvPblHtAc,9421
|
50
51
|
cryptodatapy/extract/libraries/investpy_api.py,sha256=qtGm3LDluXxJorvFv0w1bm1oBrcZIfE5cZSYzNYvttY,18409
|
51
52
|
cryptodatapy/extract/libraries/library.py,sha256=070YsO1RJzm4z_enhCjqe5hrj8qsk-Ni0Q_QKoAwQ6U,12316
|
@@ -54,17 +55,17 @@ cryptodatapy/extract/web/__init__.py,sha256=8i0fweCeqSpdiPf-47jT240I4ca6SizCu9aD
|
|
54
55
|
cryptodatapy/extract/web/aqr.py,sha256=LS1D7QzG6UWkLUfDMgBFtiHpznnnAUOpec5Sx3vRGME,11875
|
55
56
|
cryptodatapy/extract/web/web.py,sha256=27cAzlIyYn6R29726J7p9NhSwHypas9EQSjHLILtcjk,9748
|
56
57
|
cryptodatapy/transform/__init__.py,sha256=Spb5cGJ3V_o8hgSWOSrF8J_vsSZpFk0uzW7RpkgfbFE,131
|
57
|
-
cryptodatapy/transform/clean.py,sha256=
|
58
|
-
cryptodatapy/transform/clean_perp_futures_ohlcv.ipynb,sha256=
|
59
|
-
cryptodatapy/transform/convertparams.py,sha256=
|
60
|
-
cryptodatapy/transform/filter.py,sha256=
|
58
|
+
cryptodatapy/transform/clean.py,sha256=uWz9qO55o3-TZGZPPsr0tXAhg2QLMElQ6EkNy-pV96Q,12660
|
59
|
+
cryptodatapy/transform/clean_perp_futures_ohlcv.ipynb,sha256=ZCUKUSQI9YDhFt8H9fcBr3SV13FYyFp-8vXqiYWHNhM,62498
|
60
|
+
cryptodatapy/transform/convertparams.py,sha256=Y7lDVmRw6bZXOhFwFxczJzPURosb1haQIpZcQyIM42Q,44284
|
61
|
+
cryptodatapy/transform/filter.py,sha256=TH1cPeV8kylW2MsIeP2ilroOLe43gN8t7lLd7qVESmc,8982
|
61
62
|
cryptodatapy/transform/impute.py,sha256=c7qdgFg0qs_xuQnX0jazpt0wgASC0KElLZRuxTkeVKY,5519
|
62
63
|
cryptodatapy/transform/od.py,sha256=LHCzs-Q1hWHixWaQLhnHRacI-sVNlLX_EFv4jOpp4Zk,31008
|
63
64
|
cryptodatapy/transform/wrangle.py,sha256=cBPV2Ub4RmVCdFdx3UlOlI2s4Rc_zzoMAXWcJvqbehs,40157
|
64
65
|
cryptodatapy/util/__init__.py,sha256=zSQ2HU2QIXzCuptJjknmrClwtQKCvIj4aNysZljIgrU,116
|
65
66
|
cryptodatapy/util/datacatalog.py,sha256=qCCX6srXvaAbVAKuA0M2y5IK_2OEx5xA3yRahDZlC-g,13157
|
66
67
|
cryptodatapy/util/datacredentials.py,sha256=KkfJJqDr1jvzdlvpKNqrPwDvWyfbA5GDY87ZG3PHpIA,1510
|
67
|
-
cryptodatapy-0.2.
|
68
|
-
cryptodatapy-0.2.
|
69
|
-
cryptodatapy-0.2.
|
70
|
-
cryptodatapy-0.2.
|
68
|
+
cryptodatapy-0.2.5.dist-info/LICENSE,sha256=sw4oVq8bDjT3uMtaFebQ-xeIVP4H-bXldTs9q-Jjeks,11344
|
69
|
+
cryptodatapy-0.2.5.dist-info/WHEEL,sha256=y3eDiaFVSNTPbgzfNn0nYn5tEn1cX6WrdetDlQM4xWw,83
|
70
|
+
cryptodatapy-0.2.5.dist-info/METADATA,sha256=0EFq0C4Wiznup8Kf3JqXwfMCG09SOOcCv8UiPUPU_fE,6300
|
71
|
+
cryptodatapy-0.2.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|