cryptodatapy 0.2.6__py3-none-any.whl → 0.2.7__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.
@@ -27,7 +27,7 @@ vwap,volume-weighted avg price,average volume-weighted price of quote asset with
27
27
  dividend,dividend,dividend paid out on ex-ante date,market,ohlc_bars,d ,quote currency units,Float64,,,,,,divCash,,,,,,
28
28
  split,split,"factor used to adjust prices when a company splits, reverse splits, or pays a distribution",market,ohlc_bars,d ,factor ,Float64,,,,,,splitFactor,,,,,,
29
29
  ref_rate_usd,reference rate in USD,price of asset in USD using an aggregation methodology,market,ohlc_bars,d ,quote currency units,Float64,,ReferenceRateUSD,,,,,,,,,,
30
- oi,open interest,number of outstanding futures contracts that are open and have yet to be settled,market,derivatives,"1min, 5min, 10min, 15min, 30min, 1h, 2h, 4h, 8h, d, w, m, q",number of contracts,Float64,,contract_count,,,,,,,,,,
30
+ oi,open interest,number of outstanding futures contracts that are open and have yet to be settled,market,derivatives,"1min, 5min, 10min, 15min, 30min, 1h, 2h, 4h, 8h, d, w, m, q",number of contracts,Float64,,contract_count,openInterestAmount,,,,,,,,,
31
31
  funding_rate,funding rate,interest rate for holding derivative contract within time interval,market,derivatives,"1h, 2h, 4h, 8h, d, w, m, q",interest rate over time interval,Float64,,rate,fundingRate,derivatives/futures_funding_rate_perpetual,,,,,,,,
32
32
  mkt_cap,market capitalization,usd value of circulating supply,market,market capitalization,"d, w, m, q",usd,Float64,,CapMrktCurUSD,,market/marketcap_usd,,,,,,,,
33
33
  mkt_cap_real,"market capitalization, reaized","The sum USD value based on the USD closing price on the day that a native unit last moved (i.e., last transacted) for all native units",market,market capitalization,"d, w, m, q",usd,Float64,,CapRealUSD,,,,,,,,,,
@@ -17,8 +17,9 @@ class DataRequest:
17
17
  self,
18
18
  source: str = "ccxt",
19
19
  tickers: Union[str, List[str]] = "btc",
20
- freq: str = "d",
21
20
  quote_ccy: Optional[str] = None,
21
+ markets: Optional[Union[str, List[str]]] = None,
22
+ freq: str = "d",
22
23
  exch: Optional[str] = None,
23
24
  mkt_type: Optional[str] = "spot",
24
25
  start_date: Optional[Union[str, datetime, pd.Timestamp]] = None,
@@ -30,8 +31,11 @@ class DataRequest:
30
31
  trials: Optional[int] = 3,
31
32
  pause: Optional[float] = 0.1,
32
33
  source_tickers: Optional[Union[str, List[str]]] = None,
34
+ source_markets: Optional[Union[str, List[str]]] = None,
33
35
  source_freq: Optional[str] = None,
34
- source_fields: Optional[Union[str, List[str]]] = None,
36
+ source_start_date: Optional[Union[str, int, datetime, pd.Timestamp]] = None,
37
+ source_end_date: Optional[Union[str, int, datetime, pd.Timestamp]] = None,
38
+ source_fields: Optional[Union[str, List[str]]] = None
35
39
  ):
