cryptodatapy 0.2.10__tar.gz → 0.2.11__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.10 → cryptodatapy-0.2.11}/PKG-INFO +5 -5
  2. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/pyproject.toml +3 -3
  3. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/transform/convertparams.py +119 -1
  4. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/transform/impute.py +2 -1
  5. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/transform/wrangle.py +4 -10
  6. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/LICENSE +0 -0
  7. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/README.md +0 -0
  8. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/__init__.py +0 -0
  9. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/conf/__init__.py +0 -0
  10. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/conf/fields.csv +0 -0
  11. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/conf/tickers.csv +0 -0
  12. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/datasets/__init__.py +0 -0
  13. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/datasets/br_econ_calendar.csv +0 -0
  14. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/datasets/ca_econ_calendar.csv +0 -0
  15. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/datasets/cn_econ_calendar.csv +0 -0
  16. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/datasets/de_econ_calendar.csv +0 -0
  17. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/datasets/ez_econ_calendar.csv +0 -0
  18. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/datasets/fr_econ_calendar.csv +0 -0
  19. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/datasets/gb_econ_calendar.csv +0 -0
  20. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/datasets/get_econ_calendars.py +0 -0
  21. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/datasets/id_econ_calendar.csv +0 -0
  22. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/datasets/in_econ_calendar.csv +0 -0
  23. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/datasets/it_econ_calendar.csv +0 -0
  24. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/datasets/jp_econ_calendar.csv +0 -0
  25. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/datasets/kr_econ_calendar.csv +0 -0
  26. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/datasets/mx_econ_calendar.csv +0 -0
  27. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/datasets/ru_econ_calendar.csv +0 -0
  28. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/datasets/tr_econ_calendar.csv +0 -0
  29. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/datasets/us_econ_calendar.csv +0 -0
  30. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/__init__.py +0 -0
  31. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/data_vendors/.ipynb_checkpoints/CCXT-checkpoint.ipynb +0 -0
  32. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/data_vendors/.ipynb_checkpoints/DBNomics-checkpoint.ipynb +0 -0
  33. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/data_vendors/.ipynb_checkpoints/InvestPy-checkpoint.ipynb +0 -0
  34. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/data_vendors/.ipynb_checkpoints/NasdaqDataLink-checkpoint.ipynb +0 -0
  35. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/data_vendors/.ipynb_checkpoints/PandasDataReader-checkpoint.ipynb +0 -0
  36. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/data_vendors/__init__.py +0 -0
  37. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/data_vendors/coinmetrics_api.py +0 -0
  38. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/data_vendors/cryptocompare_api.py +0 -0
  39. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/data_vendors/datavendor.py +0 -0
  40. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/data_vendors/glassnode_api.py +0 -0
  41. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/data_vendors/tiingo_api.py +0 -0
  42. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/datarequest.py +0 -0
  43. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/exchanges/__init__.py +0 -0
  44. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/exchanges/dydx.py +0 -0
  45. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/exchanges/exchange.py +0 -0
  46. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/getdata.py +0 -0
  47. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/libraries/__init__.py +0 -0
  48. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/libraries/ccxt_api.py +0 -0
  49. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/libraries/dbnomics_api.py +0 -0
  50. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/libraries/investpy_api.py +0 -0
  51. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/libraries/library.py +0 -0
  52. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/libraries/pandasdr_api.py +0 -0
  53. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/web/__init__.py +0 -0
  54. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/web/aqr.py +0 -0
  55. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/extract/web/web.py +0 -0
  56. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/transform/__init__.py +0 -0
  57. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/transform/clean.py +0 -0
  58. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/transform/filter.py +0 -0
  59. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/transform/od.py +0 -0
  60. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/util/__init__.py +0 -0
  61. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/util/datacatalog.py +0 -0
  62. {cryptodatapy-0.2.10 → cryptodatapy-0.2.11}/src/cryptodatapy/util/datacredentials.py +0 -0
@@ -1,17 +1,17 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: cryptodatapy
3
- Version: 0.2.10
3
+ Version: 0.2.11
4
4
  Summary: Cryptoasset data library
5
5
  License: Apache-2.0
6
6
  Author: Systamental
7
- Requires-Python: >=3.8,<4.0
7
+ Requires-Python: >=3.9,<4.0
8
8
  Classifier: License :: OSI Approved :: Apache Software License
9
9
  Classifier: Programming Language :: Python :: 3
10
- Classifier: Programming Language :: Python :: 3.8
11
10
  Classifier: Programming Language :: Python :: 3.9
12
11
  Classifier: Programming Language :: Python :: 3.10
13
12
  Classifier: Programming Language :: Python :: 3.11
14
13
  Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
15
  Requires-Dist: DBnomics (>=1.2.3)
16
16
  Requires-Dist: ccxt (>=1.91.52)
17
17
  Requires-Dist: coinmetrics-api-client (>=2022.6.17) ; python_version >= "3.7"
@@ -20,7 +20,7 @@ Requires-Dist: investpy (>=1.0.8)
20
20
  Requires-Dist: matplotlib (>=3.5.2)
21
21
  Requires-Dist: numpy (>=1.23.2)
22
22
  Requires-Dist: openpyxl (>=3.1.2)
23
- Requires-Dist: pandas (>=1.4.4)
23
+ Requires-Dist: pandas (>=2.2.3)
24
24
  Requires-Dist: pandas-datareader (>=0.10.0)
25
25
  Requires-Dist: prophet (>=1.1) ; python_version >= "3.7"
26
26
  Requires-Dist: pyarrow (>=17.0.0)
@@ -1,13 +1,13 @@
1
1
  [tool.poetry]
2
2
  name = "cryptodatapy"
3
- version = "0.2.10"
3
+ version = "0.2.11"
4
4
  description = "Cryptoasset data library"
5
5
  authors = ["Systamental"]
6
6
  license = "Apache License 2.0"
7
7
  readme = "README.md"
8
8
 
9
9
  [tool.poetry.dependencies]
10
- python = ">=3.8,<4.0"
10
+ python = ">=3.9,<4.0"
11
11
  matplotlib = ">=3.5.2"
12
12
  requests = {version = ">=2.28.0", python = ">=3.7"}
13
13
  coinmetrics-api-client = {version = ">=2022.6.17", python = ">=3.7"}
@@ -19,7 +19,7 @@ statsmodels = ">=0.13.2"
19
19
  prophet = {version = ">=1.1", python = ">=3.7"}
20
20
  selenium = ">=4.4.3"
21
21
  numpy = ">=1.23.2"
22
- pandas = ">=1.4.4"
22
+ pandas = ">=2.2.3"
23
23
  pandas-datareader = ">=0.10.0"
24
24
  responses = ">=0.21.0"
25
25
  yfinance = ">=0.2.14"
@@ -1020,7 +1020,7 @@ class ConvertParams:
1020
1020
  List of fields in data source format.
1021
1021
 