36
40
  """
37
41
  Constructor
@@ -41,12 +45,14 @@ class DataRequest:
41
45
  source: str, default 'ccxt'
42
46
  Name of data source.
43
47
  tickers: list or str, default 'btc'
44
- Ticker symbols for assets or time series.
45
- e.g. 'BTC', 'EURUSD', 'SPY', 'US_Manuf_PMI', 'EZ_Rates_10Y', etc.
48
+ Ticker symbols for base assets.
49
+ e.g. 'BTC', 'EUR', 'SPY', 'US_Manuf_PMI', 'EZ_Rates_10Y', etc.
50
+ quote_ccy: str, optional, default None
51
+ Ticker symbol for quote asset, e.g. 'USDT' for BTCUSDT (bitcoin in Tether USD), 'GBP' for EURGBP, etc.
52
+ markets: list or str, optional, default None
53
+ Markets/traded pairs of base assets vs quote assets, e.g. 'BTC/USDT', 'EUR/USD', 'SPY/USD', etc.
46
54
  freq: str, default 'd'
47
55
  Frequency of data observations. Defaults to daily 'd' which includes weekends for cryptoassets.
48
- quote_ccy: str, optional, default None
49
- Quote currency for base asset, e.g. 'GBP' for EURGBP, 'USD' for BTCUSD (bitcoin in dollars), etc.
50
56
  exch: str, optional, default None
51
57
  Name of asset exchange, e.g. 'Binance', 'FTX', 'IEX', 'Nasdaq', etc.
52
58
  mkt_type: str, optional, default 'spot'
@@ -72,18 +78,26 @@ class DataRequest:
72
78
  source_tickers: list or str, optional, default None
73
79
  List or string of ticker symbols for assets or time series in the format used by the
74
80
  data source. If None, tickers will be converted from CryptoDataPy to data source format.
81
+ source_markets: list or str, optional, default None
82
+ List or string of markets/traded pairs of base assets vs quote assets in the format used by the
83
+ data source. If None, markets will be converted from CryptoDataPy to data source format.
75
84
  source_freq: str, optional, default None
76
85
  Frequency of observations for assets or time series in format used by data source. If None,
77
86
  frequency will be converted from CryptoDataPy to data source format.
87
+ source_start_date: str, int, datetime or pd.Timestamp, optional, default None
88
+ Start date for data request in format used by data source.
89
+ source_end_date: str, int, datetime or pd.Timestamp, optional, default None
90
+ End date for data request in format used by data source.
78
91
  source_fields: list or str, optional, default None
79
92
  List or string of fields for assets or time series in format used by data source. If None,
80
93
  fields will be converted from CryptoDataPy to data source format.
81
94
  """
82
95
  # params
83
- self.source = source # specific data source
96
+ self.source = source # name of data source
84
97
  self.tickers = tickers # tickers
85
- self.freq = freq # frequency
86
98
  self.quote_ccy = quote_ccy # quote ccy
99
+ self.markets = markets # markets
100
+ self.freq = freq # frequency
87
101
  self.exch = exch # exchange
88
102
  self.mkt_type = mkt_type # market type
89
103
  self.start_date = start_date # start date
@@ -95,7 +109,10 @@ class DataRequest:
95
109
  self.trials = trials # number of times to try query request
96
110
  self.pause = pause # number of seconds to pause between query request trials
97
111
  self.source_tickers = source_tickers # tickers used by data source
112
+ self.source_markets = source_markets
98
113
  self.source_freq = source_freq # frequency used by data source
114
+ self.source_start_date = source_start_date # start date used by data source
115
+ self.source_end_date = source_end_date # end date used by data source
99
116
  self.source_fields = source_fields # fields used by data source
100
117
 
101
118
  @property
@@ -151,6 +168,46 @@ class DataRequest:
151
168
  else:
152
169
  raise TypeError("Tickers must be a string or list of strings (tickers).")
153
170
 
171
+ @property
172
+ def quote_ccy(self):
173
+ """
174
+ Returns quote currency for data request.
175
+ """
176
+ return self._quote_ccy
177
+
178
+ @quote_ccy.setter
179
+ def quote_ccy(self, quote):
180
+ """
181
+ Sets quote currency for data request.
182
+ """
183
+ if quote is None:
184
+ self._quote_ccy = quote
185
+ elif isinstance(quote, str):
186
+ self._quote_ccy = quote
187
+ else:
188
+ raise TypeError("Quote currency must be a string.")
189
+
190
+ @property
191
+ def markets(self):
192
+ """
193
+ Returns markets for data request.
194
+ """
195
+ return self._markets
196
+
197
+ @markets.setter
198
+ def markets(self, markets):
199
+ """
200
+ Sets markets for data request.
201
+ """
202
+ if markets is None:
203
+ self._markets = markets
204
+ elif isinstance(markets, str):
205
+ self._markets = [markets]
206
+ elif isinstance(markets, list):
207
+ self._markets = markets
208
+ else:
209
+ raise TypeError("Markets must be a string or list of strings (markets).")
210
+
154
211
  @property
155
212
  def freq(self):
156
213
  """
@@ -206,25 +263,6 @@ class DataRequest:
206
263
  else:
207
264
  self._frequency = frequency
208
265
 
209
- @property
210
- def quote_ccy(self):
211
- """
212
- Returns quote currency for data request.
213
- """
214
- return self._quote_ccy
215
-
216
- @quote_ccy.setter
217
- def quote_ccy(self, quote):
218
- """
219
- Sets quote currency for data request.
220
- """
221
- if quote is None:
222
- self._quote_ccy = quote
223
- elif isinstance(quote, str):
224
- self._quote_ccy = quote
225
- else:
226
- raise TypeError("Quote currency must be a string.")
227
-
228
266
  @property
229
267
  def exch(self):
230
268
  """
@@ -486,6 +524,29 @@ class DataRequest:
486
524
  "Source tickers must be a string or list of strings (tickers) in data source's format."
487
525
  )
488
526
 
527
+ @property
528
+ def source_markets(self):
529
+ """
530
+ Returns markets for data request in data source format.
531
+ """
532
+ return self._source_markets
533
+
534
+ @source_markets.setter
535
+ def source_markets(self, markets):
536
+ """
537
+ Sets markets for data request in data source format.
538
+ """
539
+ if markets is None:
540
+ self._source_markets = markets
541
+ elif isinstance(markets, str):
542
+ self._source_markets = [markets]
543
+ elif isinstance(markets, list):
544
+ self._source_markets = markets
545
+ else:
546
+ raise TypeError(
547
+ "Source markets must be a string or list of strings (markets) in data source's format."
548
+ )
549
+
489
550
  @property
490
551
  def source_freq(self):
491
552
  """
@@ -507,6 +568,60 @@ class DataRequest:
507
568
  "Source data frequency must be a string in data source's format."
508
569
  )
509
570
 
571
+ @property
572
+ def source_start_date(self):
573
+ """
574
+ Returns start date for data request in data source format.
575
+ """
576
+ return self._source_start_date
577
+
578
+ @source_start_date.setter
579
+ def source_start_date(self, start_date):
580
+ """
581
+ Sets start date for data request in data source format.
582
+ """
583
+ if start_date is None:
584
+ self._source_start_date = start_date
585
+ elif isinstance(start_date, str):
586
+ self._source_start_date = start_date
587
+ elif isinstance(start_date, int):
588
+ self._source_start_date = start_date
589
+ elif isinstance(start_date, datetime):
590
+ self._source_start_date = start_date
591
+ elif isinstance(start_date, pd.Timestamp):
592
+ self._source_start_date = start_date
593
+ else:
594
+ raise ValueError(
595
+ 'Start date must be in "YYYY-MM-DD" string, integer, datetime or pd.Timestamp format.'
596
+ )
597
+
598
+ @property
599
+ def source_end_date(self):
600
+ """
601
+ Returns end date for data request in data source format.
602
+ """
603
+ return self._source_end_date
604
+
605
+ @source_end_date.setter
606
+ def source_end_date(self, end_date):
607
+ """
608
+ Sets end date for data request in data source format.
609
+ """
610
+ if end_date is None:
611
+ self._source_end_date = end_date
612
+ elif isinstance(end_date, str):
613
+ self._source_end_date = end_date
614
+ elif isinstance(end_date, int):
615
+ self._source_end_date = end_date
616
+ elif isinstance(end_date, datetime):
617
+ self._source_end_date = end_date
618
+ elif isinstance(end_date, pd.Timestamp):
619
+ self._source_end_date = end_date
620
+ else:
621
+ raise ValueError(
622
+ 'End date must be in "YYYY-MM-DD" string, integer, datetime or pd.Timestamp format.'
623
+ )
624
+
510
625
  @property
511
626
  def source_fields(self):
512
627
  """
@@ -0,0 +1,33 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "89bd834b-aec0-45fe-82a0-c5d873c9518a",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": []
10
+ }
11
+ ],
12
+ "metadata": {
13
+ "kernelspec": {
14
+ "display_name": "cryptodatapy",
15
+ "language": "python",
16
+ "name": "cryptodatapy"
17
+ },
18
+ "language_info": {
19
+ "codemirror_mode": {
20
+ "name": "ipython",
21
+ "version": 3
22
+ },
23
+ "file_extension": ".py",
24
+ "mimetype": "text/x-python",
25
+ "name": "python",
26
+ "nbconvert_exporter": "python",
27
+ "pygments_lexer": "ipython3",
28
+ "version": "3.9.12"
29
+ }
30
+ },
31
+ "nbformat": 4,
32
+ "nbformat_minor": 5
33
+ }