1022
1022
  """
1023
- # get fields
1023
+ # x fields
1024
1024
  with resources.path("cryptodatapy.conf", "fields.csv") as f:
1025
1025
  fields_dict_path = f
1026
1026
  fields_df, fields_list = (
@@ -1045,3 +1045,121 @@ class ConvertParams:
1045
1045
  )
1046
1046
 
1047
1047
  return fields_list
1048
+
1049
+ def to_dydx_dict(self) -> Dict[str, Union[list, str, int, float, None]]:
1050
+ """
1051
+ Convert parameters from CryptoDataPy to dYdX format.
1052
+ """
1053
+ if self.data_req.source_tickers is not None:
1054
+ tickers = self.data_req.source_tickers
1055
+ self.data_req.tickers = self.data_req.source_tickers
1056
+ else:
1057
+ tickers = [ticker.upper() for ticker in self.data_req.tickers]
1058
+
1059
+ # convert markets (if needed)
1060
+ markets = [f"{ticker}-USD" for ticker in tickers]
1061
+
1062
+ # convert freq
1063
+ if self.data_req.source_freq is not None:
1064
+ freq = self.data_req.source_freq
1065
+ self.data_req.freq = self.data_req.source_freq
1066
+ else:
1067
+ if self.data_req.freq is None:
1068
+ freq = "1DAY"
1069
+ elif self.data_req.freq == "1min":
1070
+ freq = "1MIN"
1071
+ elif self.data_req.freq == "5min":
1072
+ freq = "5MINS"
1073
+ elif self.data_req.freq == "15min":
1074
+ freq = "15MINS"
1075
+ elif self.data_req.freq == "30min":
1076
+ freq = "30MINS"
1077
+ elif self.data_req.freq == "1h":
1078
+ freq = "1HOUR"
1079
+ elif self.data_req.freq == "4h":
1080
+ freq = "4HOURS"
1081
+ elif self.data_req.freq in ["1d", "d"]:
1082
+ freq = "1DAY"
1083
+ else:
1084
+ freq = "1DAY" # Default to daily
1085
+
1086
+ # convert fields
1087
+ if self.data_req.source_fields is not None:
1088
+ fields = self.data_req.source_fields
1089
+ self.data_req.fields = self.data_req.source_fields
1090
+ else:
1091
+ # Map our standard fields to dYdX field names
1092
+ field_mapping = {
1093
+ 'open': 'open',
1094
+ 'high': 'high',
1095
+ 'low': 'low',
1096
+ 'close': 'close',
1097
+ 'volume': 'baseTokenVolume',
1098
+ 'funding_rate': 'nextFundingRate',
1099
+ 'oi': 'openInterest'
1100
+ }
1101
+
1102
+ fields = []
1103
+ for field in self.data_req.fields:
1104
+ if field in field_mapping:
1105
+ fields.append(field_mapping[field])
1106
+ else:
1107
+ logging.warning(f"Field {field} not available in dYdX API")
1108
+ return {
1109
+ "tickers": tickers, # List of market tickers
1110
+ "freq": freq, # Converted frequency
1111
+ "quote_ccy": self.data_req.quote_ccy,
1112
+ "exch": "dydx",
1113
+ "mkt_type": self.data_req.mkt_type,
1114
+ "mkts": markets, # Market identifiers
1115
+ "start_date": self.data_req.start_date,
1116
+ "end_date": self.data_req.end_date,
1117
+ "fields": fields, # Converted field names
1118
+ "tz": self.data_req.tz or "UTC",
1119
+ "cat": "crypto",
1120
+ "trials": self.data_req.trials,
1121
+ "pause": self.data_req.pause,
1122
+ "source_tickers": self.data_req.source_tickers,
1123
+ "source_freq": self.data_req.source_freq,
1124
+ "source_fields": self.data_req.source_fields,
1125
+ }
1126
+
1127
+ def to_dydx(self) -> DataRequest:
1128
+
1129
+ # tickers
1130
+ if self.data_req.source_tickers is None:
1131
+ self.data_req.source_tickers = [ticker.upper() for ticker in self.data_req.tickers]
1132
+
1133
+ # markets
1134
+ if self.data_req.source_markets is None:
1135
+ self.data_req.source_markets = [f"{ticker}-USD"
1136
+ for ticker in self.data_req.source_tickers]
1137
+
1138
+ if self.data_req.source_freq is None:
1139
+ if self.data_req.freq is None:
1140
+ self.data_req.source_freq = "1DAY"
1141
+ elif self.data_req.freq == "1min":
1142
+ self.data_req.source_freq = "1MIN"
1143
+ elif self.data_req.freq == "5min":
1144
+ self.data_req.source_freq = "5MINS"
1145
+ elif self.data_req.freq == "15min":
1146
+ self.data_req.source_freq = "15MINS"
1147
+ elif self.data_req.freq == "30min":
1148
+ self.data_req.source_freq = "30MINS"
1149
+ elif self.data_req.freq == "1h":
1150
+ self.data_req.source_freq = "1HOUR"
1151
+ elif self.data_req.freq == "4h":
1152
+ self.data_req.source_freq = "4HOURS"
1153
+ elif self.data_req.freq in ["1d", "d"]:
1154
+ self.data_req.source_freq = "1DAY"
1155
+
1156
+ field_mapping = {
1157
+ 'open': 'open',
1158
+ 'high': 'high',
1159
+ 'low': 'low',
1160
+ 'close': 'close',
1161
+ 'volume': 'baseTokenVolume',
1162
+ 'funding_rate': 'nextFundingRate',
1163
+ 'oi': 'openInterest'
1164
+ }
1165
+ return self.data_req
@@ -121,7 +121,8 @@ class Impute:
121
121
  self.imputed_df = pd.DataFrame(imp_yhat, index=self.filtered_df.index, columns=self.filtered_df.columns)
122
122
 
123
123
  # type conversion
124
- self.imputed_df = self.imputed_df.apply(pd.to_numeric, errors="ignore").convert_dtypes()
124
+ self.imputed_df = self.imputed_df.convert_dtypes()
125
+
125
126
 
126
127
  # plot
127
128
  if self.plot:
@@ -911,13 +911,10 @@ class WrangleData:
911
911
  # tickers
912
912
  tickers_dict = {source_ticker: ticker for source_ticker, ticker in zip(self.data_req.source_tickers,
913
913
  self.data_req.tickers)}
914
- if len(self.data_req.tickers) == 1:
915
- self.data_resp['Ticker'] = self.data_req.tickers[0]
916
- else:
917
- self.data_resp = self.data_resp.stack()
918
- self.data_resp.index.names = ['Date', 'Ticker']
919
- self.data_resp.index = self.data_resp.index.set_levels(self.data_resp.index.levels[1].map(tickers_dict),
920
- level=1)
914
+ self.data_resp = self.data_resp.stack(future_stack=True)
915
+ self.data_resp.columns.name = None
916
+ self.data_resp.index = self.data_resp.index.set_levels(self.data_resp.index.levels[1].map(tickers_dict),
917
+ level=1)
921
918
  self.data_resp.reset_index(inplace=True)
922
919
 
923
920
  # fields
@@ -932,9 +929,6 @@ class WrangleData:
932
929
  resample(self.data_req.freq, level='date').\
933
930
  last().swaplevel('ticker', 'date').sort_index()
934
931
 
935
- # re-order cols
936
- self.data_resp = self.data_resp.loc[:, ['open', 'high', 'low', 'close', 'close_adj', 'volume']]
937
-
938
932
  # type conversion
939
933
  self.data_resp = self.data_resp.apply(pd.to_numeric, errors='coerce').convert_dtypes()
940
934
 
File without changes
File without changes