From cd4a80ef77219232faf362daf5b3de5af3f874e0 Mon Sep 17 00:00:00 2001 From: Steffen Date: Fri, 12 Nov 2021 12:12:24 +0100 Subject: [PATCH 01/25] added cryptoreader --- pandas_datareader/crypto/__init__.py | 0 pandas_datareader/crypto/_paths.py | 16 + pandas_datareader/crypto/exchange.py | 272 +++++++++ pandas_datareader/crypto/mapping.py | 347 +++++++++++ .../resources/running_exchanges/50x.yaml | 313 ++++++++++ .../resources/running_exchanges/aax.yaml | 192 ++++++ .../running_exchanges/alterdice.yaml | 305 ++++++++++ .../resources/running_exchanges/ascendex.yaml | 401 +++++++++++++ .../resources/running_exchanges/b2bx.yaml | 330 +++++++++++ .../resources/running_exchanges/bankcex.yaml | 356 ++++++++++++ .../resources/running_exchanges/bequant.yaml | 374 ++++++++++++ .../resources/running_exchanges/bibox.yaml | 416 +++++++++++++ .../resources/running_exchanges/bidesk.yaml | 304 ++++++++++ .../resources/running_exchanges/bigone.yaml | 341 +++++++++++ .../resources/running_exchanges/binance.yaml | 388 +++++++++++++ .../resources/running_exchanges/bitbay.yaml | 384 ++++++++++++ .../resources/running_exchanges/bitfinex.yaml | 365 ++++++++++++ .../resources/running_exchanges/bitforex.yaml | 335 +++++++++++ .../resources/running_exchanges/bitfront.yaml | 251 ++++++++ .../resources/running_exchanges/bithumb.yaml | 420 ++++++++++++++ .../resources/running_exchanges/bitkub.yaml | 246 ++++++++ .../resources/running_exchanges/bitmart.yaml | 409 +++++++++++++ .../resources/running_exchanges/bitopro.yaml | 345 +++++++++++ .../resources/running_exchanges/bitrue.yaml | 227 ++++++++ .../resources/running_exchanges/bitso.yaml | 344 +++++++++++ .../resources/running_exchanges/bitstamp.yaml | 401 +++++++++++++ .../resources/running_exchanges/bittrex.yaml | 310 ++++++++++ .../resources/running_exchanges/bitvavo.yaml | 301 ++++++++++ .../resources/running_exchanges/bitwell.yaml | 338 +++++++++++ .../resources/running_exchanges/bitz.yaml | 548 ++++++++++++++++++ .../resources/running_exchanges/bkex.yaml | 356 ++++++++++++ .../running_exchanges/bleutrade.yaml | 369 ++++++++++++ .../running_exchanges/btc-alpha.yaml | 253 ++++++++ .../resources/running_exchanges/btc_turk.yaml | 389 +++++++++++++ .../resources/running_exchanges/btse.yaml | 331 +++++++++++ .../resources/running_exchanges/buda.yaml | 320 ++++++++++ .../resources/running_exchanges/bw.yaml | 420 ++++++++++++++ .../resources/running_exchanges/catex.yaml | 235 ++++++++ .../resources/running_exchanges/cexio.yaml | 251 ++++++++ .../resources/running_exchanges/chiliz.yaml | 304 ++++++++++ .../resources/running_exchanges/coinall.yaml | 202 +++++++ .../resources/running_exchanges/coinbase.yaml | 338 +++++++++++ .../resources/running_exchanges/coinbene.yaml | 378 ++++++++++++ .../resources/running_exchanges/coindcx.yaml | 221 +++++++ .../resources/running_exchanges/coinegg.yaml | 310 ++++++++++ .../resources/running_exchanges/coinex.yaml | 411 +++++++++++++ .../running_exchanges/coinfield.yaml | 348 +++++++++++ .../running_exchanges/coingecko.yaml | 116 ++++ .../resources/running_exchanges/coinhe.yaml | 333 +++++++++++ .../resources/running_exchanges/coinjar.yaml | 314 ++++++++++ .../resources/running_exchanges/coinlist.yaml | 288 +++++++++ .../running_exchanges/coinpaprika.yaml | 226 ++++++++ .../resources/running_exchanges/coinsbit.yaml | 325 +++++++++++ .../resources/running_exchanges/crex24.yaml | 313 ++++++++++ .../running_exchanges/crosstower.yaml | 364 ++++++++++++ .../resources/running_exchanges/crypto.yaml | 392 +++++++++++++ .../resources/running_exchanges/currency.yaml | 320 ++++++++++ .../running_exchanges/dex-trade.yaml | 310 ++++++++++ .../running_exchanges/digifinex.yaml | 291 ++++++++++ .../resources/running_exchanges/exmo.yaml | 285 +++++++++ .../resources/running_exchanges/exrates.yaml | 318 ++++++++++ .../resources/running_exchanges/exx.yaml | 360 ++++++++++++ .../resources/running_exchanges/folgory.yaml | 284 +++++++++ .../resources/running_exchanges/ftx.yaml | 384 ++++++++++++ .../resources/running_exchanges/gateio.yaml | 361 ++++++++++++ .../resources/running_exchanges/gemini.yaml | 320 ++++++++++ .../resources/running_exchanges/gopax.yaml | 301 ++++++++++ .../resources/running_exchanges/hbtc.yaml | 305 ++++++++++ .../resources/running_exchanges/hitbtc.yaml | 393 +++++++++++++ .../resources/running_exchanges/hoo.yaml | 341 +++++++++++ .../resources/running_exchanges/huobi.yaml | 423 ++++++++++++++ .../running_exchanges/huobi_korea.yaml | 424 ++++++++++++++ .../resources/running_exchanges/hydax.yaml | 305 ++++++++++ .../resources/running_exchanges/idex.yaml | 336 +++++++++++ .../resources/running_exchanges/indodax.yaml | 247 ++++++++ .../resources/running_exchanges/korbit.yaml | 266 +++++++++ .../resources/running_exchanges/kucoin.yaml | 432 ++++++++++++++ .../resources/running_exchanges/latoken.yaml | 225 +++++++ .../resources/running_exchanges/lbank.yaml | 333 +++++++++++ .../resources/running_exchanges/luno.yaml | 286 +++++++++ .../resources/running_exchanges/lykke.yaml | 195 +++++++ .../resources/running_exchanges/maicoin.yaml | 314 ++++++++++ .../resources/running_exchanges/mandala.yaml | 329 +++++++++++ .../resources/running_exchanges/mercatox.yaml | 248 ++++++++ .../resources/running_exchanges/mexo.yaml | 304 ++++++++++ .../resources/running_exchanges/mxc.yaml | 290 +++++++++ .../resources/running_exchanges/nicehash.yaml | 255 ++++++++ .../resources/running_exchanges/nominex.yaml | 225 +++++++ .../resources/running_exchanges/oceanex.yaml | 380 ++++++++++++ .../resources/running_exchanges/okcoin.yaml | 338 +++++++++++ .../resources/running_exchanges/okex.yaml | 360 ++++++++++++ .../resources/running_exchanges/omgfin.yaml | 359 ++++++++++++ .../resources/running_exchanges/p2pb2b.yaml | 393 +++++++++++++ .../resources/running_exchanges/poloniex.yaml | 354 +++++++++++ .../running_exchanges/stormgain.yaml | 229 ++++++++ .../running_exchanges/therocktrading.yaml | 340 +++++++++++ .../resources/running_exchanges/tidex.yaml | 270 +++++++++ .../resources/running_exchanges/upbit.yaml | 320 ++++++++++ .../resources/running_exchanges/vcc.yaml | 296 ++++++++++ .../resources/running_exchanges/vindax.yaml | 350 +++++++++++ .../resources/running_exchanges/wazirx.yaml | 252 ++++++++ .../resources/running_exchanges/whitebit.yaml | 237 ++++++++ .../resources/running_exchanges/xt.yaml | 330 +++++++++++ .../running_exchanges/xtheta_global.yaml | 303 ++++++++++ .../resources/running_exchanges/yobit.yaml | 265 +++++++++ .../resources/running_exchanges/zaif.yaml | 210 +++++++ .../resources/running_exchanges/zb.yaml | 322 ++++++++++ .../resources/running_exchanges/zbg.yaml | 405 +++++++++++++ pandas_datareader/crypto/time_helper.py | 131 +++++ pandas_datareader/crypto/utilities.py | 460 +++++++++++++++ pandas_datareader/crypto_reader.py | 136 +++++ 111 files changed, 34736 insertions(+) create mode 100644 pandas_datareader/crypto/__init__.py create mode 100644 pandas_datareader/crypto/_paths.py create mode 100644 pandas_datareader/crypto/exchange.py create mode 100644 pandas_datareader/crypto/mapping.py create mode 100644 pandas_datareader/crypto/resources/running_exchanges/50x.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/aax.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/alterdice.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/ascendex.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/b2bx.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bankcex.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bequant.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bibox.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bidesk.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bigone.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/binance.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitbay.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitfinex.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitforex.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitfront.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bithumb.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitkub.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitmart.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitopro.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitrue.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitso.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitstamp.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bittrex.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitvavo.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitwell.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitz.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bkex.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bleutrade.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/btc-alpha.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/btc_turk.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/btse.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/buda.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/bw.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/catex.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/cexio.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/chiliz.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/coinall.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/coinbase.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/coinbene.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/coindcx.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/coinegg.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/coinex.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/coinfield.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/coingecko.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/coinhe.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/coinjar.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/coinlist.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/coinpaprika.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/coinsbit.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/crex24.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/crosstower.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/crypto.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/currency.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/dex-trade.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/digifinex.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/exmo.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/exrates.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/exx.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/folgory.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/ftx.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/gateio.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/gemini.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/gopax.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/hbtc.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/hitbtc.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/hoo.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/huobi.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/huobi_korea.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/hydax.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/idex.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/indodax.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/korbit.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/kucoin.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/latoken.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/lbank.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/luno.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/lykke.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/maicoin.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/mandala.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/mercatox.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/mexo.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/mxc.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/nicehash.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/nominex.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/oceanex.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/okcoin.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/okex.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/omgfin.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/p2pb2b.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/poloniex.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/stormgain.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/therocktrading.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/tidex.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/upbit.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/vcc.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/vindax.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/wazirx.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/whitebit.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/xt.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/xtheta_global.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/yobit.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/zaif.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/zb.yaml create mode 100644 pandas_datareader/crypto/resources/running_exchanges/zbg.yaml create mode 100644 pandas_datareader/crypto/time_helper.py create mode 100644 pandas_datareader/crypto/utilities.py create mode 100644 pandas_datareader/crypto_reader.py diff --git a/pandas_datareader/crypto/__init__.py b/pandas_datareader/crypto/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pandas_datareader/crypto/_paths.py b/pandas_datareader/crypto/_paths.py new file mode 100644 index 00000000..8758aa4d --- /dev/null +++ b/pandas_datareader/crypto/_paths.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +This module is preparing the python path to access all modules. +""" +import os +import sys +from pathlib import Path + +# sys.path.insert(0, os.path.dirname(__file__)) +# +# PATH_ABSOLUT = Path().parent.absolute() + +all_paths = { + "yaml_path": Path(os.path.dirname(os.path.realpath(__file__))).joinpath("resources/running_exchanges/"), +} diff --git a/pandas_datareader/crypto/exchange.py b/pandas_datareader/crypto/exchange.py new file mode 100644 index 00000000..0bc32f29 --- /dev/null +++ b/pandas_datareader/crypto/exchange.py @@ -0,0 +1,272 @@ +from typing import Tuple, Any, Dict, Union, List, Optional + +from datetime import datetime +import string +from collections import OrderedDict, deque +import itertools + +from pandas_datareader.crypto.utilities import yaml_loader, replace_list_item +from pandas_datareader.crypto.mapping import extract_mappings +from pandas_datareader.crypto.mapping import convert_type +from pandas_datareader.base import _BaseReader + + +class Exchange(_BaseReader): + """ Class for every exchange supported. The class extracts the request url, fits parameters, + extracts the values from the response json and performs type-conversions. + """ + + def __init__(self, name: str, symbols, interval: str, **kwargs): + super(Exchange, self).__init__(symbols, **kwargs) + self.name = name + self.yaml_file = yaml_loader(self.name) + self.interval: Union[str, Dict] = interval + self.rate_limit = self.get_rate_limit() + + def get_rate_limit(self) -> int: + """ Calculates the rate-limit of an exchange. + + @return: The rate limit, i.e. time to "sleep" to not violate the limit per minute. + """ + if self.yaml_file.get("rate_limit"): + if self.yaml_file["rate_limit"]["max"] <= 0: + rate_limit = 0 + else: + rate_limit = self.yaml_file["rate_limit"]["unit"] / self.yaml_file["rate_limit"]["max"] + else: + rate_limit = 0 + + return rate_limit + + def apply_currency_pair_format(self, currency_pair: str) -> str: + """ Helper method that applies the format described in the yaml for the specific + request on the given currency-pair. + + @param currency_pair: String repr of the currency-pair + @return: String of the formatted currency-pair. Example: BTC and ETH -> "btc_eth" + """ + + first, second = currency_pair.split("-") + + request_url_and_params = self.yaml_file.get("requests").get("historic_rates").get("request") + pair_template_dict = request_url_and_params["pair_template"] + pair_template = pair_template_dict["template"] + + formatted_string: str = pair_template.format(first=first, second=second) + + if pair_template_dict["lower_case"]: + formatted_string = formatted_string.lower() + + return formatted_string + + def get_formatted_url_and_params(self, url_and_parameters: Any, currency_pair: str) -> Tuple[str, Dict]: + """ Formats the request url, inserts the currency-pair representation and/or + extracts the parameters specified for the exchange and request. + + @param url_and_parameters: Extracted url and parameters from self.extract_request_urls. + @param currency_pair: The currency pair of interest to format the url and params on. + @return Tuple of formatted url and formatted parameters. + """ + + url = url_and_parameters.get('historic_rates').get("url") + pair_template = url_and_parameters.get('historic_rates').get("pair_template") + pair_formatted = self.apply_currency_pair_format(currency_pair) + parameters = url_and_parameters.get('historic_rates').get("params") + + parameters.update({key: parameters[key][currency_pair] + for key, val in parameters.items() if isinstance(val, dict)}) + + # Case 1: Currency-Pairs in request parameters: eg. www.test.com?market=BTC-USD + if "alias" in pair_template.keys() and pair_template["alias"]: + parameters[pair_template["alias"]] = pair_formatted + # Case 2: Currency-Pairs directly in URL: eg. www.test.com/BTC-USD + elif pair_formatted: + parameters.update({"currency_pair": pair_formatted}) + + else: + return url, parameters + + variables = [item[1] for item in string.Formatter().parse(url) if item[1] is not None] + url_formatted = url.format(**parameters) + # drop params who are filled directly into the url + parameters = {k: v for k, v in parameters.items() if k not in variables} + + return url_formatted, parameters + + def extract_request_urls(self, currency_pairs: Dict[str, datetime]) -> Dict: + """ Extracts the request url from the yaml-file and implements the parameters. + + @param currency_pairs: Currency-pair with the timestamp of the latest request. + @return: Dict of the extracted url and parameters. + """ + + request_dict = self.yaml_file.get("requests").get("historic_rates").get("request") + request_parameters = dict() + request_parameters["url"] = self.yaml_file.get("api_url", "") + request_dict.get("template", "") + request_parameters["pair_template"] = request_dict.get("pair_template", None) + urls = dict() + parameter = dict() + parameters = request_dict.get("params", False) + + if not parameters: + request_parameters["params"] = {} + urls["historic_rates"] = request_parameters + return urls + + mapping: dict = {"allowed": self._allowed, "function": self._function, + "default": self._default, "type": self._type_con} + + # enumerate mapping dict to sort parameter values accordingly, i.e. {"allowed": 0, "function": 1, ...} + mapping_index = {val: key for key, val in enumerate(mapping.keys())} + + for param, options in parameters.items(): + # Kick out all option keys which are not in the mapping dict or where required: False. + # Sort the dict options according to the mapping-keys to ensure the right order of function calls. + # Otherwise a (valid) specified value might be overwritten by the default value. + options = {k: v for k, v in options.items() if k in mapping.keys()} + options = OrderedDict(sorted(options.items(), key=lambda x: mapping_index.get(x[0]))) + + if not parameters[param].get("required", True): + continue + # Iterate over the functions and fill the params dict with values. Kwargs are needed only partially. + kwargs = {"has_value": None, "currency_pairs": currency_pairs} + for key, val in options.items(): + kwargs.update({"has_value": parameter.get(param, None)}) + parameter[param] = mapping.get(key)(val, **kwargs) + + request_parameters["params"] = parameter + urls["historic_rates"] = request_parameters + return urls + + def _allowed(self, val: dict, **_: dict) -> Any: + """ Extract the configured value from all allowed values. If there is no match, return str "default". + + @param val: dict of allowed key, value pairs. + @param _: unused additional arguments needed in other methods. + @return: value if key in dict, else None. + """ + if isinstance(self.interval, dict): + value = None + else: + value = val.get(self.interval, None) + + if not bool(value): + all_intervals = {"minutes": 1, "hours": 2, "days": 3, "weeks": 4, "months": 5} + self.interval = {v: k for k, v in val.items() if all_intervals.get(k)} + return value + + def _function(self, val: str, **kwargs: dict) -> Dict[str, datetime]: + """ Execute function for all currency-pairs. Function returns the first + timestamp in the DB, or datetime.now() if none exists. + + @param val: contains the function name as string. + @param kwargs: not used but needed for another function. + @return: The currency-pair with the respective timestamp to continue requesting. + """ + if val == "last_timestamp": + return {cp: self._get_first_timestamp(last_ts) for cp, last_ts in kwargs.get("currency_pairs").items()} + + def _default(self, val: str, **kwargs: dict) -> Optional[str]: + """ Returns the default value if kwargs value (the parameter) is None. + + @param val: Default value. + @param kwargs: Parameter value. If None, return default value. + @return: Default value as a string. + """ + + default_val = val if not bool(kwargs.get("has_value")) else kwargs.get("has_value") + if isinstance(self.interval, dict): + self.interval = self.interval.get(default_val, None) + + return default_val if self.interval else None + + def _type_con(self, val: Any, **kwargs: dict) -> Any: + """ Performs type conversions. + + @param val: The conversion values specified under "type". + @param kwargs: The value to be converted. + @return: Converted value. + """ + param_value = kwargs.get("has_value", None) + conv_params = val + # to avoid conversion when only a type declaration was done. If a parameter is of type "int". + if isinstance(conv_params, str) or len(conv_params) < 2: + return param_value + # replace the key "interval" with the interval specified in the configuration file. + conv_params = [self.interval if x == "interval" else x for x in conv_params] + # return {cp: convert_type(param_value[cp], deque(conv_params)) for cp in currency_pairs} + # ToDo: Check if the above line works. The older version needed both if statements below. + if isinstance(param_value, dict): + return {cp: convert_type(param_value[cp], deque(conv_params)) for cp in kwargs.get("currency_pairs")} + elif isinstance(conv_params, list): + return convert_type(param_value, deque(conv_params)) + + def _get_first_timestamp(self, last_ts: datetime) -> datetime: + """ Returns the timestamp to continue requesting with. + + @param last_ts: The oldest timestamp from the previous request + @return: The latest timestamp. + """ + if last_ts: + return last_ts + + if self.end.timestamp() > datetime.utcnow().timestamp(): + return datetime.utcnow() + else: + return self.end + + def format_data(self, responses: Dict) -> Tuple[Optional[List], Optional[List]]: + """ Extracts and formats the response data, according to the mapping keys and path. + Data is then ordered and returned as a tuple. + + @param responses: The response json + @return: Tuple of extracted and formatted data and a list of the mapping keys in the same order. + """ + if not responses: + return None, None + + results = list() + mappings = extract_mappings(self.name, self.yaml_file.get('requests')).get('historic_rates') + mapping_keys = [mapping.key for mapping in mappings] + + # creating dictionary where key is the name of the mapping which holds an empty list + temp_results = dict(zip((key for key in mapping_keys), itertools.repeat([], len(mappings)))) + + try: + + for mapping in mappings: + if "interval" in mapping.types: + mapping.types = replace_list_item(mapping.types, "interval", self.interval) + + temp_results[mapping.key] = mapping.extract_value(responses) + + if isinstance(temp_results[mapping.key], str): + # Bugfix: if value is a single string, it is an iterable, and the string will + # be split in every letter. Therefore it is put into a list. + temp_results[mapping.key] = [temp_results[mapping.key]] + + except Exception: + print("Error extracting values from response.") + return None, None + + else: + # CHANGE: One filed invalid -> all fields invalid. + # changed this in order to avoid responses kicked out just because of one invalid field. + # The response will be filtered out in the DB-Handler if the primary-keys are missing anyways. + if all(value is None and not isinstance(value, datetime) for value in list(temp_results.values())): + return None, None + + # asserting that the extracted lists for each mapping are having the same length + assert (len(results[0]) == len(result) for result in temp_results) + + len_results = {key: len(value) for key, value in temp_results.items() if hasattr(value, "__iter__")} + len_results = max(len_results.values()) if bool(len_results) else 1 + + # update new keys only if not already exists to prevent overwriting! + # temp_results = {"time": time, **temp_results} + result = [v if hasattr(v, "__iter__") + else itertools.repeat(v, len_results) for k, v in temp_results.items()] + + result = list(itertools.zip_longest(*result)) + + return result, list(temp_results.keys()) diff --git a/pandas_datareader/crypto/mapping.py b/pandas_datareader/crypto/mapping.py new file mode 100644 index 00000000..db168afb --- /dev/null +++ b/pandas_datareader/crypto/mapping.py @@ -0,0 +1,347 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Module to find, extract and convert values from the exchange responses. + +Classes: + - Mapping +Functions: + - convert_type + - extract_mappings + - is_scalar +""" + +import logging +from collections import deque +from collections.abc import Iterable +from typing import Any, List, Dict, Deque, Tuple + +from pandas_datareader.crypto.utilities import TYPE_CONVERSIONS + + +def convert_type(value: Any, types_queue: Deque[str]) -> Any: + """ + Converts the value via type conversions. + + Helper method to convert the given value via a queue of type conversions. + + @param value: The value to get converted to another type. + @type value: Any + @param types_queue: The queue of type conversion instructions. + @type types_queue: deque + + @return: The converted value. + @rtype: Any + """ + current_type = types_queue.popleft() + + result = value + + while types_queue: + next_type = types_queue.popleft() + + types_tuple = (current_type, next_type) + + if "continue" in types_tuple: + continue + + conversion = TYPE_CONVERSIONS[types_tuple] + + params = list() + + for _ in range(conversion["params"]): + params.append(types_queue.popleft()) + + # Change here to avoid "None" as result value in the params when no value to convert is needed (i.e. when + # methods are called with ("none", ...). + # if not result and isinstance(result, (str, list)): + try: + if result is None: + result = conversion["function"](*params) + else: + result = conversion["function"](result, *params) + + current_type = next_type + except Exception: + return None + + return result + + +class Mapping: + """ + Class representing mapping data and logic. + + Class representing mapping data und further functionality provided + with methods. + + Attributes: + key: + String being the keyword indicating one or several + database table columns. See "database_column_mapping" + in "config.yaml". + path: + An ordered list of keys used for traversal through the + response dict with the intention of returning the value wanted + for the database. + types: + An ordered sequence of types and + additional parameters (if necessary). Is used to conduct + type conversions within the method "extract_value()". + """ + + def __init__(self, + key: str, + path: List[str], + types: List[str]): + """ + Constructor of Mapping. + + Constructor method for constructing method objects. + + @param key: String being the keyword indicating one or several + database table columns. See "database_column_mapping" + in "config.yaml". + @type key: str + @param path: An ordered list of keys used for traversal through the + response dict with the intention of returning the value wanted + for the database. + @type path: list + @param types: An ordered sequence of types and + additional parameters (if necessary). Is used to conduct + type conversions within the method "extract_value()". + @type types: list + """ + self.key = key + self.path = path + self.types = types + + def traverse_path(self, response: Dict[str, Any], path_queue: Deque[str], + currency_pair_info: Tuple[str, str, str] = None) \ + -> Any: + """ + Traverses the path on a response. + + Helper method for traversing the path on the given response dict (subset). + + @param response: The response dict (subset). + @type response: dict + @param path_queue: The queue of path traversal instructions. + @type path_queue: deque + @param currency_pair_info: The formatted String of a currency pair. + For special case that the key of a dictionary is the formatted currency pair string. + @type currency_pair_info: tuple[str, str, str] + + @return: The traversed response dict. + @rtype: Optional[dict] + """ + path_element = path_queue.popleft() + + if path_element == "dict_key": + # Special case to extract value from "dict_key" + traversed = list(response.keys()) + elif path_element == "dict_values": + # Special case to extract value from "dict_values" + traversed = list(response.values()) + elif path_element == "list_key": + # Special case with the currency_pair prior to a list + traversed = list(response.keys()) + elif path_element == "list_values": + traversed = list(response.values()) + elif path_element == []: + # Special case to extract multiple values from a single list ["USD","BTC",...] + traversed = response + elif path_element == "currency_pair" and currency_pair_info[2] is not None: + traversed = response[currency_pair_info[2]] + elif is_scalar(response): + return None + else: # Hier editiert für Kraken sonderfall + if isinstance(response, dict) and path_element not in response.keys(): + return None + else: + traversed = response[path_element] + + return traversed + + def extract_value(self, + # response: List[Dict[str, Any]], + response: Any, + path_queue: Deque[str] = None, + types_queue: Deque[str] = None, + iterate: bool = True, + currency_pair_info: Tuple[str, str, str] = (None, None, None)) -> Any: + """ + Extracts the value specified by "self.path". + + Extracts the value specified by the path sequence and converts it + using the "types" specified. + + @param response: The response dict (JSON) returned by an API request. + @type response: Collection + @param path_queue: The queue of path traversal instructions. + @type path_queue: deque + @param types_queue: The queue of type conversion instructions. + @type types_queue: deque + @param iterate: Whether still an auto-iteration is possible. + @type iterate: bool + @param currency_pair_info: The formatted String of a currency pair. + @type currency_pair_info: tuple[str, str, str] + + @return: The value specified by "path_queue" and converted + using "types_queue". + Can be a list of values which get extracted iteratively from + the response. + @rtype: Any + """ + if path_queue is None: + path_queue = deque(self.path) + + if types_queue is None: + types_queue = deque(self.types) + + if not response: + return None + + if not path_queue: + # TODO: after integration tests, look if clause for first and second currency can be deleted! + if types_queue[0] == "first_currency": + return currency_pair_info[0] + elif types_queue[0] == "second_currency": + return currency_pair_info[1] + return convert_type(None, types_queue) + + while path_queue: + + if iterate and isinstance(response, list): + # Iterate through list of results + result = list() + + # special case for bitfinex + if len(response) == 1: + response = response[0] + continue # because instance of response has to be checked + + for item in response: + + if is_scalar(item): + return self.extract_value(response, + path_queue, + types_queue, + iterate=False) + + result.append( + self.extract_value( + item, + deque(path_queue), + deque(types_queue) + ) + ) + + return result + + elif is_scalar(response): + # Return converted scalar value + return convert_type(response, types_queue) + + # Special case for Bitz to handle empty dicts/lists. + elif not response: + return None + + else: + # Traverse path + response = self.traverse_path(response, path_queue, currency_pair_info=currency_pair_info) + + if types_queue and response is not None: # None to allow to change 0 to boolean. + + if isinstance(response, list): + + result = list() + + for item in response: + result.append( + convert_type(item, deque(types_queue)) + ) + + # for dict_key special_case aka. test_extract_value_list_containing_dict_where_key_is_value() in test_mapping.py + if len(result) == 1: + result = result[0] + + response = result + + else: + response = convert_type(response, types_queue) + + return response + + def __str__(self) -> str: + """String representation of a Mapping""" + string_path = list() + + for item in self.path: + string_path.append(str(item)) + + return " / ".join(string_path) + " -> " + str(self.key) + + +def extract_mappings(exchange_name: str, requests: Dict[str, Any]) -> Dict[str, List[Mapping]]: + """ + Helper-Method which should be only called by the constructor. + Extracts out of a given exchange .yaml-requests-section for each + request the necessary mappings so the values can be extracted from + the response for said request. + + The key-value in the dictionary is the same as the key for the request. + i.e. behind 'ticker' are all the mappings stored which are necessary for + extracting the values out of a ticker-response. + + If there is no mapping specified in the .yaml for a value which is contained + by the response, the value will not be extracted later on because there won't + be a Mapping-object for said value. + + @param exchange_name: str + String representation of the exchange name. + @param requests: Dict[str: List[Mapping]] + Requests-section from a exchange.yaml as dictionary. + Method does not check if dictionary contains viable information. + + @return: + Dictionary with the following structure: + {'request_name': List[Mapping]} + """ + response_mappings = dict() + if requests: + for request in requests: + request_mapping = requests[request] + + if "mapping" in request_mapping.keys(): + mapping = request_mapping["mapping"] + mapping_list = list() + + try: + for entry in mapping: + mapping_list.append(Mapping(entry["key"], entry["path"], entry["type"])) + except KeyError: + print(f"Error loading mappings of {exchange_name} in {request}: {entry}") + logging.error("Error loading mappings of %s in %s: %s", exchange_name, request, entry) + break + + response_mappings[request] = mapping_list + + return response_mappings + + +def is_scalar(value: Any) -> bool: + """ + Indicates whether a value is a scalar or not. + + Convenience function returning a bool whether the provided value is a single value or not. + Strings count as scalar although they are iterable. + + @param value: The value to evaluate concerning whether it is a single value + or multiple values (iterable). + @type value: Any + + @return: Bool indicating whether the provided value is a single value or not. + @rtype: bool + """ + return isinstance(value, str) or not isinstance(value, Iterable) diff --git a/pandas_datareader/crypto/resources/running_exchanges/50x.yaml b/pandas_datareader/crypto/resources/running_exchanges/50x.yaml new file mode 100644 index 00000000..ce193048 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/50x.yaml @@ -0,0 +1,313 @@ +# Tickers don't work as they only return the first currency. The second, with the type conversion (none, constant) +# does not work yet. + +name: 50x +exchange: true + +rate_limit: null # no rate limit +# max: null +# unit: null + +api_url: https://rates.50x.com/ + +requests: + currency_pairs: + request: + template: market + pair_template: null + params: + base: + default: USDT + + response: + type: dict + values: + currency_pair: + type: dict + values: + vol: + type: str + rate: + type: str + + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - key: currency_pair_second + path: [] + type: + - none + - constant + - "USDT" + +# tickers: +# request: +# template: market +# pair_template: null +# params: +# base: +# default: "USDT" +# response: +# type: dict +# values: +# currency_pair: +# type: dict +# values: +# vol: +# type: str +# rate: +# type: str +# +# mapping: +# - key: currency_pair_first +# path: +# - dict_key +# type: +# - str +# - key: currency_pair_second +# path: [] +# type: +# - none +# - constant +# - "USDT" +# - key: last_price +# path: +# - dict_values +# - rate +# type: +# - str +# - float +# - key: time +# path: [] +# type: +# - none +# - now +# - key: daily_volume +# path: +# - dict_values +# - vol +# type: +# - str +# - float + + historic_rates: + request: + template: chart + pair_template: + template: "{first}/{second}" + lower_case: false + alias: pair + params: + period: + allowed: + minutes: M1 + hours: H1 + days: D + weeks: W + default: D + end: + function: last_timestamp + type: + - datetime + - timestamp +# start: +# function: last_timestamp +# type: +# - datetime +# - timedelta +# - interval +# - 100 + response: + type: list + values: + type: dict + values: + vol: + type: float + high: + type: float + low: + type: float + open: + type: float + close: + type: float + date: + type: int + + mapping: + - key: time + path: + - date + type: + - float + - from_timestamp + - 0 + - key: open + path: + - open + type: + - float + - key: high + path: + - high + type: + - float + - key: low + path: + - low + type: + - float + - key: close + path: + - close + type: + - float + - key: volume + path: + - vol + type: + - float + + + trades: + request: + template: last_trades/ + pair_template: + template: "{first}/{second}" + lower_case: false + alias: pair + params: null + + response: + type: list + values: + type: dict + values: + a: + type: int + bs: + type: str + ts: + type: float + rate: + type: float + vol1: + type: float + vol2: + type: float + + mapping: + - key: time + path: + - ts + type: + - float + - float + - from_timestamp + - 0 + - key: id + path: + - ts + type: + - float + - int + - key: direction + path: + - bs + type: + - value + - map + - b + - buy + - s + - sell + - key: price + path: + - rate + type: + - float + - key: amount + path: + - vol1 + type: + - float + + order_books: + request: + template: orderbook/ + pair_template: + template: "{first}/{second}" + lower_case: false + alias: pair + params: null + + response: + type: dict + values: + bid: + type: list + values: + type: list + values: + 0: + type: int + 1: + type: int + 2: + type: int + ask: + type: list + values: + type: list + values: + 0: + type: int + 1: + type: int + 2: + type: int + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bid + - 1 + type: + - float + - key: bids_price + path: + - bid + - 0 + type: + - float + - key: asks_amount + path: + - ask + - 1 + type: + - float + - key: asks_price + path: + - ask + - 0 + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/aax.yaml b/pandas_datareader/crypto/resources/running_exchanges/aax.yaml new file mode 100644 index 00000000..02f565cd --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/aax.yaml @@ -0,0 +1,192 @@ +name: aax +exchange: true +rate_limit: null +api_url: https://api.aax.com/v2/ + +requests: + currency_pairs: + request: + template: instruments + pair_template: null + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + base: + type: str + quote: + type: str + mapping: + - key: currency_pair_first + path: + - data + - base + type: + - str + - key: currency_pair_second + path: + - data + - quote + type: + - str + + order_books: + request: + template: market/orderbooks + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + level: + max: 50 + default: 50 + + response: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + bids: + type: list + values: + type: list + values: + 0: #price + type: str + 1: #quantity + type: str + e: + type: str + t: + type: int + + mapping: + - key: id + path: + - t + type: + - int + - key: time + path: + - t + type: + - float + - from_timestamp + - 1 + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - [] + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + + trades: + request: + template: market/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + max: 2000 + default: 200 + + response: + type: dict + values: + trades: + type: list + values: + type: dict + values: + p: + type: str + q: + type: str + t: + type: int + mapping: + - key: id + path: + - trades + - t + type: + - int + - key: time + path: + - trades + - t + type: + - float + - from_timestamp + - 1 + - key: price + path: + - trades + - p + type: + - str + - float_absolut + - key: amount + path: + - trades + - q + type: + - str + - float + - key: direction + path: + - trades + - p + type: + - any + - value + - map + - true + - buy + - false + - sell + diff --git a/pandas_datareader/crypto/resources/running_exchanges/alterdice.yaml b/pandas_datareader/crypto/resources/running_exchanges/alterdice.yaml new file mode 100644 index 00000000..ad4ec9c2 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/alterdice.yaml @@ -0,0 +1,305 @@ +name: alterdice +exchange: true + +rate_limit: null + +api_url: "" + +requests: + currency_pairs: + request: + template: https://api.alterdice.com/v1/public/symbols + pair_template: null + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + id: + type: int + base: + type: str + quote: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - base + type: + - str + - key: currency_pair_second + path: + - data + - quote + type: + - str + + tickers: + request: + template: https://api.alterdice.com/v1/public/ticker + pair_template: + template: "{first}{second}" + lower_case: false + alias: pair + params: null + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + last: + type: str + volume_24H: + type: str + + mapping: + - key: last_price + path: + - data + - last + type: + - str + - float + - key: time + path: [] + type: + - none + - now + - key: daily_volume + path: + - data + - volume_24H + type: + - str + - float + + historic_rates: + request: + template: https://socket.alterdice.com/graph/hist + pair_template: + template: "{first}{second}" + lower_case: false + alias: t + params: + r: + allowed: + hours: 60 + days: D + weeks: W + default: D + end: + function: last_timestamp + type: + - datetime + - timestamp + limit: + default: 1000 + response: + type: list + values: + type: dict + values: + low: # + type: int + high: + type: int + volume: + type: int + time: + type: int + open: + type: int + close: + type: int + + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 0 + - key: open + path: + - open + type: + - int + - div + - 100000000 + - key: high + path: + - high + type: + - int + - div + - 100000000 + - key: low + path: + - low + type: + - int + - div + - 100000000 + - key: close + path: + - close + type: + - int + - div + - 100000000 + - key: volume + path: + - volume + type: + - int + - div + - 100000000 + + + trades: + request: + template: https://api.alterdice.com/v1/public/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: pair + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + volume: + type: float + price: + type: float + timestamp: + type: int + type: + type: str + mapping: + - key: time + path: + - data + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - data + - timestamp + type: + - int + - key: direction + path: + - data + - type + type: + - str + - key: price + path: + - data + - price + type: + - float + - key: amount + path: + - data + - volume + type: + - float + + order_books: + request: + template: https://api.alterdice.com/v1/public/book + pair_template: + template: "{first}{second}" + lower_case: false + alias: pair + params: null + + response: + type: dict + values: + data: + type: dict + buy: + type: list + values: + type: dict + values: + volume: + type: float + rate: + type: float + sell: + type: list + values: + type: dict + values: + volume: + type: float + rate: + type: float + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - data + - buy + - volume + type: + - float + - key: bids_price + path: + - data + - buy + - rate + type: + - float + - key: asks_amount + path: + - data + - sell + - volume + type: + - float + - key: asks_price + path: + - data + - sell + - rate + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/ascendex.yaml b/pandas_datareader/crypto/resources/running_exchanges/ascendex.yaml new file mode 100644 index 00000000..d85ed847 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/ascendex.yaml @@ -0,0 +1,401 @@ +name: ascendex +exchange: true + +rate_limit: null + +api_url: https://ascendex.com/api/pro/v1/ + +requests: + currency_pairs: + request: + template: products + pair_template: null + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - baseAsset + type: + - str + - key: currency_pair_second + path: + - data + - quoteAsset + type: + - str + + tickers: + request: + template: ticker + pair_template: null + params: null + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + symbol: + type: str + volume: + type: str + ask: + type: list + values: + 0: + type: str + bids: + type: list + values: + 0: + type: str + + + mapping: + - key: currency_pair_first + path: + - data + - symbol + type: + - str + - split + - "/" + - 0 + - key: currency_pair_second + path: + - data + - symbol + type: + - str + - split + - "/" + - 1 + - key: time + path: [] + type: + - none + - now + - key: best_bid + path: + - data + - bid + - 0 + type: + - str + - float + - key: best_ask + path: + - data + - ask + - 0 + type: + - str + - float + - key: daily_volume + path: + - data + - volume + type: + - str + - float + + historic_rates: + request: + template: barhist + pair_template: + template: "{first}/{second}" + lower_case: false + alias: symbol + params: + interval: + allowed: + minutes: 1 + hours: 60 + days: 1d + weeks: 1w + months: 1m + default: 1d + to: + function: last_timestamp + type: + - datetime + - timestampms +# from: +# function: last_timestamp +# type: +# - datatime +# - timedeltams +# - interval +# - 500 + n: + default: 20 + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + data: + type: dict + values: + c: + type: str + h: + type: str + i: + type: str + l: + type: str + o: + type: str + v: + type: str + ts: + type: int + + mapping: + - key: time + path: + - data + - data + - ts + type: + - float + - from_timestamp + - 1 + - key: open + path: + - data + - data + - o + type: + - str + - float + - key: high + path: + - data + - data + - h + type: + - str + - float + - key: low + path: + - data + - data + - l + type: + - str + - float + - key: close + path: + - data + - data + - c + type: + - str + - float + - key: volume + path: + - data + - data + - v + type: + - str + - float + + trades: + request: + template: trades + pair_template: + template: "{first}/{second}" + lower_case: false + alias: symbol + params: + n: + default: 100 + + response: + type: dict + values: + data: + type: dict + values: + data: + type: list + values: + type: dict + values: + seqnum: + type: int + p: + type: str + q: + type: str + ts: + type: int + bm: + type: bool + + mapping: + - key: time + path: + - data + - data + - ts + type: + - float + - from_timestamp + - 1 + - key: id + path: + - data + - data + - seqnum + type: + - int + - key: direction + path: + - data + - data + - bm + type: + - value + - map + - true + - sell + - false + - buy + - key: price + path: + - data + - data + - p + type: + - str + - float + - key: amount + path: + - data + - data + - q + type: + - str + - float + + order_books: + request: + template: depth + pair_template: + template: "{first}/{second}" + lower_case: false + alias: symbol + params: null + + response: + type: dict + values: + data: + type: dict + data: + type: dict + seqnum: + type: int + ts: + type: int + asks: + type: list + values: + type: list + values: + 0: # p + type: str + 1: #qty + type: str + bids: + type: list + values: + type: list + values: + 0: # p + type: str + 1: #qty + type: str + + mapping: + - key: time + path: + - data + - data + - ts + type: + - float + - from_timestamp + - 1 + - key: id + path: + - data + - data + - seqnum + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - data + - data + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - data + - data + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - data + - data + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - data + - data + - asks + - 0 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/b2bx.yaml b/pandas_datareader/crypto/resources/running_exchanges/b2bx.yaml new file mode 100644 index 00000000..d20e221f --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/b2bx.yaml @@ -0,0 +1,330 @@ +name: b2bx +exchange: true + +rate_limit: + max: 120 + unit: 60 + +api_url: "" + +requests: + currency_pairs: + request: + template: https://api.b2bx.exchange:8443/trading/frontoffice/api/info + pair_template: null + params: null + + response: + type: dict + values: + pairs: + type: dict + values: + currency_pair: + type: dict + + mapping: + - key: currency_pair_first + path: + - pairs + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - pairs + - dict_key + type: + - str + - split + - "_" + - 1 + + + tickers: + request: + template: https://cmc-gate.b2bx.exchange/marketdata/cmc/v1/ticker + pair_template: null + params: null + response: + type: dict + values: + currency_pair: + type: dict + values: + last_price: + type: str + base_volume: + type: str + quote_volume: + type: str + + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - dict_values + - last_price + type: + - str + - float + - key: time + path: [] + type: + - none + - now + - key: daily_volume + path: + - dict_values + - base_volume + type: + - str + - float + + historic_rates: + request: + template: https://api.b2bx.exchange:8443/trading/marketdata/instruments/{currency_pair}/history + pair_template: + template: "{first}_{second}" + lower_case: true + params: + endDate: + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S" + startDate: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1000 + - from_timestamp + - 0 + - "%Y-%m-%dT%H:%M:%S" + count: + default: 1000 #max + type: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + months: 1M + default: 1d + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + start: + type: str + end: + type: str + open: + type: float + high: + type: float + low: + type: float + close: + type: float + volume: + type: float + quoteVolume: + type: float + + mapping: + - key: time + path: + - data + - start + type: + - str + - dateparser + - key: open + path: + - data + - open + type: + - float + - key: high + path: + - data + - high + type: + - float + - key: low + path: + - data + - low + type: + - float + - key: close + path: + - data + - close + type: + - float + - key: volume + path: + - data + - volume + type: + - float + + + trades: + request: + template: https://cmc-gate.b2bx.exchange/marketdata/cmc/v1/trades/{currency_pair} + pair_template: + template: "{first}_{second}" + lower_case: true + params: null + + response: + type: list + values: + type: dict + values: + tradeID: + type: str + price: + type: str + base_volume: + type: str + quote_volume: + type: str + trade_timestamp: + type: str + type: + type: str + mapping: + - key: time + path: + - trade_timestamp + type: + - str + - float + - from_timestamp + - 0 + - key: id + path: + - tradeID + type: + - str + - int + - key: direction + path: + - type + type: + - str + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - base_volume + type: + - str + - float + + order_books: + request: + template: https://api.b2bx.exchange:8443/trading/marketdata/instruments/{currency_pair}/depth + pair_template: + template: "{first}_{second}" + lower_case: true + params: null + + response: + type: dict + values: + bids: + type: list + values: + type: dict + values: + amount: + type: float + price: + type: float + asks: + type: list + values: + type: dict + values: + amount: + type: float + price: + type: float + version: + type: int + + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: + - version + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - amount + type: + - float + - key: bids_price + path: + - bids + - price + type: + - float + - key: asks_amount + path: + - asks + - amount + type: + - float + - key: asks_price + path: + - asks + - price + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bankcex.yaml b/pandas_datareader/crypto/resources/running_exchanges/bankcex.yaml new file mode 100644 index 00000000..da663b2d --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bankcex.yaml @@ -0,0 +1,356 @@ +name: bankcex +exchange: true + +rate_limit: + max: 300 + unit: 60 + +api_url: https://api.bankcex.com/api/v1/ + +requests: + currency_pairs: + request: + template: exchangeInfo + pair_template: null + params: null + + response: + type: dict + values: + rate_limits: + type: list + symbols: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + + + mapping: + - key: currency_pair_first + path: + - symbols + - baseAsset + type: + - str + - key: currency_pair_second + path: + - symbols + - quoteAsset + type: + - str + + tickers: + request: + template: returnTicker + pair_template: null + params: null + response: + type: dict + values: + currency_pair: + type: dict + values: + symbol: + type: str + last: + type: float + highestBid: + type: float + lowestAsk: + type: float + quoteVolume: + type: float + baseVolume: + type: float + + + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - dict_values + - last + type: + - float + - key: time + path: [] + type: + - none + - now + - key: best_bid + path: + - dict_values + - highestBid + type: + - float + - key: best_ask + path: + - dict_values + - lowestAsk + type: + - float + - key: daily_volume + path: + - dict_values + - baseVolume + type: + - float + + historic_rates: + request: + template: klines + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + max: 100 + default: 100 + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + default: 1d +# startTime: # not necessary +# function: last_timestamp +# type: +# - datetime +# - timedeltams +# - interval +# - 1000 + endTime: + function: last_timestamp + type: + - datetime + - timestampms + response: + type: list + values: + type: list + values: + 0: # open time + type: int + 1: # open + type: str + 2: # high + type: str + 3: # low + type: str + 4: # close + type: str + 5: # volume + type: str + 6: # close time + type: int + 7: # quote volume + type: str + 8: # number of trades + type: str + + mapping: + - key: time + path: + - 6 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float + + + trades: + request: + template: trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + default: 500 + + response: + type: list + values: + type: dict + values: + id: + type: str + price: + type: str + qty: + type: str + time: + type: int + isBuyerMaker: + type: bool + isBestMatch: + type: bool + + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - id + type: + - str + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - true + - sell + - false + - buy + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + + order_books: + request: + template: depth + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + max: 1000 + default: 100 + response: + type: dict + values: + lastUpdateId: + type: str + bids: + type: list + values: + type: list + values: + 0: #price + type: str + 1: # qty + type: str + asks: + type: list + values: + type: list + values: + 0: #price + type: str + 1: # qty + type: str + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bequant.yaml b/pandas_datareader/crypto/resources/running_exchanges/bequant.yaml new file mode 100644 index 00000000..996552ec --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bequant.yaml @@ -0,0 +1,374 @@ +name: bequant +exchange: true + +rate_limit: + max: 6000 + unit: 60 + +api_url: https://api.bequant.io/api/2/public/ + +requests: + currency_pairs: + request: + template: symbol + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + baseCurrency: + type: str + quoteCurrency: + type: str + + mapping: + - key: currency_pair_first + path: + - baseCurrency + type: + - str + - key: currency_pair_second + path: + - quoteCurrency + type: + - str + + tickers: + request: + template: ticker + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbols + params: null + response: + type: list + values: + type: dict + values: + ask: + type: str + bid: + type: str + last: + type: str + volume: + type: str + volumeQuote: + type: str + timestamp: + type: str + + mapping: + - key: last_price + path: + - last + type: + - str + - float + - key: time + path: + - timestamp + type: + - str + - dateparser + - key: best_bid + path: + - bid + type: + - str + - float + - key: best_ask + path: + - ask + type: + - str + - float + - key: daily_volume + path: + - volume + type: + - str + - float + + historic_rates: + request: + template: candles + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbols + params: + period: + allowed: + minutes: M1 + hours: H1 + days: D1 + weeks: D7 + months: 1M + default: D1 + + till: + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S.%fZ" + from: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1000 + - from_timestamp + - 0 + - "%Y-%m-%dT%H:%M:%S.%fZ" + sort: + default: DESC + limit: + max: 1000 + default: 1000 + + response: + type: dict + values: + currency_pair: + type: list + values: + type: dict + values: + timestamp: + type: str + open: + type: str + close: + type: str + min: + type: str + max: + type: str + volumeQuote: + type: str + volume: + type: str + + mapping: + - key: time + path: + - list_values + - timestamp + type: + - str + - dateparser + - key: open + path: + - list_values + - open + type: + - str + - float + - key: high + path: + - list_values + - max + type: + - str + - float + - key: low + path: + - list_values + - min + type: + - str + - float + - key: close + path: + - list_values + - close + type: + - str + - float + - key: volume + path: + - list_values + - volume + type: + - str + - float + + trades: + request: + template: trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbols + params: +# from: +# function: last_timestamp +# type: +# - datetime +# - timestamp +# till: +# function: last_timestamp +# type: +# - datetime +# - timedelta +# - interval +# - 1000 +# sort: +# default: DESC + limit: + max: 1000 + default: 500 + response: + type: dict + values: + currency_pair: + type: list + values: + type: dict + values: + id: + type: int + price: + type: str + quantity: + type: str + side: + type: str + timestamp: + type: str + + mapping: + - key: time + path: + - list_values + - timestamp + type: + - str + - dateparser + - key: id + path: + - list_values + - id + type: + - int + - key: direction + path: + - list_values + - side + type: + - str + - key: price + path: + - list_values + - price + type: + - str + - float + - key: amount + path: + - list_values + - quantity + type: + - str + - float + + order_books: + request: + template: orderbook + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbols + params: + limit: + default: 100 + + response: + type: dict + values: + currency_pair: + type: dict + values: + timestamp: + type: str + batchingTime: + type: str + ask: + type: list + values: + type: dict + values: + price: + type: str + size: + type: str + bid: + type: list + values: + type: dict + values: + price: + type: str + size: + type: str + + mapping: + - key: time + path: + - dict_values + - timestamp + type: + - str + - dateparser + - key: id + path: + - dict_values + - timestamp + type: + - str + - dateparser + - totimestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - dict_values + - bid + - size + type: + - str + - float + - key: bids_price + path: + - dict_values + - bid + - price + type: + - str + - float + - key: asks_amount + path: + - dict_values + - ask + - size + type: + - str + - float + - key: asks_price + path: + - dict_values + - ask + - price + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bibox.yaml b/pandas_datareader/crypto/resources/running_exchanges/bibox.yaml new file mode 100644 index 00000000..ce282e2f --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bibox.yaml @@ -0,0 +1,416 @@ +name: bibox +exchange: true +api_url: https://api.bibox.com/v1/mdata +rate_limit: null +requests: + + tickers: + request: + template: "" + pair_template: null + params: + cmd: + type: str + default: marketAll + response: + type: dict + values: + + type: list + values: + result: + type: dict + values: + + buy: + type: int + high: + type: int + last: + type: float + low: + type: int + sell: + type: int + vol24H: + type: float + last_cny: + type: int + last_usd: + type: int + cmd: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: currency_pair_first + path: + - result + - coin_symbol + type: + - str + - key: currency_pair_second + path: + - result + - currency_symbol + type: + - str + - key: daily_volume + path: + - result + - vol24H + type: + - str + - float + - key: last_price + path: + - result + - last + type: + - str + - float + + currency_pairs: + request: + template: "" + pair_template: null + params: + cmd: + type: str + default: pairList + response: + type: dict + values: + result: + type: list + values: + type: dict + values: + id: + type: int + pair: # e.g. BIX_BTC + type: str + is_hide: + type: int + cmd: + type: str + ver: + type: str + mapping: + - key: currency_pair_first + path: + - result + - pair + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - result + - pair + type: + - str + - split + - "_" + - 1 + + historic_rates: + request: + template: "" + pair_template: # pairs, example: BIX_BTC + template: "{first}_{second}" + lower_case: false + alias: pair + params: + cmd: + type: str + default: kline + period: # k line period + allowed: + minutes: 1min + hours: 1hour + days: day + weeks: week + default: day + size: # how many, 1-1000, if not passed will return 1000 + type: int + default: 1000 + response: + type: dict + values: + result: + type: list + values: + type: dict + values: + time: + type: + - float + - from_timestamp + - 0 + open: + type: + - str + - float + high: + type: + - str + - float + low: + type: + - str + - float + close: + type: + - str + - float + vol: + type: + - str + - int + cmd: + type: str + ver: + type: str + mapping: + - key: time + path: + - result + - time + type: + - float + - from_timestamp + - 1 + - key: open + path: + - result + - open + type: + - str + - float + - key: high + path: + - result + - high + type: + - str + - float + - key: low + path: + - result + - low + type: + - str + - float + - key: close + path: + - result + - close + type: + - str + - float + - key: volume + path: + - result + - vol + type: + - str + - float + + order_books: + request: + template: "" + pair_template: # pairs, example: BIX_BTC + template: "{first}_{second}" + lower_case: false + alias: pair + params: + cmd: + type: str + default: depth + size: # how many, 1-200, if not passed will return 200 + type: int + default: 200 + response: + type: dict + values: + result: + type: dict + values: + update_time: + type: + - float + - from_timestamp + - 0 + asks: + type: list + values: + type: dict + values: + price: + type: + - str + - float + volume: + type: + - str + - float + bids: + type: list + values: + type: dict + values: + price: + type: + - str + - float + volume: + type: + - str + - float + pair: + type: str + cmd: + type: str + ver: + type: str + mapping: + - key: time + path: + - result + - update_time + type: + - float + - from_timestamp + - 1 + - key: asks_price + path: + - result + - asks + - price + type: + - str + - float + - key: asks_amount + path: + - result + - asks + - volume + type: + - str + - float + - key: bids_price + path: + - result + - bids + - price + type: + - str + - float + - key: bids_amount + path: + - result + - bids + - volume + type: + - str + - float + - key: id + path: + - result + - update_time + type: + - int + - key: position + path: [] + type: + - none + - range + + trades: + request: + template: "" + pair_template: # pairs, example: BIX_BTC + template: "{first}_{second}" + lower_case: false + alias: pair + params: + cmd: + type: str + default: deals + size: # how many, 1-200, if not passed will return 200 + type: int + default: 200 + response: + type: dict + values: + result: + type: list + values: + type: dict + values: + id: + type: int + pair: + type: str + price: + type: + - str + amount: + type: + - str + time: + type: + - str + side: # transaction side, 1-bid, 2-ask + type: int + cmd: + type: str + mapping: + - key: price + path: + - result + - price + type: + - str + - float + - key: amount + path: + - result + - amount + type: + - str + - float + - key: time + path: + - result + - time + type: + - str + - float + - from_timestamp + - 1 + - key: direction + path: + - result + - side + type: + - value + - map + - 1 + - buy + - 2 + - sell + - key: id + path: + - result + - time + type: + - str + - int + diff --git a/pandas_datareader/crypto/resources/running_exchanges/bidesk.yaml b/pandas_datareader/crypto/resources/running_exchanges/bidesk.yaml new file mode 100644 index 00000000..e722bc0a --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bidesk.yaml @@ -0,0 +1,304 @@ +name: bidesk +is_exchange: true + +api_url: https://api.bidesk.com/ +rate_limit: + max: 1500 + unit: 60 + +requests: + currency_pairs: + request: + template: openapi/v1/brokerInfo + pair_template: null + params: null + + response: + type: dict + values: + symbols: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + + mapping: + - key: currency_pair_first + path: + - symbols + - baseAsset + type: + - str + - key: currency_pair_second + path: + - symbols + - quoteAsset + type: + - str + + tickers: + request: + template: openapi/quote/v1/ticker/price + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: null + + response: + type: dict + values: + symbol: + type: str + price: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - price + type: + - str + - float + + order_books: + request: + template: openapi/quote/v1/depth + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 1000 + default: 50 + response: + type: dict + values: + time: + type: int + bids: + type: list + values: + type: list + 0: #price + type: str + 1: #qty + type: str + asks: + type: list + values: + type: list + 0: + type: str + 1: + type: str + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - time + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + + trades: + request: + template: openapi/quote/v1/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 1000 + default: 500 + response: + type: list + value: + type: dict + values: + price: + type: str + qty: + typ: str + time: + type: int + isBuyerMaker: + type: bool + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - True + - sell + - False + - buy + - key: id + path: + - time + type: + - int + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + + historic_rates: + request: + template: openapi/quote/v1/klines + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + months: 1M + default: 1d + limit: + type: int + max: 1000 + default: 1000 + endTime: + function: last_timestamp + type: + - datetime + - timestampms + + response: + type: list + values: + type: list + values: + 0: #timestamp + type: int + 1: #open + type: str + 2: #high + type: str + 3: #low + type: str + 4: #close + type: str + 5: #volume + type: str + 6: #close time + type: int + 7: # quote Asset volume + type: str + 8: # number of trades + type: int + 9: # taker buy base asset volume + type: str + 10: # taker buy quote asset volume + type: str + + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bigone.yaml b/pandas_datareader/crypto/resources/running_exchanges/bigone.yaml new file mode 100644 index 00000000..a621a096 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bigone.yaml @@ -0,0 +1,341 @@ +name: bigone +exchange: true + +rate_limit: + max: 3000 + unit: 60 + +api_url: https://big.one/api/v3/ + +requests: + currency_pairs: + request: + template: asset_pairs + pair_template: null + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + name: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - name + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - data + - name + type: + - str + - split + - "-" + - 1 + + tickers: + request: + template: asset_pairs/{currency_pair}/ticker + pair_template: + template: "{first}-{second}" + lower_case: false + params: null + response: + type: dict + values: + data: + type: dict + values: + bid: + type: dict + values: + price: + type: str + ask: + type: dict + values: + price: + type: str + volume: + type: str + + mapping: + - key: time + path: [] + type: + - none + - now + - key: best_bid + path: + - data + - bid + - price + type: + - str + - float + - key: best_ask + path: + - data + - ask + - price + type: + - str + - float + - key: daily_volume + path: + - data + - volume + type: + - str + - float + + historic_rates: + request: + template: asset_pairs/{currency_pair}/candles + pair_template: + template: "{first}-{second}" + lower_case: false + params: + period: + allowed: + minutes: min1 + hours: hour1 + days: day1 + weeks: week1 + months: months1 + default: day1 + time: + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S.%fZ" + limit: + max: 500 + default: 500 + response: + type: dict + values: + type: list + values: + type: dict + values: + close: + type: str + high: + type: str + low: + type: str + open: + type: str + volume: + type: str + time: + type: str + + mapping: + - key: time + path: + - data + - time + type: + - str + - dateparser + - key: open + path: + - data + - open + type: + - str + - float + - key: high + path: + - data + - high + type: + - str + - float + - key: low + path: + - data + - low + type: + - str + - float + - key: close + path: + - data + - close + type: + - str + - float + - key: volume + path: + - data + - volume + type: + - str + - float + + + trades: + request: + template: asset_pairs/{currency_pair}/trades + pair_template: + template: "{first}-{second}" + lower_case: false + params: null + + response: + type: dict + values: + type: list + values: + type: dict + values: + id: + type: int + price: + type: str + amount: + type: str + taker_side: + type: str + created_at: + type: str + mapping: + - key: time + path: + - data + - created_at + type: + - str + - dateparser + - key: id + path: + - data + - id + type: + - int + - key: direction + path: + - data + - taker_side + type: + - value + - map + - ASK + - sell + - BID + - buy + - key: price + path: + - data + - price + type: + - str + - float + - key: amount + path: + - data + - amount + type: + - str + - float + + order_books: + request: + template: asset_pairs/{currency_pair}/depth + pair_template: + template: "{first}-{second}" + lower_case: false + params: + limit: + max: 200 + default: 50 + + response: + type: dict + values: + data: + type: dict + values: + bids: + type: list + values: + type: dict + values: + price: + type: str + quantity: + type: str + asks: + type: list + values: + type: dict + values: + price: + type: str + quantity: + type: str + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - data + - bids + - quantity + type: + - str + - float + - key: bids_price + path: + - data + - bids + - price + type: + - str + - float + - key: asks_amount + path: + - data + - asks + - quantity + type: + - str + - float + - key: asks_price + path: + - data + - asks + - price + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/binance.yaml b/pandas_datareader/crypto/resources/running_exchanges/binance.yaml new file mode 100644 index 00000000..6b33b19d --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/binance.yaml @@ -0,0 +1,388 @@ +name: binance +exchange: true +api_url: https://api.binance.com/api/ +rate_limit: + max: 1200 + unit: 60 +requests: + currency_pairs: + request: + template: v1/exchangeInfo + pair_template: null + params: null + response: + type: dict + values: + timezone: + type: str # "UTC" + serverTime: + type: + - float + - from_timestamp + - 1 + rateLimits: + type: list + exchangeFilters: + type: list + symbols: + type: list + values: + type: dict + values: + symbol: # i.e. "ETHBTC" + type: str + status: # i.e. "TRADING" + type: str + baseAsset: # i.e. ETH + type: str + baseAssetPrecision: + type: int + quoteAsset: # i.e. "BTC" + type: str + quotePrecision: + type: int + orderTypes: + type: list + icebergAllowed: + type: bool + filters: + type: list + mapping: + - key: currency_pair_first + path: + - symbols + - baseAsset + type: + - str + - key: currency_pair_second + path: + - symbols + - quoteAsset + type: + - str + + tickers: + request: + template: v3/ticker/bookTicker + pair_template: # e.g. BNBBTC + template: "{first}{second}" + lower_case: false + alias: symbol + params: null + response: + type: dict + values: + symbol: + type: str + bidPrice: + type: + - str + - float + bidQty: + type: + - str + - float + askPrice: + type: + - str + - float + askQty: + type: + - str + - float + mapping: + - key: time + path: [] + type: + - none + - now + - key: best_bid + path: + - bidPrice + type: + - str + - float + - key: best_ask + path: + - askPrice + type: + - str + - float + + order_books: + request: + template: v3/depth + pair_template: # e.g. BNBBTC + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + max: 100 + default: 50 + + response: + type: dict + values: + lastUpdateId: + type: int + bids: + type: list + values: + type: list + values: + 0: # price + type: + - str + - float + 1: # quantity + type: + - str + - float + asks: + type: list + values: + type: list + values: + 0: # price + type: + - str + - float + 1: # quantity + type: + - str + - float + mapping: + - key: time + path: [] + type: + - none + - now + + - key: id + path: + - lastUpdateId + type: + - str + + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + + trades: + request: + template: v1/trades + pair_template: # e.g. BNBBTC + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + max: 1000 + default: 500 + weight: 1 + response: + type: list + values: + type: dict + values: + id: + type: int + price: + type: + - str + - float + qty: + type: + - str + - float + time: + type: + - float + - from_timestamp + - 1 + isBuyerMaker: + type: bool + isBestMatch: + type: bool + mapping: + - key: id + path: + - id + type: + - int + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - True + - sell + - False + - buy + + historic_rates: + request: + template: v1/klines + pair_template: # e.g. BNBBTC + template: "{first}{second}" + lower_case: false + alias: symbol + params: + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + months: 1M + default: 1d + startTime: + required: false + endTime: + function: last_timestamp + type: + - datetime + - timestampms + limit: + max: 1000 + default: 1000 + response: + type: list + values: + type: list + values: + 0: # Open time + type: + - float + - from_timestamp + - 1 + 1: # open + type: + - str + - float + 2: # high + type: + - str + - float + 3: # low + type: + - str + - float + 4: # close + type: + - str + - float + 5: # volume + type: + - str + - float + 6: # close time + type: + - float + - from_timestamp + - 1 + 7: # Quote asset volume + type: + - str + - float + 8: # Number of trades + type: int + 9: # Taker buy base asset volume + type: + - str + - float + 10: # Taker buy quote asset volume + type: + - str + - float + 11: # ignore + type: ignore + mapping: + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float + - key: time + path: + - 6 + type: + - float + - from_timestamp + - 1 diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitbay.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitbay.yaml new file mode 100644 index 00000000..6e725ee3 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bitbay.yaml @@ -0,0 +1,384 @@ +name: bitbay +exchange: true + +api_url: https://api.bitbay.net/rest/trading/ +rate_limit: + max: 60 + unit: 60 + +requests: + currency_pairs: + request: + template: ticker + pair_template: null + params: null + response: + type: dict + values: + items: + type: dict + values: + currency_pair: + type: dict + + mapping: + - key: currency_pair_first + path: + - items + - dict_key + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - items + - dict_key + type: + - str + - split + - "-" + - 1 + + tickers: + request: + template: ticker + pair_template: null + params: null + response: + type: dict + values: + items: + type: dict + values: + currency_pair: + type: dict + values: + market: + type: dict + values: + time: + type: str + highestBid: + type: str + lowestAsk: + type: str + rate: + type: str + + mapping: + - key: currency_pair_first + path: + - items + - dict_key + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - items + - dict_key + type: + - str + - split + - "-" + - 1 + - key: time + path: + - items + - dict_values + - time + type: + - str + - float + - from_timestamp + - 1 + - key: last_price + path: + - items + - dict_values + - rate + type: + - str + - float + - key: best_bid + path: + - items + - dict_values + - highestBid + type: + - str + - float + - key: best_ask + path: + - items + - dict_values + - lowestAsk + type: + - str + - float + + + trades: + request: + template: transactions/{currency_pair} + pair_template: + template: "{first}-{second}" + lower_case: false + params: + limit: + type: int + max: 300 + default: 300 + response: + type: dict + values: + items: + type: list + values: + type: dict + values: + id: + type: str + t: + type: str + a: + type: str + r: + type: str + ty: + type: str + + mapping: + - key: time + path: + - items + - t + type: + - str + - float + - from_timestamp + - 1 + - key: id + path: + - items + - id + type: + - str + - key: price + path: + - items + - r + type: + - str + - float + - key: amount + path: + - items + - a + type: + - str + - float + - key: direction + path: + - items + - ty + type: + - str + + + order_books: + request: + template: orderbook-limited/{currency_pair}/50 #change limit 50 here + pair_template: + template: "{first}-{second}" + lower_case: false + params: null + response: + type: dict + values: + sell: + type: list + values: + type: dict + values: + ra: + type: str + ca: + type: str + sa: + type: str + pa: + type: str + co: + type: int + buy: + type: list + values: + type: dict + values: + ra: + type: str + ca: + type: str + sa: + type: str + pa: + type: str + co: + type: int + timestamp: + type: str + seqNo: + type: str + + mapping: + - key: time + path: + - timestamp + type: + - str + - float + - from_timestamp + - 1 + - key: id + path: + - seqNo + type: + - str + - int + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - buy + - ra + type: + - str + - float + - key: bids_amount + path: + - buy + - ca + type: + - str + - float + - key: asks_price + path: + - sell + - ra + type: + - str + - float + - key: asks_amount + path: + - sell + - ca + type: + - str + - float + + historic_rates: + request: + template: candle/history/{currency_pair}/{frequency} + pair_template: + template: "{first}-{second}" + lower_case: false + params: + to: + type: + - none + - now_timestampms + from: + function: last_timestamp + type: + - datetime + - timedeltams + - interval + - 2000 + + frequency: + allowed: + minutes: 60 + hours: 3600 + days: 86400 + weeks: 604800 + response: + type: dict + values: + items: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: dict + values: + o: + type: str + c: + type: str + h: + type: str + l: + type: str + v: + type: str + mapping: + - key: time + path: + - items + - 0 + type: + - str + - float + - from_timestamp + - 1 + - key: open + path: + - items + - 1 + - o + type: + - str + - float + - key: high + path: + - items + - 1 + - h + type: + - str + - float + - key: low + path: + - items + - 1 + - l + type: + - str + - float + - key: close + path: + - items + - 1 + - c + type: + - str + - float + - key: volume + path: + - items + - 1 + - v + type: + - str + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitfinex.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitfinex.yaml new file mode 100644 index 00000000..8c3f78cb --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bitfinex.yaml @@ -0,0 +1,365 @@ +name: bitfinex + # v1: +#api_url: https://api-pub.bitfinex.com/ +#api_url: https://api.bitfinex.com/ +api_url: '' + +rate_limit: + max: 90 + unit: 60 + +requests: + currency_pairs: + request: + template: https://api.bitfinex.com/v1/symbols_details + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + pair: + type: str + mapping: + - key: currency_pair_first + path: + - pair + type: + - str + - split_at_del_or_index + - ':' + - 3 + - 0 + + - key: currency_pair_second + path: + - pair + type: + - str + - split_at_del_or_index + - ':' + - 3 + - 1 + + + tickers: + request: + template: https://api.bitfinex.com/v1/pubticker/{currency_pair} + pair_template: # i.e. tBTCUSD + template: "{first}{second}" + lower_case: false + params: null + response: + type: dict + values: + mid: + type: str + bid: + type: str + ask: + type: str + last_price: + type: str + low: + type: str + high: + type: str + volume: + type: str + timestamp: + type: str + mapping: # for trading pairs (ex. tBTCUSD) + - key: time + path: + - timestamp + type: + - str + - float + - from_timestamp + - 0 + - key: best_bid + path: + - bid + type: + - str + - float + - key: best_ask + path: + - ask + type: + - str + - float + - key: last_price + path: + - last_price + type: + - str + - float + - key: daily_volume + path: + - volume + type: + - str + - float + + trades: + request: + template: https://api.bitfinex.com/v1/trades/{currency_pair} + pair_template: # i.e. tBTCUSD + template: "{first}{second}" + lower_case: false + params: + limit_trades: # Number of records + default: 999 # max: 10000 + start: # Millisecond start time + required: false + end: # Millisecond end time + required: false + sort: # if = 1 it sorts results returned with old > new + default: -1 + response: + type: list + values: + type: dict + values: + # template on trading pairs (ex. tBTCUSD) + timestamp: # ID + type: int + tid: # MTS: millisecond time stamp + type: + - int + price: # Price: How much was bought (positive) or sold (negative). + type: float + amount: # Amount: Price at which the trade was executed + type: float + exchange: # Exchange Name + type: str + type: # Direction (i.e. Sell/Buy) + type: str + # template on funding currencies (ex. fUSD) + + mapping: # for trading pairs (ex. tBTCUSD) + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - tid + type: + - int + - key: amount + path: + - amount + type: + - float + - key: price + path: + - price + type: + - float + - key: direction + path: + - type + type: + - str + + order_books: + request: + template: https://api.bitfinex.com/v1/book/{currency_pair} + pair_template: # i.e. tBTCUSD + template: "{first}{second}" + lower_case: false + params: + group: # Level of price aggregation (P0, P1, P2, P3, P4, R0) + type: str + default: 1 + limit_bids: # Number of price points ("25", "100") + type: int + default: 50 + limit_asks: # Number of price points ("25", "100") + type: int + default: 50 + response: + type: dict + values: + bids: + type: list + values: + type: dict + values: + price: + type: str + amount: + type: str + timestamp: + type: str + asks: + type: list + values: + type: dict + values: + price: + type: str + amount: + type: str + timestamp: + type: str + + mapping: # for trading pairs (ex. tBTCUSD), if AMOUNT > 0 then bid else ask. + - key: id + path: + - bids + - timestamp + type: + - str + - float + - int + - key: position + path: [] + type: + - none + - range + - key: time + path: + - bids + - timestamp + type: + - str + - float + - from_timestamp + - 0 + + - key: asks_price + path: + - asks + - price + type: + - str + - float + - key: asks_amount + path: + - asks + - amount + type: + - str + - float + + - key: bids_price + path: + - bids + - price + type: + - str + - float + - key: bids_amount + path: + - bids + - amount + type: + - str + - float + + + historic_rates: + request: + template: https://api-pub.bitfinex.com/v2/candles/trade:{frequency}:{currency_pair}/hist + pair_template: # i.e. tBTCUSD + template: "t{first}{second}" + lower_case: false + params: + limit: # Number of candles requested + default: 10000 # max + start: # Filter start (ms) + required: false + end: # Filter end (ms) + function: last_timestamp + type: + - datetime + - timestampms + sort: # if = 1 it sorts results returned with old > new + required: false + + frequency: + allowed: + minutes: 1m + hours: 1h + days: 1D + weeks: 7D + months: 1M + default: 1D + + response: + type: list + values: + # response with Section = "last" + - 0: # MTS: millisecond time stamp + type: + - float + - from_timestamp + - 1 + 1: # OPEN: First execution during the time frame + type: float + 2: # CLOSE: Last execution during the time frame + type: float + 3: # HIGH: Highest execution during the time frame + type: float + 4: # LOW: Lowest execution during the timeframe + type: float + 5: # VOLUME: Quantity of symbol traded within the timeframe + type: float + # response with Section = "hist" + - type: list + values: + 0: # MTS: millisecond time stamp + type: + - float + - from_timestamp + - 1 + 1: # OPEN: First execution during the time frame + type: float + 2: # CLOSE: Last execution during the time frame + type: float + 3: # HIGH: Highest execution during the time frame + type: float + 4: # LOW: Lowest execution during the timeframe + type: float + 5: # VOLUME: Quantity of symbol traded within the timeframe + type: float + mapping: # for trading pairs (ex. tBTCUSD) + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - 1 + type: + - float + - key: close + path: + - 2 + type: + - float + - key: high + path: + - 3 + type: + - float + - key: low + path: + - 4 + type: + - float + - key: volume + path: + - 5 + type: + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitforex.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitforex.yaml new file mode 100644 index 00000000..4a66f2a2 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bitforex.yaml @@ -0,0 +1,335 @@ +name: bitforex +exchange: true + +rate_limit: null + +api_url: https://api.bitforex.com/api/v1/market/ + +requests: + currency_pairs: + request: + template: symbols + pair_template: null + params: null + + response: + type: list + values: + data: + type: list + values: + type: dict + values: + symbol: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - symbol + type: + - str + - split + - "-" + - 2 + - key: currency_pair_second + path: + - data + - symbol + type: + - str + - split + - "-" + - 1 + + tickers: + request: + template: ticker + pair_template: + template: "coin-{second}-{first}" + alias: symbol + lower_case: true + params: null + response: + type: dict + values: + data: + type: dict + values: + buy: + type: float + date: + type: int + last: + type: float + sell: + type: float + vol: + type: float + mapping: + - key: last_price + path: + - data + - last + type: + - float + - key: time + path: + - data + - date + type: + - float + - from_timestamp + - 1 + - key: best_bid + path: + - data + - buy + type: + - float + - key: best_ask + path: + - data + - sell + type: + - float + - key: daily_volume + path: + - data + - vol + type: + - float + + historic_rates: + request: + template: kline + pair_template: + template: "coin-{second}-{first}" + lower_case: true + alias: symbol + params: + size: + max: 600 + default: 600 + ktype: + allowed: + minutes: 1min + hours: 1hour + days: 1day + weeks: 1week + months: 1month + default: 1day + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + close: + type: float + open: + type: float + high: + type: float + low: + type: float + time: + type: float + vol: + type: float + + mapping: + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 1 + - key: open + path: + - data + - open + type: + - float + - key: high + path: + - data + - high + type: + - float + - key: low + path: + - data + - low + type: + - float + - key: close + path: + - data + - close + type: + - float + - key: volume + path: + - data + - vol + type: + - float + + + trades: + request: + template: trades + pair_template: + template: "coin-{second}-{first}" + lower_case: true + alias: symbol + params: + size: + max: 600 + default: 200 + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + amount: + type: float + direction: + type: int + price: + type: float + tid: + type: int + time: + type: int + + mapping: + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - data + - tid + type: + - int + - key: direction + path: + - direction + type: + - value + - map + - 1 + - buy + - 2 + - sell + - key: price + path: + - data + - price + type: + - float + - key: amount + path: + - data + - amount + type: + - float + + order_books: + request: + template: depth + pair_template: + template: "coin-{second}-{first}" + lower_case: true + alias: symbol + params: + size: + max: 200 + default: 50 + + response: + type: dict + values: + data: + type: dict + values: + asks: + type: list + values: + type: dict + values: + amount: + type: float + price: + type: float + bids: + type: list + values: + type: dict + values: + amount: + type: float + price: + type: float + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - data + - bids + - amount + type: + - float + - key: bids_price + path: + - data + - bids + - price + type: + - float + - key: asks_amount + path: + - data + - asks + - amount + type: + - float + - key: asks_price + path: + - data + - asks + - price + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitfront.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitfront.yaml new file mode 100644 index 00000000..01a133e5 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bitfront.yaml @@ -0,0 +1,251 @@ +name: bitfront +exchange: true + +rate_limit: null + +api_url: https://openapi.bitfront.me/v1/market/public/ + +requests: + currency_pairs: + request: + template: /coins/pairPolicy + pair_template: null + params: null + + response: + type: dict + values: + responseData: + type: list + values: + type: dict + marketType: + type: str + coinType: + type: str + + mapping: + - key: currency_pair_first + path: + - responseData + - coinType + type: + - str + - key: currency_pair_second + path: + - responseData + - marketType + type: + - str + + tickers: + request: + template: currentTickValue + pair_template: + template: "{first}.{second}" + lower_case: false + alias: coinPair + params: null + response: + type: dict + values: + responseTime: + type: int + responseData: + type: list + values: + type: dict + values: + bid: + type: float + ask: + type: float + last: + type: float + volume: + type: float + mapping: + - key: last_price + path: + - responseData + - last + type: + - float + - key: time + path: + - responseTime + type: + - float + - from_timestamp + - 1 + - key: best_bid + path: + - responseData + - bid + type: + - float + - key: best_ask + path: + - responseData + - ask + type: + - float + - key: daily_volume + path: + - responseData + - volume + type: + - float + + + order_books: + request: + template: orderBooks + pair_template: + template: "{first}.{second}" + lower_case: false + alias: coinPair + params: + depth: + max: 1000 + default: 50 + + response: + type: dict + values: + responseTime: + type: int + responseData: + type: dict + values: + ASK: + type: list + values: + type: dict + values: + price: + type: float + amount: + type: float + BID: + type: list + values: + type: dict + values: + price: + type: float + amount: + type: float + + mapping: + - key: time + path: + - responseTime + type: + - float + - from_timestamp + - 1 + - key: id + path: + - responseTime + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - responseData + - BID + - amount + type: + - float + - key: bids_price + path: + - responseData + - BID + - price + type: + - float + - key: asks_amount + path: + - responseData + - ASK + - amount + type: + - float + - key: asks_price + path: + - responseData + - ASK + - price + type: + - float + + trades: + request: + template: tradeHistory + pair_template: + template: "{first}.{second}" + lower_case: false + alias: coinPair + params: + max: + default: 100 + + response: + type: dict + values: + responseTime: + type: int + responseData: + type: list + values: + type: dict + values: + transactionID: + type: int + price: + type: float + amount: + type: float + orderSide: + type: str + createdAt: + type: int + + mapping: + - key: time + path: + - responseData + - createdAt + type: + - float + - from_timestamp + - 1 + - key: id + path: + - responseData + - transactionID + type: + - int + - key: direction + path: + - responseData + - orderSide + type: + - str + - key: price + path: + - responseData + - price + type: + - float + - key: amount + path: + - responseData + - amount + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bithumb.yaml b/pandas_datareader/crypto/resources/running_exchanges/bithumb.yaml new file mode 100644 index 00000000..592a98ec --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bithumb.yaml @@ -0,0 +1,420 @@ +name: bithumb +exchange: true +api_url: https://global-openapi.bithumb.pro/openapi/v1/ +rate_limit: + max: 20 + unit: 1 +requests: + + currency_pairs: + request: + template: spot/ticker + pair_template: null + params: + symbol: + type: str + default: ALL + response: + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + p: # dict_key + type: dict + ver: + type: str + vol: + type: str + c: + type: str + s: + type: str + t: + type: str + v: + type: str + h: + type: str + l: + type: str + lev: + type: str + code: + type: str + msg: + type: str + timestamp: + type: int + startTime: + type: null + + mapping: + - key: currency_pair_first + path: + - data + - s + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - data + - s + type: + - str + - split + - "-" + - 1 + + tickers: + request: + template: spot/ticker + pair_template: null + params: + symbol: + type: str + default: ALL + response: + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + p: # dict_key + type: dict + ver: + type: str + vol: + type: str + c: + type: str + s: + type: str + t: + type: str + v: + type: str + h: + type: str + l: + type: str + lev: + type: str + code: + type: str + msg: + type: str + timestamp: + type: int + startTime: + type: null + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: currency_pair_first + path: + - data + - s + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - data + - s + type: + - str + - split + - "-" + - 1 + - key: last_price + path: + - data + - h + type: + - str + - float + - key: daily_volume + path: + - data + - v + type: + - str + - float + + order_books: + request: + template: spot/orderBook + pair_template: # e.g. BTC + template: "{first}-{second}" + alias: symbol + lower_case: false + params: null + response: + type: dict + values: + data: + type: dict + values: + symbol: + type: str + b: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + s: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + code: + type: str + msg: + type: str + timestamp: + type: int + startTime: + type: null + ver: + type: str + + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: bids_price + path: + - data + - b + - 0 + type: + - str + - float + - key: bids_amount + path: + - data + - b + - 1 + type: + - str + - float + - key: asks_amount + path: + - data + - s + - 1 + type: + - str + - float + - key: asks_price + path: + - data + - s + - 0 + type: + - str + - float + - key: id + path: + - data + - ver + type: + - str + - int + - key: position + path: [] + type: + - none + - range + + trades: + request: + template: spot/trades + pair_template: # e.g. BTC + template: "{first}-{second}" + alias: symbol + lower_case: false + params: null + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + p: + type: str + ver: + type: str + s: + type: str + t: + type: str + v: + type: str + mapping: + - key: time + path: + - data + - t + type: + - str + - float + - from_timestamp + - 0 + - key: id + path: + - data + - ver + type: + - str + - int + - key: amount + path: + - data + - v + type: + - str + - float + - key: price + path: + - data + - p + type: + - str + - float + - key: direction + path: + - data + - s + type: + - str + + historic_rates: + request: + template: spot/kline + pair_template: + template: "{first}-{second}" + alias: symbol + lower_case: false + params: + type: + allowed: + minutes: m1 + hours: h1 + days: d1 + weeks: w1 + months: M1 + default: m1 + start: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1000 + end: + function: last_timestamp + type: + - datetime + - timestamp + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + c: + type: str + s: + type: str + t: + type: str + v: + type: str + h: + type: str + time: + type: str + l: + type: str + o: + type: str + mapping: + - key: time + path: + - data + - time + type: + - str + - float + - from_timestamp + - 0 + - key: open + path: + - data + - o + type: + - str + - float + - key: high + path: + - data + - h + type: + - str + - float + - key: low + path: + - data + - l + type: + - str + - float + - key: close + path: + - data + - c + type: + - str + - float + - key: volume + path: + - data + - v + type: + - str + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitkub.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitkub.yaml new file mode 100644 index 00000000..e5ebcfb2 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bitkub.yaml @@ -0,0 +1,246 @@ +name: bitkub +exchange: true + +rate_limit: null +api_url: https://api.bitkub.com + +requests: + currency_pairs: + request: + template: /api/market/symbols + pair_template: null + params: null + + response: + type: dict + values: + result: + type: list + values: + type: dict + values: + symbol: + type: str + + mapping: + - key: currency_pair_first + path: + - result + - symbol + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - result + - symbol + type: + - str + - split + - "_" + - 1 + + tickers: + request: + template: /api/market/ticker + pair_template: null + params: null + response: + type: dict + values: + currency_pair: + type: dict + values: + last: + type: float + lowestAsk: + type: float + highestBid: + type: float + baseVolume: + type: float + + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - dict_values + - last + type: + - float + - key: time + path: [] + type: + - none + - now + - key: best_bid + path: + - dict_values + - highestBid + type: + - float + - key: best_ask + path: + - dict_values + - lowestAsk + type: + - float + - key: daily_volume + path: + - dict_values + - baseVolume + type: + - float + + trades: + request: + template: /api/market/trades + pair_template: + template: "{first}_{second}" + lower_case: false + alias: sym + params: + lmt: + type: int + default: 200 + response: + type: dict + values: + result: + type: list + values: + type: list + values: + 0: # time + type: int + 1: # price + type: float + 2: # quty + type: float + 3: # side + type: str + + mapping: + - key: time + path: + - result + - 0 + type: + - float + - from_timestamp + - 1 + - key: id + path: + - result + - 0 + type: + - int + - key: direction + path: + - result + - 3 + type: + - str + - key: price + path: + - result + - 1 + type: + - float + - key: amount + path: + - result + - 2 + type: + - float + + order_books: + request: + template: /api/market/depth + pair_template: + template: "{first}_{second}" + lower_case: false + alias: sym + params: + lmt: + type: int + default: 50 + + response: + type: dict + values: + bids: + type: list + values: + type: list + values: + 0: # price + type: int + 1: # quantity + type: int + asks: + type: list + values: + type: list + values: + 0: + type: int + 1: + type: int + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - float + - key: bids_price + path: + - bids + - 0 + type: + - float + - key: asks_amount + path: + - asks + - 1 + type: + - float + - key: asks_price + path: + - asks + - 0 + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitmart.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitmart.yaml new file mode 100644 index 00000000..744bccac --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bitmart.yaml @@ -0,0 +1,409 @@ +name: bitmart +exchange: true +api_url: https://api-cloud.bitmart.com/spot/v1/ +rate_limit: + max: 600 # 3-90 + unit: 60 +requests: + + currency_pairs: + request: + template: symbols + pair_template: null + params: null + response: + type: dict + values: + data: + type: dict + values: + symbols: + type: list + values: + type: str + mapping: + - key: currency_pair_first + path: + - data + - symbols + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - data + - symbols + type: + - str + - split + - "_" + - 1 + + + tickers: + request: + template: ticker + pair_template: null + params: null + response: + type: dict + values: + data: + type: dict + values: + tickers: + type: list + values: + type: dict + values: + symbol: + type: str + last_price: + type: str + quote_volume: + type: str + base_volume: + type: str + best_ask: + type: str + best_bid: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: currency_pair_first + path: + - data + - tickers + - symbol + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - data + - tickers + - symbol + type: + - str + - split + - "_" + - 1 + + - key: last_price + path: + - data + - tickers + - last_price + type: + - str + - float + - key: best_ask + path: + - data + - tickers + - best_ask + type: + - str + - float + - key: best_bid + path: + - data + - tickers + - best_bid + type: + - str + - float + - key: daily_volume + path: + - data + - tickers + - base_volume + type: + - str + - float + + + historic_rates: + request: + template: symbols/kline + pair_template: # e.g. BMX_ETH + template: "{first}_{second}" + lower_case: false + alias: symbol + params: + step: # in minutes + allowed: + minutes: 1 + hours: 60 + days: 1440 + weeks: 10080 + months: 43200 + default: 1440 # 1d + + from: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 500 + to: # in milliseconds + function: last_timestamp + type: + - datetime + - timestamp + + response: + type: dict + values: + data: + type: dict + values: + klines: + type: list + values: + type: dict + values: + last_price: + type: str + timestamp: + type: int + volume: + type: str + open: + type: str + close: + type: str + high: + type: str + low: + type: str + mapping: + - key: time + path: + - data + - klines + - timestamp + type: + - float + - from_timestamp + - 0 + - key: open + path: + - data + - klines + - open + type: + - str + - float + - key: high + path: + - data + - klines + - high + type: + - str + - float + - key: low + path: + - data + - klines + - low + type: + - str + - float + - key: close + path: + - data + - klines + - close + type: + - str + - float + - key: volume + path: + - data + - klines + - volume + type: + - str + - float + + order_books: + request: + template: symbols/book + pair_template: # e.g. BMX_ETH + template: "{first}_{second}" + lower_case: false + alias: symbol + params: + precision: # Price precision whose range is defined in symbol details + type: int + required: false + size: + type: int + max: 200 + default: 50 + + response: + type: dict + values: + trace: + type: str + data: + type: dict + values: + buya: + type: list + values: + type: dict + values: + amount: + type: str + total: + type: str + price: + type: str + count: + type: str + sells: + type: list + values: + type: dict + values: + amount: + type: str + total: + type: str + price: + type: str + count: + type: str + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - data + - buys + - amount + type: + - str + - float + - key: bids_price + path: + - data + - buys + - price + type: + - str + - float + - key: asks_amount + path: + - data + - sells + - amount + type: + - str + - float + - key: asks_price + path: + - data + - sells + - price + type: + - str + - float + + trades: + request: + template: symbols/trades + pair_template: # e.g. BMX_ETH + template: "{first}_{second}" + lower_case: false + alias: symbol + params: null + response: + type: dict + values: + data: + type: dict + values: + trades: + type: list + values: + type: dict + values: + amount: + type: str + order_time: + type: str + price: + type: str + count: + type: str + type: + type: str + mapping: + - key: amount + path: + - data + - trades + - amount + type: + - str + - float + - key: id + path: + - data + - trades + - order_time + type: + - str + - int + - key: time + path: + - data + - trades + - order_time + type: + - float + - from_timestamp + - 1 + - key: price + path: + - data + - trades + - price + type: + - str + - float + - key: direction + path: + - data + - trades + - type + type: + - str diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitopro.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitopro.yaml new file mode 100644 index 00000000..fbf9c46c --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bitopro.yaml @@ -0,0 +1,345 @@ +name: bitopro +exchange: true + +rate_limit: + max: 600 + unit: 60 + +api_url: https://api.bitopro.com/v3/ + +requests: + currency_pairs: + request: + template: provisioning/trading-pairs + pair_template: null + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + base: + type: str + quote: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - base + type: + - str + - key: currency_pair_second + path: + - data + - quote + type: + - str + + tickers: + request: + template: tickers + pair_template: null + params: null + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + pair: + type: str + lastPrice: + type: str + volume24hr: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - pair + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - data + - pair + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - data + - lastPrice + type: + - str + - float + - key: time + path: [] + type: + - none + - now + - key: daily_volume + path: + - data + - volume24hr + type: + - str + - float + + historic_rates: + request: + template: trading-history/{currency_pair} + pair_template: + template: "{first}_{second}" + lower_case: true + params: + resolution: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + month: 1M + default: 1d + to: + function: last_timestamp + type: + - datetime + - timestamp + from: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 300 + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + timestamp: + type: int + open: + type: str + high: + type: str + low: + type: str + close: + type: str + volume: + type: str + + mapping: + - key: time + path: + - data + - timestamp + type: + - float + - from_timestamp + - 1 + - key: open + path: + - data + - open + type: + - str + - float + - key: high + path: + - data + - high + type: + - str + - float + - key: low + path: + - data + - low + type: + - str + - float + - key: close + path: + - data + - close + type: + - str + - float + - key: volume + path: + - data + - volume + type: + - str + - float + + + trades: + request: + template: trades/{currency_pair} + pair_template: + template: "{first}_{second}" + lower_case: true + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + timestamp: + type: int + isBuyer: + type: str + price: + type: str + amount: + type: str + mapping: + - key: time + path: + - data + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - data + - timestamp + type: + - int + - key: direction + path: + - data + - isBuyer + type: + - value + - map + - true + - sell + - false + - buy + - key: price + path: + - data + - price + type: + - str + - float + - key: amount + path: + - data + - amount + type: + - str + - float + + order_books: + request: + template: order-book/{currency_pair} + pair_template: + template: "{first}_{second}" + lower_case: true + params: + limit: + default: 20 + + response: + type: dict + values: + asks: + type: list + values: + type: dict + values: + amount: + type: str + count: + type: int + price: + type: str + total: + type: str + bids: + type: list + values: + type: dict + values: + amount: + type: str + count: + type: int + price: + type: str + total: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - amount + type: + - str + - float + - key: bids_price + path: + - bids + - price + type: + - str + - float + - key: asks_amount + path: + - asks + - amount + type: + - str + - float + - key: asks_price + path: + - asks + - price + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitrue.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitrue.yaml new file mode 100644 index 00000000..2a7e6e3e --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bitrue.yaml @@ -0,0 +1,227 @@ +name: bitrue +exchange: true + +rate_limit: null + +api_url: https://www.bitrue.com/ + +requests: + currency_pairs: + request: + template: api/v1/exchangeInfo + pair_template: null + params: null + response: + type: dict + values: + timezone: + type: str + serverTime: + type: int + symbols: + type: list + values: + type: dict + values: + symbol: + type: str + status: + type: str + baseAsset: + type: str + quoteAsset: + type: str + mapping: + - key: currency_pair_first + path: + - symbols + - baseAsset + type: + - str + - upper + - key: currency_pair_second + path: + - symbols + - quoteAsset + type: + - str + - upper + + tickers: + request: + template: /api/v1/ticker/price + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: null + + response: + type: dict + values: + symbol: + type: str + price: + type: str + + mapping: + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - price + type: + - str + - float + + trades: + request: + template: /api/v1/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + default: 100 #max 1000 + + response: + type: list + values: + type: dict + values: + id: + type: int + price: + type: str + qty: + type: str + time: + type: str + isBuyerMaker: + type: bool + isBestMatch: + type: bool + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: amount + path: + - qty + type: + - str + - float + - key: price + path: + - price + type: + - str + - float + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - true + - sell + - false + - buy + - key: id + path: + - id + type: + - int + + + order_books: + request: + template: /api/v1/depth + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + default: 100 #max 1000 + response: + type: dict + values: + lastUpdateId: + type: int + bids: + type: list + values: + type: list + values: + 0: # price + type: str + 1: # amount + type: str + asks: + type: list + values: + type: list + values: + 0: # price + type: str + 1: # amount + type: str + mapping: + - key: time + path: + - lastUpdateId + type: + - float + - from_timestamp + - 1 + - key: id + path: + - lastUpdateId + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + + \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitso.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitso.yaml new file mode 100644 index 00000000..1a5cfdb1 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bitso.yaml @@ -0,0 +1,344 @@ +#keine moeglichkeit candles/historic_rates abzufragen +name: bitso +exchange: true +api_url: https://api.bitso.com/v3/ +rate_limit: + max: 60 + # 1 minute + unit: 60 +requests: + currency_pairs: + request: + template: available_books/ + pair_template: null + params: null + response: + type: dict + values: + success: + type: bool + payload: + type: list + values: + type: dict + values: + book: # e.g. btc_mxn + type: str + minimum_amount: + type: + - str + maximum_amount: + type: + - str + minimum_price: + type: + - str + maximum_price: + type: + - str + minimum_value: + type: + - str + maximum_value: + type: + - str + mapping: + - key: currency_pair_first + path: + - payload + - book + type: + - str + - splitupper + - "_" + - 0 + - key: currency_pair_second + path: + - payload + - book + type: + - str + - splitupper + - "_" + - 1 + + tickers: + request: + template: ticker + pair_template: null + params: + book: + type: str + default: all + response: + type: dict + values: + success: + type: bool + payload: + type: dict + values: + book: + type: + - str + volume: + type: + - str + high: + type: + - str + last: + type: + - str + low: + type: + - str + vwap: + type: + - str + ask: + type: + - str + bid: + type: + - str + created_at: + type: + - str + mapping: + - key: currency_pair_first + path: + - payload + - book + type: + - str + - split + - '_' + - 0 + - key: currency_pair_second + path: + - payload + - book + type: + - str + - split + - '_' + - 1 + - key: daily_volume + path: + - payload + - volume + type: + - str + - float + - key: last_price + path: + - payload + - last + type: + - str + - float + - key: best_ask + path: + - payload + - ask + type: + - str + - float + - key: best_bid + path: + - payload + - bid + type: + - str + - float + - key: time + path: + - payload + - created_at + type: + - str + - dateparser + + order_books: + request: + template: order_book + pair_template: # e.g. btc_mxn + template: "{first}_{second}" + lower_case: true + alias: book + params: + aggregate: + type: bool + default: true + response: + type: dict + values: + success: + type: bool + payload: + type: dict + values: + asks: + type: list + values: + type: dict + values: + book: + type: str + price: + type: + - str + amount: + type: + - str + bids: + type: list + values: + type: dict + values: + book: + type: str + price: + type: + - str + amount: + type: + - str + updated_at: + type: + - str + sequence: + type: + - str + mapping: + - key: position + path: [] + type: + - none + - range + - key: id + path: + - payload + - sequence + type: + - str + - int + - key: asks_price + path: + - payload + - asks + - price + type: + - str + - float + - key: asks_amount + path: + - payload + - asks + - amount + type: + - str + - float + - key: bids_price + path: + - payload + - bids + - price + type: + - str + - float + - key: bids_amount + path: + - payload + - bids + - amount + type: + - str + - float + - key: time + path: + - payload + - updated_at + type: + - str + - dateparser + + trades: + request: + template: trades + pair_template: # e.g. btc_mxn + template: "{first}_{second}" + lower_case: true + alias: book + params: + marker: # Returns objects that are older or newer (depending on 'sort’) than the object with this ID + type: int + required: false + sort: + type: str + default: desc + limit: + type: int + max: 100 + default: 100 + response: + type: dict + values: + success: + type: bool + payload: + type: list + values: + type: dict + values: + book: + type: str + created_at: + type: + - str + + amount: + type: + - str + maker_side: + type: str + price: + type: + - str + tid: + type: int + mapping: + - key: time + path: + - payload + - created_at + type: + - str + - dateparser + - key: id + path: + - payload + - tid + type: + - int + - key: amount + path: + - payload + - amount + type: + - str + - float + - key: direction + path: + - payload + - maker_side + type: + - str + - key: price + path: + - payload + - price + type: + - str + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitstamp.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitstamp.yaml new file mode 100644 index 00000000..5ee1f5b0 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bitstamp.yaml @@ -0,0 +1,401 @@ +name: bitstamp +exchange: true +api_url: https://www.bitstamp.net/api/v2/ +rate_limit: + max: 60 + unit: 60 +requests: + currency_pairs: + request: + template: trading-pairs-info/ + values: null + params: null + response: + type: list + values: + type: dict + values: + base_decimals: + type: int + minimum_order: + type: str + name: # e.g. LTC/USD + type: str + counter_decimals: + type: int + trading: + type: str + url_symbol: # e.g. ltcusd + type: str + description: # e.g. Litecoin / U.S. dollar + type: str + mapping: + - key: currency_pair_first + path: + - name + - 0 + type: + - str + - split + - "/" + - 0 + - key: currency_pair_second + path: + - name + - 1 + type: + - str + - split + - "/" + - 1 + + tickers: + request: + template: ticker/{currency_pair}/ + pair_template: # e.g. btcusd + template: "{first}{second}" + lower_case: true + params: null + response: + type: dict + values: + last: + type: + - str + - float + high: + type: + - str + - float + low: + type: + - str + - float + vwap: + type: + - str + - float + volume: + type: + - str + - float + bid: + type: + - str + - float + ask: + type: + - str + - float + timestamp: + type: + - str + - float + - from_timestamp + - 0 + open: + type: + - str + - float + mapping: + - key: last_price + path: + - last + type: + - str + - float + - key: daily_volume + path: + - volume + type: + - str + - float + - key: best_bid + path: + - bid + type: + - str + - float + - key: best_ask + path: + - ask + type: + - str + - float + - key: time + path: + - timestamp + type: + - str + - float + - from_timestamp + - 0 + + historic_rates: + request: + template: ohlc/{currency_pair}/ + pair_template: + template: '{first}{second}' + lower_case: true + params: + step: + type: int + allowed: + minutes: 60 + hours: 3600 + days: 86400 + weeks: 259200 + default: 86400 + limit: + type: int + default: 1000 #limit between 1 and 1000 + end: + function: last_timestamp + type: + - datetime + - timestamp + response: + type: dict + values: + data: + type: dict + values: + pair: + - str + ohlc: + type: list + values: + high: + - str + - float + timestamp: + - str + - float + - from_timestamp + - 0 + volume: + - str + - float + low: + - str + - float + open: + - str + - float + close: + - str + - float + mapping: + - key: open + path: + - data + - ohlc + - open + type: + - str + - float + - key: close + path: + - data + - ohlc + - close + type: + - str + - float + - key: high + path: + - data + - ohlc + - high + type: + - str + - float + - key: low + path: + - data + - ohlc + - low + type: + - str + - float + - key: volume + path: + - data + - ohlc + - volume + type: + - str + - float + - key: time + path: + - data + - ohlc + - timestamp + type: + - str + - float + - from_timestamp + - 0 + + order_books: + request: + template: order_book/{currency_pair} + pair_template: # e.g. btcusd + template: "{first}{second}" + lower_case: true + params: + group: + type: int + default: 1 + response: + type: dict + values: + timestamp: + type: + - str + - float + - from_timestamp + - 0 + bids: + type: list + values: + type: list + values: + 0: # price + type: + - str + - float + 1: # amount + type: + - str + - float + asks: + type: list + values: + type: list + values: + 0: # price + type: + - str + - float + 1: # amount + type: + - str + - float + mapping: + - key: time + path: + - timestamp + type: + - str + - float + - from_timestamp + - 0 + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: id + path: + - timestamp + type: + - str + - int + - key: position + path: [] + type: + - none + - range + + trades: + request: + template: transactions/{currency_pair} + pair_template: # e.g. btcusd + template: "{first}{second}" + lower_case: true + params: + time: + type: str + default: hour + response: + type: list + values: + type: dict + values: + date: + type: + - str + tid: + type: + - str + price: + type: + - str + amount: + type: + - str + type: # 0 (buy) or 1 (sell). + type: + - int + mapping: + - key: time + path: + - date + type: + - str + - float + - from_timestamp + - 0 + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - amount + type: + - str + - float + - key: direction + path: + - type + type: + - value + - map + - "0" + - buy + - "1" + - sell + - key: id + path: + - tid + type: + - str + - int + diff --git a/pandas_datareader/crypto/resources/running_exchanges/bittrex.yaml b/pandas_datareader/crypto/resources/running_exchanges/bittrex.yaml new file mode 100644 index 00000000..411eecf7 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bittrex.yaml @@ -0,0 +1,310 @@ +name: bittrex +exchange: true +api_docs: https://bittrex.github.io/api/v3 +api_url: https://api.bittrex.com/v3/ +rate_limit: null +requests: + currency_pairs: + request: + template: markets + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + symbol: + type: str + baseCurrencySymbol: + type: str + quoteCurrencySymbol: + type: str + mapping: + - key: currency_pair_first + path: + - baseCurrencySymbol + type: + - str + - key: currency_pair_second + path: + - quoteCurrencySymbol + type: + - str + + tickers: + request: + template: markets/tickers + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + symbol: + type: + - str + lastTradeRate: + type: + - str + - float + bidRate: + type: + - str + - float + askRate: + type: + - str + - float + mapping: + - key: currency_pair_first + path: + - symbol + type: + - str + - split + - '-' + - 0 + - key: currency_pair_second + path: + - symbol + type: + - str + - split + - '-' + - 1 + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - lastTradeRate + type: + - str + - float + - key: best_bid + path: + - bidRate + type: + - str + - float + - key: best_ask + path: + - askRate + type: + - str + - float + + order_books: + request: + template: markets/{currency_pair}/orderbook + pair_template: + template: "{first}-{second}" + lower_case: false + params: + depth: + type: int + max: 500 + default: 25 + response: + type: dict + values: + bid: + type: list + values: + type: dict + values: + quantity: + type: str + rate: + type: str + ask: + type: list + values: + type: dict + values: + quantity: + type: str + rate: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bid + - rate + type: + - str + - float + - key: bids_amount + path: + - bid + - quantity + type: + - str + - float + - key: asks_price + path: + - ask + - rate + type: + - str + - float + - key: asks_amount + path: + - ask + - quantity + type: + - str + - float + + trades: + request: + template: markets/{currency_pair}/trades + pair_template: + template: "{first}-{second}" + lower_case: true + params: null + response: + type: list + values: + type: dict + values: + id: + type: str + executedAt: + type: str + quantity: + type: str + rate: + type: str + takerSide: + type: str + + mapping: + - key: time + path: + - executedAt + type: + - str + - dateparser + - key: id + path: + - id + type: + - str + - key: price + path: + - rate + type: + - str + - float + - key: amount + path: + - quantity + type: + - str + - float + - key: direction + path: + - takerSide + type: + - str + + historic_rates: + request: + template: markets/{currency_pair}/candles/{frequency}/historical/{from} + pair_template: + template: "{first}-{second}" + lower_case: false + alias: null + params: + frequency: + allowed: + minutes: MINUTE_1 + default: MINUTE_1 + + from: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1440 + - from_timestamp + - 0 + - "%Y/%m/%d" + + response: + type: list + values: + type: dict + values: + startsAt: + type: str + open: + type: str + high: + type: str + low: + type: str + close: + type: str + volume: + type: str + quoteVolume: + type: str + mapping: + - key: time + path: + - startsAt + type: + - str + - dateparser + - key: open + path: + - open + type: + - str + - float + - key: high + path: + - high + type: + - str + - float + - key: low + path: + - low + type: + - str + - float + - key: close + path: + - close + type: + - str + - float + - key: volume + path: + - quoteVolume + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitvavo.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitvavo.yaml new file mode 100644 index 00000000..af5d0e49 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bitvavo.yaml @@ -0,0 +1,301 @@ +name: bitvavo +exchange: true +rate_limit: + max: 1000 + unit: 60 + +api_url: https://api.bitvavo.com/v2 + +requests: + currency_pairs: + request: + template: /markets + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + markets: + type: str + base: + type: str + quote: + type: str + mapping: + - key: currency_pair_first + path: + - base + type: + - str + - key: currency_pair_second + path: + - quote + type: + - str + + tickers: + request: + template: /ticker/price + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + market: + type: str + price: + type: str + mapping: + - key: currency_pair_first + path: + - market + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - market + type: + - str + - split + - "-" + - 1 + - key: last_price + path: + - price + type: + - str + - float + + + historic_rates: + request: + template: /{currency_pair}/candles + pair_template: + template: "{first}-{second}" + lower_case: false + params: + limit: + default: 1440 + start: + function: last_timestamp + type: + - datetime + - timedeltams + - interval + - 1400 + end: + function: last_timestamp + type: + - datetime + - timestampms + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + default: 1d + + response: + type: list + values: + type: list + values: + 0: #time + type: int + 1: # open + type: str + 2: # high + type: str + 3: # low + type: str + 4: # close + type: str + 5: # volume + type: str + + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float + + trades: + request: + template: /{currency_pair}/trades + pair_template: + template: "{first}-{second}" + lower_case: false + params: + limit: + type: int + default: 500 + + response: + type: list + values: + type: dict + values: + id: + type: str + timestamp: + type: int + amount: + type: str + price: + type: str + side: + type: str + + mapping: + - key: id + path: + - id + type: + - str + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: direction + path: + - side + type: + - str + - key: amount + path: + - amount + type: + - str + - float + - key: price + path: + - price + type: + - str + - float + + order_books: + request: + template: /{currency_pair}/book + pair_template: + template: "{first}-{second}" + lower_case: false + params: + depth: + type: int + default: 50 + + response: + type: dict + values: + market: + type: str + nonce: + type: int + bids: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + sells: + type: list + values: + type: list + values: + 0: # price + type: str + 1: # qty + type: str + + mapping: + - key: id + path: + - nonce + type: + - int + - key: position + path: [] + type: + - none + - range + - key: time + path: [] + type: + - none + - now + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitwell.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitwell.yaml new file mode 100644 index 00000000..17444213 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bitwell.yaml @@ -0,0 +1,338 @@ +name: bitwell +exchange: true +rate_limit: null + +api_url: https://openapi.bitwellex.com + +requests: + currency_pairs: + request: + template: /pub/openapi/v1/symbol/spot/all + pair_template: null + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + base_asset: + type: str + quote_asset: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - quote_asset + type: + - str + - key: currency_pair_second + path: + - data + - base_asset + type: + - str + + tickers: + request: + template: /pub/openapi/v1/hq/quote + pair_template: + template: "{first}_{second}" + lower_case: false + alias: symbol + params: null + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + time: + type: int + highest_bid: + type: float + lowest_ask: + type: float + trade: + type: float + volume_24: + type: float + mapping: + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 2 + - key: best_bid + path: + - data + - highest_bid + type: + - float + - key: best_ask + path: + - data + - lowest_ask + type: + - float + - key: last_price + path: + - data + - trade + type: + - float + - key: daily_volume + path: + - data + - volume_24 + type: + - float + + + + historic_rates: + request: + template: /pub/openapi/v1/hq/kline + pair_template: + template: "{first}_{second}" + lower_case: false + alias: symbol + params: + type: + allowed: + minutes: 3 + hours: 2 + days: 1 + default: 1 #day + num: + type: int + max: 2880 + default: 2000 + ts: + function: last_timestamp + type: + - datetime + - timestamp + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + time: + type: int + open: + type: float + high: + type: float + low: + type: float + close: + type: float + volume: + type: float + mapping: + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 0 + - key: open + path: + - data + - open + type: + - float + - key: high + path: + - data + - high + type: + - float + - key: low + path: + - data + - low + type: + - float + - key: close + path: + - data + - close + type: + - float + - key: volume + path: + - data + - volume + type: + - float + + + order_books: + request: + template: /pub/openapi/v1/hq/orderbook + pair_template: + template: "{first}_{second}" + lower_case: false + alias: symbol + params: null + + response: + type: dict + values: + data: + type: dict + values: + ask: + type: list + values: + type: list + values: + 0: + type: float + 1: + type: float + bid: + type: list + values: + type: list + values: + 0: + type: float + 1: + type: float + sn: + type: int + time: + type: int + + mapping: + - key: id + path: + - data + - sn + type: + - int + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 2 + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - data + - bid + - 1 + type: + - float + - key: asks_amount + path: + - data + - ask + - 1 + type: + - float + - key: bids_price + path: + - data + - bid + - 0 + type: + - float + - key: asks_price + path: + - data + - ask + - 0 + type: + - float + + trades: + request: + template: /pub/openapi/v1/hq/transaction + pair_template: + template: "{first}_{second}" + lower_case: false + alias: symbol + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + time_us: + type: int + price: + type: float + amount: + type: float + volume: + type: float + direction: + type: int + mapping: + - key: id + path: + - data + - sn + type: + - int + - key: time + path: + - data + - time_us + type: + - float + - from_timestamp + - 2 + - key: price + path: + - data + - price + type: + - float + - key: amount + path: + - data + - volume + type: + - float + - key: direction + path: + - data + - direction + type: + - value + - map + - 1 + - sell + - 2 + - buy \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitz.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitz.yaml new file mode 100644 index 00000000..61ce1236 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bitz.yaml @@ -0,0 +1,548 @@ +name: bitz +exchange: true +api_url: https://api.bitzapi.com/ +rate_limit: null +requests: + currency_pairs: + request: + template: Market/symbolList + pair_template: null # e.g. 777_btc + params: null + response: + type: dict + values: + status: + type: int + msg: + type: str + data: + type: dict + values: + currency_pairs: # variable key, each available currency pair + type: dict + values: + id: + type: + - str + - int + name: # e.g. ltc_btc + type: str + coinFrom: # ltc + type: str + coinTo: # btc + type: str + numberFloat: + type: + - str + - int + priceFloat: + type: + - str + - int + status: + type: + - str + - int + minTrade: + type: + - str + - float + maxTrade: + type: + - str + - float + time: + type: + - float + - from_timestamp + - 0 + microtime: + type: + - str + - float + - from_timestamp + - 0 + source: + type: str + mapping: + - key: currency_pair_first + path: + - data + - dict_values + - coinFrom + type: + - str + - upper + - key: currency_pair_second + path: + - data + - dict_values + - coinTo + type: + - str + - upper + + order_books: + request: + template: Market/depth + pair_template: # e.g. 777_btc + template: "{first}_{second}" + lower_case: true + alias: symbol + params: null + response: + type: dict + values: + status: + type: int + msg: + type: str + data: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: # price + type: + - str + 1: # number + type: + - str + 2: # Total price + type: + - str + bids: + type: list + values: + type: list + values: + 0: # price + type: + - str + 1: # number + type: + - str + 2: # Total price + type: + - str + coinPair: + type: str + time: + type: + - int + microtime: + type: + - str + source: + type: str + + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 0 + - key: position + path: [] + type: + - none + - range + - key: id + path: + - time + type: + - int + - key: asks_price + path: + - data + - asks +# - [] + - 0 + type: + - str + - float + - key: asks_amount + path: + - data + - asks +# - [] + - 1 + type: + - str + - float + - key: bids_price + path: + - data + - bids +# - [] + - 0 + type: + - str + - float + - key: bids_amount + path: + - data + - bids +# - [] + - 1 + type: + - str + - float + + + tickers: + request: + template: Market/ticker + pair_template: # e.g. 777_btc + template: "{first}_{second}" + lower_case: true + alias: symbol + params: null + response: + type: dict + values: + status: + type: int + msg: + type: str + data: + type: dict + values: + symbol: + type: str + quoteVolume: + type: + - str + - float + volume: + type: + - str + - float + priceChange24h: + type: + - str + - float + askPrice: + type: + - str + - float + askQty: + type: + - str + - float + bidPrice: + type: + - str + - float + bidQty: + type: + - str + - float + open: + type: + - str + - float + high: + type: + - str + - float + low: + type: + - str + - float + now: + type: + - str + - float + firstId: + type: + - str + - float + lastId: + type: + - str + - float + dealCount: + type: + - str + - float + numberPrecision: + type: + - str + - float + pricePrecision: + type: + - str + - float + cny: + type: + - str + - float + usd: + type: + - str + - float + krw: + type: + - str + - float + time: + type: + - float + - from_timestamp + - 0 + microtime: + type: + - str + - float + - from_timestamp + - 0 + source: + type: str + mapping: + - key: best_ask + path: + - data + - askPrice + type: + - str + - float + - key: best_bid + path: + - data + - bidPrice + type: + - str + - float + - key: daily_volume + path: + - data + - volume + type: + - str + - float + - key: time + path: + - time + type: + - float + - from_timestamp + - 0 + + historic_rates: + request: + template: Market/kline + pair_template: # e.g. 777_btc + template: "{first}_{second}" + lower_case: true + alias: symbol + params: + resolution: + type: str + allowed: + minutes: 1min + hours: 60min + days: 1day + weeks: 1week + months: 1mon + default: 1day + size: # get number range: 1-300 + type: int + min: 1 + max: 300 + required: false + to: # microsecond. Return the data before this microsecond + function: last_timestamp + type: + - datetime + - timestampms + response: + type: dict + values: + status: + type: int + msg: + type: str + data: + type: dict + values: + bars: + type: list + values: + type: dict + values: + time: + type: + - str + open: + type: + - str + - float + high: + type: + - str + - float + low: + type: + - str + - float + close: + type: + - str + - float + volume: + type: + - str + - float + datetime: + type: str + resolution: + type: str + symbol: + type: str + from: + type: + - str + to: + type: + - str + size: + type: + - str + - int + time: + type: + - int + microtime: + type: + - str + source: + type: str + mapping: + - key: time + path: + - data + - bars + - time + type: + - str + - float + - from_timestamp + - 1 + - key: open + path: + - data + - bars + - open + type: + - str + - float + - key: high + path: + - data + - bars + - high + type: + - str + - float + - key: low + path: + - data + - bars + - low + type: + - str + - float + - key: close + path: + - data + - bars + - close + type: + - str + - float + - key: volume + path: + - data + - bars + - volume + type: + - str + - float + + trades: + request: + template: Market/order + pair_template: # e.g. 777_btc + template: "{first}_{second}" + lower_case: true + alias: symbol + params: null + response: + type: dict + values: + status: + type: int + msg: + type: str + data: + type: list + values: + type: dict + values: + id: + type: + - str + t: # time, e.g. 12:58:48 + type: str + T: # timestamp + type: + - int + p: # price + type: + - str + n: # number + type: + - str + s: # type + type: str + mapping: + - key: id + path: + - data + - id + type: + - int + - key: time + path: + - data + - T + type: + - float + - from_timestamp + - 0 + - key: price + path: + - data + - p + type: + - str + - float + - key: amount + path: + - data + - n + type: + - str + - float + - key: direction + path: + - data + - s + type: + - str diff --git a/pandas_datareader/crypto/resources/running_exchanges/bkex.yaml b/pandas_datareader/crypto/resources/running_exchanges/bkex.yaml new file mode 100644 index 00000000..3c878d2b --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bkex.yaml @@ -0,0 +1,356 @@ +name: bkex +exchange: true +api_url: https://api.bkex.cc + +requests: + currency_pairs: + request: + template: /v2/common/symbols + pair_template: null + params: null + response: + type: dict + values: + msg: + type: str + code: + type: str + data: + type: list + values: + type: dict + values: + coinTypes: + type: list + values: + type: dict + values: + symbol: + type: str + mapping: + - key: currency_pair_first + path: + - data + - symbol + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - data + - symbol + type: + - str + - split + - "_" + - 1 + + tickers: + request: + template: /v2/q/ticker/price + pair_template: + template: "{first}_{second}" + lower_case: false + alias: pair + params: null + response: + type: dict + values: + code: + type: int + data: + type: list + values: + type: dict + values: + price: + type: float + symbol: + type: str + mapping: + - key: currency_pair_first + path: + - data + - symbol + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - data + - symbol + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - data + - price + type: + - float + - key: time + path: [] + type: + - none + - now + + historic_rates: + request: + template: /v2/q/kline + pair_template: + template: "{first}_{second}" + lower_case: false + alias: symbol + params: + period: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + default: 1d + size: + default: 1000 + to: + function: last_timestamp + type: + - datetime + - timestampms + from: + function: last_timestamp + type: + - datetime + - timedeltams + - interval + - 1000 + + + response: + type: dict + values: + msg: + type: str + code: + type: str + data: + type: list + values: + type: dict + values: + ts: # timestamp ms + type: int + close: # closing price + type: float + open: # opening price + type: float + hhigh: # highest price + type: float + low: # lowest price + type: float + volume: #base amount + type: float + mapping: + - key: time + path: + - data + - ts + type: + - float + - from_timestamp + - 1 + - key: low + path: + - data + - low + type: + - float + - key: high + path: + - data + - high + type: + - float + - key: open + path: + - data + - open + type: + - float + - key: close + path: + - data + - close + type: + - float + - key: volume + path: + - data + - volume + type: + - float + + order_books: + request: + template: /v2/q/depth + pair_template: + template: "{first}_{second}" + lower_case: false + alias: symbol + params: + depth: + type: + - int + default: 50 + preicion: + type: int + default: 4 + response: + type: dict + values: + msg: + type: str + code: + type: str + data: + type: dict + values: + bid: + type: list + values: + type: list + values: + 0: # price + type: float + 1: # quantity + type: float + ask: + type: list + values: + type: list + values: + 0: # price + type: float + 1: # quantity + type: float + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - data + - bid + - 0 + type: + - float + - key: bids_amount + path: + - data + - bid + - 1 + type: + - float + - key: asks_price + path: + - data + - ask + - 0 + type: + - float + - key: asks_amount + path: + - data + - ask + - 1 + type: + - float + + trades: + request: + template: /v2/q/deals + pair_template: + template: "{first}_{second}" + lower_case: false + alias: symbol + params: + size: + type: + - int + default: 50 + response: + type: dict + values: + msg: + type: str + code: + type: str + data: + type: list + values: + type: dict + values: + ts: + type: int + price: + type: float + volume: + type: float + direction: + type: str + mapping: + - key: time + path: + - data + - ts + type: + - float + - from_timestamp + - 1 + - key: id + path: + - data + - ts + type: + - int + - key: direction + path: + - data + - direction + type: + - value + - map + - B + - buy + - S + - sell + - key: price + path: + - data + - price + type: + - float + - key: amount + path: + - data + - volume + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bleutrade.yaml b/pandas_datareader/crypto/resources/running_exchanges/bleutrade.yaml new file mode 100644 index 00000000..6906c553 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bleutrade.yaml @@ -0,0 +1,369 @@ +#ToDo: API Dokumentation nicht auffindbar. Historic Rates flexibeler Timestamp nicht implementiert. +name: bleutrade +exchange: true +api_url: https://bleutrade.com/api/v3/ +rate_limit: null + +requests: + currency_pairs: + request: + template: public/getmarkets + pair_template: null + params: null + response: + type: dict + values: + success: + type: bool + message: + type: str + result: + type: list + values: + type: dict + values: + MarketName: + type: str # e.g. ETH_BTC + MarketAsset: # e.g. ETH + type: str + BaseAsset: # e.g. BTC + type: str + MarketAssetLong: # e.g. Ethereum + type: str + BaseAssetLong: # e.g. Bitcoin + type: str + IsActive: + type: bool + MinTradeSize: + type: float + InfoMassage: + type: str + mapping: + - key: currency_pair_first + path: + - result + - MarketAsset + type: + - str + - key: currency_pair_second + path: + - result + - BaseAsset + type: + - str + + + tickers: + request: + template: public/getticker + pair_template: + template: "{first}_{second}" + lower_case: false + alias: market + params: null + response: + type: dict + values: + success: + type: bool + message: + type: str + result: + type: list + values: + type: dict + values: + Market: + type: str + Bid: + type: float + Ask: + type: float + Last: + type: float + mapping: + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - result + - Last + type: + - float + - key: best_bid + path: + - result + - Bid + type: + - float + - key: best_ask + path: + - result + - Ask + type: + - float + + order_books: + request: + template: public/getorderbook + pair_template: # e.g. ETH_BTC + template: "{first}_{second}" + lower_case: false + alias: market + params: + type: + type: str + default: ALL + depth: + type: int + default: 20 + response: + type: dict + values: + success: + type: bool + message: + type: str + result: + type: dict + values: + buy: + type: list + values: + type: dict + values: + Quantity: + type: float + Rate: + type: float + sell: + type: list + values: + type: dict + values: + Quantity: + type: float + Rate: + type: float + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - result + - buy + - Rate + type: + - float + - key: bids_amount + path: + - result + - buy + - Quantity + type: + - float + - key: asks_price + path: + - result + - sell + - Rate + type: + - float + - key: asks_amount + path: + - result + - sell + - Quantity + type: + - float + + trades: + request: + template: public/getmarkethistory + pair_template: # e.g. ETH_BTC + template: "{first}_{second}" + lower_case: false + alias: market + params: + count: + type: int + max: 200 + default: 20 + response: + type: dict + values: + success: + type: bool + message: + type: str + result: + type: list + values: + type: dict + values: + TradeID: + type: int + TimeStamp: + type: + - str + Quantity: + type: float + Price: + type: float + BaseVolumne: + type: float + OrderType: + type: str + Total: + type: float + + mapping: + - key: time + path: + - result + - TimeStamp + type: + - str + - dateparser + - key: id + path: + - result + - TradeID + type: + - int + - key: amount + path: + - result + - Quantity + type: + - float + - key: price + path: + - result + - Price + type: + - float + - key: direction + path: + - result + - OrderType + type: + - str + + historic_rates: + request: + template: public/getcandles + pair_template: # e.g. ETH_BTC + template: "{first}_{second}" + lower_case: false + alias: market + params: + period: + type: str + allowed: +# minutes: 1m #raises an error + hours: 1h + days: 1d + weeks: 1w + default: 1d + response: + type: dict + values: + success: + type: bool + message: + type: str + result: + type: list + values: + type: dict + values: + TimeStamp: + type: + - str + - strptime + - "%Y-%m-%d %H:%M:%S" + Open: + type: + - str + - float + High: + type: + - str + - float + Low: + type: + - str + - float + Close: + type: + - str + - float + Volume: + type: + - str + - float + BaseVolume: + type: + - str + - float + mapping: + - key: time + path: + - result + - TimeStamp + type: + - str + - strptime + - "%Y-%m-%d %H:%M:%S" + - key: open + path: + - result + - Open + type: + - str + - float + - key: high + path: + - result + - High + type: + - str + - float + - key: low + path: + - result + - Low + type: + - str + - float + - key: close + path: + - result + - Close + type: + - str + - float + - key: volume + path: + - result + - Volume + type: + - str + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/btc-alpha.yaml b/pandas_datareader/crypto/resources/running_exchanges/btc-alpha.yaml new file mode 100644 index 00000000..6ff788c2 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/btc-alpha.yaml @@ -0,0 +1,253 @@ +name: btc-alpha +api_docs: https://btc-alpha.github.io/api-docs/ +rate_limit: null + +api_url: https://btc-alpha.com/api/ + +requests: + currency_pairs: + request: + template: v1/pairs/ + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + currency1: + type: str + currency2: + type: str + mapping: + - key: currency_pair_first + path: + - currency1 + type: + - str + - key: currency_pair_second + path: + - currency2 + type: + - str + + historic_rates: + request: + template: charts/{currency_pair}/{frequency}/chart + pair_template: + template: "{first}_{second}" + lower_case: false + params: + limit: + max: 720 + default: 720 + until: + function: last_timestamp + type: + - datetime + - timestamp + frequency: + allowed: + minutes: 5 + hours: 60 + days: D + default: D + + response: + type: list + values: + type: dict + values: + time: + type: int + open: + type: float + high: + type: float + low: + type: float + close: + type: float + volume: + type: float + + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 0 + - key: open + path: + - open + type: + - float + - key: high + path: + - high + type: + - float + - key: low + path: + - low + type: + - float + - key: close + path: + - close + type: + - float + - key: volume + path: + - volume + type: + - float + + + trades: + request: + template: v1/exchanges + pair_template: + template: "{first}_{second}" + lower_case: false + alias: pair + params: + limit: + type: int + default: 100 + + response: + type: list + values: + type: dict + values: + id: + type: int + timestamp: + type: float + price: + type: str + amount: + type: str + type: + type: str + + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - id + type: + - int + - key: direction + path: + - type + type: + - str + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - amount + type: + - str + - float + + order_books: + request: + template: v1/orderbook/{currency_pair} + pair_template: + template: "{first}_{second}" + lower_case: false + params: + group: + type: int + default: 1 # group by price + limit_asks: + type: int + default: 50 + limit_bids: + type: int + default: 50 + response: + type: dict + values: + sell: + type: list + values: + type: dict + values: + price: + type: float + id: # id and timestamp only if group=1 + type: int + amount: + type: float + timestamp: + type: float + buy: + type: list + values: + type: dict + values: + price: + type: float + id: + type: int + amount: + type: float + timestamp: + type: float + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - buy + - amount + type: + - float + - key: bids_price + path: + - buy + - price + type: + - float + - key: asks_amount + path: + - sell + - amount + type: + - float + - key: asks_price + path: + - sell + - price + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/btc_turk.yaml b/pandas_datareader/crypto/resources/running_exchanges/btc_turk.yaml new file mode 100644 index 00000000..112ab64f --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/btc_turk.yaml @@ -0,0 +1,389 @@ +name: btc_turk +is_exchange: true + +api_url: "" #Base Api url changes. Complete URL therefore in templates +rate_limit: + max: 60 + unit: 60 + +requests: + currency_pairs: + request: + template: https://api.btcturk.com/api/v2/ticker + pair_template: null + params: null + response: + type: dict + values: + data: + type: dict + values: + type: list + values: + pair: + type: str + pairNormalized: + type: str + timestamp: + type: int + last: + type: float + high: + type: float + low: + type: float + bid: + type: float + ask: + type: float + open: + type: float + volume: + type: float + + mapping: + - key: currency_pair_first + path: + - data + - pairNormalized + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - data + - pairNormalized + type: + - str + - split + - "_" + - 1 + + tickers: + request: + template: https://api.btcturk.com/api/v2/ticker + pair_template: null + params: null + response: + type: dict + values: + data: + type: dict + values: + type: list + values: + pair: + type: str + pairNormalized: + type: str + timestamp: + type: int + last: + type: float + high: + type: float + low: + type: float + bid: + type: float + ask: + type: float + open: + type: float + volume: + type: float + mapping: + - key: currency_pair_first + path: + - data + - pairNormalized + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - data + - pairNormalized + type: + - str + - split + - "_" + - 1 + - key: time + path: + - data + - timestamp + type: + - float + - from_timestamp + - 1 + - key: best_bid + path: + - data + - bid + type: + - float + - key: daily_volume + path: + - data + - volume + type: + - float + - key: best_ask + path: + - data + - ask + type: + - float + - key: last_price + path: + - data + - last + type: + - float + + order_books: + request: + template: https://api.btcturk.com/api/v2/orderbook + pair_template: # e.g. BTCTRY + template: "{first}{second}" + lower_case: false + alias: pairSymbol + params: + limit: + type: int + default: 100 #max 1000 + response: + type: dict + values: + data: + type: dict + values: + timestamp: + type: int + bids: + type: list + values: + type: list + values: + 0: #price + type: str + 1: # qty + type: str + asks: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + + mapping: + - key: time + path: + - data + - timestamp + type: + - float + - from_timestamp + - 1 + - key: id + path: + - data + - timestamp + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - data + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - data + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - data + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - data + - asks + - 1 + type: + - str + - float + + trades: + request: + template: https://api.btcturk.com/api/v2/trades + pair_template: # e.g. BTCTRY + template: "{first}{second}" + lower_case: false + alias: pairSymbol + params: + last: + type: int + max: 50 + default: 50 + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + pair: + type: str + pairNormalized: + type: str + date: + type: int + tid: + type: str + price: + type: float + amount: + type: float + side: + type: str + + + mapping: + - key: time + path: + - data + - date + type: + - float + - from_timestamp + - 1 + - key: id + path: + - data + - tid + type: + - str + - int + - key: direction + path: + - data + - side + type: + - str + - key: price + path: + - data + - price + type: + - str + - float + - key: amount + path: + - data + - amount + type: + - str + - float + + historic_rates: # no hint which currency pair is meant + request: + template: https://graph-api.btcturk.com/v1/ohlcs + pair_template: + template: "{first}_{second}" + lower_case: false + alias: pair + params: + to: # from and to params are available. But API returns every data point by default. + function: last_timestamp + type: + - datetime + - timestamp + from: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1000 + + response: + type: list + values: + type: dict + values: + time: + type: int + open: + type: float + high: + type: float + low: + type: float + close: + type: float + volume: + type: float + average: + type: float + dailyChangeAmount: + type: float + dailyChangePercentage: + type: float + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 0 + - key: open + path: + - open + type: + - float + - key: high + path: + - high + type: + - float + - key: low + path: + - low + type: + - float + - key: close + path: + - close + type: + - float + - key: volume + path: + - volume + type: + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/btse.yaml b/pandas_datareader/crypto/resources/running_exchanges/btse.yaml new file mode 100644 index 00000000..094e1af6 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/btse.yaml @@ -0,0 +1,331 @@ +name: btse +exchange: true + +rate_limit: + max: 900 + unit: 60 + +api_url: https://api.btse.com/spot/ + +requests: + currency_pairs: + request: + template: api/v3.2/market_summary + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + symbol: + type: str + base: + type: str + quote: + type: str + mapping: + - key: currency_pair_first + path: + - base + type: + - str + - key: currency_pair_second + path: + - quote + type: + - str + + tickers: + request: + template: api/v3.2/market_summary + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + symbol: + type: str + base: + type: str + quote: + type: str + last: + type: float + lowestAsk: + type: float + highestBid: + type: float + volume: + type: float + + mapping: + - key: currency_pair_first + path: + - base + type: + - str + - key: currency_pair_second + path: + - quote + type: + - str + - key: last_price + path: + - last + type: + - float + - key: time + path: [] + type: + - none + - now + - key: best_bid + path: + - highestBid + type: + - float + - key: best_ask + path: + - lowestAsk + type: + - float + - key: daily_volume + path: + - volume + type: + - float + + historic_rates: + request: + template: api/v3.2/ohlcv + pair_template: + template: "{first}-{second}" + lower_case: false + alias: symbol + params: + resolution: + allowed: + minutes: 1 + hours: 60 + days: 1440 + weeks: 10080 + months: 43200 + default: 1440 + start: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 200 + end: + function: last_timestamp + type: + - datetime + - timestamp + response: + type: list + values: + type: list + values: + 0: #time + type: int + 1: #open + type: float + 2: #high + type: float + 3: #low + type: float + 4: #close + type: float + 5: #volume + type: float + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 0 + - key: open + path: + - 1 + type: + - float + - key: high + path: + - 2 + type: + - float + - key: low + path: + - 3 + type: + - float + - key: close + path: + - 4 + type: + - float + - key: volume + path: + - 5 + type: + - float + + + trades: + request: + template: api/v3.2/trades + pair_template: + template: "{first}-{second}" + lower_case: false + alias: symbol + params: +# startTime: +# function: last_timestamp +# type: +# - timestamp +# - timedelta +# - interval +# - 200 +# - datetime +# endTime: +# function: last_timestamp +# type: +# - timestmap +# - datetime + count: + default: 300 + + response: + type: list + values: + type: dict + values: + price: + type: float + size: + type: float + side: + type: str + serialId: + type: int + timestamp: + type: int + + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: id + path: + - serialId + type: + - int + - key: direction + path: + - side + type: + - str + - key: price + path: + - price + type: + - float + - key: amount + path: + - size + type: + - float + + order_books: + request: + template: api/v3.2/orderbook/L2 + pair_template: + template: "{first}-{second}" + lower_case: false + alias: symbol + params: + depth: + default: 50 + + response: + type: dict + values: + timestamp: + type: int + buyQuote: + type: list + values: + type: dict + values: + price: + type: str + size: + type: str + sellQuote: + type: list + values: + type: dict + values: + price: + type: str + size: + type: str + + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: id + path: + - timestamp + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - buyQuote + - size + type: + - str + - float + - key: bids_price + path: + - buyQuote + - price + type: + - str + - float + - key: asks_amount + path: + - sellQuote + - size + type: + - str + - float + - key: asks_price + path: + - sellQuote + - price + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/buda.yaml b/pandas_datareader/crypto/resources/running_exchanges/buda.yaml new file mode 100644 index 00000000..8370ac40 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/buda.yaml @@ -0,0 +1,320 @@ +name: buda + +api_url: https://www.buda.com/api/v2/ +rate_limit: null +requests: + currency_pairs: + request: + template: markets + pair_template: null + params: null + response: + type: dict + values: + markets: + type: list + values: + type: dict + values: + id: # e.g. BTC-CLP + type: str + name: # e.g. btc-clp + type: str + base_currency: # i.e. "BTC" + type: str + quote_currency: # i.e. "CLP" + type: str + minimum_order_amount: + type: list + values: + 0: # amount + type: + - str + - float + 1: # currency + type: str + mapping: + - key: currency_pair_first + path: + - markets + - base_currency + type: + - str + - key: currency_pair_second + path: + - markets + - quote_currency + type: + - str + + tickers: + request: + template: markets/{currency_pair}/ticker + pair_template: # e.g. btc-clp + template: "{first}-{second}" + lower_case: true + params: null + response: + type: dict + values: + ticker: + type: dict + values: + last_price: + type: list + values: + 0: # amount + type: + - str + - float + 1: # currency + type: str + market_id: # i.e. "BTC-CLP" + type: str + max_bid: + type: list + values: + 0: # amount + type: + - str + - float + 1: # currency + type: str + min_ask: + type: list + values: + 0: # amount + type: + - str + - float + 1: # currency + type: str + price_variation_24h: + type: + - str + - float + price_variation_7d: + type: + - str + - float + volume: + type: list + values: + 0: # amount + type: + - str + - float + 1: # currency + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - ticker + - last_price + - 0 + type: + - str + - float + - key: best_bid + path: + - ticker + - max_bid + - 0 + type: + - str + - float + - key: best_ask + path: + - ticker + - min_ask + - 0 + type: + - str + - float + - key: daily_volume + path: + - ticker + - volume + - 0 + type: + - str + - float + + order_books: + request: + template: markets/{currency_pair}/order_book + pair_template: # e.g. btc-clp + template: "{first}-{second}" + lower_case: true + params: null + response: + type: dict + values: + order_book: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: # price + type: + - str + - float + 1: # amount + type: + - str + - float + bids: + type: list + values: + type: list + values: + 0: # price + type: + - str + - float + 1: # amount + type: + - str + - float + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [ ] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: asks_price + path: + - order_book + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - order_book + - asks + - 1 + type: + - str + - float + - key: bids_price + path: + - order_book + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - order_book + - bids + - 1 + type: + - str + - float + + trades: + request: + template: markets/{currency_pair}/trades + pair_template: # e.g. btc-clp + template: "{first}-{second}" + lower_case: true + params: + timestamp: # Unix Timestamp (int) + required: false + limit: + type: int + max: 100 + default: 50 + response: + type: dict + values: + trades: + type: dict + values: + timestamp: + type: + - str + last_timestamp: + type: + - str + market_id: + type: str + entries: + type: list + values: + type: list + values: + 0: # timestamp + type: + - str + 1: # amount + type: + - str + 2: # price + type: + - str + 3: # direction, i.e. "buy" + type: str + mapping: + - key: time + path: + - trades + - entries + - 0 + type: + - str + - float + - from_timestamp + - 1 + - key: id + path: + - trades + - entries + - 0 + type: + - str + - int + - key: amount + path: + - trades + - entries + - 1 + type: + - str + - float + - key: price + path: + - trades + - entries + - 2 + type: + - str + - float + - key: direction + path: + - trades + - entries + - 3 + type: + - str diff --git a/pandas_datareader/crypto/resources/running_exchanges/bw.yaml b/pandas_datareader/crypto/resources/running_exchanges/bw.yaml new file mode 100644 index 00000000..c3150056 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/bw.yaml @@ -0,0 +1,420 @@ +name: bw +exchange: true +rate_limit: null +api_url: https://www.bw.com/api/ + +requests: + currency_pairs: + request: + template: data/v1/tickers + pair_template: null + params: + isUseMarketName: + type: bool + default: "True" + response: + type: dict + values: + datas: + type: dict + values: + currency_pair: + type: list + + mapping: + - key: currency_pair_first + path: + - datas + - list_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - datas + - list_key + type: + - str + - split + - "_" + - 1 + + tickers: + request: + template: data/v1/tickers + pair_template: null + params: + isUseMarketName: + type: bool + default: True + response: + type: dict + values: + datas: + type: dict + values: + currency_pair: + type: list + values: + 0: #MarketID + type: int + 1: #last + type: str + 2: #high + type: str + 3: #low + type: str + 4: #24h Volumne + type: str + 5: #24h price increase + type: str + 6: #recent 6h closing price list + type: str + 7: #buy one price + type: str + 8: #sell one price + type: str + 9: #24h turnover + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: currency_pair_first + path: + - datas + - list_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - datas + - list_key + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - datas + - list_values + - 1 + type: + - str + - float + - key: daily_volume + path: + - datas + - list_values + - 4 + type: + - str + - float + - key: best_bid + path: + - datas + - list_values + - 7 + type: + - str + - float + - key: best_ask + path: + - datas + - list_values + - 8 + type: + - str + - float + + historic_rates: + request: + template: data/v1/klines + pair_template: + template: "{first}_{second}" + lower_case: false + alias: marketName + params: + dataSize: + type: int + default: 500 + type: + allowed: + minutes: 1M + hours: 1H + days: 1D + weeks: 1W + default: 1D + + response: + type: dict + values: + datas: + type: list + values: + type: list + values: + 0: #data Typ + type: str + 1: #market ID + type: int + 2: #market_name + type: str + 3: #timestamp + type: int + 4: #opening Price + type: str + 5: #highest price + type: str + 6: #lowest Price + type: str + 7: #closing Price + type: #str + 8: #volume + type: str + 9: #price_range + type: str + 10: #US Dollar Exchange Rate + type: # str + 11: # K-line Period + type: str + 12: #converted + type: bool + 13: #? + type: str + resMsg: + type: dict + values: + message: + type: str + method: + type: str + code: + type: str + + mapping: + - key: time + path: + - datas + - 3 + type: + - str + - float + - from_timestamp + - 0 + - key: open + path: + - datas + - 4 + type: + - str + - float + - key: close + path: + - datas + - 7 + type: + - str + - float + - key: low + path: + - datas + - 6 + type: + - str + - float + - key: high + path: + - datas + - 5 + type: + - str + - float + - key: volume + path: + - datas + - 8 + type: + - str + - float + + + trades: + request: + template: data/v1/trades + pair_template: + template: "{first}_{second}" + lower_case: false + alias: marketName + params: + dataSize: + type: int + max: 20 + default: 20 + response: + type: dict + values: + datas: + type: list + values: + type: list + values: + 0: #trade data + type: str + 1: # market ID + type: str + 2: # timestamp + type: str + 3: # symbol + type: str + 4: # direction + type: str + 5: # price + type: str + 6: # amount + type: str + mapping: + - key: time + path: + - datas + - 2 + type: + - str + - float + - from_timestamp + - 0 + - key: id + path: + - datas + - 2 + type: + - str + - int + - key: direction + path: + - datas + - 4 + type: + - value + - map + - bid + - sell + - ask + - buy + - key: price + path: + - datas + - 5 + type: + - str + - float + - key: amount + path: + - datas + - 6 + type: + - str + - float + + order_books: + request: + template: data/v1/entrusts + pair_template: + template: "{first}_{second}" + lower_case: false + alias: marketName + params: + dataSize: + type: int + max: 50 + default: 50 + + response: + type: dict + values: + datas: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + bids: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + timestamp: + type: str + mapping: + - key: time + path: + - datas + - timestamp + type: + - str + - float + - from_timestamp + - 0 + - key: id + path: + - datas + - timestamp + type: + - str + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - datas + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - datas + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - datas + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - datas + - asks + - 0 + type: + - str + - float + diff --git a/pandas_datareader/crypto/resources/running_exchanges/catex.yaml b/pandas_datareader/crypto/resources/running_exchanges/catex.yaml new file mode 100644 index 00000000..13d4ddf6 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/catex.yaml @@ -0,0 +1,235 @@ +name: catex +exchange: true + +rate_limit: null +api_url: https://www.catex.io/api/ + +requests: + currency_pairs: + request: + template: token/currency + pair_template: null + params: + baseCurrency: + default: USDT # USDT, BTC, ETH, DODGE + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + currency: + type: str + baseCurrency: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - currency + type: + - str + - key: currency_pair_second + path: + - data + - baseCurrency + type: + - str + + tickers: + request: + template: token + pair_template: + template: "{first}/{second}" + lower_case: false + alias: pair + params: null + response: + type: dict + values: + data: + type: dict + values: + volume24HoursByCurrency: + type: float + volume24HoursByBaseCurrency: + type: float + priceByBaseCurrency: + type: float + + mapping: + - key: last_price + path: + - data + - priceByBaseCurrency + type: + - float + - key: time + path: [] + type: + - none + - now + - key: daily_volume + path: + - data + - volume24HoursByBaseCurrency + type: + - float + + trades: + request: + template: trading/history + pair_template: + template: "{first}/{second}" + lower_case: false + alias: market + params: + limit: + default: 200 + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + volume: + type: float + price: + type: float + id: + type: str + time: + type: str + type: + type: str + + mapping: + - key: time + path: + - data + - time + type: + - str + - dateparser + - key: id + path: + - data + - id + type: + - str + - key: direction + path: + - data + - type + type: + - str + - key: price + path: + - data + - price + type: + - float + - key: amount + path: + - data + - volume + type: + - float + + order_books: + request: + template: order + pair_template: + template: "{first}/{second}" + lower_case: false + alias: market + params: + limit: + default: 50 + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: #price + type: str + 1: #qty + type: str + bids: + type: list + values: + type: list + values: + 0: #price + type: str + 1: #qty + type: str + timestamp: + type: str + + mapping: + - key: time + path: + - data + - timestamp + type: + - str + - dateparser + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - data + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - data + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - data + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - data + - asks + - 0 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/cexio.yaml b/pandas_datareader/crypto/resources/running_exchanges/cexio.yaml new file mode 100644 index 00000000..91bd5119 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/cexio.yaml @@ -0,0 +1,251 @@ +# No HR as the API as is only goes back 2 month. + +name: cexio +is_exchange: true +api_url: https://cex.io/api/ + +requests: + currency_pairs: + request: + template: currency_limits + pair_template: null + params: null + response: + type: dict + values: + e: + type: str + ok: + type: str + data: + type: dict + values: + pairs: + type: list + values: + type: dict + values: + symbol1: + type: str + symbol2: + type: str + mapping: + - key: currency_pair_first + path: + - data + - pairs + - symbol1 + type: + - str + - key: currency_pair_second + path: + - data + - pairs + - symbol2 + type: + - str + + tickers: + request: + template: ticker/{currency_pair} + pair_template: + template: "{first}/{second}" + lower_case: false + alias: null + params: null + response: + type: dict + values: + timestamp: + type: str + low: + type: str + high: + type: str + last: + type: str + volume: + type: str + volume30d: + type: str + bid: + type: str + ask: + type: str + + mapping: + - key: time + path: + - timestamp + type: + - str + - float + - from_timestamp + - 0 + - key: last + path: + - last + type: + - str + - float + - key: best_bid + path: + - bid + type: + - str + - float + - key: best_ask + path: + - ask + type: + - str + - float + - key: daily_volume + path: + - volume + type: + - str + - float + + trades: + request: + template: trade_history/{currency_pair} + pair_template: + template: "{first}/{second}" + lower_case: false + alias: null + params: + since: + type: int + required: false # maximum of 1000 items are returned + + response: + type: list + values: + type: dict + values: + type: + type: str + date: + type: str + amount: + type: str + price: + type: str + tid: + type: str + mapping: + - key: time + path: + - date + type: + - str + - float + - from_timestamp + - 0 + - key: id + path: + - tid + type: + - str + - int + - key: direction + path: + - type + type: + - str + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - amount + type: + - str + - float + + order_books: + request: + template: order_book/{currency_pair} + pair_template: + template: "{first}/{second}" + lower_case: false + alias: null + params: + depth: + type: int + default: 100 # if omitted, whole list is returned + + response: + type: dict + values: + timestamp: + type: int + bids: + type: list + values: + type: list + values: + 0: + type: float + 1: + type: float + asks: + type: list + values: + type: list + values: + 0: + type: float + 1: + type: float + pair: + type: str + id: + type: int + + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - id + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - float + - key: bids_price + path: + - bids + - 0 + type: + - float + - key: asks_amount + path: + - asks + - 1 + type: + - float + - key: asks_price + path: + - asks + - 0 + type: + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/chiliz.yaml b/pandas_datareader/crypto/resources/running_exchanges/chiliz.yaml new file mode 100644 index 00000000..bd4f34a7 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/chiliz.yaml @@ -0,0 +1,304 @@ +name: chiliz +is_exchange: true + +api_url: https://api.chiliz.net/ +rate_limit: + max: 3000 + unit: 60 + +requests: + currency_pairs: + request: + template: openapi/v1/brokerInfo + pair_template: null + params: null + + response: + type: dict + values: + symbols: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + + mapping: + - key: currency_pair_first + path: + - symbols + - baseAsset + type: + - str + - key: currency_pair_second + path: + - symbols + - quoteAsset + type: + - str + + tickers: + request: + template: openapi/quote/v1/ticker/price + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: null + + response: + type: dict + values: + symbol: + type: str + price: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - price + type: + - str + - float + + order_books: + request: + template: openapi/quote/v1/depth + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 100 + default: 100 + response: + type: dict + values: + time: + type: int + bids: + type: list + values: + type: list + 0: #price + type: str + 1: #qty + type: str + asks: + type: list + values: + type: list + 0: + type: str + 1: + type: str + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - time + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + + trades: + request: + template: openapi/quote/v1/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 1000 + default: 500 + response: + type: list + value: + type: dict + values: + price: + type: str + qty: + typ: str + time: + type: int + isBuyerMaker: + type: bool + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - True + - sell + - False + - buy + - key: id + path: + - time + type: + - int + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + + historic_rates: + request: + template: openapi/quote/v1/klines + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + months: 1M + default: 1d + limit: + type: int + max: 1000 + default: 1000 + endTime: + function: last_timestamp + type: + - datetime + - timestampms + + response: + type: list + values: + type: list + values: + 0: #timestamp + type: int + 1: #open + type: str + 2: #high + type: str + 3: #low + type: str + 4: #close + type: str + 5: #volume + type: str + 6: #close time + type: int + 7: # quote Asset volume + type: str + 8: # number of trades + type: int + 9: # taker buy base asset volume + type: str + 10: # taker buy quote asset volume + type: str + + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/coinall.yaml b/pandas_datareader/crypto/resources/running_exchanges/coinall.yaml new file mode 100644 index 00000000..d73fc08d --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/coinall.yaml @@ -0,0 +1,202 @@ +name: coinall +exchange: true +api_url: https://www.coinall.com/api/spot/v3/ +rate_limit: + max: 6 + unit: 1 + +requests: + currency_pairs: + request: + template: instruments + pair_template: null + params: null + response: + type: list + vaues: + type: dict + values: + base_currency: + type: str + instrument_id: + type: str + quote_currency: + type: str + size_increment: + type: str + tick_size: + type: str + mapping: + - key: currency_pair_first + path: + - base_currency + type: + - str + - key: currency_pair_second + path: + - quote_currency + type: + - str + + tickers: + request: + template: instruments/ticker + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + best_ask: + type: str + best_bid: + type: str + instrument_id: + type: str + product_id: + type: str + last: + type: str + ask: + type: str + bid: + type: str + open24h: + type: str + high24h: + type: str + low_24h: + type: str + base_volume_24h: + type: str + timestamp: + type: str + quote_volume_24h: + type: str + mapping: + - key: time + path: + - timestamp + type: + - str + - strptime + - "%Y-%m-%dT%H:%M:%S.%fz" + - key: currency_pair_first + path: + - instrument_id + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - instrument_id + type: + - str + - split + - "-" + - 1 + - key: last_price + path: + - last + type: + - str + - float + - key: best_bid + path: + - best_bid + type: + - str + - float + - key: best_ask + path: + - best_ask + type: + - str + - float + + + historic_rates: + request: + template: instruments/{currency_pair}/candles + pair_template: + template: "{first}-{second}" + lower_case: false + params: + granularity: + allowed: + minutes: 60 + hours: 3600 + days: 86400 + weeks: 604800 + default: 86400 #1d in seconds + end: + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S.%fZ" + + response: + type: list + values: + type: list + values: + 0: #timestamp + type: str + 1: #open + type: str + 2: #high + type: str + 3: #low + type: str + 4: #close + type: str + 5: #volume + type: str + mapping: + - key: time + path: + - [] + - 0 + type: + - str + - strptime + - "%Y-%m-%dT%H:%M:%S.%fz" + - key: open + path: + - [] + - 1 + type: + - str + - float + - key: high + path: + - [] + - 2 + type: + - str + - float + - key: low + path: + - [] + - 3 + type: + - str + - float + - key: close + path: + - [] + - 4 + type: + - str + - float + - key: volume + path: + - [] + - 5 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/coinbase.yaml b/pandas_datareader/crypto/resources/running_exchanges/coinbase.yaml new file mode 100644 index 00000000..c86b01ce --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/coinbase.yaml @@ -0,0 +1,338 @@ +name: coinbase +exchange: true +api_url: https://api.pro.coinbase.com/ +rate_limit: + max: 180 + unit: 60 +requests: + currency_pairs: + request: + template: products/ + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + id: # i.e. "BTC-USD" + type: str + base_currency: # i.e. "BTC" + type: str + quote_currency: # i.e. "USD" + type: str + base_min_size: + type: + - str + base_max_size: + type: + - str + quote_increment: + type: + - str + mapping: + - key: currency_pair_first + path: + - base_currency + type: + - str + - key: currency_pair_second + path: + - quote_currency + type: + - str + + tickers: + request: + template: products/{currency_pair}/ticker + pair_template: # e.g. BTC-USD + template: "{first}-{second}" + lower_case: false + params: null + response: + type: dict + values: + trade_id: + type: int + price: + type: + - str + size: + type: + - str + bid: + type: + - str + ask: + type: + - str + volume: + type: + - str + time: + type: + - str + mapping: + + - key: last_price + path: + - price + type: + - str + - float + - key: best_bid + path: + - bid + type: + - str + - float + - key: best_ask + path: + - ask + type: + - str + - float + - key: daily_volume + path: + - volume + type: + - str + - float + - key: time + path: + - time + type: + - str + - dateparser + + + order_books: + request: + template: products/{currency_pair}/book + pair_template: # e.g. BTC-USD + template: "{first}-{second}" + lower_case: false + params: + level: + type: int + possible: + - 1 # Only the best bid and ask + - 2 # Top 50 bids and asks (aggregated) + - 3 # Full order book (non aggregated), Abuse of Level 3 via polling will cause your access to be limited or blocked. + default: 2 + response: + type: dict + values: + sequence: + type: + - int + bids: + type: list + values: + type: list + values: + 0: # price + type: + - str + 1: # size + type: + - str + 2: # num-orders + type: int + asks: + type: list + values: + type: list + values: + 0: # price + type: + - str + 1: # size + type: + - str + 2: # num-orders + type: int + mapping: + - key: time + path: [] + type: + - none + - now + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: position + path: [] + type: + - none + - range + - key: id + path: + - sequence + type: + - int + + + trades: + request: + template: products/{currency_pair}/trades + pair_template: # e.g. BTC-USD + template: "{first}-{second}" + lower_case: false + params: null + response: + type: list + values: + type: dict + values: + time: + type: + - str + trade_id: + type: int + price: + type: + - str + size: + type: + - str + side: + type: str + mapping: + - key: time + path: + - time + type: + - str + - dateparser + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - size + type: + - str + - float + - key: direction + path: + - side + type: + - str + - key: id + path: + - trade_id + type: + - int + + historic_rates: # Historical rates should not be polled frequently. If you need real-time information, use the trade and book endpoints along with the websocket feed. + request: + template: products/{currency_pair}/candles + pair_template: # e.g. BTC-USD + template: "{first}-{second}" + lower_case: false + params: + start: # Start time in ISO 8601 "%Y-%m-%dT%H:%M:%S.%fZ" + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 300 + - from_timestamp + - 0 + - "%Y-%m-%dT%H:%M:%S.%fZ" + end: # End time in ISO 8601 + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S.%fZ" + granularity: # Desired timeslice in seconds + type: int + allowed: + minutes: 60 + hours: 3600 + days: 86400 + default: 86400 + response: + type: list # TODO: Header Entry? + values: + type: list + values: + 0: # start time + type: int + 1: # low + type: float + 2: # high + type: float + 3: # open + type: float + 4: # close + type: float + 5: # volume + type: float + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 0 + - to_end + - interval + + - key: low + path: + - 1 + type: + - float + - key: high + path: + - 2 + type: + - float + - key: open + path: + - 3 + type: + - float + - key: close + path: + - 4 + type: + - float + - key: volume + path: + - 5 + type: + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/coinbene.yaml b/pandas_datareader/crypto/resources/running_exchanges/coinbene.yaml new file mode 100644 index 00000000..70621f7b --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/coinbene.yaml @@ -0,0 +1,378 @@ +name: coinbene +exchange: true +api_url: https://openapi-exchange.coinbene.com/api/exchange/v2/market/ +rate_limit: + max: 15 + unit: 1 +requests: + currency_pairs: + request: + template: tradePair/list + pair_template: null + params: null + response: + type: dict + values: + code: + type: int + data: + type: list + values: + type: dict + values: + symbol: + type: str + baseAsset: + type: str + quoteAsset: + type: str + mapping: + - key: currency_pair_first + path: + - data + - baseAsset + type: + - str + - key: currency_pair_second + path: + - data + - quoteAsset + type: + - str + + tickers: + request: + template: ticker/one + pair_template: + template: "{first}/{second}" + lower_case: false + alias: symbol + params: null + response: + type: dict + values: + code: + type: int + message: + type: str + data: + type: dict + values: + symbol: + type: str + latestPrice: + type: str + bestBid: + type: str + bestAsk: + type: str + high24h: + type: str + low24h: + type: str + volume24h: + type: str + chg24h: + type: str + chg0h: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - data + - latestPrice + type: + - str + - float + - key: best_bid + path: + - data + - bestBid + type: + - str + - float + - key: best_ask + path: + - data + - bestAsk + type: + - str + - float + + trades: + request: + template: trades + pair_template: + template: "{first}/{second}" + lower_case: false + alias: symbol + params: null + response: + type: dict + values: + code: + type: int + data: + type: list + values: + type: list + 0: + type: str + 1: + type: str + 2: + type: str + 3: + type: str + 4: + type: str + mapping: + - key: time + path: + - data + - 4 + type: + - str + - strptime + - "%Y-%m-%dT%H:%M:%S.%fZ" + - key: id + path: + - data + - 4 + type: + - strptime + - totimestamp + - "%Y-%m-%dT%H:%M:%S.%fZ" + - key: amount + path: + - data + - 2 + type: + - str + - float + - key: price + path: + - data + - 1 + type: + - str + - float + - key: direction + path: + - data + - 3 + type: + - str + + historic_rates: + request: + template: instruments/candles + pair_template: + template: "{first}/{second}" + lower_case: false + alias: symbol + params: + period: + allowed: + minutes: 1 + hours: 60 + days: D + weeks: W + months: M + default: D + end: + function: last_timestamp + type: + - datetime + - timestamp + response: + type: dict + values: + code: + type: int + data: + type: list + values: + type: list + values: + 0: #timestamp + type: str + 1: # open + type: str + 2: # high + type: str + 3: # low + type: str + 4: # close + type: str + 5: #volume + type: str + mapping: + - key: time + path: + - data + - 0 + type: + - str + - strptime + - "%Y-%m-%dT%H:%M:%S.%fZ" + - key: open + path: + - data + - 1 + type: + - str + - float + - key: high + path: + - data + - 2 + type: + - str + - float + - key: low + path: + - data + - 3 + type: + - str + - float + - key: close + path: + - data + - 4 + type: + - str + - float + - key: volume + path: + - data + - 5 + type: + - str + - float + + order_books: + request: + template: orderBook + pair_template: + template: "{first}/{second}" + lower_case: false + alias: symbol + params: + depth: + type: int + default: 100 + response: + type: dict + values: + code: + type: int + data: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: # Price + type: str + 1: # Size + type: str + bids: + type: list + values: + type: list + values: + 0: # Price + type: str + 1: # Size + type: str + mapping: + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: time + path: [] + type: + - none + - now + - key: bids_price + path: + - data + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - data + - bids + - 1 + type: + - str + - float + - key: asks_amount + path: + - data + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - data + - asks + - 0 + type: + - str + - float + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pandas_datareader/crypto/resources/running_exchanges/coindcx.yaml b/pandas_datareader/crypto/resources/running_exchanges/coindcx.yaml new file mode 100644 index 00000000..8cdcbe62 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/coindcx.yaml @@ -0,0 +1,221 @@ +# Structure of Order-Books not applicable to our program. Tickers not with single request, while CP are not separated. + +name: coindcx +exchange: true + +rate_limit: null + +api_url: "" #Base URL differs + +requests: + currency_pairs: + request: + template: https://api.coindcx.com/exchange/v1/markets_details + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + base_currency_short_name: + type: str + target_currency_short_name: + type: str + + mapping: + - key: currency_pair_first + path: + - target_currency_short_name + type: + - str + - key: currency_pair_second + path: + - base_currency_short_name + type: + - str + + historic_rates: + request: + template: https://public.coindcx.com/market_data/candles + pair_template: + template: "B-{first}_{second}" + lower_case: false + alias: pair + params: + limit: + dafault: 1000 + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w +# months: 1M + default: 1d + endTime: + function: last_timestamp + type: + - datetime + - timestampms + startTime: + function: last_timestamp + type: + - datetime + - timedeltams + - interval + - 1000 + response: + type: list + values: + type: dict + values: + open: + type: float + high: + type: float + low: + type: float + close: + type: float + volume: + type: float + time: + type: int + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: open + path: + - open + type: + - float + - key: high + path: + - high + type: + - float + - key: low + path: + - low + type: + - float + - key: close + path: + - close + type: + - float + - key: volume + path: + - volume + type: + - float + + trades: + request: + template: https://public.coindcx.com/market_data/trade_history + pair_template: + template: "B-{first}_{second}" + lower_case: false + alias: pair + params: + limit: + default: 100 + max: 500 + response: + type: list + values: + type: dict + values: + p: + type: float + q: + type: float + s: + type: str + T: + type: int + m: + type: str + + mapping: + - key: direction + path: + - m + type: + - value + - map + - True + - sell + - False + - buy + - key: time + path: + - T + type: + - float + - from_timestamp + - 1 + - key: id + path: + - T + type: + - int + + - key: price + path: + - p + type: + - float + - key: amount + path: + - q + type: + - float +# +# order_books: +# request: +# template: /market_data/orderbook +# pair_template: +# template: "B{first}_{second}" +# lower_case: false +# alias: pair +# params: null +# +# response: +# type: dict +# values: +# bids: +# type: dict +# values: +# +# +# mapping: +# - key: time +# path: +# type: +# - key: id +# path: +# type: +# - key: position +# path: [] +# type: +# - none +# - range +# - key: bids_amount +# path: +# type: +# - key: bids_price +# path: +# type: +# - key: asks_amount +# path: +# type: +# - key: asks_price +# path: +# type: \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/coinegg.yaml b/pandas_datareader/crypto/resources/running_exchanges/coinegg.yaml new file mode 100644 index 00000000..ef9d0b34 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/coinegg.yaml @@ -0,0 +1,310 @@ +name: coinegg +exchange: true + +rate_limit: + max: 3000 + unit: 60 + +api_url: https://api.coinegg.fun/ + +requests: + currency_pairs: + request: + template: openapi/v1/brokerInfo + pair_template: null + params: null + + response: + type: dict + values: + symbols: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + + mapping: + - key: currency_pair_first + path: + - symbols + - baseAsset + type: + - str + - key: currency_pair_second + path: + - symbols + - quoteAsset + type: + - str + + tickers: + request: + template: openapi/quote/v1/ticker/price + pair_template: + template: "{first}{second}" + lower_case: false + alias: sybmol + params: null + response: + type: dict + values: + symbol: + type: str + price: + type: str + + mapping: + - key: last_price + path: + - price + type: + - str + - float + - key: time + path: [] + type: + - none + - now + + historic_rates: + request: + template: openapi/quote/v1/klines + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + interval: + allowed: + minutes: 1m +# hours: 1h + days: 1d + weeks: 1w + months: 1M + default: 1d + endTime: + function: last_timestamp + type: + - datetime + - timestampms +# startTime: #not required with endTime and limit parameter +# function: last_timestamp +# type: +# - datetime +# - timedeltams +# - interval +# - 100 + limit: + type: + - int + default: 1000 + + response: + type: list + values: + type: list + values: + 0: #open time + type: int + 1: #open + type: str + 2: # high + type: str + 3: # low + type: str + 4: # close + type: str + 5: # vol + type: str + 6: # close time + type: int + 7: # quote_vol + type: str + + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 1 + - to_end + - interval + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float + + + trades: + request: + template: openapi/quote/v1/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + default: 500 #max: 1000 + + response: + type: list + values: + type: dict + values: + price: + type: str + time: + type: int + qty: + type: str + isBuyerMaker: + type: bool + + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - time + type: + - int + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - true + - sell + - false + - buy + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + + order_books: + request: + template: openapi/quote/v1/depth + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + default: 50 + + response: + type: dict + values: + time: + type: int + bids: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + asks: + type: list + values: + type: list + values: + 0: #price + type: str + 1: #qty + type: str + + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - time + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/coinex.yaml b/pandas_datareader/crypto/resources/running_exchanges/coinex.yaml new file mode 100644 index 00000000..4768381c --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/coinex.yaml @@ -0,0 +1,411 @@ +name: coinex +terms: + terms_url: https://www.coinex.com/service + permission: false + search_targets: + - tag: div + class: article-body-inner +api_url: https://api.coinex.com/v1/ + +rate_limit: null # 20 times per second per IP (for Trading and Account API); no limit on Market API +requests: + currency_pairs: + request: + template: market/info + pair_template: null + params: null + response: + type: dict + values: + code: + type: int + data: + type: dict + values: + currency_pair: + type: dict + values: + name: + type: str + pricing_name: + type: str + trading_name: + type: str + mapping: + - key: currency_pair_first + path: + - data + - dict_values + - trading_name + type: + - str + - key: currency_pair_second + path: + - data + - dict_values + - pricing_name + type: + - str + + tickers: + request: + template: market/ticker + pair_template: + template: "{first}{second}" + lower_case: false + alias: market + params: null + response: + type: dict + values: + code: + type: int + data: + type: dict + values: + date: + type: int + ticker: + type: dict + values: + vol: + type: str + low: + type: str + open: + type: str + high: + type: str + last: + type: str + buy: + type: str + buy_amount: + type: str + sell: + type: str + sell_amount: + type: str + message: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: best_bid + path: + - data + - ticker + - buy + type: + - str + - float + - key: last_price + path: + - data + - ticker + - last + type: + - str + - float + - key: best_ask + path: + - data + - ticker + - sell + type: + - str + - float + - key: daily_volume + path: + - data + - ticker + - vol + type: + - str + - float +# + order_books: + request: + template: market/depth + pair_template: # e.g. BTCBCH + template: "{first}{second}" + lower_case: false + alias: market + params: + merge: + type: float + required: true + default: 0 + limit: + type: int + default: 50 + response: + type: dict + values: + code: + type: int + data: + type: dict + values: + last: + type: + - str + asks: + type: list + values: + type: list + values: + 0: # Order price + type: + - str + 1: # Order amount + type: + - str + bids: + type: list + values: + type: list + values: + 0: # Order price + type: + - str + 1: # Order amount + type: + - str + message: + type: str + mapping: + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - data + - time + type: + - int + - key: position + path: [] + type: + - none + - range + - key: asks_price + path: + - data + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - data + - asks + - 1 + type: + - str + - float + - key: bids_price + path: + - data + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - data + - bids + - 1 + type: + - str + - float + + trades: + request: + template: market/deals + pair_template: # e.g. BTCBCH + template: "{first}{second}" + lower_case: false + alias: market + params: + last_id: # Transaction history id, send 0 to draw from the latest record. + type: int + default: 0 + limit: + type: int + default: 100 # less than 1,000 + response: + type: dict + values: + code: + type: int + data: + type: list + values: + type: dict + values: + amount: + type: + - str + - float + date: + type: + - int + date_ms: + type: + - int + id: + type: int + price: + type: + - str + - float + type: + type: str + message: + type: str + mapping: + - key: id + path: + - data + - id + type: + - int + - key: amount + path: + - data + - amount + type: + - str + - float + - key: time + path: + - data + - date + type: + - float + - from_timestamp + - 0 + - key: price + path: + - data + - price + type: + - str + - float + - key: direction + path: + - data + - type + type: + - str + + historic_rates: + request: + template: market/kline + pair_template: # e.g. BTCBCH + template: "{first}{second}" + lower_case: false + alias: market + params: + type: + type: str + allowed: + minutes: 1min + hours: 1hour + days: 1day + weeks: 1week + default: 1day + limit: # Less than or equal to 1000 + type: int + max: 1000 + default: 1000 + response: + type: dict + values: + code: + type: int + data: + type: list + values: + type: list + values: + 0: # Time + type: + - int + 1: # open + type: + - str + 2: # close + type: + - str + 3: # highest + type: + - str + 4: # lowest + type: + - str + 5: # volume + type: + - str + 6: # amount + type: + - str + 7: # market + type: str + message: + type: str + mapping: + - key: time + path: + - data + - 0 + type: + - float + - from_timestamp + - 0 + - key: open + path: + - data + - 1 + type: + - str + - float + - key: close + path: + - data + - 2 + type: + - str + - float + - key: high + path: + - data + - 3 + type: + - str + - float + - key: low + path: + - data + - 4 + type: + - str + - float + - key: volume + path: + - data + - 5 + type: + - str + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/coinfield.yaml b/pandas_datareader/crypto/resources/running_exchanges/coinfield.yaml new file mode 100644 index 00000000..546f3fc1 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/coinfield.yaml @@ -0,0 +1,348 @@ +name: coinfield +exchange: true + +rate_limit: null + +api_url: https://api.coinfield.com/v1/ + +requests: + currency_pairs: + request: + template: markets + pair_template: null + params: null + + response: + type: dict + values: + markets: + type: list + values: + type: dict + values: + id: + type: str + name: + type: str + + mapping: + - key: currency_pair_first + path: + - markets + - name + type: + - str + - split + - "/" + - 0 + - key: currency_pair_second + path: + - markets + - name + type: + - str + - split + - "/" + - 1 + + tickers: + request: + template: tickers/{currency_pair} + pair_template: + template: "{first}{second}" + lower_case: true + params: null + response: + type: dict + values: + markets: + type: list + values: + type: dict + values: + timestamp: + type: str + bid: + type: float + ask: + type: float + vol: + type: float + last: + type: float + + mapping: + - key: last_price + path: + - markets + - last + type: + - float + - key: time + path: [] + type: + - none + - now + - key: best_bid + path: + - markets + - bid + type: + - float + - key: best_ask + path: + - markets + - ask + type: + - float + - key: daily_volume + path: + - markets + - vol + type: + - float + + historic_rates: + request: + template: ohlc/{currency_pair} + pair_template: + template: "{first}{second}" + lower_case: true + params: + limit: + default: 400 + period: + allowed: + minutes: 1 + hours: 60 + days: 1440 + weeks: 10080 + default: 1440 + to: + function: last_timestamp + type: + - datetime + - timestamp + from: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 400 + response: + type: dict + values: + ohlc: + type: list + values: + type: dict + values: + ts: + type: str + o: + type: str + h: + type: str + l: + type: str + c: + type: str + v: + type: str + + mapping: + - key: time + path: + - ohlc + - ts + type: + - str + - dateparser + - key: open + path: + - ohlc + - o + type: + - str + - float + - key: high + path: + - ohlc + - h + type: + - str + - float + - key: low + path: + - ohlc + - l + type: + - str + - float + - key: close + path: + - ohlc + - c + type: + - str + - float + - key: volume + path: + - ohlc + - v + type: + - str + - float + + + trades: + request: + template: trades/{currency_pair} + pair_template: + template: "{first}{second}" + lower_case: true + params: + limit: + default: 200 + + response: + type: dict + values: + trades_hash: + type: str + trades: + type: list + values: + type: dict + values: + id: + type: int + price: + type: str + volume: + type: str + total_value: + type: str + timestamp: + type: str + + + mapping: + - key: time + path: + - trades + - timestamp + type: + - str + - dateparser + - key: id + path: + - trades + - id + type: + - int +# - key: direction +# path: +# type: + - key: price + path: + - trades + - price + type: + - str + - float + - key: amount + path: + - trades + - volume + type: + - str + - float + + order_books: + request: + template: orderbook/{currency_pair} + pair_template: + template: "{first}{second}" + lower_case: true + params: + limit: + default: 50 + + response: + type: dict + values: + asks_hash: + type: str + bids: + type: list + values: + type: dict + values: + id: + type: int + price: + type: str + volume: + type: str + timestamp: + type: str + asks: + type: list + values: + type: dict + values: + id: + type: int + price: + type: str + volume: + type: str + timestamp: + type: str + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - volume + type: + - str + - float + - key: bids_price + path: + - bids + - price + type: + - str + - float + - key: asks_amount + path: + - asks + - volume + type: + - str + - float + - key: asks_price + path: + - asks + - price + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/coingecko.yaml b/pandas_datareader/crypto/resources/running_exchanges/coingecko.yaml new file mode 100644 index 00000000..3bcdbd32 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/coingecko.yaml @@ -0,0 +1,116 @@ +name: coingecko +exchange: false +api_url: https://api.coingecko.com/api/v3/ +#api_url: https://api.coingecko.com/api/v2/ +rate_limit: + max: 50 + unit: 60 + +requests: + currency_pairs: + request: + template: coins/list + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + id: + type: str + symbol: + type: str + name: + type: str + + mapping: + - key: currency_pair_first + path: + - id + type: + - str + - key: currency_pair_second + path: [] + type: + - none + - constant + - USD + + historic_rates: + request: + template: coins/{currency_pair}/market_chart + pair_template: + template: "{first}" + lower_case: true + params: + vs_currency: + type: str + default: USD + days: + type: int + default: max + + response: + type: dict + values: + prices: + type: list + values: + type: list + values: + 0: + type: int + 1: + type: float + market_caps: + type: list + values: + type: list + values: + 0: + type: int + 1: + type: float + total_volumes: + type: list + values: + type: list + values: + 0: + type: int + 1: + type: float + + mapping: + - key: time + path: + - prices + - 0 + type: + - float + - from_timestamp + - 1 + - to_end + - interval + - key: close + path: + - prices + - 1 + type: + - float + - key: volume + path: + - total_volumes + - 1 + type: + - float + - key: market_cap + path: + - market_caps + - 1 + type: + - float + + diff --git a/pandas_datareader/crypto/resources/running_exchanges/coinhe.yaml b/pandas_datareader/crypto/resources/running_exchanges/coinhe.yaml new file mode 100644 index 00000000..8a06582e --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/coinhe.yaml @@ -0,0 +1,333 @@ +name: coinhe +exchange: true + +rate_limit: null + +api_url: https://api.coinhe.io/v1/ + +requests: + currency_pairs: + request: + template: market-summary/ + pair_template: null + params: null + + response: + type: list + values: + tyoe: dict + values: + currency_pair: + type: dict + + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 1 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 0 + + tickers: + request: + template: market-summary/ + pair_template: null + params: null + response: + type: list + values: + tyoe: dict + values: + currency_pair: + type: dict + values: + lastUpdateTimestamp: + type: int + LastPrice: + type: float + highestBid: + type: float + lowestAsk: + type: float + baseVolume24g: + type: float + quoteVolume24h: + type: float + + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 1 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: last_price + path: + - dict_values + - LastPrice + type: + - float + - key: time + path: + - dict_values + - lastUpdateTimestamp + type: + - float + - from_timestamp + - 0 + - key: best_bid + path: + - dict_values + - highestBid + type: + - float + - key: best_ask + path: + - dict_values + - lowestAsk + type: + - float + - key: daily_volume + path: + - dict_values + - baseVolume24h + type: + - float + - key: daily_base_volume + path: + - dict_values + - quoteVolume24h + type: + - float + + historic_rates: + request: + template: candlestick-v2 + pair_template: + template: "{second}_{first}" + lower_case: false + alias: pair + params: + interval: + allowed: + minutes: 5m + days: 1d + default: 5m + timestamp: + function: last_timestamp + type: + - datetime + - timestamp + response: + type: list + values: + type: dict + values: + close: + type: str + high: + type: str + open: + type: str + low: + type: str + volume: + type: str + timestamp: + type: int + + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 0 + - key: open + path: + - open + type: + - str + - float + - key: high + path: + - high + type: + - str + - float + - key: low + path: + - low + type: + - str + - float + - key: close + path: + - close + type: + - str + - float + - key: volume + path: + - volume + type: + - str + - float + + + trades: + request: + template: trades/{currency_pair} + pair_template: + template: "{second}_{first}" + lower_case: false +# alias: + params: null + + response: + type: list + values: + type: dict + values: + tradeID: + type: int + price: + type: float + base_volume: + type: float + quote_volume: + type: float + trade_timestamp: + type: int + type: + type: str + + mapping: + - key: time + path: + - trade_timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - tradeID + type: + - int + - key: direction + path: + - type + type: + - str + - key: price + path: + - price + type: + - float + - key: amount + path: + - quote_volume # pair is quoted indirectly + type: + - float + + order_books: + request: + template: orderbook/{currency_pair} + pair_template: + template: "{second}_{first}" + lower_case: false +# alias: + params: null + + response: + type: dict + values: + timestamp: + type: int + bids: + type: list + values: + type: list + values: + 0: #price + type: str + 1: #qty + type: str + asks: + type: list + values: + type: list + values: + 0: #price + type: str + 1: #qty + type: str + + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - timestamp + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/coinjar.yaml b/pandas_datareader/crypto/resources/running_exchanges/coinjar.yaml new file mode 100644 index 00000000..45b377d3 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/coinjar.yaml @@ -0,0 +1,314 @@ +name: coinjar +exchange: true + +rate_limit: null + +api_url: "" + +requests: + currency_pairs: + request: + template: https://api.exchange.coinjar.com/products + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + name: + type: str + + mapping: + - key: currency_pair_first + path: + - name + type: + - str + - split + - "/" + - 0 + - key: currency_pair_second + path: + - name + type: + - str + - split + - "/" + - 1 + + tickers: + request: + template: https://data.exchange.coinjar.com/products/{currency_pair}/ticker + pair_template: + template: "{first}{second}" + lower_case: false + params: null + response: + type: dict + values: + volume_24h: + type: str + last: + type: str + current_time: + type: str + bid: + type: str + ask: + type: str + + mapping: + - key: last_price + path: + - last + type: + - str + - float + - key: time + path: + - current_time + type: + - str + - dateparser + - key: best_bid + path: + - bid + type: + - str + - float + - key: best_ask + path: + - ask + type: + - str + - float + - key: daily_volume + path: + - volume_24h + type: + - str + - float + + historic_rates: + request: + template: https://data.exchange.coinjar.com/products/{currency_pair}/candles + pair_template: + template: "{first}{second}" + lower_case: false + params: + before: + function: last_timestamp + type: + - datetime + - timestamp + after: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 300 + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + months: 1M + default: 1d + + response: + type: list + values: + type: list + values: + 0: #time + type: str + 1: #open + type: str + 2: #high + type: str + 3: #low + type: str + 4: #close + type: str + 5: #vol + type: str + + mapping: + - key: time + path: + - 0 + type: + - str + - dateparser + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float + + + trades: + request: + template: https://data.exchange.coinjar.com/products/{currency_pair}/trades + pair_template: + template: "{first}{second}" + lower_case: false + params: + limit: + default: 200 + + response: + type: list + values: + type: dict + values: + value: + type: str + timestamp: + type: str + tid: + type: int + taker_side: + type: str + size: + type: str + price: + type: str + + mapping: + - key: time + path: + - timestamp + type: + - str + - dateparser + - key: id + path: + - tid + type: + - int + - key: direction + path: + - taker_side + type: + - str + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - size + type: + - str + - float + + order_books: + request: + template: https://data.exchange.coinjar.com/products/{currency_pair}/book + pair_template: + template: "{first}{second}" + lower_case: false + params: + level: + allowed: + 1: #Best bid/best ask + 2: #Top20 + 3: #Full Book + default: 2 + response: + type: dict + values: + bids: + type: list + values: + type: list + values: + 0: # price + type: str + 1: # qty + type: str + asks: + type: list + values: + type: list + values: + 0: # price + type: str + 1: # qty + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/coinlist.yaml b/pandas_datareader/crypto/resources/running_exchanges/coinlist.yaml new file mode 100644 index 00000000..1da79c76 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/coinlist.yaml @@ -0,0 +1,288 @@ +name: coinlist +exchange: true + +rate_limit: + max: 200 + unit: 60 + +api_url: http://trade-api.coinlist.co/v1/ + +requests: + currency_pairs: + request: + template: symbols + pair_template: null + params: null + + response: + type: list + values: + symbols: + type: list + values: + type: dict + values: + symbol: + type: str + base_currency: + type: str + quote_currency: + type: str + + mapping: + - key: currency_pair_first + path: + - symbols + - base_currency + type: + - str + - key: currency_pair_second + path: + - symbols + - quote_currency + type: + - str + + tickers: + request: + template: symbols/summary + pair_template: null + params: null + response: + type: dict + values: + currency_pair: + type: dict + values: + last_price: + type: str + lowest_ask: + type: str + highest_bid: + type: str + volume_base_24h: + type: str + volume_quote_24h: + type: str + + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "-" + - 1 + - key: last_price + path: + - dict_values + - last_price + type: + - str + - float + - key: time + path: [] + type: + - none + - now + - key: best_bid + path: + - dict_values + - highest_bid + type: + - str + - float + - key: best_ask + path: + - dict_values + - lowest_ask + type: + - str + - float + - key: daily_volume + path: + - dict_values + - volume_base_24h + type: + - str + - float + + historic_rates: + request: + template: symbols/{currency_pair}/candles + pair_template: + template: "{first}-{second}" + lower_case: false + params: + granularity: + allowed: + minutes: 1m + hours: 30m + default: 30m +# start_time: +# function: last_timestamp +# type: +# - datetime +# - timedelta +# - interval +# - 300 +# - format +# - "%Y-%m%dT%H:%M:%S.%fZ" + end_time: + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S.%fZ" + response: + type: dict + values: + candles: + type: list + values: + type: list + values: + 0: #time + type: str + 1: #open + type: str + 2: #high + type: str + 3: # low + type: str + 4: #close + type: str + 5: #volume + type: str + mapping: + - key: time + path: + - candles + - 0 + type: + - str + - dateparser + - key: open + path: + - candles + - 1 + type: + - str + - float + - key: high + path: + - candles + - 2 + type: + - str + - float + - key: low + path: + - candles + - 3 + type: + - str + - float + - key: close + path: + - candles + - 4 + type: + - str + - float + - key: volume + path: + - candles + - 5 + type: + - str + - float + + order_books: + request: + template: symbols/{currency_pair}/book + pair_template: + template: "{first}-{second}" + lower_case: false + params: null + + response: + type: dict + values: + call_time: + type: str + after_auction_code: + type: str + bids: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + asks: + type: list + values: + type: list + values: + 0: #price + type: str + 1: #qty + type: str + + mapping: + - key: time + path: + - call_time + type: + - str + - dateparser + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/coinpaprika.yaml b/pandas_datareader/crypto/resources/running_exchanges/coinpaprika.yaml new file mode 100644 index 00000000..654a2722 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/coinpaprika.yaml @@ -0,0 +1,226 @@ +# ToDo: Tickers fehlerhaft +name: coinpaprika +exchange: false + +rate_limit: + max: 600 + unit: 60 + +api_url: https://api.coinpaprika.com/v1/ + +requests: + currency_pairs: + request: + template: coins + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + id: + type: str + name: + type: str + symbol: + type: str + + + mapping: + - key: currency_pair_first + path: + - id + type: + - str + - key: currency_pair_second + path: [] + type: + - none + - constant + - 'USD' + +# pair_infos: +# request: +# template: coins/{currency_pair} +# pair_template: +# template: "{first}" +# lower_case: true +# params: null +# response: +# type: dict +# values: +# first_data_at: +# type: str +# last_data_at: +# type: str +# mapping: +# - key: start +# path: +# - first_data_at +# type: +# - str +# - dateparser +# - key: end +# path: +# - last_data_at +# type: +# - str +# - dateparser +## + historic_rates: + request: + template: tickers/{currency_pair}/historical + pair_template: + template: "{first}" + lower_case: true + params: + start: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 5000 + end: + function: last_timestamp + type: + - datetime + - timestamp + limit: + default: 5000 # max! + interval: + allowed: + minutes: 5m + hours: 1h + days: 1d + weeks: 7d + months: 30d + default: 1d + + response: + type: list + values: + type: dict + values: + timestamp: + type: str + price: + type: float + volume_24h: + type: float + market_cap: + type: float + + mapping: + - key: time + path: + - timestamp + type: + - str + - dateparser + - key: close + path: + - price + type: + - float + - key: volume + path: + - volume_24h + type: + - float + - key: market_cap + path: + - market_cap + type: + - float + + +# sentiments: +# request: +# template: tickers/{currency_pair}/historical +# pair_template: +# template: "{first}" +# lower_case: true +# params: +# +# historic_rates: +# request: +# template: coins/{currency_pair}/ohlcv/historical +# pair_template: +# template: "{first}" +# lower_case: true +# params: +# start: +# function: last_timestamp +# type: +# - datetime +# - timedelta +# - interval +# - 366 +# limit: +# default: 366 # max value +# quote: +# default: usd # or 'btc' +# +# response: +# type: list +# values: +# type: dict +# values: +# time_open: +# type: str +# time_close: +# type: str +# open: +# type: float +# high: +# type: float +# low: +# type: float +# close: +# type: float +# volume: +# type: float +# market_cap: +# type: float +# +# +# mapping: +# - key: time +# path: +# - time_close +# type: +# - str +# - dateparser +# - key: open +# path: +# - open +# type: +# - float +# - key: high +# path: +# - high +# type: +# - float +# - key: low +# path: +# - low +# type: +# - float +# - key: close +# path: +# - close +# type: +# - float +# - key: volume +# path: +# - volume +# type: +# - float +# - key: market_cap +# path: +# - market_cap +# type: +# - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/coinsbit.yaml b/pandas_datareader/crypto/resources/running_exchanges/coinsbit.yaml new file mode 100644 index 00000000..41928331 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/coinsbit.yaml @@ -0,0 +1,325 @@ +name: coinsbit +exchange: true + +rate_limit: null +api_url: https://coinsbit.io/api/v1/public/ + +requests: + currency_pairs: + request: + template: markets + pair_template: null + params: null + + response: + type: dict + values: + result: + type: list + values: + type: dict + values: + name: + type: str + stock: + type: str + money: + type: str + mapping: + - key: currency_pair_first + path: + - result + - stock + type: + - str + - key: currency_pair_second + path: + - result + - money + type: + - str + + tickers: + request: + template: tickers + pair_template: null + params: null + response: + type: dict + values: + result: + type: dict + values: + currency_pair: + type: dict + values: + at: + type: int + ticker: + type: dict + values: + bid: + type: str + ask: + type: str + last: + type: str + vol: + type: str + + mapping: + - key: currency_pair_first + path: + - result + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - result + - dict_key + type: + - str + - split + - "_" + - 1 + - key: time + path: + - result + - dict_values + - at + type: + - float + - from_timestamp + - 0 + - key: last + path: + - result + - dict_values + - ticker + - last + type: + - str + - float + - key: best_bid + path: + - result + - dict_values + - ticker + - bid + type: + - str + - float + - key: best_ask + path: + - result + - dict_values + - ticker + - ask + type: + - str + - float + - key: daily_volume + path: + - result + - dict_values + - ticker + - vol + type: + - str + - float + + order_books: + request: + template: depth/result + pair_template: + template: "{first}_{second}" + lower_case: false + alias: market + params: + limit: + default: 50 #max=100 + response: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: #price + type: str + 1: #qty + type: str + bids: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + + historic_rates: + request: + template: kline + pair_template: + template: "{first}_{second}" + lower_case: false + alias: market + params: + start: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1000 + end: + function: last_timestamp + type: + - datetime + - timestamp + interval: + allowed: #minimum is 86400 +# minutes: 60 +# hours: 3600 + days: 86400 + weeks: 604800 + months: 18144000 + + default: 86400 # 1day + response: + type: dict + values: + result: + type: dict + values: + market: + type: str + start: + type: int + end: + type: int + interval: + type: int + kline: + type: list + values: + type: dict + values: + time: + type: int + open: + type: str + highest: + type: str + lowest: + type: str + close: + type: str + volume: + type: str + amount: + type: str + mapping: + - key: time + path: + - result + - kline + - time + type: + - float + - from_timestamp + - 0 + - key: open + path: + - result + - kline + - open + type: + - str + - float + - key: high + path: + - result + - kline + - highest + type: + - str + - float + - key: low + path: + - result + - kline + - lowest + type: + - str + - float + - key: close + path: + - result + - kline + - close + type: + - str + - key: volume + path: + - result + - kline + - volume + type: + - str + - float + + + + diff --git a/pandas_datareader/crypto/resources/running_exchanges/crex24.yaml b/pandas_datareader/crypto/resources/running_exchanges/crex24.yaml new file mode 100644 index 00000000..03fa17ff --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/crex24.yaml @@ -0,0 +1,313 @@ +name: crex24 +exchange: true +api_url: https://api.crex24.com/v2/public/ +rate_limit: null + +requests: + + currency_pairs: + request: + template: instruments + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + symbol: + type: str + baseCurrency: + type: str + quoteCurrency: + type: str + + + mapping: + - key: currency_pair_first + path: + - baseCurrency + type: + - str + - key: currency_pair_second + path: + - quoteCurrency + type: + - str + + tickers: + request: + template: tickers + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + instrument: + type: str + last: + type: float + percentChange: + type: float + low: + type: float + high: + type: float + baseVolume: + type: float + quoteVolume: + type: float + volumeInBtc: + type: float + volumeInUsd: + type: float + ask: + type: float + bid: + type: float + timestamp: + type: str + + mapping: + - key: time + path: + - timestamp + type: + - str + - dateparser + - key: currency_pair_first + path: + - instrument + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - instrument + type: + - str + - split + - "-" + - 1 + - key: last_price + path: + - last + type: + - float + - key: best_ask + path: + - ask + type: + - float + - key: best_bid + path: + - bid + type: + - float + - key: daily_volume + path: + - baseVolume + type: + - float + + historic_rates: + request: + template: ohlcv + pair_template: + template: "{first}-{second}" + lower_case: false + alias: instrument + params: + granularity: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + default: 1d + limit: + type: int + default: 1000 #between 1-1000, if not specified, default is 100. + response: + type: list + values: + type: dict + values: + timestamp: + type: str + open: + type: float + high: + type: float + low: + type: float + close: + type: float + volume: + type: float + mapping: + - key: time + path: + - timestamp + type: + - str + - dateparser + - key: open + path: + - open + type: + - float + - key: high + path: + - high + type: + - float + - key: low + path: + - low + type: + - float + - key: close + path: + - close + type: + - float + - key: volume + path: + - volume + type: + - float + + trades: + request: + template: recentTrades + pair_template: + template: "{first}-{second}" + lower_case: false + alias: instrument + params: + limit: + type: int + default: 1000 + + response: + type: list + values: + type: dict + values: + timestamp: + type: str + price: + type: float + volume: + type: float + side: + type: float + mapping: + - key: id + path: + - timestamp + type: + - str + - dateparser + - totimestamp + - key: time + path: + - timestamp + type: + - str + - dateparser + - key: direction + path: + - side + type: + - str + - key: price + path: + - price + type: + - float + - key: amount + path: + - volume + type: + - float + + + order_books: + request: + template: orderBook + pair_template: + template: "{first}-{second}" + lower_case: false + alias: instrument + params: + limit: + type: int + default: 50 + response: + type: dict + values: + buyLevels: + type: list + values: + type: dict + values: + price: + type: float + volume: + type: float + sellLevels: + type: list + values: + type: dict + values: + price: + type: float + volume: + type: float + mapping: + - key: id + path: [] + type: + - none + - now_timestamp + - key: time + path: [] + type: + - none + - now + - key: position + path: [] + type: + - none + - now + - key: bids_amount + path: + - buyLevels + - volume + type: + - float + - key: bids_price + path: + - buyLevels + - price + type: + - float + - key: asks_amount + path: + - sellLevels + - volume + type: + - float + - key: asks_price + path: + - sellLevels + - price + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/crosstower.yaml b/pandas_datareader/crypto/resources/running_exchanges/crosstower.yaml new file mode 100644 index 00000000..9e48e226 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/crosstower.yaml @@ -0,0 +1,364 @@ +name: crosstower +exchange: true + +rate_limit: + max: 6000 + unit: 60 + +api_url: https://api.crosstower.com/api/2/ + +requests: + currency_pairs: + request: + template: public/symbol + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + baseCurrency: + type: str + quoteCurrency: + type: str + + mapping: + - key: currency_pair_first + path: + - baseCurrency + type: + - str + - key: currency_pair_second + path: + - quoteCurrency + type: + - str + + tickers: + request: + template: public/ticker + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbols + params: null + response: + type: list + values: + type: dict + values: + ask: + type: str + bid: + type: str + last: + type: str + volume: + type: str + timestamp: + type: str + volumeQuote: + type: str + + mapping: + - key: last_price + path: + - last + type: + - str + - float + - key: time + path: + - timestamp + type: + - str + - dateparser + - key: best_bid + path: + - bid + type: + - str + - float + - key: best_ask + path: + - ask + type: + - str + - float + - key: daily_volume + path: + - volumeQuote + type: + - str + - float + + historic_rates: + request: + template: public/candles + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbols + params: + period: + allowed: + minutes: M1 + hours: H1 + days: D1 + weeks: W1 + months: 1M + sort: + default: DESC +# from: +# function: last_timestamp +# type: +# - datetime +# - timedelta +# - interval +# - 1000 +# - fromtimestamp +# - "%Y-%m-%dT%H:%M:%S.%fZ" + till: + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S.%fZ" + limit: + default: 1000 + response: + type: dict + values: + currency_pair: + type: list + values: + type: dict + values: + timestamp: + type: str + open: + type: str + max: + type: str + min: + type: str + close: + type: str + volume: + type: str + volumeQuote: + type: str + + mapping: + - key: time + path: + - dict_values + - timestamp + type: + - str + - dateparser + - key: open + path: + - dict_values + - open + type: + - str + - float + - key: high + path: + - dict_values + - max + type: + - str + - float + - key: low + path: + - dict_values + - min + type: + - str + - float + - key: close + path: + - dict_values + - close + type: + - str + - float + - key: volume + path: + - dict_values + - volume + type: + - str + - float + + trades: + request: + template: public/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbols + params: +# from: +# function: last_timestamp +# type: +# - datetime +# - timedelta +# - interval +# - 1000 +# - fromtimestamp +# - "%Y-%m-%dT%H:%M:%S.%fZ" +# till: +# function: last_timestamp +# type: +# - datetime +# - format +# - "%Y-%m-%dT%H:%M:%S.%fZ" + limit: + default: 1000 + max: 1000 + + response: + type: dict + values: + currency_pair: + type: list + values: + type: dict + values: + timestamp: + type: str + id: + type: int + price: + type: str + quantity: + type: str + side: + type: str + + mapping: + - key: time + path: + - dict_values + - timestamp + type: + - str + - dateparser + - key: id + path: + - dict_values + - id + type: + - int + - key: direction + path: + - dict_values + - side + type: + - str + - key: price + path: + - dict_values + - price + type: + - str + - float + - key: amount + path: + - dict_values + - quantity + type: + - str + - float + + order_books: + request: + template: public/orderbook + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbols + params: + limit: + default: 50 + max: 0 # to see complete order-book + + response: + type: dict + values: + currency_pair: + type: dict + values: + ask: + type: list + values: + type: dict + price: + type: str + size: + type: str + sell: + type: list + values: + type: dict + price: + type: str + size: + type: str + timestamp: + type: str + mapping: + - key: time + path: + - dict_values + - timestamp + type: + - str + - dateparser + - key: id + path: [] + type: + - none + - now_timestampms + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - dict_values + - bid + - size + type: + - str + - float + - key: bids_price + path: + - dict_values + - bid + - price + type: + - str + - float + - key: asks_amount + path: + - dict_values + - ask + - size + type: + - str + - float + - key: asks_price + path: + - dict_values + - ask + - price + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/crypto.yaml b/pandas_datareader/crypto/resources/running_exchanges/crypto.yaml new file mode 100644 index 00000000..1549a8fe --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/crypto.yaml @@ -0,0 +1,392 @@ +name: crypto +exchange: true +rate_limit: + max: 6000 + unit: 60 + +api_url: https://uat-api.3ona.co/v2/ + +requests: + currency_pairs: + request: + template: public/get-instruments + pair_template: null + params: null + + response: + type: dict + values: + result: + type: dict + values: + instruments: + type: list + values: + type: dict + values: + instrument_name: + type: str + quote_currency: + type: str + base_currency: + type: str + mapping: + - key: currency_pair_first + path: + - result + - instruments + - base_currency + type: + - str + - key: currency_pair_second + path: + - result + - instruments + - quote_currency + type: + - str + + tickers: + request: + template: public/get-ticker + pair_template: null + params: null + response: + type: dict + values: + result: + type: dict + values: + data: + type: list + values: + i: + type: str + b: + type: float + k: + type: float + a: + type: float + t: + type: int + v: + type: float + mapping: + - key: currency_pair_first + path: + - result + - data + - i + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - result + - data + - i + type: + - str + - split + - "_" + - 1 + - key: time + path: + - result + - data + - t + type: + - float + - from_timestamp + - 1 + - key: last_price + path: + - result + - data + - a + type: + - float + - key: best_bid + path: + - result + - data + - b + type: + - float + - key: best_ask + path: + - result + - data + - k + type: + - float + - key: daily_volume + path: + - result + - data + - v + type: + - float + + trades: + request: + template: public/get-trades + pair_template: + template: "{first}_{second}" + lower_case: false + alias: instrument_name + params: null + + response: + type: dict + values: + result: + type: dict + values: + instrument_name: + type: str + data: + type: list + values: + type: dict + values: + dataTime: + type: int + d: #trade id + type: int + s: #side + type: str + p: #price + type: float + q: #quantity + type: float + t: #time + type: int + i: + type: str + mapping: + - key: time + path: + - result + - data + - t + type: + - float + - from_timestamp + - 1 + - key: id + path: + - result + - data + - d + type: + - int + - key: direction + path: + - result + - data + - s + type: + - str + - key: price + path: + - result + - data + - p + type: + - float + - key: amount + path: + - result + - data + - q + type: + - float + + order_books: + request: + template: public/get-book + pair_template: + template: "{first}_{second}" + lower_case: false + alias: instrument_name + params: + depth: + type: int + max: 150 + default: 50 + response: + type: dict + values: + result: + type: dict + values: + data: + type: list + values: + type: dict + values: + bids: + type: list + values: + type: list + values: + 0: #price + type: float + 1: #qty + type: float + asks: + type: list + values: + type: list + values: + 0: #price + type: float + 1: #qty + type: float + t: #timestamp + type: int + mapping: + - key: time + path: + - result + - data + - t + type: + - float + - from_timestamp + - 1 + - key: id + path: + - result + - data + - t + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - result + - data + - bids + - 0 + type: + - float + - key: bids_amount + path: + - result + - data + - bids + - 1 + type: + - float + - key: asks_price + path: + - result + - data + - asks + - 0 + type: + - float + - key: asks_amount + path: + - result + - data + - asks + - 1 + type: + - float + + historic_rates: + request: + template: public/get-candlestick + pair_template: + template: "{first}_{second}" + lower_case: false + alias: instrument_name + params: + timeframe: + allowed: +# minutes: 1M +# hours: 1H + days: 1D + weeks: 1W +# months: 1M + default: 1D + limit: + default: 100 + + response: + type: dict + values: + result: + type: data + values: + type: list + values: + type: dict + values: + t: + type: int + o: + type: float + h: + type: float + l: + type: float + c: + type: float + v: + type: float + mapping: + - key: time + path: + - result + - data + - t + type: + - float + - from_timestamp + - 1 + - key: open + path: + - result + - data + - o + type: + - float + - key: high + path: + - result + - data + - h + type: + - float + - key: low + path: + - result + - data + - l + type: + - float + - key: close + path: + - result + - data + - c + type: + - float + - key: volume + path: + - result + - data + - v + type: + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/currency.yaml b/pandas_datareader/crypto/resources/running_exchanges/currency.yaml new file mode 100644 index 00000000..a245d290 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/currency.yaml @@ -0,0 +1,320 @@ +name: currency +exchange: true +api_url: https://marketcap.backend.currency.com/api/v1/ + +rate_limit: null + +requests: + currency_pairs: + request: + template: ticker + pair_template: null + params: null + + response: + type: dict + values: + currency_pair: + type: dict + values: + base_currency: + type: str + quote_currency: + type: str + mapping: + - key: currency_pair_first + path: + - dict_values + - base_currency + type: + - str + - key: currency_pair_second + path: + - dict_values + - quote_currency + type: + - str + + tickers: + request: + template: ticker + pair_template: null + params: null + + response: + type: dict + values: + currency_pair: + type: dict + values: + base_currency: + type: str + quote_currency: + type: str + last_price: + type: float + base_volume: + type: float + lowest_ask_price: + type: float + highest_bid_price: + type: float + mapping: + - key: currency_pair_first + path: + - dict_values + - base_currency + type: + - str + - key: currency_pair_second + path: + - dict_values + - quote_currency + type: + - str + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - dict_values + - last_price + type: + - float + - key: best_bid + path: + - dict_values + - highest_bid + type: + - float + - key: best_ask + path: + - dict_values + - lowest_ask + type: + - float + - key: daily_volume + path: + - dict_values + - base_volume + type: + - float + + order_books: + request: + template: orderbook + pair_template: + template: "{first}/{second}" + lower_case: false + alias: symbol + params: + depth: + default: 50 + + response: + type: dict + values: + timestamp: + type: int + asks: + type: list + values: + type: list + values: + 0: # price + type: float + 1: # qty + type: float + bids: + type: list + values: + type: list + values: + 0: # price + type: float + 1: # qty + type: float + + mapping: + - key: id + path: + - timestamp + type: + - int + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bids + - 0 + type: + - float + - key: bids_amount + path: + - bids + - 1 + type: + - float + - key: asks_price + path: + - asks + - 0 + type: + - float + - key: asks_amount + path: + - asks + - 1 + type: + - float + + historic_rates: + request: + template: candles + pair_template: + template: "{first}/{second}" + lower_case: false + alias: symbol + params: + interval: + allowed: + minutes: M1 + hours: H1 + days: D1 + weeks: W1 + default: D1 + limit: + default: 1000 + endTime: + function: last_timestamp + type: + - datetime + - timestampms + startTime: + function: last_timestamp + type: + - datetime + - timedeltams + - interval + - 1000 + + response: + type: list + values: + type: list + values: + 0: + type: int + 1: + type: str + 2: + type: str + 3: + type: str + 4: + type: str + mapping: + - key: time + path: + - [] + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - [] + - 1 + type: + - str + - float + - key: high + path: + - [] + - 2 + type: + - str + - float + - key: low + path: + - [] + - 3 + type: + - str + - float + - key: close + path: + - [] + - 4 + type: + - str + - float + + trades: + request: + template: trades + pair_template: + template: "{first}/{second}" + lower_case: false + alias: symbol + params: null + + response: + type: list + values: + type: dict + values: + tradeID: + type: int + price: + type: float + base_volume: + type: float + quote_volume: + type: float + trade_timestamp: + type: float + type: + type: str + + mapping: + - key: id + path: + - tradeID + type: + - int + - key: time + path: + - trade_timestamp + type: + - float + - from_timestamp + - 0 + - key: direction + path: + - type + type: + - str + - key: price + path: + - price + type: + - float + - key: amount + path: + - base_volume + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/dex-trade.yaml b/pandas_datareader/crypto/resources/running_exchanges/dex-trade.yaml new file mode 100644 index 00000000..a28b224d --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/dex-trade.yaml @@ -0,0 +1,310 @@ +name: dex-trade +exchange: true + +rate_limit: null + +api_url: "" + +requests: + currency_pairs: + request: + template: https://api.dex-trade.com/v1/public/symbols + pair_template: null + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + base: + type: str + quote: + type: str + id: + type: int + + mapping: + - key: currency_pair_first + path: + - data + - base + type: + - str + - key: currency_pair_second + path: + - data + - quote + type: + - str + + tickers: + request: + template: https://api.dex-trade.com/v1/public/ticker + pair_template: + template: "{first}{second}" + lower_case: false + alias: pair + params: null + response: + type: dict + values: + data: + type: dict + values: + last: + type: str + volume_24H: + type: str + + mapping: + - key: last_price + path: + - data + - last + type: + - str + - float + - key: time + path: [] + type: + - none + - now + - key: daily_volume + path: + - data + - volume_24H + type: + - str + - float + + historic_rates: + request: + template: https://socket.dex-trade.com/graph/hist + pair_template: + template: "{first}{second}" + lower_case: false + alias: t + params: + r: + allowed: + minutes: 1 + hours: 60 + days: D + weeks: W + default: D + end: + function: last_timestamp + type: + - datetime + - timestamp + limit: + default: 1000 + + response: + type: list + values: + type: dict + values: + low: + type: float + high: + type: float + volume: + type: float + time: + type: float + open: + type: float + close: + type: float + + + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 0 + - key: open + path: + - open + type: + - int + - div + - 100000000 + - key: high + path: + - high + type: + - int + - div + - 100000000 + - key: low + path: + - low + type: + - int + - div + - 100000000 + - key: close + path: + - close + type: + - int + - div + - 100000000 + - key: volume + path: + - volume + type: + - int + - div + - 100000000 + + trades: + request: + template: https://api.dex-trade.com/v1/public/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: pair + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + volume: + type: float + rate: + type: float + price: + type: float + timestamp: + type: int + type: + type: str + + mapping: + - key: time + path: + - data + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - data + - timestamp + type: + - int + - key: direction + path: + - data + - type + type: + - str + - key: price + path: + - data + - rate + type: + - float + - key: amount + path: + - data + - volume + type: + - float + + order_books: + request: + template: https://api.dex-trade.com/v1/public/book + pair_template: + template: "{first}{second}" + lower_case: false + alias: pair + params: null + + response: + type: dict + values: + buy: + type: list + values: + type: dict + values: + volume: + type: float + count: + type: float + rate: + type: float + sell: + type: list + values: + type: dict + values: + volume: + type: float + count: + type: float + rate: + type: float + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - data + - buy + - volume + type: + - float + - key: bids_price + path: + - data + - buy + - rate + type: + - flot + - key: asks_amount + path: + - data + - sell + - volume + type: + - float + - key: asks_price + path: + - data + - sell + - rate + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/digifinex.yaml b/pandas_datareader/crypto/resources/running_exchanges/digifinex.yaml new file mode 100644 index 00000000..1f80bf12 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/digifinex.yaml @@ -0,0 +1,291 @@ +name: digifinex +exchange: true +api_doc: https://docs.digifinex.com/en-ww/v3/#market-data +rate_limit: null +api_url: https://openapi.digifinex.vip/v3/ + +requests: + currency_pairs: + request: + template: markets + pair_template: null + params: null + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + volume_precision: + type: int + price_precision: + type: int + market: + type: str + min_amount: + type: int + min_volume: + type: float + mapping: + - key: currency_pair_first + path: + - data + - market + type: + - str + - splitupper + - "_" + - 0 + - key: currency_pair_second + path: + - data + - market + type: + - str + - splitupper + - "_" + - 1 + + tickers: + request: + template: ticker + pair_template: null + params: null + response: + type: dict + values: + ticker: + type: list + values: + type: dict + values: + vol: + type: float + change: + type: float + base_vol: + type: float + sell: + type: float + last: + type: float + symbol: + type: str + low: + type: float + buy: + type: float + high: + type: float + date: + type: int + code: + type: bool + + mapping: + - key: time + path: [] + type: + - none + - now + - key: currency_pair_first + path: + - ticker + - symbol + type: + - str + - splitupper + - "_" + - 0 + - key: currency_pair_second + path: + - ticker + - symbol + type: + - str + - splitupper + - "_" + - 1 + - key: last_price + path: + - ticker + - last + type: + - float + - key: best_bid + path: + - ticker + - buy + type: + - float + - key: best_ask + path: + - ticker + - sell + type: + - float + - key: daily_volume + path: + - ticker + - vol + type: + - float + + historic_rates: + request: + template: kline + pair_template: + template: "{first}_{second}" + lower_case: true + alias: symbol + params: + period: + allowed: + minutes: 1 + hours: 60 + days: 1D + weeks: 1W + default: 1D + start_time: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1000 + end_time: + function: last_timestamp + type: + - datetime + - timestamp + + response: + type: dict + values: + code: + type: dict + data: + type: list + values: + type: list + values: + 0: # timestamp + type: int + 1: # volume + type: float + 2: # close + type: float + 3: # high + type: float + 4: # low + type: float + 5: # open + type: float + mapping: + - key: time + path: + - data + - [] + - 0 + type: + - float + - from_timestamp + - 0 + - key: volume + path: + - data + - [] + - 1 + type: + - float + - key: close + path: + - data + - [] + - 2 + type: + - float + - key: high + path: + - data + - [] + - 3 + type: + - float + - key: low + path: + - data + - [] + - 4 + type: + - float + - key: open + path: + - data + - [] + - 4 + type: + - float + +# trades: +# request: +# template: trades +# pair_template: +# template: "{first}_{second}" +# lower_case: true +# alias: symbol +# params: +# limit: #between 100-500 +# type: int +# default: 100 +# response: +# type: dict +# values: +# data: +# type: list +# values: +# type: dict +# values: +# date: +# type: int +# id: +# type: int +# amount: +# type: float +# type: +# type: str +# price: +# type: float +# mapping: +# - key: trade_time +# path: +# - data +# - date +# type: +# - int +# - fromtimestamp +# - key: trade_amount +# path: +# - data +# - amount +# type: +# - float +# - key: trade_last_price +# path: +# - data +# - price +# type: +# - int +# - key: trade_side +# path: +# - data +# - type +# type: +# - str +# +# order_book: +# request: +# response: +# mapping: \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/exmo.yaml b/pandas_datareader/crypto/resources/running_exchanges/exmo.yaml new file mode 100644 index 00000000..f465d22d --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/exmo.yaml @@ -0,0 +1,285 @@ +name: exmo +exchange: true +api_url: https://api.exmo.com/v1.1/ +rate_limit: + max: 600 + unit: 60 + +requests: + currency_pairs: + request: + template: pair_settings + pair_template: + params: + response: + type: dict + values: + currency_pair: + type: dict + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + + tickers: + request: + template: ticker + pair_template: null + params: null + response: + type: dict + values: + currency_pair: # variable key, each available currency pair + type: dict + values: + buy_price: # current maximum buy price + type: + - str + sell_price: # current minimum sell price + type: + - str + last_trade: # last deal price + type: + - str + high: # maximum deal price within the last 24 hours + type: + - str + low: # minimum deal price within the last 24 hours + type: + - str + avg: # average deal price within the last 24 hours + type: + - str + vol: # the volume of deals within the last 24 hours + type: + - str + vol_curr: # the total value of all deals within the last 24 hours + type: + - str + updated: # date and time of data update + type: + - int + mapping: + - key: time + path: + - dict_values + - updated + type: + - float + - from_timestamp + - 0 + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + - key: best_bid + path: + - dict_values + - buy_price + type: + - str + - float + - key: best_ask + path: + - dict_values + - sell_price + type: + - str + - float + - key: last_price + path: + - dict_values + - last_trade + type: + - str + - float + - key: daily_volume + path: + - dict_values + - vol + type: + - str + - float + + trades: + request: + template: trades + pair_template: + template: "{first}_{second}" + lower_case: false + alias: pair + params: + response: + type: dict + values: + currency_pair: # variable key, each available currency pair + type: dict + values: + trade_id: # current maximum buy price + type: + - int + date: # current minimum sell price + type: + - int + type: # last deal price + type: + - str + quantity: # maximum deal price within the last 24 hours + type: + - str + price: # minimum deal price within the last 24 hours + type: + - str + amout: # average deal price within the last 24 hours + type: + - str + mapping: + - key: id + path: + - dict_values + - trade_id + type: + - int + - key: time + path: + - dict_values + - date + type: + - float + - from_timestamp + - 0 + - key: direction + path: + - dict_values + - type + type: + - str + - key: price + path: + - dict_values + - price + type: + - str + - float + - key: amount + path: + - dict_values + - quantity + type: + - str + - float + + order_books: + request: + template: order_book + pair_template: + template: "{first}_{second}" + lower_case: false + alias: pair + params: + limit: + type: int + default: 100 #max: 1000 + + response: + type: dict + values: + currency_pair: + type: dict + values: + ask: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + 2: + type: str + bid: + type: list + values: + type: list + values: + 0: #Price + type: str + 1: #Quantity + type: str + 2: #Amount (-> Price*Quantity) + type: str + + mapping: + - key: id + path: [] + type: + - none + - now_timestamp + - key: time + path: [] + type: + - none + - now + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - dict_values + - bid + - 0 + type: + - str + - float + - key: bids_amount + path: + - dict_values + - bid + - 1 + type: + - str + - float + - key: asks_price + path: + - dict_values + - ask + - 0 + type: + - str + - float + - key: asks_amount + path: + - dict_values + - ask + - 1 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/exrates.yaml b/pandas_datareader/crypto/resources/running_exchanges/exrates.yaml new file mode 100644 index 00000000..af1c2475 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/exrates.yaml @@ -0,0 +1,318 @@ +name: exrates +exchange: true +api_url: '' +api_docs: https://docs.exrates.me/ +rate_limit: + max: 10 + unit: 60 + +requests: + currency_pairs: + request: + template: https://api.exrates.me/v1/public/symbols + pair_template: null + params: null + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + id: + type: int + base: + type: str + quote: + type: str + mapping: + - key: currency_pair_first + path: + - data + - base + type: + - str + - key: currency_pair_second + path: + - data + - quote + type: + - str + + tickers: + request: + template: https://api.exrates.me/v1/public/ticker + pair_template: + template: "{first}{second}" + lower_case: false + alias: pair + params: null + response: + type: dict + values: + status: + type: boolean + data: + type: dict + values: + id: + type: int + pair: + type: str + last: + type: str + open: + type: str + close: + type: str + high: + type: str + low: + type: str + volume_24H: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: price + path: + - data + - last + type: + - str + - float + - key: daily_volume + path: + - data + - volume_24H + type: + - str + - float + + trades: + request: + template: https://api.exrates.me/v1/public/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: pair + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + volume: + type: float + rate: + type: float + price: + type: float + timestamp: + type: int + type: + type: str + + mapping: + - key: id + path: + - data + - timestamp + type: + - int + - key: time + path: + - data + - timestamp + type: + - float + - from_timestamp + - 0 + - key: direction + path: + - data + - type + type: + - str + - key: price + path: + - data + - rate + type: + - float + - key: amount + path: + - data + - volume + type: + - float + + order_books: + request: + template: https://api.exrates.me/v1/public/book + pair_template: + template: "{first}{second}" + lower_case: false + alias: pair + params: null + + response: + type: dict + values: + data: + type: dict + values: + buy: + type: list + values: + type: dict + values: + volume: + type: float + count: + type: int + rate: + type: float + sell: + type: list + values: + type: dict + values: + volume: + type: float + count: + type: int + rate: + type: float + mapping: + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - data + - buy + - rate + type: + - float + - key: bids_amount + path: + - data + - buy + - volume + type: + - float + - key: asks_price + path: + - data + - sell + - rate + type: + - float + - key: asks_amount + path: + - data + - sell + - volume + type: + - float + + historic_rates: + request: + template: https://socket.exrates.me/graph/hist + pair_template: + template: "{first}{second}" + lower_case: false + alias: t + params: + end: + function: last_timestamp + type: + - datetime + - timestamp + r: + allowed: + minutes: 1 + hours: 60 + days: D + weeks: W + default: D + limit: + type: int + default: 500 + + response: + type: list + values: + type: dict + values: + low: + type: int + high: + type: int + volume: + type: int + time: + type: int + close: + type: int + open: + type: int + mapping: + - key: open + path: + - open + type: + - int + - div + - 100000000 + - key: high + path: + - high + type: + - int + - div + - 100000000 + - key: low + path: + - low + type: + - int + - div + - 100000000 + - key: close + path: + - close + type: + - int + - div + - 100000000 + - key: volume + path: + - volume + type: + - int + - div + - 100000000 + - key: time + path: + - time + type: + - float + - from_timestamp + - 0 diff --git a/pandas_datareader/crypto/resources/running_exchanges/exx.yaml b/pandas_datareader/crypto/resources/running_exchanges/exx.yaml new file mode 100644 index 00000000..f04a9777 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/exx.yaml @@ -0,0 +1,360 @@ +name: exx +exchange: true +api_docs: https://www.exx.com/help/restApi +api_url: https://api.exx.com/data/v1/ +rate_limit: null +requests: + currency_pairs: + request: + template: markets + pair_template: null + params: null + response: + type: dict + values: + currency_pair: # e.g. ltc_cnyt, variable key, each available currency pair + type: dict + values: + amountScale: + type: int + minAmount: + type: + - str + - float + isOpen: + type: boolean + maxLevels: + type: int + priceScale: + type: int + mapping: + - key: currency_pair_first + path: # key not values! + - dict_key + type: + - str + - splitupper + - "_" + - 0 + - key: currency_pair_second + path: # key not values! + - dict_key + type: + - str + - splitupper + - "_" + - 1 + + tickers: + request: + template: tickers + pair_template: null + params: null + response: + type: dict + values: + currency_pairs: # e.g. bts_btc, variable key, each available currency pair + type: dict + values: + high: + type: str + vol: + type: str + monthRiseRate: + type: float + last: + type: str + low: + type: str + buy: + type: str + sell: + type: str + weekRiseRate: + type: float + riseRate: + type: float + mapping: + - key: time + path: [] + type: + - none + - now + - key: currency_pair_first + path: + - dict_key + type: + - str + - splitupper + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - splitupper + - "_" + - 1 + - key: daily_volume + path: + - dict_values + - vol + type: + - str + - float + - key: last_price + path: + - dict_values + - last + type: + - str + - float + - key: best_ask + path: + - dict_values + - sell + type: + - str + - float + - key: best_bid + path: + - dict_values + - buy + type: + - str + - float + + order_books: + request: + template: depth + pair_template: # e.g. ltc_cnyt + template: "{first}_{second}" + lower_case: true + alias: currency + params: null + response: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: # price + type: + - str + 1: # size + type: + - str + bids: + type: list + values: + type: list + values: + 0: # price + type: + - str + 1: # size + type: + - str + timestamp: + type: + - int + mapping: + - key: id + path: + - timestamp + type: + - int + - key: position + path: [] + type: + - none + - range + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 0 + + trades: + request: + template: trades + pair_template: # e.g. ltc_cnyt + template: "{first}_{second}" + lower_case: true + alias: currency + params: null + response: + type: list + values: + type: dict + values: + date: + type: + - float + - from_timestamp + - 0 + amount: + type: float + price: + type: float + trade_type: + type: str + type: + type: str + tid: + type: int + mapping: + - key: time + path: + - date + type: + - float + - from_timestamp + - 0 + - key: id + path: + - tid + type: + - int + - key: amount + path: + - amount + type: + - float + - key: price + path: + - price + type: + - float + - key: direction + path: + - type + type: + - str + + historic_rates: + request: + template: klines + pair_template: # e.g. ltc_cnyt + template: "{first}_{second}" + lower_case: true + alias: market + params: + type: + allowed: + minutes: 1min + hours: 1hour + days: 1day + default: 1day + size: + type: int + required: false + default: 10000 + assist: + type: str #usd, cny + default: none + response: + type: dict + values: + datas: + type: dict + values: + symbol: + type: str + data: + type: list + values: + type: list + values: + 0: # timestamp + type: + - int + 1: # open + type: float + 2: # high + type: float + 3: # low + type: float + 4: # close + type: float + 5: # volume + type: float + + mapping: + - key: time + path: + - datas + - data + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - datas + - data + - 1 + type: + - float + - key: high + path: + - datas + - data + - 2 + type: + - float + - key: low + path: + - datas + - data + - 3 + type: + - float + - key: close + path: + - datas + - data + - 4 + type: + - float + - key: volume + path: + - datas + - data + - 5 + type: + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/folgory.yaml b/pandas_datareader/crypto/resources/running_exchanges/folgory.yaml new file mode 100644 index 00000000..0624c0b9 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/folgory.yaml @@ -0,0 +1,284 @@ +name: folgory +exchange: true +api_url: https://folgory.com/ + +requests: + currency_pairs: + request: + template: api/v1 + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + cur: + type: str + symbol: + type: str + last: + type: str + high: + type: str + low: + type: str + volume: + type: str + vwap: + type: str + max_bid: + type: str + best_ask: + type: str + best_bid: + type: str + mapping: + - key: currency_pair_first + path: + - [] + - symbol + type: + - str + - split + - / + - 0 + - key: currency_pair_second + path: + - [] + - symbol + type: + - str + - split + - / + - 1 + + tickers: + request: + template: api/v1 + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + cur: + type: str + symbol: + type: str + last: + type: str + high: + type: str + low: + type: str + volume: + type: str + vwap: + type: str + max_bid: + type: str + best_ask: + type: str + best_bid: + type: str + mapping: + - key: currency_pair_first + path: + - [] + - symbol + type: + - str + - split + - / + - 0 + - key: currency_pair_second + path: + - [] + - symbol + type: + - str + - split + - / + - 1 + - key: last_price + path: + - [] + - last + type: + - str + - float + - key: best_bid + path: + - [] + - max_bid + type: + - str + - float + - key: best_ask + path: + - [] + - best_ask + type: + - str + - float + - key: daily_volume + path: + - [] + - volume + type: + - str + - float + + trades: + request: + template: market/trade + pair_template: + template: "{first}_{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 500 + default: 500 + + response: + type: list + values: + type: dict + values: + id: + type: str + amount: + type: str + qty: + type: str + time: + type: str + Type: + type: str + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 0 + - key: id + path: + - id + type: + - str + - int + - key: direction + path: + - Type + type: + - str + - key: price + path: + - amount + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + + order_books: + request: + template: market/order_book + pair_template: + template: "{first}_{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 50 + default: 50 + response: + type: dict + values: + data: + type: dict + values: + timestamp: + type: int + asks: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + bids: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + + mapping: + - key: time + path: + - data + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - data + - timestamp + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - data + - bids + - 1 + type: + - str + - float + - key: bids_amount + path: + - data + - bids + - 0 + type: + - str + - float + - key: asks_price + path: + - data + - asks + - 1 + type: + - str + - float + - key: asks_amount + path: + - data + - asks + - 0 + type: + - str + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/ftx.yaml b/pandas_datareader/crypto/resources/running_exchanges/ftx.yaml new file mode 100644 index 00000000..dd98c2aa --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/ftx.yaml @@ -0,0 +1,384 @@ +name: ftx +is_exchange: true +api_docs: https://docs.ftx.com/#rest-api +api_url: https://ftx.com/api/ +# +rate_limit: + max: 1800 + unit: 60 + +requests: + currency_pairs: + request: + template: markets + pair_template: null + params: null + + response: + type: dict + values: + success: + type: boolean + result: + type: list + values: + type: dict + values: + name: + type: str + baseCurrency: + type: str + quoteCurrency: + type: str + type: + type: str + underlying: + type: str + enabled: + type: boolean + ask: + type: float + bid: + type: float + last: + type: float + postOnly: + type: boolean + priceIncrement: + type: float + sizeIncrement: + type: float + restricted: + type: boolean + + mapping: + - key: currency_pair_first + path: + - result + - baseCurrency + type: + - str + - key: currency_pair_second + path: + - result + - quoteCurrency + type: + - str + + tickers: + request: + template: markets + pair_template: null + params: null + + response: + type: dict + values: + success: + type: boolean + result: + type: list + values: + type: dict + values: + name: + type: str + baseCurrency: + type: str + quoteCurrency: + type: str + type: + type: str + underlying: + type: str + enabled: + type: boolean + ask: + type: float + bid: + type: float + last: + type: float + postOnly: + type: boolean + priceIncrement: + type: float + sizeIncrement: + type: float + restricted: + type: boolean + + mapping: + - key: currency_pair_first + path: + - result + - baseCurrency + type: + - str + - key: currency_pair_second + path: + - result + - quoteCurrency + type: + - str + - key: time + path: [] + type: + - none + - now + - key: last + path: + - result + - last + type: + - float + - key: best_ask + path: + - result + - ask + type: + - float + - key: best_bid + path: + - result + - bid + type: + - float + + historic_rates: + request: + template: markets/{currency_pair}/candles + pair_template: + template: "{first}_{second}" + alias: null + lower_case: false + params: + resolution: + allowed: + seconds: 15 + minutes: 60 + hours: 3600 + days: 86400 + default: 86400 #daily + limit: + type: int + default: 5000 + end_time: + function: last_timestamp + type: + - datetime + - timestamp + + response: + type: dict + values: + success: + type: boolean + result: + type: list + values: + type: dict + values: + close: + type: float + high: + type: float + low: + type: float + open: + type: float + startTime: + type: str + time: + type: int + volume: + type: float + mapping: + - key: time + path: + - result + - time + type: + - float + - from_timestamp + - 1 + - key: open + path: + - result + - open + type: + - float + - key: high + path: + - result + - high + type: + - float + - key: low + path: + - result + - low + type: + - float + - key: close + path: + - result + - close + type: + - float + - key: volume + path: + - result + - volume + type: + - float + + trades: + request: + template: markets/{currency_pair}/trades + pair_template: + template: "{first}_{second}" + alias: null + lower_case: false + params: + limit: + type: int + default: 100 + + response: + type: dict + values: + success: + type: boolean + result: + type: list + values: + type: dict + values: + id: + type: int + liquidation: + type: boolean + price: + type: float + side: + type: str + size: + type: float + time: + type: str + mapping: + - key: time + path: + - result + - time + type: + - str + - strptime + - "%Y-%m-%dT%H:%M:%S.%f+00:00" + - key: id + path: + - result + - id + type: + - int + - key: direction + path: + - result + - side + type: + - str + - key: price + path: + - result + - price + type: + - float + - key: amount + path: + - result + - size + type: + - float + + order_books: + request: + template: markets/{currency_pair}/orderbook + pair_template: + template: "{first}_{second}" + alias: null + lower_case: false + params: + depth: + type: int + default: 200 + + response: + type: dict + values: + success: + type: bool + result: + type: dict + values: + asks: + type: list + values: + type: list + 0: + type: float + 1: + type: float + bids: + type: list + values: + type: list + 0: + type: float + 1: + type: float + + mapping: + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: time + path: [] + type: + - none + - now + - key: bids_price + path: + - result + - bids + - 0 + type: + - float + - key: bids_amount + path: + - result + - bids + - 1 + type: + - float + - key: asks_price + path: + - result + - asks + - 0 + type: + - float + - key: asks_amount + path: + - result + - asks + - 1 + type: + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/gateio.yaml b/pandas_datareader/crypto/resources/running_exchanges/gateio.yaml new file mode 100644 index 00000000..01312051 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/gateio.yaml @@ -0,0 +1,361 @@ +name: gateio +exchange: true +api_url: https://api.gateio.ws/api/v4/spot/ +rate_limit: null +requests: + currency_pairs: + request: + template: currency_pairs + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + id: + type: str + base: + type: str + quote: + type: str + fee: + type: str + min_base_amount: + type: str + min_quote_amount: + type: str + amount_precision: + type: str + precision: + type: int + trade_status: + type: str + mapping: + - key: currency_pair_first + path: + - base + type: + - str + - key: currency_pair_second + path: + - quote + type: + - str + + tickers: + request: + template: tickers + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + currency_pair: + type: str + last: + type: str + lowest_ask: + type: str + highest_bid: + type: str + change_percentage: + type: str + base_volume: + type: str + quote_volume: + type: str + high_24h: + type: str + low_24h: + type: str + mapping: + - key: currency_pair_first + path: + - currency_pair + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - currency_pair + type: + - str + - split + - "_" + - 1 + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - last + type: + - str + - float + - key: best_bid + path: + - highest_bid + type: + - str + - float + - key: best_ask + path: + - lowest_ask + type: + - str + - float + - key: daily_volume + path: + - quote_volume + type: + - str + - float +# + order_books: + request: + template: order_book + pair_template: + template: "{first}_{second}" + alias: currency_pair + lower_case: true + params: + interval: + type: int + default: 0 + limit: + type: int + default: 30 + + response: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: # price + type: + - str + 1: # size + type: + - str + bids: + type: list + values: + type: list + values: + 0: + type: + - str + 1: + type: + - str + mapping: + - key: time + path: [] + type: + - none + - now + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + + trades: + request: + template: trades + pair_template: + template: "{first}_{second}" + alias: currency_pair + lower_case: true + params: + limit: + type: int + default: 200 + last_id: + type: int + required: false + response: + type: list + values: + type: dict + values: + id: + type: str + create_time: + type: str + side: + type: str + role: + type: str + amount: + type: str + price: + type: str + order_id: + type: str + fee: + type: str + fee_currency: + type: str + point_fee: + type: str + gt_fee: + type: str + + mapping: + - key: time + path: + - create_time + type: + - str + - float + - from_timestamp + - 0 + - key: amount + path: + - amount + type: + - str + - float + - key: direction + path: + - side + type: + - str + - key: price + path: + - price + type: + - str + - float + - key: id + path: + - id + type: + - str + - int + + + historic_rates: + request: + template: candlesticks + pair_template: + template: "{first}_{second}" + alias: currency_pair + lower_case: true + params: + limit: + type: int + default: 1000 + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + default: 1d + to: + function: last_timestamp + type: + - datetime + - timestamp + response: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + 2: + type: str + 3: + type: str + 4: + type: str + 5: + type: str + 6: + type: str + mapping: + - key: time + path: + - 0 + type: + - str + - float + - from_timestamp + - 0 + - key: volume + path: + - 1 + type: + - str + - float + - key: close + path: + - 2 + type: + - str + - float + - key: high + path: + - 3 + type: + - str + - float + - key: low + path: + - 4 + type: + - str + - float + - key: open + path: + - 5 + type: + - str \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/gemini.yaml b/pandas_datareader/crypto/resources/running_exchanges/gemini.yaml new file mode 100644 index 00000000..6cecc2f6 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/gemini.yaml @@ -0,0 +1,320 @@ +# The extraction of the currency_pairs relies on the fact, that every quote_currency is only 3 digits long. +# However this may change in future. + +name: gemini +exchange: true +api_docs: https://docs.gemini.com/rest-api/ +api_url: https://api.gemini.com/ +rate_limit: # For public API entry points, we limit requests to 120 requests per minute, and recommend that you do not exceed 1 request per second. + max: 120 # recommended: 60 + unit: 60 + +requests: + currency_pairs: + request: + template: v1/symbols + pair_template: null + params: null + response: + type: list + values: # each available currency pair, i.e. "btcusd" + type: str + mapping: # TODO split Methode + - key: currency_pair_first + path: + - [] + type: + - str + - slice + - 0 + - -3 + - key: currency_pair_second + path: + - [] + type: + - str + - slice + - -3 + - + + tickers: + request: + template: v1/pricefeed + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + pair: + type: str + price: + type: str + percentageChange24h: + type: str + + mapping: + - key: currency_pair_first + path: + - pair + type: + - str + - slice + - 0 + - -3 + - key: currency_pair_second + path: + - pair + type: + - str + - slice + - -3 + - + - key: last_price + path: + - price + type: + - str + - float + - key: time + path: [] + type: + - none + - now + + order_books: + request: + template: v1/book/{currency_pair} + pair_template: # e.g. btcusd + template: "{first}{second}" + lower_case: true + params: + limit_bids: # Optional. Limit the number of bids (offers to buy) returned. Default is 50. May be 0 to return the full order book on this side. + type: int + default: 50 + limit_asks: # Optional. Limit the number of asks (offers to sell) returned. Default is 50. May be 0 to return the full order book on this side. + type: int + default: 50 + response: + type: dict + values: + bids: # The bids currently on the book. These are offers to buy at a given price + type: list + values: + type: dict + values: + amount: # The total quantity remaining at the price + type: + - str + price: # The price + type: + - str + timestamp: # DO NOT USE - this field is included for compatibility reasons only and is just populated with a dummy value. + type: + - str + asks: # The asks currently on the book. These are offers to sell at a given price + type: list + values: + type: dict + values: + amount: # The total quantity remaining at the price + type: + - str + price: # The price + type: + - str + timestamp: # DO NOT USE - this field is included for compatibility reasons only and is just populated with a dummy value. + type: + - str + mapping: + - key: time + path: + - bids + - timestamp + type: + - str + - float + - from_timestamp + - 0 + - key: id + path: + - bids + - timestamp + type: + - str + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - amount + type: + - str + - float + - key: bids_price + path: + - bids + - price + type: + - str + - float + - key: asks_amount + path: + - asks + - amount + type: + - str + - float + - key: asks_price + path: + - asks + - price + type: + - str + - float + + trades: # This public API endpoint is limited to retrieving seven calendar days of data. + request: + template: v1/trades/{currency_pair} + pair_template: # e.g. btcusd + template: "{first}{second}" + lower_case: true + params: + since: # Optional. Only return trades after this timestamp. If not present, will show the most recent trades. + required: false + limit_trades: # Optional. The maximum number of trades to return. The default is 50. + type: int + default: 50 + include_breaks: # Optional. Whether to display broken trades. False by default. Can be '1' or 'true' to activate + type: bool + required: false + response: + type: list + values: + type: dict + values: + timestamp: # The time that the trade was executed + type: + - int + timestampms: # The time that the trade was executed in milliseconds + type: + - int + tid: # The trade ID number + type: + - int + price: # The price the trade was executed at + type: + - str + amount: # The amount that was traded + type: + - str + exchange: # Will always be "gemini" + type: str + type: + type: str + allowed: + - buy # buy means that an ask was removed from the book by an incoming buy order + - sell # sell means that a bid was removed from the book by an incoming sell order + - auction # auction indicates a bulk trade from an auction + - block # block indicates a block trade + broken: + type: bool # Whether the trade was broken or not. Broken trades will not be displayed by default; use the include_breaks to display them. + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - tid + type: + - int + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - amount + type: + - str + - float + - key: direction + path: + - type + type: + - str + + historic_rates: + request: + template: v2/candles/{currency_pair}/{frequency} + pair_template: + template: "{first}{second}" + lower_case: true + params: + frequency: + allowed: + minutes: 1m + hours: 1hr + days: 1day + default: 1day + response: + type: list + values: + type: list + values: + 0: # timestamp + type: int + 1: # open + type: float + 2: # high + type: float + 3: # low + type: float + 4: # close + type: float + 5: # volume + type: float + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - 1 + type: + - float + - key: high + path: + - 2 + type: + - float + - key: low + path: + - 3 + type: + - float + - key: close + path: + - 4 + type: + - float + - key: volume + path: + - 5 + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/gopax.yaml b/pandas_datareader/crypto/resources/running_exchanges/gopax.yaml new file mode 100644 index 00000000..1d628caf --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/gopax.yaml @@ -0,0 +1,301 @@ +name: gopax +exchange: true + +rate_limit: + max: 1200 + unit: 60 + +api_url: https://api.gopax.co.kr + +requests: + currency_pairs: + request: + template: /trading-pairs + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + + mapping: + - key: currency_pair_first + path: + - baseAsset + type: + - str + - key: currency_pair_second + path: + - quoteAsset + type: + - str + + tickers: + request: + template: /trading-pairs/{currency_pair}/ticker + pair_template: + template: "{first}-{second}" + lower_case: false + params: null + response: + type: dict + values: + price: + type: float + ask: + type: float + bid: + type: float + volume: + type: float + time: + type: str + + mapping: + - key: last_price + path: + - price + type: + - float + - key: time + path: + - time + type: + - str + - dateparser + - key: best_bid + path: + - bid + type: + - float + - key: best_ask + path: + - ask + type: + - float + - key: daily_volume + path: + - volume + type: + - float + + historic_rates: + request: + template: /trading-pairs/{currency_pair}/candles + pair_template: + template: "{first}-{second}" + lower_case: false + params: + interval: + allowed: + minutes: 1 + hours: 60 + days: 1440 + default: 1440 # e.g. 1 day + start: + default: 0 # better as intervals up to 5000 can lead to zero new prices and the program exits. +# function: last_timestamp +# type: +# - datetime +# - timedeltams +# - interval +# - 5000 + end: + function: last_timestamp + type: + - datetime + - timestampms + + response: + type: list + values: + type: list + values: + 0: #time + type: int + 1: #open + type: float + 2: #high + type: float + 3: #low + type: float + 4: #close + type: float + 5: #volume + type: float + + mapping: + - key: time + path: + - [] + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - [] + - 1 + type: + - float + - key: high + path: + - [] + - 2 + type: + - float + - key: low + path: + - [] + - 3 + type: + - float + - key: close + path: + - [] + - 4 + type: + - float + - key: volume + path: + - [] + - 5 + type: + - float + + + trades: + request: + template: /trading-pairs/{currency_pair}/trades + pair_template: + template: "{first}-{second}" + lower_case: false + params: null + + response: + type: list + values: + type: dict + values: + date: + type: int + id: + type: int + price: + type: float + amount: + type: float + side: + type: str + + mapping: + - key: time + path: + - date + type: + - float + - from_timestamp + - 0 + - key: id + path: + - id + type: + - int + - key: direction + path: + - side + type: + - str + - key: price + path: + - price + type: + - float + - key: amount + path: + - amount + type: + - float + + order_books: + request: + template: /trading-pairs/{currency_pair}/book + pair_template: + template: "{first}-{second}" + lower_case: false + params: + level: + type: int + default: 2 + + response: + type: dict + values: + sequence: + type: int + bid: + type: list + values: + type: list + values: + 1: #price + type: float + 2: #quantity + type: float + ask: + type: list + values: + type: list + values: + 1: #price + type: float + 2: #quantity + type: float + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: + - sequence + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bid + - 2 + type: + - float + - key: bids_price + path: + - bid + - 1 + type: + - float + - key: asks_amount + path: + - ask + - 2 + type: + - float + - key: asks_price + path: + - ask + - 1 + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/hbtc.yaml b/pandas_datareader/crypto/resources/running_exchanges/hbtc.yaml new file mode 100644 index 00000000..88ba65b5 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/hbtc.yaml @@ -0,0 +1,305 @@ +name: hbtc +is_exchange: true + +rate_limit: null +api_url: https://api.bhex.com/ + +requests: + currency_pairs: + request: + template: openapi/v1/pairs + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + symbol: + type: str + quoteToke: + type: str + baseToken: + type: str + mapping: + - key: currency_pair_first + path: + - baseToken + type: + - str + - key: currency_pair_second + path: + - quoteToken + type: + - str + + tickers: + request: + template: openapi/quote/v1/ticker/price + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: null + response: + type: dict + values: + price: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - price + type: + - str + - float + + + order_books: + request: + template: openapi/quote/v1/depth/merged + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + default: 40 + response: + type: dict + values: + time: + type: int + bids: + type: list + values: + type: list + values: + 0: #price + type: str + 1: #quantity + type: str + asks: + type: list + values: + type: list + values: + 0: #price + type: str + 1: #quantity + type: str + + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - time + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + + trades: + request: + template: openapi/quote/v1/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 1000 + default: 500 + response: + type: list + values: + type: dict + values: + price: + type: str + time: + type: int + qty: + type: str + isBuyerMaker: + type: bool + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - time + type: + - int + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - true + - sell + - false + - buy + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + + historic_rates: + request: + template: openapi/quote/v1/klines + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + startTime: + type: int + required: false + endTime: + function: last_timestamp + type: + - datetime + - timestampms + limit: + type: int + max: 1000 + default: 1000 + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + months: 1M + default: 1d + response: + type: list + values: + type: list + values: + 0: #open time + type: int + 1: # open + type: str + 2: #high + type: str + 3: #low + type: str + 4: #close + type: str + 5: #volume + type: str + 6: # close time + type: str + 7: # quote asset volume + type: str + 8: # numb. trades + type: str + 9: # taker buy base asset volume + type: str + 10: # taker buy quote asset volume + type: str + 11: + type: str + + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float + + + diff --git a/pandas_datareader/crypto/resources/running_exchanges/hitbtc.yaml b/pandas_datareader/crypto/resources/running_exchanges/hitbtc.yaml new file mode 100644 index 00000000..a6905592 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/hitbtc.yaml @@ -0,0 +1,393 @@ +name: hitbtc +exchange: true +api_docs: https://api.hitbtc.com/#market-data +api_url: https://api.hitbtc.com/api/2/ +rate_limit: + max: 100 + unit: 1 +requests: + currency_pairs: + request: + template: public/symbol/ + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + id: # Symbol identifier. In the future, the description will simply use the symbol, i.e. "ETHBTC" + type: str + baseCurrency: # i.e. "ETH" + type: str + quoteCurrency: # i.e. "BTC" + type: str + quantityIncrement: + type: + - str + - float + tickSize: + type: + - str + - float + takeLiquidityRate: # Default fee rate + type: + - str + - float + provideLiquidityRate: # Default fee rate for market making trades + type: + - str + - float + feeCurrency: # i.e. "BTC" + type: str + mapping: + - key: currency_pair_first + path: + - baseCurrency + type: + - str + - key: currency_pair_second + path: + - quoteCurrency + type: + - str + + tickers: + request: + template: public/ticker/{currency_pair} + pair_template: # i.e. ETHBTC + template: "{first}{second}" + lower_case: false + params: null + response: + type: list + values: + type: dict + values: + ask: # Best ask price + type: + - str + - float + bid: # Best bid price + type: + - str + - float + last: # Last trade price + type: + - str + - float + open: # Last trade price 24 hours ago + type: + - str + - float + low: # Lowest trade price within 24 hours + type: + - str + - float + high: # Highest trade price within 24 hours + type: + - str + - float + volume: # Total trading amount within 24 hours in base currency + type: + - str + - float + volumeQuote: # Total trading amount within 24 hours in quote currency + type: + - str + - float + timestamp: # Last update or refresh ticker timestamp + type: + - str + symbol: + type: str + mapping: + - key: best_ask + path: + - ask + type: + - str + - float + - key: best_bid + path: + - bid + type: + - str + - float + - key: last_price + path: + - last + type: + - str + - float + - key: daily_volume + path: + - volume + type: + - str + - float + - key: time + path: + - timestamp + type: + - str + - dateparser + + trades: + request: + template: public/trades/{currency_pair} + pair_template: # i.e. ETHBTC + template: "{first}{second}" + lower_case: false + params: + sort: + type: str + default: DESC + by: # Filtration definition. Accepted values: id, timestamp. Default timestamp + type: str + default: timestamp + required: false + from: # Number or Datetime + required: false + till: # Number or Datetime + required: false + limit: + type: int + required: false + offset: + type: int + required: false + response: + type: list + values: + type: dict + values: + id: + type: int + price: + type: + - str + - float + quantity: + type: + - str + - float + side: # Trade side "sell" or "buy" + type: str + timestamp: + type: + - str + mapping: + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - quantity + type: + - str + - float + - key: direction + path: + - side + type: + - str + - key: ime + path: + - timestamp + type: + - str + - dateparser + - key: id + path: + - id + type: + - int + + order_books: + request: + template: public/orderbook/{currency_pair} + pair_template: # i.e. ETHBTC + template: "{first}{second}" + lower_case: false + params: + limit: # Limit of orderbook levels. Set 0 to view full orderbook levels + type: int + default: 100 + response: + type: dict + values: + ask: + type: list + values: + type: dict + values: + price: # Price level + type: + - str + size: # Total volume of orders with the specified price + type: + - str + bid: + type: list + values: + type: dict + values: + price: # Price level + type: + - str + size: # Total volume of orders with the specified price + type: + - str + mapping: + - key: book_time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: asks_price + path: + - ask + - price + type: + - str + - float + - key: asks_amount + path: + - ask + - size + type: + - str + - float + - key: bids_price + path: + - bid + - price + type: + - str + - float + - key: bids_amount + path: + - bid + - size + type: + - str + - float + + historic_rates: + request: + template: public/candles/{currency_pair} + pair_template: # i.e. ETHBTC + template: "{first}{second}" + lower_case: false + params: + period: + type: str + allowed: + minutes: M1 +# hours: H1 + days: D1 + weeks: D7 + months: 1M + default: D1 + sort: + type: str + default: ASC + from: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1000 + - from_timestamp + - 0 + - "%Y-%m-%dT%H:%M:%S.%fZ" + till: + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S.%fZ" + limit: # Limit of candles, default 100. + type: int + default: 1000 + offset: + type: int + required: false + response: # Result contain candles only with non zero volume. (No trades - no candles) + type: list + values: + type: dict + values: + timestamp: + type: + - str + open: # Open price + type: + - str + close: # Close price + type: + - str + min: # Min price + type: + - str + max: # Max price + type: + - str + volume: # Volume in base currency + type: + - str + volumeQuote: # Volume in quote currency + type: + - str + mapping: + - key: time + path: + - timestamp + type: + - str + - dateparser + - key: open + path: + - open + type: + - str + - float + - key: close + path: + - close + type: + - str + - float + - key: low + path: + - min + type: + - str + - float + - key: high + path: + - max + type: + - str + - float + - key: volume + path: + - volume + type: + - str + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/hoo.yaml b/pandas_datareader/crypto/resources/running_exchanges/hoo.yaml new file mode 100644 index 00000000..d9723730 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/hoo.yaml @@ -0,0 +1,341 @@ +name: hoo +exchange: true +api_docs: https://hoo.com/docs-en +rate_limit: + max: 300 + unit: 60 + +api_url: https://api.hoolgd.com/open/v1/ + +requests: + currency_pairs: + request: + template: tickers/market + pair_template: null + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + price: + type: str + symbol: + type: str + volume: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - symbol + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - data + - symbol + type: + - str + - split + - "-" + - 1 + + tickers: + request: + template: tickers/market + pair_template: null + params: null + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + price: + type: str + symbol: + type: str + volume: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - symbol + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - data + - symbol + type: + - str + - split + - "-" + - 1 + - key: time + path: [] + type: + - none + - now + - key: daily_volume + path: + - data + - volume + type: + - str + - float + - key: last_price + path: + - data + - price + type: + - str + - float + + historic_rates: + request: + template: kline/market + pair_template: + template: "{first}-{second}" + lower_case: false + alias: symbol + params: + type: + allowed: + minutes: 1Min + hours: 1Hour + days: 1Day + weeks: 1Week + default: 1Day + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + open: + type: str + high: + type: str + low: + type: str + close: + type: str + time: + type: int + volume: + type: str + mapping: + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 0 + - key: open + path: + - data + - open + type: + - str + - float + - key: high + path: + - data + - high + type: + - str + - float + - key: low + path: + - data + - low + type: + - str + - float + - key: close + path: + - data + - close + type: + - str + - float + - key: volume + path: + - data + - volume + type: + - str + - float + + trades: + request: + template: trade/market + pair_template: + template: "{first}-{second}" + lower_case: false + alias: symbol + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + amount: + type: str + price: + type: str + time: + type: int + side: + type: str + volume: + type: str + + mapping: + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - data + - time + type: + - int + - key: direction + path: + - data + - side + type: + - value + - map + - -1 + - buy + - 1 + - sell + - key: price + path: + - data + - price + type: + - str + - float + - key: amount + path: + - data + - volume + type: + - str + - float + + order_books: + request: + template: depth/market + pair_template: + template: "{first}-{second}" + lower_case: false + alias: symbol + params: null + + response: + type: dict + values: + data: + type: dict + values: + bids: + type: list + values: + type: dict + values: + price: + type: str + quantity: + type: str + asks: + type: list + values: + type: dict + values: + price: + type: str + quantity: + type: str + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - data + - bids + - quantity + type: + - str + - float + - key: bids_price + path: + - data + - bids + - price + type: + - str + - float + - key: asks_amount + path: + - data + - asks + - quantity + type: + - str + - float + - key: asks_price + path: + - data + - asks + - price + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/huobi.yaml b/pandas_datareader/crypto/resources/running_exchanges/huobi.yaml new file mode 100644 index 00000000..274acc47 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/huobi.yaml @@ -0,0 +1,423 @@ +name: huobi +exchange: true +api_docs: https://huobiapi.github.io/docs/spot/v1/en/ +api_url: https://api.huobi.pro/ +rate_limit: + max: 100 + unit: 10 +requests: + currency_pairs: + request: + template: v1/common/symbols + pair_template: null + params: null + response: + type: dict + values: + status: + type: str + data: + type: list + values: + type: dict + values: + base-currency: + type: str + quote-currency: + type: str + price-precision: + type: int + amoint_precision: + type: int + symbol-partition: + type: str + symbol: + type: str + state: + type: str + value-precision: + type: int + min-order-amt: + type: float + max-oder-amt: + type: float + min-order-value: + type: float + laverage-ratio: + type: int + mapping: + - key: currency_pair_first + path: + - data + - base-currency + type: + - str + - upper + - key: currency_pair_second + path: + - data + - quote-currency + type: + - str + - upper + + historic_rates: + request: + template: market/history/kline + pair_template: # i.e. BTC_CQ + template: "{first}{second}" + lower_case: true + alias: symbol + params: + period: + type: str + allowed: + minutes: 1min + hours: 60min + days: 1day + weeks: 1week + months: 1mon + default: 1day + size: + type: int + min: 1 + max: 2000 + default: 2000 + response: + type: dict + values: + status: + type: str + allowed: + - ok + - error + ch: # channel format, i.e. "market.btcusdt.kline.1day" + type: str + ts: # timestamp in millisecond + type: + - int + data: + type: list + values: + type: dict + values: + id: + type: int + amount: + type: float + count: + type: int + open: + type: float + close: + type: float + low: + type: float + high: + type: float + vol: + type: float + mapping: + - key: time + path: + - data + - id + type: + - float + - from_timestamp + - 0 + - key: open + path: + - data + - open + type: + - float + - key: close + path: + - data + - close + type: + - float + - key: low + path: + - data + - low + type: + - float + - key: high + path: + - data + - high + type: + - float + - key: volume + path: + - data + - vol + type: + - float + + tickers: + request: + template: market/detail/merged + pair_template: # i.e. BTC_CQ + template: "{first}{second}" + lower_case: true + alias: symbol + params: null + response: + type: dict + values: + status: + type: str + ch: # channel format, i.e. "market.btcusdt.kline.1day" + type: str + ts: # timestamp in millisecond + type: + - int + tick: + type: dict + values: + amount: + type: float + open: # daily Kline, opening price + type: float + close: # daily Kline, closing price + type: float + high: # daily Kline,the maxmum price + type: float + id: + type: int + count: + type: int + low: # daily Kline, the minimum price + type: float + version: + type: int + ask: + type: list + values: + 0: + type: float + 1: + type: float + bid: + type: list + values: + 0: # price + type: float + 1: # size + type: float + vol: + type: float + mapping: + - key: time + path: + - ts + type: + - float + - from_timestamp + - 1 + - key: daily_volume + path: + - tick + - vol + type: + - float + - key: best_ask + path: + - tick + - ask + - 0 + type: + - float + - key: best_bid + path: + - tick + - bid + - 0 + type: + - float + + order_books: + request: + template: market/depth + pair_template: # i.e. BTC_CQ + template: "{first}{second}" + lower_case: true + alias: symbol + params: + type: + type: str + default: step0 #aggregation level (step5 -->max. aggregation) + response: + type: dict + values: + status: + type: str + ch: + type: str + ts: # timestamp in millisecond + type: + - int + tick: # Depth + type: dict + values: + id: + type: int + ts: + type: + - int + bids: + type: list + values: + type: list + values: + 0: # price + type: int + 1: # amount + type: float + asks: + type: list + values: + type: list + values: + 0: # price + type: int + 1: # amount + type: float + mapping: + - key: time + path: + - tick + - ts + type: + - float + - from_timestamp + - 1 + - key: bids_price + path: + - tick + - bids + - 0 + type: + - int + - key: bids_amount + path: + - tick + - bids + - 1 + type: + - float + - key: asks_price + path: + - tick + - asks + - 0 + type: + - int + - key: asks_amount + path: + - tick + - asks + - 1 + type: + - float + - key: id + path: + - tick + - version + type: + - int + - key: position + path: [] + type: + - none + - range + +# Probleme mit der resoponse. Die können wir nicht mappen, da manchmal zu einem Zeitpunkt mehrere Trades zurückkommen. +# trades: +# request: +# template: market/history/trade +# pair_template: # i.e. BTC_CQ +# template: "{first}{second}" +# alias: symbol +# lower_case: true +# params: +# size: +# type: int +# default: 5 +# response: +# type: dict +# values: +# status: +# type: str +# ch: +# type: str +# ts: +# type: int +# data: +# type: list +# values: +# type: dict +# values: +# id: +# type: int +# ts: # timestamp +# type: int +# data: +# type: list +# values: +# type: dict +# values: +# id: +# type: int +# ts: +# type: int +# trade-id: +# type: int +# amount: +# type: float +# price: +# type: +# - int +# direction: +# type: str +# +# mapping: +# - key: price +# path: +# - data +# - data +# - price +# type: +# - float +# - key: amount +# path: +# - data +# - data +# - amount +# type: +# - float +# - key: direction +# path: +# - data +# - data +# - direction +# type: +# - str +# - key: time +# path: +# - data +# - data +# - ts +# type: +# - int +# - Afrom_timestamp +# - key: id +# path: +# - data +# - data +# - trade-id +# type: +# - int \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/huobi_korea.yaml b/pandas_datareader/crypto/resources/running_exchanges/huobi_korea.yaml new file mode 100644 index 00000000..48c89493 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/huobi_korea.yaml @@ -0,0 +1,424 @@ +name: huobi_korea +exchange: true +api_url: https://api-cloud.huobi.co.kr/ +rate_limit: + max: 100 + unit: 10 +requests: + currency_pairs: + request: + template: v1/common/symbols + pair_template: null + params: null + response: + type: dict + values: + status: + type: str + data: + type: list + values: + type: dict + values: + base-currency: + type: str + quote-currency: + type: str + price-precision: + type: int + amoint_precision: + type: int + symbol-partition: + type: str + symbol: + type: str + state: + type: str + value-precision: + type: int + min-order-amt: + type: float + max-oder-amt: + type: float + min-order-value: + type: float + laverage-ratio: + type: int + mapping: + - key: currency_pair_first + path: + - data + - base-currency + type: + - str + - upper + - key: currency_pair_second + path: + - data + - quote-currency + type: + - str + - upper + + + + historic_rates: + request: + template: market/history/kline + pair_template: # i.e. BTC_CQ + template: "{first}{second}" + lower_case: true + alias: symbol + params: + period: + type: str + allowed: + minutes: 1min + hours: 60min + days: 1day + weeks: 1week + months: 1mon + default: 1day + size: + type: int + min: 1 + max: 2000 + default: 2000 + response: + type: dict + values: + status: + type: str + allowed: + - ok + - error + ch: # channel format, i.e. "market.btcusdt.kline.1day" + type: str + ts: # timestamp in millisecond + type: + - int + data: + type: list + values: + type: dict + values: + id: + type: int + amount: + type: float + count: + type: int + open: + type: float + close: + type: float + low: + type: float + high: + type: float + vol: + type: float + mapping: + - key: time + path: + - data + - id + type: + - float + - from_timestamp + - 0 + - key: open + path: + - data + - open + type: + - float + - key: close + path: + - data + - close + type: + - float + - key: low + path: + - data + - low + type: + - float + - key: high + path: + - data + - high + type: + - float + - key: volume + path: + - data + - vol + type: + - float + + tickers: + request: + template: market/detail/merged + pair_template: # i.e. BTC_CQ + template: "{first}{second}" + lower_case: true + alias: symbol + params: null + response: + type: dict + values: + status: + type: str + ch: # channel format, i.e. "market.btcusdt.kline.1day" + type: str + ts: # timestamp in millisecond + type: + - int + tick: + type: dict + values: + amount: + type: float + open: # daily Kline, opening price + type: float + close: # daily Kline, closing price + type: float + high: # daily Kline,the maxmum price + type: float + id: + type: int + count: + type: int + low: # daily Kline, the minimum price + type: float + version: + type: int + ask: + type: list + values: + 0: + type: float + 1: + type: float + bid: + type: list + values: + 0: # price + type: float + 1: # size + type: float + vol: + type: float + mapping: + - key: time + path: + - ts + type: + - float + - from_timestamp + - 1 + - key: daily_volume + path: + - tick + - vol + type: + - float + - key: best_ask + path: + - tick + - ask + - 0 + type: + - float + - key: best_bid + path: + - tick + - bid + - 0 + type: + - float + + order_books: + request: + template: market/depth + pair_template: # i.e. BTC_CQ + template: "{first}{second}" + lower_case: true + alias: symbol + params: + type: + type: str + default: step0 #aggregation level (step5 -->max. aggregation) + response: + type: dict + values: + status: + type: str + ch: + type: str + ts: # timestamp in millisecond + type: + - int + tick: # Depth + type: dict + values: + id: + type: int + ts: + type: + - int + bids: + type: list + values: + type: list + values: + 0: # price + type: int + 1: # amount + type: float + asks: + type: list + values: + type: list + values: + 0: # price + type: int + 1: # amount + type: float + mapping: + - key: time + path: + - tick + - ts + type: + - float + - from_timestamp + - 1 + - key: bids_price + path: + - tick + - bids + - 0 + type: + - int + - key: bids_amount + path: + - tick + - bids + - 1 + type: + - float + - key: asks_price + path: + - tick + - asks + - 0 + type: + - int + - key: asks_amount + path: + - tick + - asks + - 1 + type: + - float + - key: id + path: + - tick + - version + type: + - int + - key: position + path: [] + type: + - none + - range + +# Probleme mit der resoponse. Die können wir nicht mappen, da manchmal zu einem Zeitpunkt mehrere Trades zurückkommen. +# trades: +# request: +# template: market/history/trade +# pair_template: # i.e. BTC_CQ +# template: "{first}{second}" +# alias: symbol +# lower_case: true +# params: +# size: +# type: int +# default: 5 +# response: +# type: dict +# values: +# status: +# type: str +# ch: +# type: str +# ts: +# type: int +# data: +# type: list +# values: +# type: dict +# values: +# id: +# type: int +# ts: # timestamp +# type: int +# data: +# type: list +# values: +# type: dict +# values: +# id: +# type: int +# ts: +# type: int +# trade-id: +# type: int +# amount: +# type: float +# price: +# type: +# - int +# direction: +# type: str +# +# mapping: +# - key: price +# path: +# - data +# - data +# - price +# type: +# - float +# - key: amount +# path: +# - data +# - data +# - amount +# type: +# - float +# - key: direction +# path: +# - data +# - data +# - direction +# type: +# - str +# - key: time +# path: +# - data +# - data +# - ts +# type: +# - int +# - Afrom_timestamp +# - key: id +# path: +# - data +# - data +# - trade-id +# type: +# - int \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/hydax.yaml b/pandas_datareader/crypto/resources/running_exchanges/hydax.yaml new file mode 100644 index 00000000..dc7c31e7 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/hydax.yaml @@ -0,0 +1,305 @@ +name: hydax +is_exchange: true + +api_url: https://api.hydax.com/ +rate_limit: + max: 3000 + unit: 60 + +requests: + currency_pairs: + request: + template: openapi/v1/brokerInfo + pair_template: null + params: null + + response: + type: dict + values: + symbols: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + + mapping: + - key: currency_pair_first + path: + - symbols + - baseAsset + type: + - str + - key: currency_pair_second + path: + - symbols + - quoteAsset + type: + - str + + tickers: + request: + template: openapi/quote/v1/ticker/price + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: null + + response: + type: dict + values: + symbol: + type: str + price: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - price + type: + - str + - float + + order_books: + request: + template: openapi/quote/v1/depth + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 1000 + default: 50 + response: + type: dict + values: + time: + type: int + bids: + type: list + values: + type: list + 0: #price + type: str + 1: #qty + type: str + asks: + type: list + values: + type: list + 0: + type: str + 1: + type: str + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - time + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + + trades: + request: + template: openapi/quote/v1/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 1000 + default: 500 + response: + type: list + value: + type: dict + values: + price: + type: str + qty: + typ: str + time: + type: int + isBuyerMaker: + type: bool + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - True + - sell + - False + - buy + - key: id + path: + - time + type: + - int + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + + historic_rates: + request: + template: openapi/quote/v1/klines + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + months: 1M + default: 1d + limit: + type: int + max: 1000 + default: 1000 + endTime: + function: last_timestamp + type: + - datetime + - timestampms + + + response: + type: list + values: + type: list + values: + 0: #timestamp + type: int + 1: #open + type: str + 2: #high + type: str + 3: #low + type: str + 4: #close + type: str + 5: #volume + type: str + 6: #close time + type: int + 7: # quote Asset volume + type: str + 8: # number of trades + type: int + 9: # taker buy base asset volume + type: str + 10: # taker buy quote asset volume + type: str + + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/idex.yaml b/pandas_datareader/crypto/resources/running_exchanges/idex.yaml new file mode 100644 index 00000000..741a0e3a --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/idex.yaml @@ -0,0 +1,336 @@ +name: idex +exchange: true +api_docs: https://docs.idex.io/#introduction +api_url: https://api.idex.io/ +rate_limit: + max: 300 + unit: 60 +requests: + currency_pairs: + request: + template: v1/markets + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + mapping: + - key: currency_pair_first + path: + - baseAsset + type: + - str + - key: currency_pair_second + path: + - quoteAsset + type: + - str + + + tickers: + request: + template: v1/tickers + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + baseVolume: + type: str + quoteVolume: + type: str + ask: + type: str + bid: + type: str + time: + type: int + + mapping: + - key: currency_pair_first + path: + - market + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - market + type: + - str + - split + - "-" + - 1 + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: best_ask + path: + - bid + type: + - str + - float + - key: best_bid + path: + - bid + type: + - str + - float + + order_books: + request: + template: v1/orderbook + pair_template: # e.g. ETH_SAN + template: "{first}-{second}" + lower_case: false + alias: market + params: + level: + type: int + default: 2 + limit: + type: int + default: 50 + + response: + type: dict + values: + sequence: + type: int + asks: + type: list + values: + type: list + values: + 0: #price + type: + - str + 1: #quantity + type: + - str + bids: + type: list + values: + type: list + values: + 0: #price + type: + - str + 1: #quantity + type: + - str + mapping: + - key: position + path: [] + type: + - none + - range + - key: id + path: + - sequence + type: + - int + - key: time + path: [] + type: + - none + - now + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + + trades: + request: + template: v1/trades + pair_template: # e.g. ETH_SAN + template: "{first}-{second}" + lower_case: false + alias: market + params: + limit: + type: int + max: 1000 + default: 200 + response: + type: list + values: + type: dict + values: + fillId: + type: str + quantity: + type: str + price: + type: str + time: + type: int + makerSide: + type: str + sequence: + type: int + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - sequence + type: + - int + - key: amount + path: + - quantity + type: + - str + - float + - key: direction + path: + - makerSide + type: + - value + - map + - sell + - buy + - buy + - sell + - key: price + path: + - price + type: + - str + - float + + historic_rates: + request: + template: v1/candles + pair_template: # e.g. ETH_SAN + template: "{first}-{second}" + lower_case: false + alias: market + params: + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + default: 1d + limit: + max: 1000 + default: 1000 + end: + function: last_timestamp + type: + - datetime + - timestampms +# start: +# function: last_timestamp +# type: +# - datetime +# - timedeltams +# - interval +# - 1000 + + response: + type: list + values: + type: dict + values: + market: + type: str + start: + type: int + open: + type: str + high: + type: str + low: + type: str + close: + type: str + volume: + type: str + mapping: + - key: time + path: + - start + type: + - float + - from_timestamp + - 1 + - key: open + path: + - open + type: + - str + - float + - key: high + path: + - high + type: + - str + - float + - key: low + path: + - low + type: + - str + - float + - key: close + path: + - close + type: + - str + - float + - key: volume + path: + - volume + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/indodax.yaml b/pandas_datareader/crypto/resources/running_exchanges/indodax.yaml new file mode 100644 index 00000000..5c6905df --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/indodax.yaml @@ -0,0 +1,247 @@ +name: indodax +api_url: https://indodax.com/api/ +is_exchange: True + +requests: + currency_pairs: + request: + template: pairs + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + id: + type: str + symbol: + type: str + base_currency: + type: str + traded_currency: + type: str + mapping: + - key: currency_pair_first + path: + - traded_currency + type: + - str + - upper + - key: currency_pair_second + path: + - base_currency + type: + - str + - upper + + tickers: + request: + template: ticker_all + pair_template: null + params: null + + response: + type: dict + values: + tickers: + type: dict + values: + currency_pair: + type: dict + values: + high: + type: str + low: + type: str + vol_btc: + type: str + vol_idr: + type: str + last: + type: str + buy: + type: str + sell: + type: str + server_time: + type: int + mapping: + - key: currency_pair_first + path: + - tickers + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - tickers + - dict_key + type: + - str + - split + - "_" + - 1 + - key: time + path: + - tickers + - dict_values + - server_time + type: + - float + - from_timestamp + - 0 + - key: last_price + path: + - tickers + - dict_values + - last + type: + - str + - float + - key: best_bid + path: + - tickers + - dict_values + - buy + type: + - str + - float + - key: best_ask + path: + - tickers + - dict_values + - sell + type: + - str + - float + + order_books: + request: + template: depth/{currency_pair} + pair_template: + template: "{first}{second}" + alias: null + lower_case: true + params: null + + response: + type: dict + values: + buy: + type: list + 0: #price + type: strr + 1: #size + type: str + sell: + type: list + 0: + type: str + 1: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - buy + - 1 + type: + - str + - float + - key: bids_price + path: + - buy + - 0 + type: + - str + - float + - key: asks_amount + path: + - sell + - 1 + type: + - str + - float + - key: asks_price + path: + - sell + - 0 + type: + - str + - float + + trades: + request: + template: trades/{currency_pair} + pair_template: + template: "{first}{second}" + alias: null + lower_case: true + params: null + + response: + type: list + values: + type: dict + values: + date: + type: str + price: + type: str + amount: + type: str + tid: + type: str + type: + type: str + mapping: + - key: time + path: + - date + type: + - str + - float + - from_timestamp + - 0 + - key: id + path: + - tid + type: + - str + - int + - key: direction + path: + - type + type: + - str + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - amount + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/korbit.yaml b/pandas_datareader/crypto/resources/running_exchanges/korbit.yaml new file mode 100644 index 00000000..16401272 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/korbit.yaml @@ -0,0 +1,266 @@ +name: korbit +exchange: true +api_url: https://api.korbit.co.kr/v1/ + +rate_limit: + max: 60 + unit: 60 + +requests: + + currency_pairs: + request: + template: ticker/detailed/all + pair_template: null + params: null + + response: + type: dict + values: + currency_pair: + type: dict + values: + timetamp: + type: int + last: + type: str + bid: + type: str + ask: + type: str + volume: + type: str + + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + + tickers: + request: + template: ticker/detailed/all + pair_template: null + params: null + + response: + type: dict + values: + currency_pair: + type: dict + values: + timetamp: + type: int + last: + type: str + bid: + type: str + ask: + type: str + volume: + type: str + + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + - key: time + path: + - dict_values + - timestamp + type: + - float + - from_timestamp + - 1 + - key: last_price + path: + - dict_values + - last + type: + - str + - float + - key: best_bid + path: + - dict_values + - bid + type: + - str + - float + - key: best_ask + path: + - dict_values + - ask + type: + - str + - float + - key: daily_volume + path: + - dict_values + - volume + type: + - str + - float + + order_books: + request: + template: orderbook + pair_template: + template: "{first}_{second}" + lower_case: true + alias: currency_pair + params: null + + response: + type: dict + values: + timestamp: + type: int + bids: + type: list + values: + type: list + values: + 0: # price + type: str + 1: # qty + type: str + 2: + type: str + asks: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + 2: + type: str + mapping: + - key: id + path: + - timestamp + type: + - int + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + + trades: + request: + template: transactions + pair_template: + template: "{first}_{second}" + lower_case: true + alias: currency_pair + params: null + + response: + type: list + values: + type: dict + values: + timestamp: + type: int + tid: + type: str + price: + type: str + amount: + type: str + type: + type: str + mapping: + - key: id + path: + - tid + type: + - str + - int + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - amount + type: + - str + - float + - key: direction + path: + - type + type: + - str \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/kucoin.yaml b/pandas_datareader/crypto/resources/running_exchanges/kucoin.yaml new file mode 100644 index 00000000..2a51a4bd --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/kucoin.yaml @@ -0,0 +1,432 @@ +name: kucoin +exchange: true +api_url: https://api.kucoin.com/api/v1/ +rate_limit: + max: 30 + unit: 60 +requests: + currency_pairs: + request: + template: symbols + pair_template: null + params: null + response: + type: dict + values: + code: + type: + - str + - int + data: + type: list + values: + symbol: + type: str + name: + type: str + baseCurrency: + type: str + quoteCurrency: + type: str + baseMinSize: + type: float + quoteMinSize: + type: int + baseMaxSize: + type: int + quoteMaxSize: + type: float + baseIncrement: + type: float + quoteIncrement: + type: float + priceIncrement: + type: float + feeCurrency: + type: str + enableTrading: + type: bool + mapping: + - key: currency_pair_first + path: + - data + - symbol + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - data + - symbol + type: + - str + - split + - "-" + - 1 + + tickers: + request: + template: market/allTickers + pair_template: null + params: null + response: + type: dict + values: + code: + type: int + data: + type: dict + values: + ticker: + type: list + values: + type: dict + values: + symbol: # e.g. KCS + type: str + high: + type: float + vol: + type: float + last: + type: float + low: + type: float + buy: + type: float + sell: + type: float + changePrice: + type: float + averagePrice: + type: float + changeRate: + type: float + volValue: + type: float + time: + type: int + mapping: + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 1 + - key: currency_pair_first + path: + - data + - ticker + - symbol + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - data + - ticker + - symbol + type: + - str + - split + - "-" + - 1 + - key: last_price + path: + - data + - ticker + - last + type: + - float + - key: best_bid + path: + - data + - ticker + - buy + type: + - float + - key: best_ask + path: + - data + - ticker + - sell + type: + - float + - key: daily_volume + path: + - data + - ticker + - volValue + type: + - float + + historic_rates: + request: + template: market/candles + pair_template: # e.g. KCS-BTC + template: "{first}-{second}" + lower_case: false + alias: symbol + params: + startAt: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1000 + endAt: + function: last_timestamp + type: + - datetime + - timestamp + type: + allowed: + minutes: 1min + hours: 1hour + days: 1day + weeks: 1week + default: 1day + + response: + type: dict + values: + code: + type: str + data: + type: list + values: + type: list + values: + 0: # timestamp + type: + - str + 1: # open + type: + - str + 2: # close + type: + - str + 3: # high + type: + - str + 4: # low + type: + - str + 5: # volume + type: + - str + 6: # amount + type: + - str + mapping: + - key: time + path: + - data + - 0 + type: + - str + - float + - from_timestamp + - 0 + - key: open + path: + - data + - 1 + type: + - str + - float + - key: close + path: + - data + - 2 + type: + - str + - float + - key: high + path: + - data + - 3 + type: + - str + - float + - key: low + path: + - data + - 4 + type: + - str + - float + - key: volume + path: + - data + - 5 + type: + - str + - float + + + order_books: + request: + template: market/orderbook/level2_20 + pair_template: # e.g. KCS-BTC + template: "{first}-{second}" + lower_case: false + alias: symbol + params: null + response: + type: dict + values: + code: + type: str + data: + type: dict + values: + time: + type: int + sequence: + type: str + bids: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + asks: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + mapping: + - key: asks_price + path: + - data + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - data + - asks + - 1 + type: + - str + - float + - key: bids_price + path: + - data + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - data + - bids + - 1 + type: + - str + - float + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - data + - sequence + type: + - str + - int + - key: position + path: [] + type: + - none + - range + + trades: + request: + template: market/histories + pair_template: + template: "{first}-{second}" + alias: symbol + lower_case: false + params: null + + response: + type: dict + values: + code: + type: str + data: + type: list + values: + type: dict + values: + sequence: + type: str + price: + type: str + size: + type: str + side: + type: str + time: + type: int + mapping: + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 3 + - key: price + path: + - data + - price + type: + - str + - float + - key: amount + path: + - data + - size + type: + - str + - float + - key: direction + path: + - data + - side + type: + - str + - key: id + path: + - data + - sequence + type: + - str + - int + diff --git a/pandas_datareader/crypto/resources/running_exchanges/latoken.yaml b/pandas_datareader/crypto/resources/running_exchanges/latoken.yaml new file mode 100644 index 00000000..de5934f3 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/latoken.yaml @@ -0,0 +1,225 @@ +name: latoken +exchange: true +api_url: https://api.latoken.com/api/v2/ +rate_limit: null + +requests: + + currency_pairs: + request: + template: ticker + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + symbol: + type: str + lastPrice: + type: str + mapping: + - key: currency_pair_first + path: + - symbol + type: + - str + - split + - "/" + - 0 + - key: currency_pair_second + path: + - symbol + type: + - str + - split + - "/" + - 1 + + tickers: + request: + template: ticker + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + symbol: + type: str + lastPrice: + type: str + mapping: + - key: currency_pair_first + path: + - symbol + type: + - str + - split + - "/" + - 0 + - key: currency_pair_second + path: + - symbol + type: + - str + - split + - "/" + - 1 + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - lastPrice + type: + - str + - float + + + order_books: + request: + template: book/{currency_pair} + pair_template: + template: "{first}/{second}" + lower_case: false + params: + limit: + type: int + max: 1000 + default: 50 + + response: + type: dict + values: + ask: + type: list + values: + type: dict + values: + price: + type: str + quantity: + type: str + bid: + type: list + values: + type: dict + values: + price: + type: str + quantity: + type: str + + mapping: + - key: id + path: [] + type: + - none + - now_timestamp + - key: time + path: [] + type: + - none + - now + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bid + - price + type: + - str + - float + - key: bids_amount + path: + - bid + - quantity + type: + - str + - float + - key: asks_price + path: + - ask + - price + type: + - str + - float + - key: asks_amount + path: + - ask + - quantity + type: + - str + - float + + + + trades: + request: + template: trade/history/{currency_pair} + pair_template: #BTCETH + template: "{first}/{second}" + lower_case: false + params: + limit: + type: int + default: 100 + + response: + type: list + values: + type: dict + value: + id: + type: int + isMakerBuyer: + type: str + price: + type: str + quantity: + type: str + timestamp: + type: int + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: id + path: + - id + type: + - str + - key: direction + path: + - isMakerBuyer + type: + - value + - map + - false + - buy + - true + - sell + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - quantity + type: + - str + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/lbank.yaml b/pandas_datareader/crypto/resources/running_exchanges/lbank.yaml new file mode 100644 index 00000000..594d53b5 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/lbank.yaml @@ -0,0 +1,333 @@ +name: lbank +exchange: true +api_docs: https://github.com/LBank-exchange/lbank-official-api-docs/tree/master/API-For-Spot-EN +api_url: https://api.lbkex.com/v1/ +rate_limit: null + +requests: + tickers: + request: + template: ticker.do + pair_template: null + params: + symbol: + type: str + default: all + response: + type: list + values: + type: dict + values: + symbol: + type: str + ticker: + type: dict + values: + change: + type: float + high: + type: float + latest: + type: float + low: + type: float + turnover: + type: float + vol: + type: float + timestamp: + type: + - int + mapping: + - key: time + path: [] + type: + - none + - now + - key: currency_pair_first + path: + - symbol + type: + - str + - splitupper + - "_" + - 0 + - key: currency_pair_second + path: + - symbol + type: + - str + - splitupper + - "_" + - 1 + - key: last_price + path: + - ticker + - latest + type: + - float + - key: last_price + path: + - ticker + - latest + type: + - float + - key: daily_volume + path: + - ticker + - vol + type: + - float + + currency_pairs: + request: + template: currencyPairs.do + pair_template: null + params: null + response: + type: list + values: # each available currency pair e.g. "bcc_eth","etc_btc"... + type: str + mapping: + - key: currency_pair_first + path: + - [] + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - [] + type: + - str + - split + - "_" + - 1 + + order_books: + request: + template: depth.do + pair_template: # e.g. eth_btc + template: "{first}_{second}" + lower_case: true + alias: symbol + params: + size: + type: int + min: 1 + max: 60 + default: 60 + merge: + type: int + default: 0 + response: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: # price + type: float + 1: # size + type: float + bids: + type: list + values: + type: list + values: + 0: # price + type: float + 1: # size + type: float + mapping: + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: time + path: [] + type: + - none + - now + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + + trades: + request: + template: trades.do + pair_template: # e.g. eth_btc + template: "{first}_{second}" + lower_case: true + alias: symbol + params: + size: + type: int + min: 1 + max: 600 + default: 200 + time: + required: false + response: + type: list + values: + type: dict + values: + date_ms: + type: + - float + - from_timestamp + - 0 + amount: + type: float + price: + type: float + type: + type: str + tid: + type: str + mapping: + - key: id + path: + - tid + type: + - str + - key: time + path: + - date_ms + type: + - float + - from_timestamp + - 1 + - key: amount + path: + - amount + type: + - float + - key: price + path: + - price + type: + - float + - key: direction + path: + - type + type: + - str + + historic_rates: + request: + template: kline.do + pair_template: # e.g. eth_btc + template: "{first}_{second}" + lower_case: true + alias: symbol + params: + size: + type: int + min: 1 + max: 2880 + default: 2880 + type: + allowed: + minutes: minute1 + hours: hour1 + days: day1 + weeks: week1 + months: month1 + default: day1 + time: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 2880 +# type: int +# default: 1325432318 #01.01.2012 + response: + type: list + values: + type: list + values: + 0: # timestamp + type: + - int + 1: # open + type: float + 2: # high + type: float + 3: # low + type: float + 4: # close + type: float + 5: # volume + type: float + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 0 + - key: open + path: + - 1 + type: + - float + - key: high + path: + - 2 + type: + - float + - key: low + path: + - 3 + type: + - float + - key: close + path: + - 4 + type: + - float + - key: volume + path: + - 5 + type: + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/luno.yaml b/pandas_datareader/crypto/resources/running_exchanges/luno.yaml new file mode 100644 index 00000000..316a3b57 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/luno.yaml @@ -0,0 +1,286 @@ +name: luno +is_exchange: true + +api_url: https://api.luno.com/api/1/ +rate_limit: + max: 1 + unit: 1 +requests: + currency_pairs: + request: + template: tickers + pair_template: null + params: null + + response: + type: dict + values: + tickers: + type: list + values: + type: dict + values: + pair: + type: str + timestamp: + type: int + bid: + type: str + ask: + type: str + last_trade: + type: str + rolling_24_hour_volume: + type: str + status: + type: str + mapping: + - key: currency_pair_first + path: + - tickers + - pair + type: + - str + - slice + - 0 + - 3 + - key: currency_pair_second + path: + - tickers + - pair + type: + - str + - slice + - 3 + - 6 + + tickers: + request: + template: tickers + pair_template: null + params: null + response: + type: dict + values: + tickers: + type: list + values: + type: dict + values: + pair: + type: str + timestamp: + type: int + bid: + type: str + ask: + type: str + last_trade: + type: str + rolling_24_hour_volume: + type: str + status: + type: str + mapping: + - key: currency_pair_first + path: + - tickers + - pair + type: + - str + - slice + - 0 + - 3 + - key: currency_pair_second + path: + - tickers + - pair + type: + - str + - slice + - 3 + - 6 + - key: time + path: + - tickers + - timestamp + type: + - float + - from_timestamp + - 1 + - key: last_price + path: + - tickers + - last_trade + type: + - str + - float + - key: best_bid + path: + - tickers + - bid + type: + - str + - float + - key: best_ask + path: + - tickers + - ask + type: + - str + - float + + + order_books: + request: + template: orderbook_top + pair_template: # e.g. XBTZAR + template: "{first}{second}" + lower_case: false + alias: pair + params: null + response: + type: dict + values: + timestamp: + type: + - float + - from_timestamp + - 1 + asks: + type: list + values: + type: dict + values: + price: + type: str + volume: + type: str + + bids: + type: list + values: + type: dict + values: + price: + type: str + volume: + type: str + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: asks_price + path: + - asks + - price + type: + - str + - float + - key: asks_amount + path: + - asks + - price + type: + - str + - float + - key: bids_price + path: + - bids + - price + type: + - str + - float + - key: bids_amount + path: + - bids + - price + type: + - str + - float + - key: id + path: + - timestamp + type: + - int + - key: position + path: [] + type: + - none + - range + + + trades: + request: + template: trades + pair_template: # e.g. XBTZAR + template: "{first}{second}" + lower_case: false + alias: pair + params: + since: + type: + - datetime + - totimestamp + required: false + response: + type: dict + values: + trades: + type: list + values: + type: dict + values: + timestamp: + type: int + price: + type: str + volume: + type: str + is_buy: + type: bool + mapping: + - key: time + path: + - trades + - timestamp + type: + - float + - from_timestamp + - 1 + - key: direction + path: + - trades + - is_buy + type: + - value + - map + - true + - 'buy' + - false + - 'sell' + + - key: id + path: + - trades + - sequence + type: + - int + - key: price + path: + - trades + - price + type: + - str + - float + - key: amount + path: + - trades + - volume + type: + - str + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/lykke.yaml b/pandas_datareader/crypto/resources/running_exchanges/lykke.yaml new file mode 100644 index 00000000..3453078d --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/lykke.yaml @@ -0,0 +1,195 @@ +# ToDO: Ticker not working. ErrorCode: Internal Server Error. Try again later. + +name: lykke +exchange: true +rate_limit: null +api_url: https://hft-apiv2.lykke.com/api/ + +requests: + currency_pairs: + request: + template: assetpairs + pair_template: null + params: null + response: + type: dict + values: + payload: + type: list + values: + type: dict + values: + name: + type: str + mapping: + - key: currency_pair_first + path: + - payload + - name + type: + - str + - split + - "/" + - 0 + - key: currency_pair_second + path: + - payload + - name + type: + - str + - split + - "/" + - 1 + + order_books: + request: + template: orderbooks + pair_template: + template: "{first}{second}" + lower_case: false + alias: assetPairId + params: + depth: + type: int + default: 50 + + response: + type: dict + values: + payload: + type: list + values: + type: dict + values: + timestamp: + type: int + bids: + type: list + values: + type: dict + values: + v: + type: float + p: + type: float + asks: + type: list + values: + type: dict + values: + v: + type: float + p: + type: float + + mapping: + - key: time + path: + - payload + - timestamp + type: + - float + - from_timestamp + - 1 + - key: id + path: + - payload + - timestamp + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - payload + - bids + - v + type: + - float + - key: bids_price + path: + - payload + - bids + - p + type: + - float + - key: asks_amount + path: + - payload + - asks + - v + type: + - float + - key: asks_price + path: + - payload + - asks + - p + type: + - float + + + trades: + request: + template: trades/public/{currency_pair} + pair_template: + template: "{first}{second}" + lower_case: false + params: + take: + type: int + default: 200 + response: + type: dict + values: + payload: + type: list + values: + type: dict + values: + timestamp: + type: int + id: + type: str + price: + type: float + volume: + type: float + side: + type: str + mapping: + - key: time + path: + - payload + - timestamp + type: + - float + - from_timestamp + - 1 + - key: direction + path: + - payload + - side + type: + - str + - key: id + path: + - payload + - id + type: + - str + - key: price + path: + - payload + - price + type: + - float + - key: amount + path: + - payload + - volume + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/maicoin.yaml b/pandas_datareader/crypto/resources/running_exchanges/maicoin.yaml new file mode 100644 index 00000000..346d5b98 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/maicoin.yaml @@ -0,0 +1,314 @@ +name: maicoin +exchange: true +api_docs: https://max.maicoin.com/documents/api_list#!/public/getApiV2K +rate_limit: + max: 1200 + unit: 60 + +api_url: https://max-api.maicoin.com/api/v2/ + +requests: + currency_pairs: + request: + template: markets + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + base_unit: + type: str + quote_unit: + type: str + + mapping: + - key: currency_pair_first + path: + - base_unit + type: + - str + - key: currency_pair_second + path: + - quote_unit + type: + - str + + tickers: + request: + template: tickers/{currency_pair} + pair_template: + template: "{first}{second}" + lower_case: true + params: null + response: + type: dict + values: + at: + type: int + buy: + type: str + sell: + type: str + last: + type: str + vol: + type: str + + + mapping: + - key: last_price + path: + - last + type: + - str + - float + - key: time + path: + - at + type: + - float + - from_timestamp + - 0 + - key: best_bid + path: + - buy + type: + - str + - float + - key: best_ask + path: + - sell + type: + - str + - float + - key: daily_volume + path: + - vol + type: + - str + - float + + historic_rates: + request: + template: k + pair_template: + template: "{first}{second}" + lower_case: true + alias: market + params: + limit: + default: 2000 + timestamp: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 2000 + period: + allowed: + minutes: 1 + hours: 60 + days: 1440 + weeks: 10080 + default: 1440 + response: + type: list + values: + type: list + values: + 0: #time + type: int + 1: #open + type: float + 2: #high + type: float + 3: #low + type: float + 4: #close + type: float + 5: #vol + type: float + + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 0 + - key: open + path: + - 1 + type: + - float + - key: high + path: + - 2 + type: + - float + - key: low + path: + - 3 + type: + - float + - key: close + path: + - 4 + type: + - float + - key: volume + path: + - 5 + type: + - float + + + trades: + request: + template: trades + pair_template: + template: "{first}{second}" + lower_case: true + alias: market + params: + limit: + default: 200 + + response: + type: list + values: + type: dict + values: + id: + type: int + price: + type: str + volume: + type: str + created_at: + type: int + side: + type: str + + mapping: + - key: time + path: + - created_at + type: + - float + - from_timestamp + - 0 + - key: id + path: + - id + type: + - int + - key: direction + path: + - side + type: + - value + - map + - ask + - sell + - bid + - buy + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - volume + type: + - str + - float + + order_books: + request: + template: depth + pair_template: + template: "{first}{second}" + lower_case: true + alias: market + params: + limit: + default: 50 + + response: + type: dict + values: + timestamp: + type: int + asks: + type: list + values: + type: list + values: + 0: #Price + type: str + 1: # Qty + type: str + bids: + type: list + values: + type: list + values: + 0: #Price + type: str + 1: # Qty + type: str + + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - timestamp + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/mandala.yaml b/pandas_datareader/crypto/resources/running_exchanges/mandala.yaml new file mode 100644 index 00000000..3bb77dbd --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/mandala.yaml @@ -0,0 +1,329 @@ +name: mandala +exchange: true + +rate_limit: + max: 1200 + unit: 60 + +api_url: "" + +requests: + currency_pairs: + request: + template: https://trade.mandala.exchange/open/v1/common/symbols + pair_template: null + params: null + + response: + type: dict + values: + data: + type: dict + values: + list: + type: list + values: + type: dict + values: + symbol: + type: str + baseAsset: + type: str + quoteAsset: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - list + - baseAsset + type: + - str + - key: currency_pair_second + path: + - data + - list + - quoteAsset + type: + - str + + order_books: + request: + template: https://api.binance.com/api/v3/depth + pair_template: # e.g. BNBBTC + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + max: 100 + default: 50 + + response: + type: dict + values: + lastUpdateId: + type: int + bids: + type: list + values: + type: list + values: + 0: # price + type: + - str + - float + 1: # quantity + type: + - str + - float + asks: + type: list + values: + type: list + values: + 0: # price + type: + - str + - float + 1: # quantity + type: + - str + - float + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: + - lastUpdateId + type: + - int + + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + + trades: + request: + template: https://api.binance.com/api/v1/trades + pair_template: # e.g. BNBBTC + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + max: 1000 + default: 500 + weight: 1 + response: + type: list + values: + type: dict + values: + id: + type: int + price: + type: + - str + - float + qty: + type: + - str + - float + time: + type: + - float + - from_timestamp + - 1 + isBuyerMaker: + type: bool + isBestMatch: + type: bool + mapping: + - key: id + path: + - id + type: + - int + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - True + - sell + - False + - buy + + historic_rates: + request: + template: https://api.binance.com/api/v1/klines + pair_template: # e.g. BNBBTC + template: "{first}{second}" + lower_case: false + alias: symbol + params: + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + months: 1M + default: 1d + startTime: + required: false + endTime: + function: last_timestamp + type: + - datetime + - timestampms +# - timedeltams +# - interval +# - 1000 + limit: + max: 1000 + default: 1000 + response: + type: list + values: + type: list + values: + 0: # Open time + type: + - float + - from_timestamp + - 1 + 1: # open + type: + - str + - float + 2: # high + type: + - str + - float + 3: # low + type: + - str + - float + 4: # close + type: + - str + - float + 5: # volume + type: + - str + - float + 6: # close time + type: + - float + - from_timestamp + - 1 + 7: # Quote asset volume + type: + - str + - float + 8: # Number of trades + type: int + 9: # Taker buy base asset volume + type: + - str + - float + 10: # Taker buy quote asset volume + type: + - str + - float + 11: # ignore + type: ignore + mapping: + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float + - key: time + path: + - 6 + type: + - float + - from_timestamp + - 1 diff --git a/pandas_datareader/crypto/resources/running_exchanges/mercatox.yaml b/pandas_datareader/crypto/resources/running_exchanges/mercatox.yaml new file mode 100644 index 00000000..87f66265 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/mercatox.yaml @@ -0,0 +1,248 @@ +name: mercatox +terms: null +api_url: https://mercatox.com/api/public/v1/ +rate_limit: null +requests: + + currency_pairs: + request: + template: ticker + pair_template: null + params: null + response: + type: dict + values: + currency_pair: + type: dict + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + + tickers: + request: + template: ticker + pair_template: null + params: null + response: + type: dict + values: + currency_pair: + type: dict + values: + last_price: + type: str + baseVolume: + type: str + quoteVolume: + type: str + lowestAsk: + type: str + highestBid: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - dict_values + - last_price + type: + - str + - float + - key: best_bid + path: + - dict_values + - highestBid + type: + - str + - float + - key: best_ask + path: + - dict_values + - lowestAsk + type: + - str + - float + - key: daily_volume + path: + - dict_values + - base_volume + type: + - str + - float + + trades: + request: + template: trades + pair_template: + template: "{first}_{second}" + lower_case: false + alias: market_pair + params: null + + response: + type: list + values: + type: dict + values: + trade_id: + type: str + price: + type: str + base_volume: + type: str + quote_volume: + type: str + trade_timestamp: + type: str + type: + type: str + + mapping: + - key: time + path: + - trade_timestamp + type: + - str + - float + - from_timestamp + - 0 + - key: id + path: + - trade_id + type: + - str + - int + - key: direction + path: + - type + type: + - str + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - base_volume + type: + - str + - float + + order_books: + request: + template: orderbook + pair_template: + template: "{first}_{second}" + lower_case: false + alias: market_pair + params: null + + response: + type: dict + values: + timestamp: + type: str + asks: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + bids: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + mapping: + - key: time + path: + - timestamp + type: + - str + - float + - from_timestamp + - 0 + - key: id + path: + - timestamp + type: + - str + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + + \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/mexo.yaml b/pandas_datareader/crypto/resources/running_exchanges/mexo.yaml new file mode 100644 index 00000000..997d3b45 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/mexo.yaml @@ -0,0 +1,304 @@ +name: mexo +is_exchange: true +api_docs: https://github.com/mexo-tech/Mexo-OpenApi/blob/master/doc/rest-api.md +api_url: https://api.mexo.io/ +rate_limit: + max: 1500 + unit: 60 + +requests: + currency_pairs: + request: + template: openapi/v1/brokerInfo + pair_template: null + params: null + + response: + type: dict + values: + symbols: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + + mapping: + - key: currency_pair_first + path: + - symbols + - baseAsset + type: + - str + - key: currency_pair_second + path: + - symbols + - quoteAsset + type: + - str + + tickers: + request: + template: openapi/quote/v1/ticker/price + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: null + + response: + type: dict + values: + symbol: + type: str + price: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - price + type: + - str + - float + + order_books: + request: + template: openapi/quote/v1/depth + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 100 + default: 100 + response: + type: dict + values: + time: + type: int + bids: + type: list + values: + type: list + 0: #price + type: str + 1: #qty + type: str + asks: + type: list + values: + type: list + 0: + type: str + 1: + type: str + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - time + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + + trades: + request: + template: openapi/quote/v1/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 1000 + default: 500 + response: + type: list + value: + type: dict + values: + price: + type: str + qty: + typ: str + time: + type: int + isBuyerMaker: + type: bool + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - True + - sell + - False + - buy + - key: id + path: + - time + type: + - int + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + + historic_rates: + request: + template: openapi/quote/v1/klines + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + months: 1M + default: 1d + limit: + type: int + max: 1000 + default: 1000 + endTime: + function: last_timestamp + type: + - datetime + - timestampms + + response: + type: list + values: + type: list + values: + 0: #timestamp + type: int + 1: #open + type: str + 2: #high + type: str + 3: #low + type: str + 4: #close + type: str + 5: #volume + type: str + 6: #close time + type: int + 7: # quote Asset volume + type: str + 8: # number of trades + type: int + 9: # taker buy base asset volume + type: str + 10: # taker buy quote asset volume + type: str + + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/mxc.yaml b/pandas_datareader/crypto/resources/running_exchanges/mxc.yaml new file mode 100644 index 00000000..7b3eb289 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/mxc.yaml @@ -0,0 +1,290 @@ +# historic rates require a start time which is not known. +# the new api v2 requires an API key. + +name: mxc +exchange: true +api_url: https://www.mxc.com/ + +requests: + currency_pairs: + request: + template: /open/api/v1/data/markets + pair_template: null + params: null + response: + type: dict + values: + code: + type: str + data: + type: list + values: + currency_pair: + type: str + msg: + type: str + mapping: + - key: currency_pair_first + path: + - data + - [] + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - data + - [] + type: + - str + - split + - "_" + - 1 + + tickers: + request: + template: open/api/v1/data/ticker + pair_template: null + params: null + response: + type: dict + values: + code: + type: str + data: + type: dict + values: + currency_pair: + type: dict + values: + volume: + type: float + high: + type: float + low: + type: float + buy: + type: float + sell: + type: float + open: + type: float + last: + type: float + percentChange: + type: float + msg: + type: str + + mapping: + - key: time + path: [] + type: + - none + - now + - key: currency_pair_first + path: + - data + - dict_key + type: + - str + - splitupper + - "_" + - 0 + - key: currency_pair_second + path: + - data + - dict_key + type: + - str + - splitupper + - "_" + - 1 + - key: daily_volume + path: + - data + - dict_values + - volume + type: + - float + - key: best_ask + path: + - data + - dict_values + - buy + type: + - float + - key: best_bid + path: + - data + - dict_values + - sell + type: + - float + - key: last_price + path: + - data + - dict_values + - last + type: + - float + + + trades: + request: + template: /open/api/v1/data/history + pair_template: + template: "{first}_{second}" + lower_case: false + alias: market + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + tradeTime: + type: str + tradePrice: + type: str + tradeQuantity: + type: str + tradeType: + type: str + mapping: + - key: id + path: + - data + - tradeTime + type: + - str + - dateparser + - totimestamp + - key: time + path: + - data + - tradeTime + type: + - str + - dateparser + - key: direction + path: + - data + - tradeType + type: + - value + - map + - "1" + - sell + - "2" + - buy + - key: price + path: + - data + - tradeQuantity + type: + - str + - float + - key: amount + path: + - data + - tradePrice + type: + - str + - float + + + + order_books: + request: + template: /open/api/v1/data/depth + pair_template: + template: "{first}_{second}" + lower_case: false + alias: market + params: + depth: + type: int + degfault: 50 + + response: + type: dict + values: + data: + type: dict + values: + asks: + type: list + values: + type: dict + values: + price: + type: str + quantity: + type: str + bids: + type: list + values: + type: dict + values: + price: + type: str + quantity: + type: str + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - data + - bids + - price + type: + - str + - float + - key: bids_amount + path: + - data + - bids + - quantity + type: + - str + - float + - key: asks_price + path: + - data + - asks + - price + type: + - str + - float + - key: asks_amount + path: + - data + - asks + - quantity + type: + - str + - float + + diff --git a/pandas_datareader/crypto/resources/running_exchanges/nicehash.yaml b/pandas_datareader/crypto/resources/running_exchanges/nicehash.yaml new file mode 100644 index 00000000..2e5efdbc --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/nicehash.yaml @@ -0,0 +1,255 @@ +# Tickers only with no split parameter in the CP +name: nicehash +exchange: true + +rate_limit: null + +api_url: https://api2.nicehash.com/exchange/api/v2/ + +requests: + currency_pairs: + request: + template: info/status + pair_template: null + params: null + + response: + type: dict + values: + symbols: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + + mapping: + - key: currency_pair_first + path: + - symbols + - baseAsset + type: + - str + - key: currency_pair_second + path: + - symbols + - quoteAsset + type: + - str + + + historic_rates: + request: + template: info/candlesticks + pair_template: + template: "{first}{second}" + lower_case: false + alias: market + params: + resolution: + allowed: + minutes: 1 + hours: 60 + days: 1440 + default: 1440 # daily + from: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 2000 + to: + function: last_timestamp + type: + - datetime + - timestamp + response: + type: list + values: + type: dict + values: + time: + type: int + open: + type: float + close: + type: float + high: + type: float + low: + type: float + volume: + type: float + quote_volume: + type: float + + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 0 + - key: open + path: + - open + type: + - float + - key: high + path: + - high + type: + - float + - key: low + path: + - low + type: + - float + - key: close + path: + - close + type: + - float + - key: volume + path: + - volume + type: + - float + + trades: + request: + template: info/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: market + params: + limit: + default: 200 + response: + type: list + values: + type: dict + values: + id: + type: str + dir: + type: str + price: + type: flaot + qty: + type: float + sndQty: + type: float + time: + type: int + + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 2 + - key: id + path: + - id + type: + - str + - key: direction + path: + - dir + type: + - str + - key: price + path: + - price + type: + - float + - key: amount + path: + - qty + type: + - float + + order_books: + request: + template: orderbook + pair_template: + template: "{first}{second}" + lower_case: false + alias: market + params: + limit: + default: 50 + + response: + type: dict + values: + tick: + type: int + buy: + type: list + values: + type: list + values: + 0: + type: float + 1: + type: float + sell: + type: list + values: + type: list + values: + 0: + type: float + 1: + type: float + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: + - tick + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - buy + - 1 + type: + - float + - key: bids_price + path: + - buy + - 0 + type: + - float + - key: asks_amount + path: + - sell + - 1 + type: + - float + - key: asks_price + path: + - sell + - 0 + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/nominex.yaml b/pandas_datareader/crypto/resources/running_exchanges/nominex.yaml new file mode 100644 index 00000000..b0084fe2 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/nominex.yaml @@ -0,0 +1,225 @@ +# Cannot extract bid/sell side from orderbooks. +name: nominex +exchange: true + +rate_limit: null +api_docs: https://developer.nominex.io/#parameters +api_url: https://nominex.io/api/rest/v1/ + +requests: + currency_pairs: + request: + template: pairs + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + name: + type: str + + mapping: + - key: currency_pair_first + path: + - name + type: + - str + - split + - "/" + - 0 + - key: currency_pair_second + path: + - name + type: + - str + - split + - "/" + - 1 + + tickers: + request: + template: ticker/{currency_pair} + pair_template: + template: "{first}/{second}" + lower_case: false + params: null + response: + type: dict + values: + bid: + type: float + ask: + type: float + baseVolume: + type: float + price: + type: float + + mapping: + - key: last_price + path: + - price + type: + - float + - key: time + path: [] + type: + - none + - now + - key: best_bid + path: + - bid + type: + - float + - key: best_ask + path: + - ask + type: + - float + - key: daily_volume + path: + - baseVolume + type: + - float + + historic_rates: + request: + template: candles/{currency_pair}/{frequency} + pair_template: + template: "{first}/{second}" + lower_case: false + params: + frequency: + allowed: + minutes: TF1M + hours: TF1H + days: TF1D + weeks: TF7D + months: TF1MO + default: TF1D + limit: + default: 400 # max + end: + function: last_timestamp + type: + - datetime + - timestampms + response: + type: list + values: + type: dict + values: + timestamp: + type: int + open: + type: float + close: + type: float + high: + type: float + low: + type: float + volume: + type: float + + + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: open + path: + - open + type: + - float + - key: high + path: + - high + type: + - float + - key: low + path: + - low + type: + - float + - key: close + path: + - close + type: + - float + - key: volume + path: + - volume + type: + - float + + + trades: + request: + template: trades/{currency_pair} + pair_template: + template: "{first}/{second}" + lower_case: false + params: + limit: + default: 200 # max + + response: + type: dict + values: + items: + type: list + values: + type: dict + values: + id: + type: int + timestamp: + type: int + amount: + type: float + price: + type: float + side: + type: str + + mapping: + - key: time + path: + - items + - timestamp + type: + - float + - from_timestamp + - 1 + - key: id + path: + - items + - id + type: + - int + - key: direction + path: + - items + - side + type: + - str + - key: price + path: + - items + - price + type: + - float + - key: amount + path: + - items + - amount + type: + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/oceanex.yaml b/pandas_datareader/crypto/resources/running_exchanges/oceanex.yaml new file mode 100644 index 00000000..bc7ff21f --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/oceanex.yaml @@ -0,0 +1,380 @@ +name: oceanex +exchange: true + +rate_limit: + max: 3000 + unit: 60 + +api_url: https://api.oceanex.pro/v1/ + +requests: + currency_pairs: + request: + template: markets + pair_template: null + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + name: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - name + type: + - str + - split + - "/" + - 0 + - key: currency_pair_second + path: + - data + - name + type: + - str + - split + - "/" + - 1 + + tickers: + request: + template: tickers + pair_template: null + params: null + response: + type: dict + values: + data: + type: dict + values: + currency_pair: + type: dict + values: + base_unit: + type: str + quote_unit: + type: str + at: + type: int + sell: + type: str + buy: + type: str + last: + type: str + volume: + type: str + mapping: + - key: currency_pair_first + path: + - data + - dict_values + - base_unit + type: + - str + - key: currency_pair_second + path: + - data + - dict_values + - quote_unit + type: + - str + - key: last_price + path: + - data + - dict_values + - last + type: + - str + - float + - key: time + path: + - data + - dict_values + - at + type: + - float + - from_timestamp + - 0 + - key: best_bid + path: + - data + - dict_values + - buy + type: + - str + - float + - key: best_ask + path: + - data + - dict_values + - sell + type: + - str + - float + - key: daily_volume + path: + - data + - dict_values + - volume + type: + - str + - float + + historic_rates: + request: + template: k + pair_template: + template: "{first}{second}" + lower_case: true + alias: market + params: + limit: + max: null + default: 10000 + period: + allowed: + minutes: 1 + hours: 60 + days: 1440 + default: 1440 #daily + timestamp: + function: last_timestamp # data after that timestamp + type: + - datetime + - timedelta + - interval + - 10000 + response: + type: dict + values: + data: + type: list + values: + type: list + values: + 0: # timestamp + type: int + 1: #open + type: float + 2: #high + type: float + 3: #low + type: float + 4: #close + type: float + 5: #vol + type: float + + mapping: + - key: time + path: + - data + - 0 + type: + - float + - from_timestamp + - 0 + - key: open + path: + - data + - 1 + type: + - float + - key: high + path: + - data + - 2 + type: + - float + - key: low + path: + - data + - 3 + type: + - float + - key: close + path: + - data + - 4 + type: + - float + - key: volume + path: + - data + - 5 + type: + - float + + + trades: + request: + template: trades + pair_template: + template: "{first}{second}" + lower_case: true + alias: market + params: + limit: + default: 200 + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + id: + type: int + price: + type: str + volume: + type: str + side: + type: str + created_on: + type: int + + + mapping: + - key: time + path: + - data + - created_on + type: + - float + - from_timestamp + - 0 + - key: id + path: + - data + - id + type: + - int + - key: direction + path: + - data + - side + type: + - value + - map + - bid + - buy + - ask + - sell + - key: price + path: + - data + - price + type: + - str + - float + - key: amount + path: + - data + - volume + type: + - str + - float + + order_books: + request: + template: order_book + pair_template: + template: "{first}{second}" + lower_case: true + alias: market + params: + limit: + max: 300 + default: 50 + + response: + type: dict + values: + data: + type: dict + values: + timestamp: + type: int + asks: + type: list + values: + type: list + values: + 0: # price + type: str + 1: #qty + type: str + bids: + type: list + values: + type: list + values: + 0: # price + type: str + 1: #qty + type: str + mapping: + - key: time + path: + - data + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - data + - timestamp + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - data + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - data + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - data + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - data + - asks + - 0 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/okcoin.yaml b/pandas_datareader/crypto/resources/running_exchanges/okcoin.yaml new file mode 100644 index 00000000..d0846e3b --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/okcoin.yaml @@ -0,0 +1,338 @@ +name: okcoin +exchange: true + +api_url: https://www.okcoin.com/api/spot/v3/ +rate_limit: + max: 360 + unit: 60 + +requests: + currency_pairs: + request: + template: instruments + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + base_currency: + type: str + quote_currency: + type: str + mapping: + - key: currency_pair_first + path: + - base_currency + type: + - str + - key: currency_pair_second + path: + - quote_currency + type: + - str + + + tickers: + request: + template: instruments/ticker + pair_template: null # + params: null + response: + type: list + values: + type: dict + values: + instrument_id: + type: str + last: + type: str + bid: + type: str + ask: + type: str + base_volume_24h: + type: str + timestamp: + type: str + quote_volume_24h: + type: str + mapping: + - key: currency_pair_first + path: + - product_id + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - product_id + type: + - str + - split + - "-" + - 1 + - key: time + path: + - timestamp + type: + - str + - dateparser + - key: last_price + path: + - last + type: + - str + - float + - key: best_ask + path: + - ask + type: + - str + - float + - key: best_bid + path: + - bid + type: + - str + - float + - key: daily_volume + path: + - base_volume_24h + type: + - str + - float + + order_books: + request: + template: instruments/{currency_pair}/book + pair_template: # e.g. btc_usd + template: "{first}-{second}" + lower_case: false + params: + size: + type: int + min: 1 + max: 200 + required: false + default: 50 + merge: + type: int + possible: + - 1 + - 0.1 + required: false + response: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: # price + type: str + 1: # size + type: str + bids: + type: list + values: + type: list + values: + 0: # price + type: str + 1: # size + type: str + timestamp: + type: str + mapping: + - key: time + path: + - timestamp + type: + - str + - dateparser + - key: id + path: + - timestamp + type: + - str + - dateparser + - totimestamp + - key: position + path: [] + type: + - none + - range + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + + trades: + request: + template: instruments/{currency_pair}/trades + pair_template: # e.g. btc_usd + template: "{first}-{second}" + lower_case: false + params: + limit: + type: int + max: 100 + default: 100 + response: + type: list + values: + type: dict + values: + timestamp: + type: str + price: + type: str + size: + type: str + trade_id: + type: str + side: + type: str + mapping: + - key: time + path: + - timestamp + type: + - str + - dateparser + - key: id + path: + - timestamp + type: + - str + - dateparser + - totimestamp + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - size + type: + - str + - key: direction + path: + - side + type: + - str + + historic_rates: + request: + template: instruments/{currency_pair}/candles + pair_template: # e.g. btc_usd + template: "{first}-{second}" + lower_case: false + params: + granularity: + allowed: + minutes: 60 + hours: 3600 + days: 86400 + weeks: 604800 + default: 86400 # 1 day +# start: #returns only the last 200 entries until end or "today". +# function: last_timestamp +# type: +# - datetime +# - timedelta +# - interval +# - 1000 +# - fromtimestamp +# - "%Y-%m-%dT%H:%M:%S.%fZ" + end: + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S.%fZ" # e.g. 2020-11-10T16:00:00.000Z + response: + type: list + values: + type: list + values: + 0: # timestamp + type: str + 1: # open + type: str + 2: # high + type: str + 3: # low + type: str + 4: # close + type: str + 5: # volume + type: str + mapping: + - key: time + path: + - 0 + type: + - str + - dateparser + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/okex.yaml b/pandas_datareader/crypto/resources/running_exchanges/okex.yaml new file mode 100644 index 00000000..7cde4876 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/okex.yaml @@ -0,0 +1,360 @@ +name: okex +exchange: true + +api_url: https://www.okex.com/api/spot/v3/ +rate_limit: + max: 20 + unit: 2 +requests: + currency_pairs: + request: + template: instruments + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + base_currency: + type: str + category: + type: str + instrument_id: + type: str + min_size: + type: str + quote_currency: + type: str + size_increment: + type: str + tick_size: + type: str + mapping: + - key: currency_pair_first + path: + - base_currency + type: + - str + - lower + - key: currency_pair_second + path: + - quote_currency + type: + - str + - lower + + + tickers: + request: + template: instruments/ticker + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + best_ask: + type: str + best_bid: + type: str + instrument_id: + type: str + product_id: + type: str + last: + type: str + last_qty: + type: str + ask: + type: str + best_ask_size: + type: str + bid: + type: str + best_bid_size: + type: str + open: + type: str + open_24h: + type: str + high_24h: + type: str + low_24h: + type: str + base_volume_24h: + type: str + timestamp: + type: str + qutote_volume_24h: + type: str + + mapping: + - key: currency_pair_first + path: + - instrument_id + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - instrument_id + type: + - str + - split + - "-" + - 1 + - key: best_bid + path: + - best_bid + type: + - str + - float + - key: last_price + path: + - last + type: + - str + - float + - key: best_ask + path: + - best_ask + type: + - str + - float + - key: daily_volume + path: + - base_volume_24h + type: + - str + - float +# + order_books: + request: + template: instruments/{currency_pair}/book + pair_template: # e.g. btc_usd + template: "{first}-{second}" + lower_case: false + params: + size: + min: 1 + max: 200 + default: 50 + response: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: # price + type: float + 1: # size + type: float + bids: + type: list + values: + type: list + values: + 0: # price + type: float + 1: # size + type: float + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: asks_price + path: + - asks + - 0 + type: + - float + - key: asks_amount + path: + - asks + - 1 + type: + - float + - key: bids_price + path: + - bids + - 0 + type: + - float + - key: bids_amount + path: + - bids + - 1 + type: + - float + + trades: + request: + template: instruments/{currency_pair}/trades + pair_template: # e.g. btc_usd + template: "{first}-{second}" + lower_case: false + params: + limit: # get recently 60 pieces of data starting from the given tid (optional) + type: str + required: false + default: 100 + response: + type: list + values: + type: dict + values: + 0: + type: str + 1: + type: str + 2: + type: str + 3: + type: str + 4: + type: str + 5: + type: str + mapping: + - key: time + path: + - dict_values + - 1 + type: + - str + - strptime + - "%Y-%m-%dT%H:%M:%S.%fZ" + - key: price + path: + - dict_values + - 3 + type: + - str + - float + - key: amount + path: + - dict_values + - 4 + type: + - str + - float + - key: direction + path: + - dict_values + - 5 + type: + - str + - key: id + path: + - dict_values + - 2 + type: + - str + - int + + historic_rates: + request: + template: instruments/{currency_pair}/candles + pair_template: # e.g. btc_usd + template: "{first}-{second}" + lower_case: false + params: + granularity: + allowed: + minutes: 60 + hours: 3600 + days: 86400 + weeks: 604800 + default: 86400 # 1day + limit: + default: 300 + start: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 300 + - from_timestamp + - 0 + - "%Y-%m-%dT%H:%M:%S.%fZ" + end: + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S.%fZ" + response: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + 2: + type: str + 3: + type: str + 4: + type: str + 5: + type: str + mapping: + - key: time + path: + - 0 + type: + - str + - strptime + - "%Y-%m-%dT%H:%M:%S.%fZ" + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/omgfin.yaml b/pandas_datareader/crypto/resources/running_exchanges/omgfin.yaml new file mode 100644 index 00000000..9f17a715 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/omgfin.yaml @@ -0,0 +1,359 @@ +#ToDO: HR endpoint is not really working. Frequently returning data is non-json format (status 503) which can not +# be parsed. + +name: omgfin +api_url: https://omgfin.com/api/v1/ +rate_limit: + max: 600 + unit: 60 + + +requests: + + currency_pairs: + request: + template: exchangeInfo + pair_template: null + params: null + + response: + type: dict + values: + symbols: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + mapping: + - key: currency_pair_first + path: + - symbols + - baseAsset + type: + - str + - key: currency_pair_second + path: + - symbols + - quoteAsset + type: + - str + + tickers: + request: + template: ticker/summary + pair_template: null + params: null + response: + type: dict + values: + currency_pair: + type: dict + values: + last: + type: str + lowestAsk: + type: str + highest_bid: + type: str + percentChange: + type: str + baseVolume: + type: str + quoteVolume: + type: str + high24h: + type: str + low24h: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - dict_values + - last + type: + - str + - float + - key: best_bid + path: + - dict_values + - highestBid + type: + - str + - float + - key: best_ask + path: + - dict_values + - lowestAsk + type: + - str + - float + - key: daily_volume + path: + - dict_values + - baseVolume + type: + - str + - float + + historic_rates: + request: + template: klines + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + default: 1d + limit: + default: 300 # max: 300 +# startTime: +# function: last_timestamp +# type: +# - datetime +# - timedeltams +# - interval +# - 300 + endTime: + function: last_timestamp + type: + - datetime + - timestampms + response: + type: list + values: + type: dict + values: + OT: + type: int + O: + type: str + H: + type: str + L: + type: str + C: + type: str + CT: + type: int + QV: + type: str + V: + type: str + + mapping: + - key: time + path: + - CT + type: + - float + - from_timestamp + - 1 + - key: open + path: + - O + type: + - str + - float + - key: high + path: + - H + type: + - str + - float + - key: low + path: + - L + type: + - str + - float + - key: close + path: + - C + type: + - str + - float + - key: volume + path: + - V + type: + - str + - float + + + trades: + request: + template: trades/{currency_pair} + pair_template: + template: "{first}{second}" + lower_case: false + params: + limit: + max: 1000 + default: 500 + + response: + type: list + values: + type: dict + values: + id: + type: int + price: + type: str + qty: + type: str + time: + type: int + isBuyerMaker: + type: str + isBestMatch: + type: str + + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - id + type: + - int + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - True + - sell + - False + - buy + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + + order_books: + request: + template: orderbook/{currency_pair} + pair_template: + template: "{first}{second}" + lower_case: false + params: + limit: + max: 500 + default: 50 + + response: + type: dict + values: + timestamp: + type: int + bids: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + asks: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - timestamp + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/p2pb2b.yaml b/pandas_datareader/crypto/resources/running_exchanges/p2pb2b.yaml new file mode 100644 index 00000000..4f3ff4e0 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/p2pb2b.yaml @@ -0,0 +1,393 @@ +# ToDo: Function für einen Offset für HR schreiben. + +name: p2pb2b +exchange: true +rate_limit: + max: 100 + unit: 60 +api_url: https://api.p2pb2b.io/api/v2/public/ + +requests: + currency_pairs: + request: + template: markets + pair_template: null + params: null + response: + type: dict + values: + result: + type: list + values: + type: dict + values: + name: + type: str + stock: + type: str + money: + type: str + mapping: + - key: currency_pair_first + path: + - result + - stock + type: + - str + - key: currency_pair_second + path: + - result + - money + type: + - str + + tickers: + request: + template: tickers + pair_template: null + params: null + response: + type: dict + values: + success: + type: bool + message: + type: str + resulst: + type: dict + values: + currency_pair: + type: dict + values: + at: + type: int + ticker: + type: dict + values: + bid: + type: float + ask: + type: float + low: + type: float + high: + type: float + last: + type: float + vol: + type: float + change: + type: float + mapping: + - key: time + path: + - result + - dict_values + - at + type: + - float + - from_timestamp + - 0 + - key: currency_pair_first + path: + - result + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - result + - dict_key + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - result + - dict_values + - ticker + - last + type: + - float + - key: best_bid + path: + - result + - dict_values + - ticker + - bid + type: + - float + - key: best_ask + path: + - result + - dict_values + - ticker + - ask + type: + - float + - key: daily_volume + path: + - result + - dict_values + - ticker + - vol + type: + - float + + trades: + request: + template: history + pair_template: + template: "{first}_{second}" + lower_case: false + alias: market + params: + lastId: + type: int + default: 1 + limit: + type: int + default: 100 + response: + type: dict + values: + success: + type: bool + message: + type: str + result: + type: list + values: + type: dict + values: + id: + type: int + type: + type: str + time: + type: int + amount: + type: float + price: + type: float + + mapping: + - key: time + path: + - result + - time + type: + - float + - from_timestamp + - 0 + - key: id + path: + - result + - id + type: + - int + - key: amount + path: + - result + - amount + type: + - float + - key: price + path: + - result + - price + type: + - float + - key: direction + path: + - result + - type + type: + - str + + order_books: + request: + template: depth/result + pair_template: + template: "{first}_{second}" + lower_case: false + alias: market + params: + limit: + type: int + default: 100 + interval: + default: 0 + + response: + type: dict + values: + result: + type: dict + asks: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + bids: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + cache_time: + type: float + current_time: + type: float + mapping: + - key: id + path: + - cache_time + type: + - float + - int + - key: time + path: + - cache_time + type: + - float + - from_timestamp + - 0 + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - result + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - result + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - result + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - result + - asks + - 1 + type: + - str + - float + + historic_rates: + request: + template: market/kline + pair_template: + template: "{first}_{second}" + lower_case: false + alias: market + params: + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + default: 1d + limit: + type: int + default: 500 + + response: + type: dict + values: + result: + type: list + values: + type: dict + values: + 0: #time + type: int + 1: #open + type: str + 2: #close + type: str + 3: #high + type: str + 4: #low + type: str + 5: #volume + type: str + 6: #amount + type: str + + mapping: + - key: time + path: + - result + - 0 + type: + - float + - from_timestamp + - 0 + - key: open + path: + - result + - 1 + type: + - str + - float + - key: high + path: + - result + - 3 + type: + - str + - float + - key: low + path: + - result + - 4 + type: + - str + - float + - key: close + path: + - result + - 2 + type: + - str + - float + - key: volume + path: + - result + - 5 + type: + - str + - float + + + diff --git a/pandas_datareader/crypto/resources/running_exchanges/poloniex.yaml b/pandas_datareader/crypto/resources/running_exchanges/poloniex.yaml new file mode 100644 index 00000000..280bf1c4 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/poloniex.yaml @@ -0,0 +1,354 @@ +name: poloniex +exchange: true +api_url: https://poloniex.com/ +rate_limit: null +requests: + currency_pairs: + request: + template: public?command=returnTicker + pair_template: null + params: null + response: + type: dict + values: + currency_pair: # variable key, each currency pair e.g. ltc_btc + type: dict + values: + last: + type: float + lowestAsk: + type: float + highestBid: + type: float + percentChange: + type: float + baseVolume: + type: float + quoteVolume: + type: float + isFrozen: + type: int + high24hr: + type: float + low24hr: + type: float + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - splitupper + - "_" + - 1 + - key: currency_pair_second + path: + - dict_key + type: + - str + - splitupper + - "_" + - 0 + + tickers: + request: + template: public?command=returnTicker + pair_template: null + params: null + response: + type: dict + values: + currency_pair: # variable key, each currency pair e.g. ltc_btc + type: dict + values: + last: + type: float + lowestAsk: + type: float + highestBid: + type: float + percentChange: + type: float + baseVolume: + type: float + quoteVolume: + type: float + isFrozen: + type: int + high24hr: + type: float + low24hr: + type: float + mapping: + - key: time + path: [] + type: + - none + - now + - key: currency_pair_first + path: + - dict_key + type: + - str + - splitupper + - "_" + - 1 + - key: currency_pair_second + path: + - dict_key + type: + - str + - splitupper + - "_" + - 0 + - key: last_price + path: + - dict_values + - last + type: + - float + - key: best_bid + path: + - dict_values + - highestBid + type: + - float + - key: best_ask + path: + - dict_values + - lowestAsk + type: + - float + - key: daily_volume + path: + - dict_values + - base_volume + type: + - float + + historic_rates: + request: + template: public?command=returnChartData + pair_template: + template: "{first}_{second}" + alias: currencyPair + lower_case: false + params: + start: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1000 +# type: int +# default: 946684800 # 01.01.2000 + period: + allowed: + minutes: 300 + hours: 7200 + days: 86400 + default: 86400 #1 Day in Seconds + + response: + type: list + values: + type: dict + values: + date: + type: int + high: + type: float + low: + type: float + open: + type: float + close: + type: float + quoteVolume: + type: float + weightedAverage: + type: flaot + + mapping: + - key: time + path: + - date + type: + - float + - from_timestamp + - 0 + - key: close + path: + - close + type: + - float + - key: open + path: + - open + type: + - float + - key: high + path: + - high + type: + - float + - key: low + path: + - low + type: + - float + - key: volume + path: + - volume + type: + - float + + order_books: + request: + template: public?command=returnOrderBook + pair_template: + template: "{first}_{second}" + alias: currencyPair + lower_case: false + params: + depth: + type: int + default: 100 + + response: + type: dict + values: + ask: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: float + bids: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: float + is_frozen: + type: str + seq: + type: int + + mapping: + - key: time + path: [] + type: + - none + - now + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - float + - key: id + path: + - seq + type: + - int + - key: position + path: [] + type: + - none + - range + + trades: + request: + template: public?command=returnTradeHistory + pair_template: + template: "{first}_{second}" + alias: currencyPair + lower_case: false + params: null + + response: + type: list + values: + type: dict + values: + globalTradeID: + type: int + tradeID: + type: int + date: + type: str + type: + type: str + rate: + type: str + amount: + type: str + total: + type: str + orderNumber: + type: str + mapping: + - key: time + path: + - date + type: + - str + - strptime + - "%Y-%m-%d %H:%M:%S" + - key: id + path: + - tradeID + type: + - str + - int + - key: price + path: + - rate + type: + - str + - float + - key: amount + path: + - amount + type: + - str + - float + - key: direction + path: + - type + type: + - str + + + + + + diff --git a/pandas_datareader/crypto/resources/running_exchanges/stormgain.yaml b/pandas_datareader/crypto/resources/running_exchanges/stormgain.yaml new file mode 100644 index 00000000..ffaa3e66 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/stormgain.yaml @@ -0,0 +1,229 @@ +#ToDO: trades do not respond. Either no trades are made or the API is dysfunctional. + +name: stormgain +exchange: true +rate_limit: + +api_url: https://public-api.stormgain.com/api/v1/ + +requests: + currency_pairs: + request: + template: spot/summary + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + base_currency: + type: str + quote_currency: + type: str + + mapping: + - key: currency_pair_first + path: + - base_currency + type: + - str + - key: currency_pair_second + path: + - quote_currency + type: + - str + tickers: + request: + template: spot/summary + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + base_currency: + type: str + quote_currency: + type: str + last_price: + type: str + lowest_ask: + type: str + highest_bid: + type: str + base_volume: + type: str + mapping: + - key: currency_pair_first + path: + - base_currency + type: + - str + - key: currency_pair_second + path: + - quote_currency + type: + - str + - key: last_price + path: + - last_price + type: + - str + - float + - key: best_bid + path: + - highest_bid + type: + - str + - float + - key: best_ask + path: + - lowest_ask + type: + - str + - float + - key: daily_volume + path: + - base_volume + type: + - str + - float + + order_books: + request: + template: orderbook/{currency_pair} + pair_template: + template: "{first}_{second}" + lower_case: false + params: null + + response: + type: dict + values: + timestamp: + type: int + bids: + type: list + values: + type: list + values: + 0: #price + type: str + 1: # quantity + type: str + asks: + type: list + values: + type: list + values: + 0: #price + type: str + 1: # quantity + type: str + mapping: + - key: id + path: + - timestamp + type: + - int + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + + trades: + request: + template: trade/{currency_pair} + pair_template: + template: "{first}_{second}" + lower_case: false + params: null + + response: + type: list + values: + type: dict + values: + trade_id: + type: int + timestamp: + type: str + type: + type: str + price: + type: str + base_volume: + type: str + quote_volume: + type: str + mapping: + - key: id + path: + - trade_id + type: + - int + - key: time + path: + - timestamp + type: + - str + - float + - from_timestamp + - 1 + - key: direction + path: + - type + type: + - str + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - base_volume + type: + - str + - float + + diff --git a/pandas_datareader/crypto/resources/running_exchanges/therocktrading.yaml b/pandas_datareader/crypto/resources/running_exchanges/therocktrading.yaml new file mode 100644 index 00000000..032ada09 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/therocktrading.yaml @@ -0,0 +1,340 @@ +name: therocktrading +exchange: true + +rate_limit: + max: 600 + unit: 60 + +api_url: https://api.therocktrading.com/v1/ + +requests: + currency_pairs: + request: + template: funds + pair_template: null + params: null + + response: + type: dict + values: + funds: + type: list + values: + type: dict + values: + base_currency: + type: str + trade_currency: + type: str + + + mapping: + - key: currency_pair_first + path: + - funds + - trade_currency + type: + - str + - key: currency_pair_second + path: + - funds + - base_currency + type: + - str + + tickers: + request: + template: funds/{currency_pair}/ticker + pair_template: + template: "{first}{second}" + lower_case: false + params: null + response: + type: dict + values: + date: + type: str + bid: + type: str + ask: + type: str + last: + type: str + volume: + type: str + traded_volume: + type: str + + mapping: + - key: last_price + path: + - last + type: + - str + - float + - key: time + path: + - date + type: + - str + - dateparser + - key: best_bid + path: + - bid + type: + - str + - float + - key: best_ask + path: + - ask + type: + - str + - float + - key: daily_volume + path: + - volume + type: + - str + - float + + historic_rates: + request: + template: funds/{currency_pair}/ohlc_statistics + pair_template: + template: "{first}{second}" + lower_case: false + params: + period: + allowed: + minutes: 1 + hours: 60 +# days: 1440 +# weeks: 10080 +# months: 43200 + default: 60 + before: + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S%Z" + after: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1000 #max interval 60 DAYS! + - from_timestamp + - 0 + - "%Y-%m-%dT%H:%M:%S%Z" +# default: "2020-03-19T17:25:00.000Z" + sort: + default: DESC + response: + type: list + values: + type: dict + values: + open: + type: float + high: + type: float + low: + type: float + close: + type: float + base_volume: + type: float + trade_volume: + type: float + interval_starts_at: + type: str + interval_ends_at: + type: str + + mapping: + - key: time + path: + - interval_ends_at + type: + - str + - dateparser + - key: open + path: + - open + type: + - float + - key: high + path: + - high + type: + - float + - key: low + path: + - low + type: + - float + - key: close + path: + - close + type: + - float + - key: volume + path: + - traded_volume + type: + - float + + trades: + request: + template: funds/{currency_pair}/trades + pair_template: + template: "{first}{second}" + lower_case: false + params: +# before: +# function: last_timestamp +# type: +# - datetime +# - format +# - "%Y-%m-%dT%H:%M:%S%Z" +# after: +# function: last_timestamp +# type: +# - datetime +# - timedelta +# - interval +# - 1000 +# - fromtimestamp +# - "%Y-%m-%dT%H:%M:%S%Z" + per_page: + max: 250 + default: 250 + + response: + type: dict + values: + type: list + values: + type: dict + values: + trade_id: + type: int + amount: + type: float + price: + type: float + side: + type: str + date: + type: str + + + mapping: + - key: time + path: + - trades + - date + type: + - str + - dateparser + - key: id + path: + - trades + - id + type: + - int + - key: direction + path: + - trades + - side + type: + - str + - key: price + path: + - trades + - price + type: + - float + - key: amount + path: + - trades + - amount + type: + - float + + order_books: + request: + template: funds/{currency_pair}/orderbook + pair_template: + template: "{first}{second}" + lower_case: false + params: + limit: + default: 50 + response: + type: dict + values: + date: + type: str + asks: + type: list + values: + type: dict + values: + price: + type: float + amount: + type: float + bids: + type: list + values: + type: dict + values: + price: + type: float + amount: + type: float + + mapping: + - key: time + path: + - date + type: + - str + - dateparser + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - amount + type: + - float + - key: bids_price + path: + - bids + - price + type: + - float + - key: asks_amount + path: + - asks + - amount + type: + - float + - key: asks_price + path: + - asks + - price + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/tidex.yaml b/pandas_datareader/crypto/resources/running_exchanges/tidex.yaml new file mode 100644 index 00000000..53ee1022 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/tidex.yaml @@ -0,0 +1,270 @@ +name: tidex +exchange: true + +api_url: https://api.tidex.com/api/3/ +rate_limit: null + +requests: + currency_pairs: + request: + template: info + pair_template: null + params: null + response: + type: dict + values: + server_time: + type: + - int + pairs: + type: dict + values: + currency_pair: # each available currency pair e.g. eth_btc + type: dict + values: + decimal_places: + type: int + min_price: + type: float + max_price: + type: float + min_amount: + type: float + hidden: + type: int + fee: + type: float + mapping: + - key: currency_pair_first + path: # key not values! + - pairs + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: # key not values! + - pairs + - dict_key + type: + - str + - split + - "_" + - 1 + + tickers: + request: + template: ticker/{currency_pair}/ + pair_template: # e.g. eth_btc + template: "{first}_{second}" + lower_case: true + params: null + response: + type: dict + values: + currency_pair: # variable key, requested currency pair + type: dict + values: + high: + type: float + low: + type: float + avg: + type: float + vol: # trade volume + type: float + vol_cur: # trade volume in currency + type: float + last: # price of last trade + type: float + buy: + type: float + sell: + type: float + updated: + type: + - float + - from_timestamp + - 0 + mapping: + - key: daily_volume + path: + - dict_values + - vol + type: + - float + - key: last_price + path: + - dict_values + - last + type: + - float + - key: best_ask + path: + - dict_values + - buy + type: + - float + - key: best_bid + path: + - dict_values + - sell + type: + - float + - key: time + path: + - dict_values + - updated + type: + - float + - from_timestamp + - 0 + + order_books: + request: + template: depth/{currency_pair} + pair_template: # e.g. eth_btc + template: "{first}_{second}" + lower_case: true + params: + limit: + type: int + default: 150 + response: + type: dict + values: + currency_pair: # requested currency pair + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: # price + type: float + 1: # size + type: float + bids: + type: list + values: + type: list + values: + 0: # price + type: float + 1: # size + type: float + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: asks_price + path: + - dict_values + - asks + - 0 + type: + - float + - key: asks_amount + path: + - dict_values + - asks + - 1 + type: + - float + - key: bids_price + path: + - dict_values + - bids + - 0 + type: + - float + - key: bids_amount + path: + - dict_values + - bids + - 1 + type: + - float + + trades: + request: + template: trades/{currency_pair} + pair_template: # e.g. eth_btc + template: "{first}_{second}" + lower_case: true + params: + limit: + type: int + default: 150 + response: + type: dict + values: + currency_pair: # requested currency pair + type: list + values: + type: dict + values: + type: + type: str + price: + type: float + amount: + type: float + tid: + type: int + timestamp: + type: + - int + mapping: + - key: direction + path: + - dict_values + - type + type: + - value + - map + - ask + - sell + - bid + - buy + - key: id + path: + - dict_values + - tid + type: + - int + - key: price + path: + - dict_values + - price + type: + - float + - key: amount + path: + - dict_values + - amount + type: + - float + - key: time + path: + - dict_values + - timestamp + type: + - float + - from_timestamp + - 0 diff --git a/pandas_datareader/crypto/resources/running_exchanges/upbit.yaml b/pandas_datareader/crypto/resources/running_exchanges/upbit.yaml new file mode 100644 index 00000000..0beb46fa --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/upbit.yaml @@ -0,0 +1,320 @@ +name: upbit +exchange: true +api_url: https://api.upbit.com/v1/ +rate_limit: null + +requests: + currency_pairs: + request: + template: market/all + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + market: # e.g. KRW-BTC + type: str + korean_name: + type: str + english_name: + type: str + mapping: + - key: currency_pair_first + path: + - market + type: + - str + - split + - "-" + - 1 + - key: currency_pair_second + path: + - market + type: + - str + - split + - "-" + - 0 + + historic_rates: + request: + template: candles/{frequency} + pair_template: # e.g. KRW-BTC + template: "{second}-{first}" + lower_case: false + alias: market + params: + frequency: + allowed: + minutes: minutes/1 + hours: minutes/60 + days: days + weeks: weeks + months: months + default: days + to: + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S.%fZ" + count: + type: int + max: 200 + default: 200 + response: + type: list + values: + type: dict + values: + market: + type: str + candle_date_time_utc: + type: + - str + candle_date_time_kst: + type: + - str + opening_price: + type: float + high_price: + type: float + low_price: + type: float + trade_price: + type: float + timestamp: + type: + - int + candle_acc_trade_price: + type: float + candle_acc_trade_volume: + type: float + mapping: + - key: open + path: + - opening_price + type: + - float + - key: high + path: + - high_price + type: + - float + - key: low + path: + - low_price + type: + - float + - key: close + path: + - trade_price + type: + - float + - key: time + path: + - candle_date_time_utc + type: + - str + - dateparser + - key: volume + path: + - candle_acc_trade_volume + type: + - float + + trades: + request: + template: trades/ticks + pair_template: # e.g. KRW-BTC + template: "{second}-{first}" + lower_case: false + alias: market + params: + count: + type: int + default: 1000 + response: + type: list + values: + type: dict + values: + market: + type: str + trade_date_utc: + type: + - str + - strptime + - "%Y-%m-%d" + trade_time_utc: + type: + - str + - strptime + - "%H:%M:%S" + timestamp: + type: + - float + - from_timestamp + - 0 + trade_price: + type: float + trade_volume: + type: float + prev_closing_price: + type: float + change_price: + type: float + ask_bid: # ask or bid + type: str + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: price + path: + - trade_price + type: + - float + - key: amount + path: + - trade_volume + type: + - float + - key: direction + path: + - ask_bid + type: + - value + - map + - ASK + - sell + - BID + - buy + - key: id + path: + - sequential_id + type: + - float + + tickers: + request: + template: ticker + pair_template: + template: "{second}-{first}" + lower_case: false + alias: markets + params: null + response: + type: list + values: + type: dict + values: + market: + type: str + trade_date: + type: str + trade_time: + type: str + trade_timestamp: + type: int + trade_price: + type: int + mapping: + - key: time + path: + - trade_timestamp + type: + - float + - from_timestamp + - 1 + - key: last_price + path: + - trade_price + type: + - float + + order_books: + request: + template: orderbook + pair_template: # e.g. KRW-BTC + template: "{second}-{first}" + lower_case: false + alias: markets + params: null + response: + type: list + values: + type: dict + values: + market: + type: str + timestamp: + type: + - float + - from_timestamp + - 0 + total_ask_size: + type: float + total_bid_size: + type: float + orderbook_units: + type: list + values: + type: dict + values: + ask_price: + type: float + bid_price: + type: float + ask_size: + type: float + bid_size: + type: float + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: id + path: + - timestamp + type: + - int + - key: position + path: [] + type: + - none + - range + - key: asks_price + path: + - orderbook_units + - ask_price + type: + - float + - key: bids_price + path: + - orderbook_units + - bid_price + type: + - float + - key: asks_amount + path: + - orderbook_units + - ask_size + type: + - float + - key: bids_amount + path: + - orderbook_units + - bid_size + type: + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/vcc.yaml b/pandas_datareader/crypto/resources/running_exchanges/vcc.yaml new file mode 100644 index 00000000..a7b3d7d0 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/vcc.yaml @@ -0,0 +1,296 @@ + +#https://vcc.exchange/api/#summary +name: vcc +exchange: true + +rate_limit: null + +api_url: https://api.vcc.exchange/v3 + +requests: + currency_pairs: + request: + template: /summary + pair_template: null + params: null + + response: + type: dict + values: + data: + type: dict + values: + currency_pair: + type: dict + + + mapping: + - key: currency_pair_first + path: + - data + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - data + - dict_key + type: + - str + - split + - "_" + - 1 + + tickers: + request: + template: /summary + pair_template: null + params: null + + response: + type: dict + values: + data: + type: dict + values: + currency_pair: + type: dict + values: + last: + type: str + baseVolume: + type: str + quoteVolume: + type: str + highestBid: + type: str + lowestAsk: + type: str + + + mapping: + - key: currency_pair_first + path: + - data + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - data + - dict_key + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - data + - dict_values + - last + type: + - str + - float + - key: time + path: [] + type: + - none + - now + - key: best_bid + path: + - data + - dict_values + - highestBid + type: + - str + - float + - key: best_ask + path: + - data + - dict_values + - lowestAsk + type: + - str + - float + - key: daily_base_volume + path: + - data + - dict_values + - baseVolume + type: + - str + - float + - key: daily_volume + path: + - data + - dict_values + - quoteVolume + type: + - str + - float + + trades: + request: + template: /trades/{currency_pair} + pair_template: + template: "{first}_{second}" + lower_case: false +# alias: + params: + count: + max: 1000 + default: 500 + + response: + type: dict + values: + data: + type: list + values: + trade_id: + type: int + price: + type: str + base_volume: + type: str + trade_timestamp: + type: int + type: str + + mapping: + - key: time + path: + - data + - trade_timestamp + type: + - str + - float + - from_timestamp + - 1 + - key: id + path: + - data + - trade_id + type: + - int + - key: direction + path: + - data + - type + type: + - str + - key: price + path: + - data + - price + type: + - str + - float + - key: amount + path: + - data + - base_volume + type: + - str + - float + + order_books: + request: + template: /orderbook/{currency_pair} + pair_template: + template: "{first}_{second}" + lower_case: false + params: + depth: + # possible: [0, 5, 10, 20, 50, 500] #zero is full + default: 50 + level: + # possible: [1, 2, 3] # 1: Best Bid/Ask, 2: Aggregated by Price, 3: Full, no agg. + default: 2 + response: + type: dict + values: + dataVersion: + type: str + data: + type: dict + values: + timestamp: + type: str + bids: + type: list + values: + type: list + values: + 0: #price + type: str + 1: # qty + type: str + asks: + type: list + values: + type: list + values: + 0: #qty + type: str + 1: # price + type: str + mapping: + - key: time + path: + - data + - timestamp + type: + - str + - float + - from_timestamp + - 1 + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - data + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - data + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - data + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - data + - asks + - 0 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/vindax.yaml b/pandas_datareader/crypto/resources/running_exchanges/vindax.yaml new file mode 100644 index 00000000..2f6c7f90 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/vindax.yaml @@ -0,0 +1,350 @@ +name: vindax +exchange: true +api_url: https://api.vindax.com/api/v1/ +rate_limit: + max: 6 + unit: 1 + +requests: + currency_pairs: + request: + template: returnTicker + pair_template: null + params: null + response: + type: dict + values: + currency_pair: + type: dict + + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + + tickers: + request: + template: returnTicker + pair_template: null + params: null + response: + type: dict + values: + currency_pair: + type: dict + values: + quote_volume: + type: str + symbol: + type: str + percentChange: + type: float + last: + type: float + highestBid: + type: float + lowsetAsk: + type: float + baseVolume: + type: float + openTime: + type: int + closeTime: + type: int + high24hr: + type: float + low24hr: + type: float + isFrozen: + type: bool + + mapping: + - key: time + path: [] + type: + - none + - now + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - dict_values + - last + type: + - float + - key: best_bid + path: + - dict_values + - highestBid + type: + - float + - key: best_ask + path: + - dict_values + - lowsetAsk + type: + - float + + + order_books: + request: + template: depth + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 1000 + default: 50 + response: + type: dict + values: + lastUpdateId: + type: str + bids: + type: list + values: + type: list + values: + 0: #Price + type: float + 1: #Qty + type: float + asks: + type: list + values: + type: list + values: + 0: + type: float + 1: + type: float + mapping: + - key: id + path: [] + type: + - none + - now_timestamp + - key: time + path: [] + type: + - none + - now + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - float + - key: asks_amount + path: + - asks + - 1 + type: + - float + - key: bids_price + path: + - bids + - 0 + type: + - float + - key: asks_price + path: + - asks + - 0 + type: + - float + + + trades: + request: + template: trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 500 + default: 100 + + response: + type: list + values: + type: dict + values: + id: + type: str + price: + type: str + qty: + type: str + time: + type: int + isBuyerMaker: + type: true + isBestMatch: + type: true + mapping: + - key: id + path: + - id + type: + - str + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - true + - sell + - false + - buy + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + + + + historic_rates: + request: + template: klines + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 500 + default: 1000 + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + default: 1d + endTime: + function: last_timestamp + type: + - datetime + - timestampms + + response: + type: list + values: + type: list + values: + 0: + type: int + 1: + type: str + 2: + type: str + 3: + type: str + 4: + type: str + 5: + type: str + 6: + type: str + 7: + type: str + mapping: + - key: time + path: + - [] + - 6 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - [] + - 1 + type: + - str + - float + - key: high + path: + - [] + - 2 + type: + - str + - float + - key: low + path: + - [] + - 3 + type: + - str + - float + - key: close + path: + - [] + - 4 + type: + - str + - float + - key: volume + path: + - [] + - 5 + type: + - str + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/wazirx.yaml b/pandas_datareader/crypto/resources/running_exchanges/wazirx.yaml new file mode 100644 index 00000000..ea23b051 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/wazirx.yaml @@ -0,0 +1,252 @@ +name: wazirx +is_exchange: true + +api_url: https://api.wazirx.com/api/v2/ + +requests: + currency_pairs: + request: + template: market-status + pair_template: null + params: null + response: + type: dict + values: + markets: + type: list + values: + type: dict + values: + baseMarket: + type: str + quoteMarket: + type: str + + mapping: + - key: currency_pair_first + path: + - markets + - baseMarket + type: + - str + - upper + - key: currency_pair_second + path: + - markets + - quoteMarket + type: + - str + - upper + + + tickers: + request: + template: tickers + pair_template: null + params: null + response: + type: dict + values: + currency_pair: + type: dict + values: + base_unit: + type: str + quote_unit: + type: str + last: + type: str + sell: + type: str + buy: + type: str + at: + type: int + volume: + type: str + mapping: + - key: currency_pair_first + path: + - dict_values + - base_unit + type: + - str + - upper + - key: currency_pair_second + path: + - dict_values + - quote_unit + type: + - str + - upper + - key: time + path: + - dict_values + - at + type: + - float + - from_timestamp + - 0 + - key: last_price + path: + - dict_values + - last + type: + - str + - float + - key: best_ask + path: + - dict_values + - sell + type: + - str + - float + - key: best_bid + path: + - dict_values + - buy + type: + - str + - float + - key: daily_volume + path: + - dict_values + - volume + type: + - str + - float + + order_books: + request: + template: depth + pair_template: + template: "{first}{second}" + lower_case: true + alias: market + params: null + + response: + type: dict + values: + timestamp: + type: int + asks: + type: list + values: + type: list + values: + 0: # price + type: str + 1: #volume + type: str + bids: + type: list + values: + type: list + values: + 0: # price + type: str + 1: #volume + type: str + + mapping: + - key: time + path: + - timestamp + type: + - str + - float + - from_timestamp + - 0 + - key: id + path: + - timestamp + type: + - str + - int + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + + trades: + request: + template: trades + pair_template: + template: "{first}{second}" + lower_case: true + alias: market + params: null + + response: + type: list + values: + type: dict + values: + id: + type: int + price: + type: str + volume: + type: str + funds: + type: str + market: + type: str + created_at: + type: str + side: + type: null + mapping: + - key: time + path: + - created_at + type: + - str + - dateparser + - key: id + path: + - id + type: + - int + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - volume + type: + - str + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/whitebit.yaml b/pandas_datareader/crypto/resources/running_exchanges/whitebit.yaml new file mode 100644 index 00000000..5244e6a8 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/whitebit.yaml @@ -0,0 +1,237 @@ +name: whitebit +exchange: true +api_url: https://whitebit.com/api/v4/public/ + +requests: + currency_pairs: + request: + template: ticker + pair_template: null + params: null + response: + type: dict + values: + currency_pair: + type: dict + values: + base_id: + type: int + quote_id: + type: int + last_price: + type: str + base_volume: + type: str + quote_volume: + type: str + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + + + tickers: + request: + template: ticker + pair_template: null + params: null + response: + type: dict + values: + currency_pair: + type: dict + values: + base_id: + type: int + quote_id: + type: int + last_price: + type: str + base_volume: + type: str + quote_volume: + type: str + + + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - dict_values + - last_price + type: + - str + - float + - key: daily_volume + path: + - dict_values + - base_volume + type: + - str + - float + + trades: + request: + template: trades/{currency_pair} + pair_template: + template: "{first}_{second}" + lower_case: false + params: null + response: + type: list + values: + type: dict + values: + tradeID: + type: int + price: + type: str + trade_timestamp: + type: int + base_volume: + type: str + quote_volume: + type: str + type: + type: str + mapping: + - key: id + path: + - tradeID + type: + - int + - key: direction + path: + - type + type: + - str + - key: time + path: + - trade_timestamp + type: + - float + - from_timestamp + - 0 + - key: amount + path: + - quote_volume + type: + - str + - float + - key: price + path: + - price + type: + - str + - float + + order_books: + request: + template: orderbook/{currency_pair} + pair_template: + template: "{first}_{second}" + lower_case: false + params: + depth: + type: int + default: 50 + level: + type: int + default: 2 + response: + type: dict + values: + timestamp: + type: int + asks: + type: list + values: + list: + values: + 0: #price + type: str + 1: #qty + type: str + bids: + type: list + values: + list: + values: + 0: #price + type: str + 1: #qty + type: str + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 0 + - key: position + path: [] + type: + - none + - range + - key: id + path: + - timestamp + type: + - int + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/xt.yaml b/pandas_datareader/crypto/resources/running_exchanges/xt.yaml new file mode 100644 index 00000000..6360597b --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/xt.yaml @@ -0,0 +1,330 @@ + +name: xt +exchange: true +api_docs: https://github.com/xtpub/api-doc/blob/master/rest-api-v1-en.md +rate_limit: + max: 1000 + unit: 60 + +api_url: https://api.xt.com + +requests: + currency_pairs: + request: + template: /data/api/v1/getMarketConfig + pair_template: null + params: null + + response: + type: + type: list + values: + currency_pair: + type: dict + + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + + tickers: + request: + template: /data/api/v1/getTickers + pair_template: null + params: null + response: + type: dict + values: + currency_pair: + type: dict + values: + price: + type: float + ask: + type: float + bid: + type: float + coinVol: + type: float + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - dict_values + - price + type: + - float + - key: time + path: [] + type: + - none + - now + - key: best_bid + path: + - dict_values + - bid + type: + - float + - key: best_ask + path: + - dict_values + - ask + type: + - float + - key: daily_volume + path: + - dict_values + - coinVol + type: + - float + + historic_rates: + request: + template: /data/api/v1/getKLine + pair_template: + template: "{first}_{second}" + lower_case: true + alias: market + params: + type: + allowed: + minutes: 1min + hours: 1hour + days: 1day + weeks: 7day + months: 30day + default: 1day + since: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1000 + response: + type: dict + values: + datas: + type: list + values: + type: list + values: + 0: #time + type: int + 1: #open + type: float + 2: #high + type: float + 3: #low + type: float + 4: #close + type: float + 5: #vol + type: float + 6: #turnover + type: float + + mapping: + - key: time + path: + - datas + - 0 + type: + - float + - from_timestamp + - 0 + - key: open + path: + - datas + - 1 + type: + - float + - key: high + path: + - datas + - 2 + type: + - float + - key: low + path: + - datas + - 3 + type: + - float + - key: close + path: + - datas + - 4 + type: + - float + - key: volume + path: + - datas + - 5 + type: + - float + + + trades: + request: + template: /data/api/v1/getTrades + pair_template: + template: "{first}_{second}" + lower_case: true + alias: market + params: null + + response: + type: list + values: + type: list + values: + 0: #time + type: int + 1: #price + type: float + 2: #quantity + type: float + 3: # directoin + type: str + 4: #id + type: int + + mapping: + - key: time + path: + - [] + - 0 + type: + - float + - from_timestamp + - 1 + - key: id + path: + - [] + - 4 + type: + - int + - key: direction + path: + - [] + - 3 + type: + - value + - map + - bid + - buy + - ask + - sell + - key: price + path: + - [] + - 1 + type: + - float + - key: amount + path: + - [] + - 2 + type: + - float + + order_books: + request: + template: /data/api/v1/getDepth + pair_template: + template: "{first}_{second}" + lower_case: true + alias: market + params: null + + response: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: #price + type: float + 1: #quantity + type: float + bids: + type: list + values: + type: list + values: + 0: #price + type: float + 1: #quantity + type: float + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - float + - key: bids_price + path: + - bids + - 0 + type: + - float + - key: asks_amount + path: + - asks + - 1 + type: + - float + - key: asks_price + path: + - asks + - 0 + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/xtheta_global.yaml b/pandas_datareader/crypto/resources/running_exchanges/xtheta_global.yaml new file mode 100644 index 00000000..c336d4ad --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/xtheta_global.yaml @@ -0,0 +1,303 @@ +name: xtheta_global +is_exchange: true + +api_url: https://api.xthetaglobal.com/ +rate_limit: + max: 1500 + unit: 60 + +requests: + currency_pairs: + request: + template: openapi/v1/brokerInfo + pair_template: null + params: null + + response: + type: dict + values: + symbols: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + + mapping: + - key: currency_pair_first + path: + - symbols + - baseAsset + type: + - str + - key: currency_pair_second + path: + - symbols + - quoteAsset + type: + - str + + tickers: + request: + template: openapi/quote/v1/ticker/price + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: null + + response: + type: dict + values: + symbol: + type: str + price: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - price + type: + - str + - float + + order_books: + request: + template: openapi/quote/v1/depth + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 100 + default: 100 + response: + type: dict + values: + time: + type: int + bids: + type: list + values: + type: list + 0: #price + type: str + 1: #qty + type: str + asks: + type: list + values: + type: list + 0: + type: str + 1: + type: str + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - time + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + + trades: + request: + template: openapi/quote/v1/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 1000 + default: 500 + response: + type: list + value: + type: dict + values: + price: + type: str + qty: + typ: str + time: + type: int + isBuyerMaker: + type: bool + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - True + - sell + - False + - buy + - key: id + path: + - time + type: + - int + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + + historic_rates: + request: + template: openapi/quote/v1/klines + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + default: 1d + limit: + type: int + max: 1000 + default: 1000 + endTime: + function: last_timestamp + type: + - datetime + - timestampms + + response: + type: list + values: + type: list + values: + 0: #timestamp + type: int + 1: #open + type: str + 2: #high + type: str + 3: #low + type: str + 4: #close + type: str + 5: #volume + type: str + 6: #close time + type: int + 7: # quote Asset volume + type: str + 8: # number of trades + type: int + 9: # taker buy base asset volume + type: str + 10: # taker buy quote asset volume + type: str + + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/yobit.yaml b/pandas_datareader/crypto/resources/running_exchanges/yobit.yaml new file mode 100644 index 00000000..7a3aa4dd --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/yobit.yaml @@ -0,0 +1,265 @@ +name: yobit + +api_url: https://yobit.net/api/3/ +rate_limit: + max: 30 + unit: 60 +requests: + currency_pairs: + request: + template: info/ + pair_template: null + params: null + response: + type: dict + values: + server_time: + type: + - int + pairs: + type: dict + values: + currency_pair: # e.g. ltc_btc; each available currency_pair, variable key + type: dict + values: + decimal_places: + type: int + min_price: + type: float + max_price: + type: float + min_amount: + type: float + hidden: + type: int + fee: + type: float + mapping: + - key: currency_pair_first + path: + - pairs + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - pairs + - dict_key + type: + - str + - split + - "_" + - 1 + + tickers: + request: + template: ticker/{currency_pair}/ + pair_template: # e.g. ltc_btc + template: "{first}_{second}" + lower_case: true + params: null + response: + type: dict + values: + currency_pair: # requested currency pair + type: dict + values: + high: + type: float + low: + type: float + avg: + type: float + vol: + type: float + vol_cur: + type: float + last: + type: float + buy: + type: float + sell: + type: float + updated: + type: + - int + mapping: + - key: daily_volume + path: + - dict_values + - vol + type: + - float + - key: last_price + path: + - dict_values + - last + type: + - float + - key: best_bid + path: + - dict_values + - buy + type: + - float + - key: best_ask + path: + - dict_values + - sell + type: + - float + - key: time + path: + - dict_values + - updated + type: + - float + - from_timestamp + - 0 + + order_books: + request: + template: depth/{currency_pair}/ + pair_template: # e.g. ltc_btc + template: "{first}_{second}" + lower_case: true + params: + limit: + type: int + max: 2000 + default: 150 + response: + type: dict + values: + currency_pair: # requested currency pair + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: # price + type: float + 1: # size + type: float + bids: + type: list + values: + type: list + values: + 0: # price + type: float + 1: # size + type: float + mapping: + - key: time + path: [] + type: + - none + - now + - key: position + path: [] + type: + - none + - range + - key: id + path: [] + type: + - none + - now_timestamp + - key: asks_price + path: + - dict_values + - asks + - 0 + type: + - float + - key: asks_amount + path: + - dict_values + - asks + - 1 + type: + - float + - key: bids_price + path: + - dict_values + - bids + - 0 + type: + - float + - key: bids_amount + path: + - dict_values + - bids + - 1 + type: + - float + + trades: + request: + template: trades/{currency_pair}/ + pair_template: # e.g. ltc_btc + template: "{first}_{second}" + lower_case: true + params: + limit: + type: int + max: 2000 + default: 150 + response: + type: dict + values: + currency_pair: # requested currency pair + type: list + values: + type: dict + values: + type: + type: str + price: + type: float + amount: + type: float + tid: + type: int + timestamp: + type: + - int + mapping: + - key: direction + path: + - dict_values + - type + type: + - str + - key: price + path: + - dict_values + - price + type: + - float + - key: amount + path: + - dict_values + - amount + type: + - float + - key: time + path: + - dict_values + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - dict_values + - tid + type: + - int diff --git a/pandas_datareader/crypto/resources/running_exchanges/zaif.yaml b/pandas_datareader/crypto/resources/running_exchanges/zaif.yaml new file mode 100644 index 00000000..9c7d3fe2 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/zaif.yaml @@ -0,0 +1,210 @@ +name: zaif +is_exchange: true +api_url: https://api.zaif.jp/api/1/ + +rate_limit: null +requests: + currency_pairs: + request: + template: currency_pairs/all + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + title: + type: str + name: + type: str + mapping: + - key: currency_pair_first + path: + - name + type: + - str + - split + - "/" + - 0 + - key: currency_pair_second + path: + - name + type: + - str + - split + - "/" + - 1 + + tickers: + request: + template: ticker/{currency_pair} + pair_template: + template: "{first}_{second}" + lower_case: true + alias: null + params: null + response: + type: dict + values: + last: + type: float + high: + type: float + low: + type: float + vwap: + type: float + volume: + type: float + bid: + type: float + ask: + type: float + + mapping: + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - last + type: + - float + - key: best_bid + path: + - bid + type: + - float + - key: best_ask + path: + - ask + type: + - float + + trades: + request: + template: trades/{currency_pair} + pair_template: + template: "{first}_{second}" + lower_case: true + alias: null + params: null + response: + type: list + values: + type: dict + values: + date: + type: int + price: + type: float + amount: + type: float + tid: + type: int + currency_pair: + type: str + trade_type: + type: str + mapping: + - key: time + path: + - date + type: + - float + - from_timestamp + - 0 + - key: id + path: + - tid + type: + - int + - key: direction + path: + - trade_type + type: + - str + - key: price + path: + - price + type: + - float + - key: amount + path: + - amount + type: + - float + + order_books: + request: + template: depth/{currency_pair} + pair_template: + template: "{first}_{second}" + lower_case: true + alias: null + params: null + response: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: + type: flaot + 1: + type: float + bids: + type: list + values: + type: list + values: + 0: + type: float + 1: + type: float + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - float + - key: bids_price + path: + - bids + - 0 + type: + - float + - key: asks_price + path: + - asks + - 0 + type: + - float + - key: asks_amount + path: + - asks + - 1 + type: + - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/zb.yaml b/pandas_datareader/crypto/resources/running_exchanges/zb.yaml new file mode 100644 index 00000000..dd56aa37 --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/zb.yaml @@ -0,0 +1,322 @@ +name: zb +is_exchange: true +api_docs: https://www.zb.com/en/api +api_url: http://api.zb.land/ +rate_limit: + max: 60 + unit: 60 + +requests: + currency_pairs: + request: + template: data/v1/markets + pair_template: null + params: null + + response: + type: dict + values: + currency_pair: + type: dict + values: + priceScale: + type: int + + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + + tickers: + request: + template: data/v1/ticker + pair_template: + template: "{first}_{second}" + lower_case: true + alias: market + params: null + + response: + type: dict + values: + date: + type: int + ticker: + type: dict + values: + vol: + type: str + last: + type: str + buy: + type: str + sell: + type: str + mapping: + - key: time + path: + - date + type: + - str + - float + - from_timestamp + - 1 + - key: last_price + path: + - ticker + - last + type: + - str + - float + - key: best_ask + path: + - ticker + - sell + type: + - str + - float + - key: best_bid + path: + - ticker + - buy + type: + - str + - float + - key: daily_volume + path: + - ticker + - vol + type: + - str + - float + + + order_books: + request: + template: data/v1/depth + pair_template: + template: "{first}_{second}" + lower_case: true + alias: market + params: + size: + type: int + max: 50 + default: 50 + response: + type: dict + values: + timestamp: + type: int + bids: + type: list + values: + type: list + 0: #price + type: float + 1: #qty + type: float + asks: + type: list + values: + type: list + 0: + type: float + 1: + type: float + mapping: + - key: timestamp + path: + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - timestamp + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bids + - 0 + type: + - float + - key: bids_amount + path: + - bids + - 1 + type: + - float + - key: asks_price + path: + - asks + - 0 + type: + - float + - key: asks_amount + path: + - asks + - 1 + type: + - float + + trades: + request: + template: data/v1/trades + pair_template: + template: "{first}_{second}" + lower_case: true + alias: market + params: null + response: + type: list + value: + type: dict + values: + price: + type: str + amount: + typ: str + date: + type: int + type: + type: str + tid: + type: int + mapping: + - key: time + path: + - date + type: + - float + - from_timestamp + - 0 + - key: direction + path: + - type + type: + - str + - key: id + path: + - tid + type: + - int + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - amount + type: + - str + - float + + historic_rates: + request: + template: data/v1/kline + pair_template: + template: "{first}_{second}" + lower_case: true + alias: market + params: + type: + allowed: + minutes: 1min + days: 1day + hours: 1hour + weeks: 1week + default: 1day + since: + function: last_timestamp + type: + - datetime + - timedeltams + - interval + - 1000 + limit: + type: int + max: 1000 + default: 1000 + + + response: + type: dict + values: + data: + type: list + values: + 0: #timestamp + type: int + 1: #open + type: float + 2: #high + type: float + 3: #low + type: float + 4: #close + type: float + 5: #volume + type: float + + mapping: + - key: time + path: + - data + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - data + - 1 + type: + - float + - key: high + path: + - data + - 2 + type: + - float + - key: low + path: + - data + - 3 + type: + - float + - key: close + path: + - data + - 4 + type: + - float + - key: volume + path: + - data + - 5 + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/zbg.yaml b/pandas_datareader/crypto/resources/running_exchanges/zbg.yaml new file mode 100644 index 00000000..80e3cbcc --- /dev/null +++ b/pandas_datareader/crypto/resources/running_exchanges/zbg.yaml @@ -0,0 +1,405 @@ +# Trade direction is available but not certain what is meant... +name: zbg +exchange: true +api_url: https://kline.zbg.com/ + +rate_limit: + max: 1000 + unit: 60 + +requests: + currency_pairs: + request: + template: /exchange/api/v1/common/symbols + pair_template: null + params: null + + response: + type: dict + values: + datas: + type: list + values: + type: dict + values: + symbol: + type: str + base-currency: + type: str + quote-currency: + type: str + + mapping: + - key: currency_pair_first + path: + - datas + - base-currency + type: + - str + - key: currency_pair_second + path: + - datas + - quote-currency + type: + - str + + + tickers: + request: + template: api/data/v1/tickers + pair_template: null + params: + isUseMarketName: + type: str + default: true + response: + type: dict + values: + datas: + type: dict + values: + currency_pair: + type: list + values: + 0: #marketId + type: str + 1: #last price + type: str + 2: #highest price + type: str + 3: #lowest + type: str + 4: #24h volume + type: str + 5: #24h change + type: str + 6: # + type: str + 7: #top buying price + type: str + 8: #top selling price + type: str + 9: #24h volume in unit of buyers currency + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: currency_pair_first + path: + - datas + - list_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - datas + - list_key + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - datas + - list_values + - 1 + type: + - str + - float + - key: daily_volume + path: + - datas + - list_values + - 4 + type: + - str + - float + - key: best_bid + path: + - datas + - list_values + - 7 + type: + - str + - float + - key: best_ask + path: + - datas + - list_values + - 8 + type: + - str + - float + + + historic_rates: + request: + template: api/data/v1/klines + pair_template: + template: "{first}_{second}" + lower_case: false + alias: marketName + params: + type: + allowed: + minutes: 1M + hours: 1H + days: 1D + weeks: 1W + default: 1D + dataSize: + type: int + default: 10000 + + response: + type: dict + values: + datas: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + 2: # pair + type: str + 3: # time + type: str + 4: # open + type: str + 5: # high + type: str + 6: # low + type: str + 7: # close + type: str + 8: # base volume + type: str + 13: # quote volume + type: str + mapping: + - key: time + path: + - datas + - 3 + type: + - str + - float + - from_timestamp + - 0 + - key: open + path: + - datas + - 4 + type: + - str + - float + - key: high + path: + - datas + - 5 + type: + - str + - float + - key: low + path: + - datas + - 6 + type: + - str + - float + - key: close + path: + - datas + - 7 + type: + - str + - float + - key: volume + path: + - datas + - 8 + type: + - str + - float + + trades: + request: + template: /api/data/v1/trades + pair_template: + template: "{first}_{second}" + lower_case: false + alias: marketName + params: + dataSize: + type: int + max: 1000 + default: 1000 + + response: + type: dict + values: + datas: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + 2: # time + type: str + 3: # pair + type: str + 4: # direction + type: str + 5: # price + type: str + 6: # qty + type: str + mapping: + - key: id + path: + - datas + - 2 + type: + - str + - int + - key: time + path: + - datas + - 2 + type: + - str + - float + - from_timestamp + - 0 + - key: price + path: + - datas + - 5 + type: + - str + - float + - key: amount + path: + - datas + - 6 + type: + - str + - float +# - key: direction # not certain what bid and ask for a direction is +# path: +# - datas +# - 4 +# type: +# - map +# - values +# - bid +# - sell +# - ask +# - buy + + order_books: + request: + template: api/data/v1/entrusts + pair_template: + template: "{first}_{second}" + lower_case: false + alias: marketName + params: + dataSize: + type: int + max: 200 + default: 50 + + response: + type: dict + values: + datas: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + bids: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + timestamp: + type: str + mapping: + - key: id + path: + - datas + - timestamp + type: + - str + - int + - key: position + path: [] + type: + - none + - range + - key: time + path: + - datas + - timestamp + type: + - str + - float + - from_timestamp + - 0 + - key: bids_amount + path: + - datas + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - datas + - bids + - 0 + type: + - str + - float + - key: asks_price + path: + - datas + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - datas + - asks + - 1 + type: + - str + - float diff --git a/pandas_datareader/crypto/time_helper.py b/pandas_datareader/crypto/time_helper.py new file mode 100644 index 00000000..e89b4c50 --- /dev/null +++ b/pandas_datareader/crypto/time_helper.py @@ -0,0 +1,131 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Contains helper classes to manage dates and times. + +Classes: +- TimeHelper: Used to create/convert timezone aware (UTC+0) dates and times. + +Enums: +- TimeUnit: Used to indicate the unit of timestamps. +""" + +from datetime import datetime, timezone +from enum import IntEnum + +from datetime_periods import period +from dateutil.parser import parse + + +class TimeUnit(IntEnum): + """ + An enumeration to indicate the unit of timestamps. + """ + SECONDS = 0 + MILLISECONDS = 1 + MICROSECONDS = 2 + NANOSECONDS = 3 + + +class TimeHelper: + """ + A helper class to create/convert dates and times. + + It ensures that all dates and times are timezone aware (UTC+0). + + freq_map is used to convert specific strings from plural into singular. + """ + freq_map = { + "minutes": "minute", + "hours": "hour", + "days": "day", + "weeks": "week", + "months": "month" + } + + @staticmethod + def now() -> datetime: + """ + Get the current datetime (UTC+0). + + The accuracy is limited to milliseconds and the remaining microseconds are cleared. + + @return: The current datetime (UTC+0). + @rtype: datetime + """ + now = datetime.now(tz=timezone.utc) + return now.replace(microsecond=now.microsecond - now.microsecond % 1000) + + @staticmethod + def now_timestamp(unit: TimeUnit = TimeUnit.SECONDS) -> float: + """ + Get the timestamp of the current datetime (UTC+0). + + @param unit: The desired time unit of the timestamp. + @type unit: TimeUnit + + @return: The timestamp of the current datetime (UTC+0). + @rtype: float + """ + return TimeHelper.to_timestamp(TimeHelper.now(), unit) + + @staticmethod + def from_string(representation: str) -> datetime: + """ + Get a datetime (UTC+0) from a given representation. + + @param representation: The string that represents a datetime. + @type representation: str + + @return: The datetime (UTC+0) of the given representation. + @rtype: datetime + """ + return parse(representation).replace(tzinfo=timezone.utc) + + @staticmethod + def from_timestamp(timestamp: float, unit: TimeUnit = TimeUnit.SECONDS) -> datetime: + """ + Get a datetime (UTC+0) from a given timestamp. + + @param timestamp: The timestamp whose datetime is to be obtained. + @type timestamp: float + @param unit: The time unit in which the timestamp is given. + @type unit: TimeUnit + + @return: The datetime (UTC+0) of the given timestamp. + @rtype: datetime + """ + timestamp_in_sec: float = timestamp / (1000 ** int(unit)) + return datetime.fromtimestamp(timestamp_in_sec, tz=timezone.utc) + + @staticmethod + def to_timestamp(date_time: datetime, unit: TimeUnit = TimeUnit.SECONDS) -> float: + """ + Convert a datetime to a timestamp. + + @param date_time: The datetime to be converted. + @type date_time: datetime + @param unit: The desired time unit of the timestamp. + @type unit: TimeUnit + + @return: The timestamp of the given datetime in the desired time unit. + @rtype: float + """ + return date_time.replace(tzinfo=timezone.utc).timestamp() * (1000 ** int(unit)) + + @staticmethod + def start_end_conversion(date_time: datetime, frequency: str, to_end: bool = True) -> datetime: + """ + Returns the beginning/end of a period. + + @param date_time: The datetime object to be converted. + @type date_time: datetime + @param frequency: The underlying period frequency. + @type frequency: str + @param to_end: boolean, return end of period. Default: True + @type to_end: bool + + @return: datetime of start/end of period. + @rtype: datetime + """ + return period(date_time, TimeHelper.freq_map[frequency])[int(to_end)] diff --git a/pandas_datareader/crypto/utilities.py b/pandas_datareader/crypto/utilities.py new file mode 100644 index 00000000..93ee6edf --- /dev/null +++ b/pandas_datareader/crypto/utilities.py @@ -0,0 +1,460 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Module providing several utility functions needed across the whole program. + +Functions: + - TYPE_CONVERSION: Dict providing functions for type conversions. + - COMPARATOR: Dict providing function for comparison. + - read_config: Function reading the config-file. + - yaml_loader: Function for loading yaml-files. + - load_program_config: Function loading the program configuration. + - provide_ssl_context: Function providing an SSL-context if none is available. + - get_exchange_names: Function returning all exchanges. + - replace_list_item: Function replacing a specific item from a list. + - get_all_exchanges_and_methods: Function returning all exchanges and supported request methods. + - prepend_spaces_to_columns: Function prepending spaces to columns for readability. + - handler: Exception handler logging uncaught exceptions. + - signal_handler: Function recognizing kill signals and raising SystemExit. + - init_logger: Function initializing the global logger. +""" +import calendar +import datetime +import logging +import os +from datetime import timedelta +from typing import Any, Optional, Dict, List, Union + +import dateutil.parser +import yaml +import pandas as pd + + +from pandas_datareader.crypto.time_helper import TimeHelper, TimeUnit +import pandas_datareader.crypto._paths as _paths + +TYPE_CONVERSIONS = { + ("float", "from_timestamp"): { + "function": TimeHelper.from_timestamp, + "params": 1 + }, + ("bool", "int"): { + "function": int, + "params": 0 + }, + ("float", "int"): { + "function": int, + "params": 0 + }, + ("int", "bool"): { + "function": bool, + "params": 0 + }, + ("int", "div"): { + "function": lambda integer, div: integer / (1 * div), + "params": 1 + }, + ("any", "value"): { + "function": lambda number: float(number) > 0, + "params": 0 + }, + ("str", "bool"): { + "function": lambda string: string.lower() == "true", + "params": 0 + }, + ("str", "int"): { + "function": int, + "params": 0 + }, + ("str", "float"): { + "function": float, + "params": 0 + }, + ("str", "float_absolut"): { + "function": lambda string: abs(float(string)), + "params": 0 + }, + ("str", "floatNA"): { + "function": lambda string: float(string) if string != "N/A" else None, + "params": 0 + }, + ("str", "strptime"): { + "function": lambda string, *args: datetime.datetime.strptime(string, args[0]), + "params": 1 + }, + ("strptime_w_f", "strptime_wo_f"): { + "function": lambda string, *args: datetime.datetime.strptime(string.split(".")[0], *args), + "params": 1 + }, + ("str", "split"): { + "function": lambda string, *args: string.split(args[0])[args[1]] if args[0] in string else None, + "params": 2 + }, + ("str", "splitupper"): { + "function": lambda string, *args: string.split(args[0])[args[1]].upper(), + "params": 2 + }, + ("str", "slice"): { + "function": lambda string, *args: string[args[0]:args[1]], + "params": 2 + }, + ("str", "upper"): { + "function": lambda string: string.upper(), + "params": 0 + }, + ("str", "lower"): { + "function": lambda string: string.lower(), + "params": 0 + }, + ("str", "dateparser"): { + "function": dateutil.parser.parse, + "params": 0 + }, + ("datetime", "strftime"): { + "function": lambda time, *args: datetime.datetime.strftime(time, args[0]), + "params": 1 + }, + ("dateparser", "totimestamp"): { + "function": lambda time: int(time.timestamp()), + "params": 0 + }, + ("datetime", "totimestamp"): { + "function": lambda time: int(time.timestamp()), + "params": 0 + }, + ("datetime", "totimestampms"): { + "function": lambda time: int(round(time.timestamp() * 1000)), + "params": 0 + }, + ("datetime", "utctotimestamp"): { + "function": lambda time: calendar.timegm(time.utctimetuple()), + "params": 0 + }, + ("strptime", "totimestamp"): { + "function": lambda string, *args: int(datetime.datetime.timestamp(datetime.datetime.strptime(string, args[0]))), + "params": 1 + }, + ("none", "nowstrptime"): { + "function": lambda arg: TimeHelper.now().replace(hour=0, minute=0, second=0, microsecond=0), + "params": 0 + }, + ("none", "now"): { + "function": TimeHelper.now, + "params": 0 + }, + ("none", "now_format"): { + "function": lambda spec: format(TimeHelper.now(), spec), + "params": 1 + }, + ("none", "constant"): { # Returns the first argument + "function": lambda *args: args[0], + "params": 1 + }, + ("none", "range"): { + "function": lambda: range(1), + "params": 0 + }, + ("value", "map"): { + # translate into buy/sell. Args: {0: 'buy', 1:'sell'} and arg[0] is the response value (i.e. 0/1) + "function": lambda *args: {args[1]: args[2], args[3]: args[4]}[args[0]], + "params": 4 + }, + ("str", "split_at_del_or_index"): { + "function": lambda string, *args: string.split(args[0])[args[2]] if len(string) != len( + string.split(args[0])[0]) else string[:args[1]] if args[2] == 0 else string[args[1]:], + "params": 3 # delimiter, index, 0 or 1 aka. left or right + }, + ("none", "now_timestamp"): { + "function": lambda: int(TimeHelper.now_timestamp()), + "params": 0 + }, + ("none", "now_timestampms"): { + "function": lambda: int(TimeHelper.now_timestamp(TimeUnit.MILLISECONDS)), + "params": 0 + }, + ("now", "timedelta"): { + "function": lambda delta: int(TimeHelper.to_timestamp(TimeHelper.now() - timedelta(days=int(delta)))), + "params": 1 + }, + ("datetime", "timedelta"): { + "function": lambda time, interval, delta: int( + TimeHelper.to_timestamp(time - timedelta(**{interval: int(delta)}))), + "params": 2 + }, + ("utcfromtimestamp", "timedelta"): { + "function": lambda time, interval, value: TimeHelper.from_timestamp(time) - timedelta( + **{interval: value}) if + isinstance(time, int) else dateutil.parser.parse(time) - timedelta(**{interval: value}), + "params": 2 + }, + ("datetime", "timedeltams"): { + "function": lambda time, interval, delta: int( + TimeHelper.to_timestamp(time - timedelta(**{interval: int(delta)}))) * 1000, + "params": 2 + }, + ("datetime", "timestamp"): { + "function": lambda time: int(TimeHelper.to_timestamp(time)), + "params": 0 + }, + ("datetime", "timestampms"): { + "function": lambda time: int(TimeHelper.to_timestamp(time)) * 1000, + "params": 0 + }, + ("datetime", "format"): { + "function": format, + "params": 1 + }, + ("timedelta", "from_timestamp"): { + "function": lambda time, unit, spec: format(TimeHelper.from_timestamp(time, unit), spec), + "params": 2 + }, + ("from_timestamp", "to_start"): { + "function": lambda time, interval: TimeHelper.start_end_conversion(time, interval, False), + "params": 1 + }, + ("from_timestamp", "to_end"): { + "function": lambda time, interval: TimeHelper.start_end_conversion(time, interval, True), + "params": 1 + } +} +""" + Type Conversions used to convert extracted values from the API-Response into the desired type ("first", "second"). + The values are specified in the .yaml-file of each exchange under the "mapping" of each method. + The function is called in the Mapping Class of utilities.py under the method convert_types(). + + "first": + The actual type extracted from the API-Request (.json) + "second": + The desired type to convert + "function": + the actual function to apply + "params": + the number of additional parameters needed +""" + +COMPARATOR = {"equal": lambda x, y: x == y, + "lower": lambda x, y: x < y, + "lower_or_equal": lambda x, y: x <= y, + "equal_or_lower": lambda x, y: x <= y, + "higher": lambda x, y: x > y, + "higher_or_equal": lambda x, y: x >= y, + "equal_or_higher": lambda x, y: x >= y} +""" +Dict providing basic compare functionality. +""" + + +def read_config(file: Optional[str] = None, + section: Optional[str] = None, + reset: bool = False) -> Dict[str, Any]: + """ + @param file: Name of the config file. + @type file: str + @param section: Name of the section the information is stored in. + @type section: str + @param reset: Reset global config file to None. + @type reset: bool + + @return: Parameters for the program as a dictionary. + Keys are the names of the parameters in the config-file. + @rtype: dict[str, Any] + + @raise KeyError: If the section does not exist in the config. + """ + if reset and not file: + GlobalConfig().set_file() + + if file: + GlobalConfig().set_file(file) + + while True: + try: + filename = GlobalConfig().file + config_yaml = open(filename, encoding="UTF-8") + break + except FileNotFoundError: + try: + available_files = os.listdir(os.path.dirname(filename)) + available_files = [file for file in available_files if not + os.path.isdir(os.path.join(os.path.dirname(filename), file))] + print(f"File not found. Retry! \nAvailable file(s): {', '.join(available_files)}") + except FileNotFoundError: + print("File not found. Retry!") + finally: + GlobalConfig().set_file() + + + config_dict = yaml.load(config_yaml, Loader=yaml.FullLoader) + config_yaml.close() + + if section is None: + return config_dict + + for general_section in config_dict.keys(): + if section == general_section: + return config_dict[general_section] + + for nested_section in config_dict[general_section].keys(): + if section == nested_section: + return config_dict[general_section][nested_section] + + raise KeyError() + + +def yaml_loader(exchange: str, path: str = None) -> Dict[str, Any]: + """ + Loads, reads and returns the data of a .yaml-file specified by the param exchange. + + @param exchange: The file name to load (exchange). + @type exchange: str + + @param path: path to the yaml-files + @type path: str + + @return: Returns a dict of the loaded data from the .yaml-file. + @rtype: dict + + @raise Exception: If the .yaml file could not be evaluated for a given exchange. + """ + exchange = exchange.replace(" ", "") + + path = _paths.all_paths.get("yaml_path") + + try: + with open(path.joinpath(".".join([exchange.lower(), "yaml"])), "r", encoding="UTF-8") as file: + return yaml.load(file, Loader=yaml.FullLoader) + + except FileNotFoundError as error: + print(f"\nFile {path.joinpath('.'.join([exchange.lower(), 'yaml']))} not found.") + # logging.exception("Error loading yaml of %s.\n", exchange) + # raise SystemExit from error + + # except Exception as error: + # print(f"\nError loading yaml of {exchange}. ") + # logging.exception("Error loading yaml of %s.\n", exchange) + # raise SystemExit from error + + +# def load_program_config(return_path: bool = False) -> Union[str, Dict]: +# """ +# Loads the program configuration from a predefined directory. If the file is not found, it will return +# the template with default settings. +# @return: Program config. +# @rtype: dict +# """ +# path = _paths.all_paths.get("program_config_path") +# +# if return_path: +# return path +# +# try: +# with open(path, "r", encoding="UTF-8") as file: +# return yaml.load(file, Loader=yaml.FullLoader) +# +# except FileNotFoundError: +# path = "resources/templates/program_config.yaml" +# with open(path, "r", encoding="UTF-8") as file: +# return yaml.load(file, Loader=yaml.FullLoader) +# +# +# def get_exchange_names(yaml_path: str = None) -> Optional[List[str]]: +# """ +# Gives information about all exchange that the program will send +# requests to. This means if the name of a exchange is not part of the +# list that is returned, the program will not send any request to said +# exchange. +# @param: yaml-path +# @type yaml_path: str +# @return: Names from all the exchange, which have a .yaml-file in +# the directory described in YAML_PATH. +# @rtype: list[str] +# """ +# if not yaml_path: +# yaml_path = _paths.all_paths.get("yaml_path") +# path_to_resources = Path.joinpath(_paths.all_paths.get("path_absolut"), Path(yaml_path)) +# +# try: +# exchanges = os.listdir(path_to_resources) +# exchanges = [x.split(".yaml")[0] for x in exchanges if x.endswith(".yaml")] +# exchanges.sort() +# except FileNotFoundError: +# print(f"YAML files not found. The path {path_to_resources} is incorrect.") +# logging.error("Exchange YAML-files not found. Path %s seems incorrect.", path_to_resources) +# return +# +# return exchanges + + + +def replace_list_item(replace_list: list, condition: str, value: str) -> list: + """ + Replaces a specific value from a list. + @param replace_list: The list in which the value needs to be replaced + @param condition: The value to be updated + @param value: The new value + @return: Updated list + """ + for i, item in enumerate(replace_list): + if item == condition: + replace_list[i] = value + return replace_list + + +# def get_all_exchanges_and_methods() -> Dict[str, dict]: +# """ +# Returns the exchange names and all supported methods. +# @return: List of exchanges with supported request methods. +# @rtype: list +# """ +# result_dict = dict() +# yaml_path = _paths.all_paths.get("yaml_path") +# +# exchanges = get_exchange_names(yaml_path=yaml_path) +# for exchange in exchanges: +# file = yaml_loader(exchange, path=yaml_path) +# result_dict.update({exchange: {method: True for method in list(file.get("requests").keys())}}) +# +# return result_dict + + +def prepend_spaces_to_columns(dataframe: pd.DataFrame, space_count: int = 3) -> pd.DataFrame: + """ + Adds spaced between pd.DataFrame columns for easy readability. + @param dataframe: Dataframe to append spaced to + @type: pd.DataFrame + @param space_count: Number of spaces + @type: int + @return: DataFrame with appended spaced. + @rtype: pd.DataFrame + """ + dataframe.replace(pd.NA, False, inplace=True) + spaces = " " * space_count + + # ensure every column name has the leading spaces: + if isinstance(dataframe.columns, pd.MultiIndex): + for i in range(dataframe.columns.nlevels): + level_new = [spaces + str(s) for s in dataframe.columns.levels[i]] + dataframe.columns.set_levels(level_new, level=i, inplace=True) + else: + dataframe.columns = spaces + dataframe.columns + + # ensure every element has the leading spaces: + dataframe = dataframe.astype(str) + dataframe = spaces + dataframe + return dataframe + + + +def split_str_to_list(string: str, splitter: str = ",") -> List[str]: + """ + Splits a string into a list of string. + + @param string: A long string. + @param splitter: The splitting parameter. + + @return: List of strings. + """ + items = string.rsplit(splitter) + + # remove possible blanks from strings + return [item.replace(" ", "") for item in items] diff --git a/pandas_datareader/crypto_reader.py b/pandas_datareader/crypto_reader.py new file mode 100644 index 00000000..31561178 --- /dev/null +++ b/pandas_datareader/crypto_reader.py @@ -0,0 +1,136 @@ +import sys +from typing import Dict + +from sys import stdout +import pandas as pd +import time +import pytz + +from pandas_datareader.crypto.exchange import Exchange +from pandas_datareader.crypto.utilities import split_str_to_list + + +class CryptoReader(Exchange): + """ Class to request the data from a given exchange for a given currency-pair. + The class inherits from Exchange to extract and format the request urls, as well as to + extract and format the values from the response json. The requests are performed by + the _BaseReader. + """ + + def __init__(self, exchange_name: str, symbols, interval: str = 'minutes', **kwargs): + """ Constructor. + + @param exchange_name: String repr of the exchange name + @param symbols: Currency pair to request (i.e. BTC-USD) + @param interval: Candle interval (i.e. minutes, hours, days, weeks, months) + @param kwargs: Additional arguments for the _BaseReader class. + """ + + super(CryptoReader, self).__init__(exchange_name, symbols, interval, **kwargs) + + def await_rate_limit(self): + """ Sleep in order to not violate the rate limit.""" + + time.sleep(self.rate_limit) + + @staticmethod + def sort_columns(dataframe: pd.DataFrame) -> pd.DataFrame: + """ Sort columns in OHLCV order. + + @param dataframe: Requested data with unordered columns + @return: pd.DataFrame with ordered columns + """ + + columns = {'open', 'high', 'low', 'close', 'volume', 'market_cap'} + columns = list(columns.intersection(set(dataframe.columns))) + return dataframe.loc[columns, :] + + @staticmethod + def print_timestamp(timestamp): + """ Prints the actual request timestamp. + + @param timestamp: The timestamp + """ + stdout.write("Requesting from: \r{}".format(timestamp)) + stdout.flush() + + def index_and_cut_dataframe(self, dataframe: pd.DataFrame) -> pd.DataFrame: + """ Set index and cut data according to user specification. + + @param dataframe: Requested raw data + @return: pd.DataFrame with specified length and proper index. + """ + + dataframe.set_index("time", inplace=True) + dataframe.sort_index(inplace=True) + dataframe = dataframe.loc[pytz.utc.localize(self.start): pytz.utc.localize(self.end)] + + return dataframe + + def _get_data(self) -> Dict: + """ Requests the data and returns the response json. + + @return: Response json + """ + # Ensure that the currency-pairs are seperated in a list + if isinstance(self.symbols, str): + self.symbols = split_str_to_list(self.symbols) + self.symbols = dict.fromkeys(self.symbols, self.end) + + # Extract and format the url and parameters for the request + param_dict = self.extract_request_urls(self.symbols) + url, params = self.get_formatted_url_and_params(param_dict, *self.symbols.keys()) + + # Perform the request + self.print_timestamp(list(self.symbols.values())[0]) + resp = self._get_response(url, params=params, headers=None) + + # Await the rate-limit to avoid ip ban. + self.await_rate_limit() + return resp.json() + + def request(self, new_symbols: str = None) -> pd.DataFrame: + """ Requests and extracts the data. Requests may be performed iteratively over time + to collect the full time-series. + + @param new_symbols: New currency-pair to request, if they differ from the constructor. + @return df: pd.DataFrame of the returned data. + """ + + if new_symbols: + if isinstance(new_symbols, str): + new_symbols = split_str_to_list(new_symbols) + self.symbols = dict.fromkeys(new_symbols, self.end) + + result = list() + # Repeat until no "older" timestamp is delivered. Cryptocurrency exchanges often restrict the amount of + # data points returned by a single request, thus making it necessary to iterate backwards in time and merge + # the retrieved data. + while True: + resp = self._get_data() + data, mappings = self.format_data(resp) + if not data: + break + # Append new data to the result list + result = result + data + + # Find the place in the mapping list for the key "time". + for counter, value in enumerate(mappings): + if value == 'time': + break + + # Extract the minimum timestamp from the response to continue requesting with. + new_time = min(item[counter] for item in data) + + # Break the requesting if condition is fulfilled + if new_time.timestamp() <= self.start.timestamp(): + break + # Or continue requesting from the new timestamp. + else: + self.symbols.update({list(self.symbols.keys())[0]: new_time}) + + # Move cursor to the next line to ensure that new print statements are executed correctly. + stdout.write("\n") + if result: + result = pd.DataFrame(result, columns=mappings) + return self.index_and_cut_dataframe(result) From 1996f5652707fb1651ef0237459139a6001fc7ac Mon Sep 17 00:00:00 2001 From: Steffen Date: Mon, 15 Nov 2021 11:16:18 +0100 Subject: [PATCH 02/25] Added unit tests. Deleted exchanges without historic-rates request Refactoring --- .../{crypto_reader.py => crypto.py} | 68 ++- pandas_datareader/crypto/__init__.py | 0 pandas_datareader/crypto/_paths.py | 16 - pandas_datareader/crypto/exchange.py | 272 --------- pandas_datareader/crypto/mapping.py | 347 ----------- .../resources/running_exchanges/50x.yaml | 313 ---------- .../resources/running_exchanges/aax.yaml | 192 ------ .../running_exchanges/alterdice.yaml | 305 ---------- .../resources/running_exchanges/ascendex.yaml | 401 ------------- .../resources/running_exchanges/b2bx.yaml | 330 ----------- .../resources/running_exchanges/bankcex.yaml | 356 ------------ .../resources/running_exchanges/bequant.yaml | 374 ------------ .../resources/running_exchanges/bibox.yaml | 416 ------------- .../resources/running_exchanges/bidesk.yaml | 304 ---------- .../resources/running_exchanges/bigone.yaml | 341 ----------- .../resources/running_exchanges/binance.yaml | 388 ------------- .../resources/running_exchanges/bitbay.yaml | 384 ------------ .../resources/running_exchanges/bitfinex.yaml | 365 ------------ .../resources/running_exchanges/bitforex.yaml | 335 ----------- .../resources/running_exchanges/bitfront.yaml | 251 -------- .../resources/running_exchanges/bithumb.yaml | 420 -------------- .../resources/running_exchanges/bitkub.yaml | 246 -------- .../resources/running_exchanges/bitmart.yaml | 409 ------------- .../resources/running_exchanges/bitopro.yaml | 345 ----------- .../resources/running_exchanges/bitrue.yaml | 227 -------- .../resources/running_exchanges/bitso.yaml | 344 ----------- .../resources/running_exchanges/bitstamp.yaml | 401 ------------- .../resources/running_exchanges/bittrex.yaml | 310 ---------- .../resources/running_exchanges/bitvavo.yaml | 301 ---------- .../resources/running_exchanges/bitwell.yaml | 338 ----------- .../resources/running_exchanges/bitz.yaml | 548 ------------------ .../resources/running_exchanges/bkex.yaml | 356 ------------ .../running_exchanges/bleutrade.yaml | 369 ------------ .../running_exchanges/btc-alpha.yaml | 253 -------- .../resources/running_exchanges/btc_turk.yaml | 389 ------------- .../resources/running_exchanges/btse.yaml | 331 ----------- .../resources/running_exchanges/buda.yaml | 320 ---------- .../resources/running_exchanges/bw.yaml | 420 -------------- .../resources/running_exchanges/catex.yaml | 235 -------- .../resources/running_exchanges/cexio.yaml | 251 -------- .../resources/running_exchanges/chiliz.yaml | 304 ---------- .../resources/running_exchanges/coinall.yaml | 202 ------- .../resources/running_exchanges/coinbase.yaml | 338 ----------- .../resources/running_exchanges/coinbene.yaml | 378 ------------ .../resources/running_exchanges/coindcx.yaml | 221 ------- .../resources/running_exchanges/coinegg.yaml | 310 ---------- .../resources/running_exchanges/coinex.yaml | 411 ------------- .../running_exchanges/coinfield.yaml | 348 ----------- .../running_exchanges/coingecko.yaml | 116 ---- .../resources/running_exchanges/coinhe.yaml | 333 ----------- .../resources/running_exchanges/coinjar.yaml | 314 ---------- .../resources/running_exchanges/coinlist.yaml | 288 --------- .../running_exchanges/coinpaprika.yaml | 226 -------- .../resources/running_exchanges/coinsbit.yaml | 325 ----------- .../resources/running_exchanges/crex24.yaml | 313 ---------- .../running_exchanges/crosstower.yaml | 364 ------------ .../resources/running_exchanges/crypto.yaml | 392 ------------- .../resources/running_exchanges/currency.yaml | 320 ---------- .../running_exchanges/dex-trade.yaml | 310 ---------- .../running_exchanges/digifinex.yaml | 291 ---------- .../resources/running_exchanges/exmo.yaml | 285 --------- .../resources/running_exchanges/exrates.yaml | 318 ---------- .../resources/running_exchanges/exx.yaml | 360 ------------ .../resources/running_exchanges/folgory.yaml | 284 --------- .../resources/running_exchanges/ftx.yaml | 384 ------------ .../resources/running_exchanges/gateio.yaml | 361 ------------ .../resources/running_exchanges/gemini.yaml | 320 ---------- .../resources/running_exchanges/gopax.yaml | 301 ---------- .../resources/running_exchanges/hbtc.yaml | 305 ---------- .../resources/running_exchanges/hitbtc.yaml | 393 ------------- .../resources/running_exchanges/hoo.yaml | 341 ----------- .../resources/running_exchanges/huobi.yaml | 423 -------------- .../running_exchanges/huobi_korea.yaml | 424 -------------- .../resources/running_exchanges/hydax.yaml | 305 ---------- .../resources/running_exchanges/idex.yaml | 336 ----------- .../resources/running_exchanges/indodax.yaml | 247 -------- .../resources/running_exchanges/korbit.yaml | 266 --------- .../resources/running_exchanges/kucoin.yaml | 432 -------------- .../resources/running_exchanges/latoken.yaml | 225 ------- .../resources/running_exchanges/lbank.yaml | 333 ----------- .../resources/running_exchanges/luno.yaml | 286 --------- .../resources/running_exchanges/lykke.yaml | 195 ------- .../resources/running_exchanges/maicoin.yaml | 314 ---------- .../resources/running_exchanges/mandala.yaml | 329 ----------- .../resources/running_exchanges/mercatox.yaml | 248 -------- .../resources/running_exchanges/mexo.yaml | 304 ---------- .../resources/running_exchanges/mxc.yaml | 290 --------- .../resources/running_exchanges/nicehash.yaml | 255 -------- .../resources/running_exchanges/nominex.yaml | 225 ------- .../resources/running_exchanges/oceanex.yaml | 380 ------------ .../resources/running_exchanges/okcoin.yaml | 338 ----------- .../resources/running_exchanges/okex.yaml | 360 ------------ .../resources/running_exchanges/omgfin.yaml | 359 ------------ .../resources/running_exchanges/p2pb2b.yaml | 393 ------------- .../resources/running_exchanges/poloniex.yaml | 354 ----------- .../running_exchanges/stormgain.yaml | 229 -------- .../running_exchanges/therocktrading.yaml | 340 ----------- .../resources/running_exchanges/tidex.yaml | 270 --------- .../resources/running_exchanges/upbit.yaml | 320 ---------- .../resources/running_exchanges/vcc.yaml | 296 ---------- .../resources/running_exchanges/vindax.yaml | 350 ----------- .../resources/running_exchanges/wazirx.yaml | 252 -------- .../resources/running_exchanges/whitebit.yaml | 237 -------- .../resources/running_exchanges/xt.yaml | 330 ----------- .../running_exchanges/xtheta_global.yaml | 303 ---------- .../resources/running_exchanges/yobit.yaml | 265 --------- .../resources/running_exchanges/zaif.yaml | 210 ------- .../resources/running_exchanges/zb.yaml | 322 ---------- .../resources/running_exchanges/zbg.yaml | 405 ------------- pandas_datareader/crypto/time_helper.py | 131 ----- pandas_datareader/crypto/utilities.py | 460 --------------- pandas_datareader/data.py | 6 + pandas_datareader/tests/test_cryptoreader.py | 78 +++ 113 files changed, 129 insertions(+), 34623 deletions(-) rename pandas_datareader/{crypto_reader.py => crypto.py} (67%) delete mode 100644 pandas_datareader/crypto/__init__.py delete mode 100644 pandas_datareader/crypto/_paths.py delete mode 100644 pandas_datareader/crypto/exchange.py delete mode 100644 pandas_datareader/crypto/mapping.py delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/50x.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/aax.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/alterdice.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/ascendex.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/b2bx.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bankcex.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bequant.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bibox.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bidesk.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bigone.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/binance.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitbay.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitfinex.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitforex.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitfront.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bithumb.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitkub.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitmart.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitopro.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitrue.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitso.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitstamp.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bittrex.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitvavo.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitwell.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bitz.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bkex.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bleutrade.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/btc-alpha.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/btc_turk.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/btse.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/buda.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/bw.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/catex.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/cexio.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/chiliz.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/coinall.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/coinbase.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/coinbene.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/coindcx.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/coinegg.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/coinex.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/coinfield.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/coingecko.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/coinhe.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/coinjar.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/coinlist.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/coinpaprika.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/coinsbit.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/crex24.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/crosstower.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/crypto.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/currency.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/dex-trade.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/digifinex.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/exmo.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/exrates.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/exx.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/folgory.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/ftx.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/gateio.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/gemini.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/gopax.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/hbtc.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/hitbtc.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/hoo.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/huobi.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/huobi_korea.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/hydax.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/idex.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/indodax.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/korbit.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/kucoin.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/latoken.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/lbank.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/luno.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/lykke.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/maicoin.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/mandala.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/mercatox.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/mexo.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/mxc.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/nicehash.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/nominex.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/oceanex.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/okcoin.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/okex.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/omgfin.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/p2pb2b.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/poloniex.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/stormgain.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/therocktrading.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/tidex.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/upbit.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/vcc.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/vindax.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/wazirx.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/whitebit.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/xt.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/xtheta_global.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/yobit.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/zaif.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/zb.yaml delete mode 100644 pandas_datareader/crypto/resources/running_exchanges/zbg.yaml delete mode 100644 pandas_datareader/crypto/time_helper.py delete mode 100644 pandas_datareader/crypto/utilities.py create mode 100644 pandas_datareader/tests/test_cryptoreader.py diff --git a/pandas_datareader/crypto_reader.py b/pandas_datareader/crypto.py similarity index 67% rename from pandas_datareader/crypto_reader.py rename to pandas_datareader/crypto.py index 31561178..9ddde85c 100644 --- a/pandas_datareader/crypto_reader.py +++ b/pandas_datareader/crypto.py @@ -1,13 +1,12 @@ -import sys -from typing import Dict +from typing import Dict, List from sys import stdout import pandas as pd import time import pytz -from pandas_datareader.crypto.exchange import Exchange -from pandas_datareader.crypto.utilities import split_str_to_list +from pandas_datareader.crypto_utils.exchange import Exchange +from pandas_datareader.crypto_utils.utilities import split_str_to_list, get_exchange_names class CryptoReader(Exchange): @@ -17,7 +16,7 @@ class CryptoReader(Exchange): the _BaseReader. """ - def __init__(self, exchange_name: str, symbols, interval: str = 'minutes', **kwargs): + def __init__(self, exchange_name: str, symbols, interval: str = 'days', **kwargs): """ Constructor. @param exchange_name: String repr of the exchange name @@ -28,25 +27,36 @@ def __init__(self, exchange_name: str, symbols, interval: str = 'minutes', **kwa super(CryptoReader, self).__init__(exchange_name, symbols, interval, **kwargs) - def await_rate_limit(self): + @staticmethod + def get_all_exchanges() -> List: + """ Get all supported exchange names. + + @return List of exchange names. + """ + + return get_exchange_names() + + def _await_rate_limit(self): """ Sleep in order to not violate the rate limit.""" time.sleep(self.rate_limit) @staticmethod - def sort_columns(dataframe: pd.DataFrame) -> pd.DataFrame: + def _sort_columns(dataframe: pd.DataFrame) -> pd.DataFrame: """ Sort columns in OHLCV order. @param dataframe: Requested data with unordered columns @return: pd.DataFrame with ordered columns """ - columns = {'open', 'high', 'low', 'close', 'volume', 'market_cap'} - columns = list(columns.intersection(set(dataframe.columns))) - return dataframe.loc[columns, :] + # remove columns not returned by the exchange and maintain order. + columns = ['open', 'high', 'low', 'close', 'volume', 'market_cap'] + columns = sorted(set(columns).intersection(dataframe.columns), key=columns.index) + + return dataframe.loc[:, columns] @staticmethod - def print_timestamp(timestamp): + def _print_timestamp(timestamp): """ Prints the actual request timestamp. @param timestamp: The timestamp @@ -54,7 +64,16 @@ def print_timestamp(timestamp): stdout.write("Requesting from: \r{}".format(timestamp)) stdout.flush() - def index_and_cut_dataframe(self, dataframe: pd.DataFrame) -> pd.DataFrame: + def read(self, new_symbols: str = None) -> pd.DataFrame: + """ Read the data. + + @param new_symbols: Set new currency-pair different from the initial one. + @return: pd.DataFrame of requested data + """ + + return self._request(new_symbols) + + def _index_and_cut_dataframe(self, dataframe: pd.DataFrame) -> pd.DataFrame: """ Set index and cut data according to user specification. @param dataframe: Requested raw data @@ -65,7 +84,7 @@ def index_and_cut_dataframe(self, dataframe: pd.DataFrame) -> pd.DataFrame: dataframe.sort_index(inplace=True) dataframe = dataframe.loc[pytz.utc.localize(self.start): pytz.utc.localize(self.end)] - return dataframe + return self._sort_columns(dataframe) def _get_data(self) -> Dict: """ Requests the data and returns the response json. @@ -82,18 +101,19 @@ def _get_data(self) -> Dict: url, params = self.get_formatted_url_and_params(param_dict, *self.symbols.keys()) # Perform the request - self.print_timestamp(list(self.symbols.values())[0]) + self._print_timestamp(list(self.symbols.values())[0]) resp = self._get_response(url, params=params, headers=None) # Await the rate-limit to avoid ip ban. - self.await_rate_limit() + self._await_rate_limit() return resp.json() - def request(self, new_symbols: str = None) -> pd.DataFrame: + def _request(self, new_symbols: str = None) -> pd.DataFrame: """ Requests and extracts the data. Requests may be performed iteratively over time to collect the full time-series. @param new_symbols: New currency-pair to request, if they differ from the constructor. + @return df: pd.DataFrame of the returned data. """ @@ -107,22 +127,23 @@ def request(self, new_symbols: str = None) -> pd.DataFrame: # data points returned by a single request, thus making it necessary to iterate backwards in time and merge # the retrieved data. while True: + # perform request and extract data. resp = self._get_data() data, mappings = self.format_data(resp) if not data: break + # Append new data to the result list result = result + data # Find the place in the mapping list for the key "time". - for counter, value in enumerate(mappings): - if value == 'time': - break + time_key = {v: k for k, v in enumerate(mappings)} + time_key = time_key.get('time') - # Extract the minimum timestamp from the response to continue requesting with. - new_time = min(item[counter] for item in data) + # Extract the minimum timestamp from the response for further requests. + new_time = min(item[time_key] for item in data) - # Break the requesting if condition is fulfilled + # Break the requesting if minimum timestamp is lower than initial start time. if new_time.timestamp() <= self.start.timestamp(): break # Or continue requesting from the new timestamp. @@ -131,6 +152,7 @@ def request(self, new_symbols: str = None) -> pd.DataFrame: # Move cursor to the next line to ensure that new print statements are executed correctly. stdout.write("\n") + # If there is data put it into a pd.DataFrame, set index and cut it to fit the initial start/end time. if result: result = pd.DataFrame(result, columns=mappings) - return self.index_and_cut_dataframe(result) + return self._index_and_cut_dataframe(result) diff --git a/pandas_datareader/crypto/__init__.py b/pandas_datareader/crypto/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pandas_datareader/crypto/_paths.py b/pandas_datareader/crypto/_paths.py deleted file mode 100644 index 8758aa4d..00000000 --- a/pandas_datareader/crypto/_paths.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" -This module is preparing the python path to access all modules. -""" -import os -import sys -from pathlib import Path - -# sys.path.insert(0, os.path.dirname(__file__)) -# -# PATH_ABSOLUT = Path().parent.absolute() - -all_paths = { - "yaml_path": Path(os.path.dirname(os.path.realpath(__file__))).joinpath("resources/running_exchanges/"), -} diff --git a/pandas_datareader/crypto/exchange.py b/pandas_datareader/crypto/exchange.py deleted file mode 100644 index 0bc32f29..00000000 --- a/pandas_datareader/crypto/exchange.py +++ /dev/null @@ -1,272 +0,0 @@ -from typing import Tuple, Any, Dict, Union, List, Optional - -from datetime import datetime -import string -from collections import OrderedDict, deque -import itertools - -from pandas_datareader.crypto.utilities import yaml_loader, replace_list_item -from pandas_datareader.crypto.mapping import extract_mappings -from pandas_datareader.crypto.mapping import convert_type -from pandas_datareader.base import _BaseReader - - -class Exchange(_BaseReader): - """ Class for every exchange supported. The class extracts the request url, fits parameters, - extracts the values from the response json and performs type-conversions. - """ - - def __init__(self, name: str, symbols, interval: str, **kwargs): - super(Exchange, self).__init__(symbols, **kwargs) - self.name = name - self.yaml_file = yaml_loader(self.name) - self.interval: Union[str, Dict] = interval - self.rate_limit = self.get_rate_limit() - - def get_rate_limit(self) -> int: - """ Calculates the rate-limit of an exchange. - - @return: The rate limit, i.e. time to "sleep" to not violate the limit per minute. - """ - if self.yaml_file.get("rate_limit"): - if self.yaml_file["rate_limit"]["max"] <= 0: - rate_limit = 0 - else: - rate_limit = self.yaml_file["rate_limit"]["unit"] / self.yaml_file["rate_limit"]["max"] - else: - rate_limit = 0 - - return rate_limit - - def apply_currency_pair_format(self, currency_pair: str) -> str: - """ Helper method that applies the format described in the yaml for the specific - request on the given currency-pair. - - @param currency_pair: String repr of the currency-pair - @return: String of the formatted currency-pair. Example: BTC and ETH -> "btc_eth" - """ - - first, second = currency_pair.split("-") - - request_url_and_params = self.yaml_file.get("requests").get("historic_rates").get("request") - pair_template_dict = request_url_and_params["pair_template"] - pair_template = pair_template_dict["template"] - - formatted_string: str = pair_template.format(first=first, second=second) - - if pair_template_dict["lower_case"]: - formatted_string = formatted_string.lower() - - return formatted_string - - def get_formatted_url_and_params(self, url_and_parameters: Any, currency_pair: str) -> Tuple[str, Dict]: - """ Formats the request url, inserts the currency-pair representation and/or - extracts the parameters specified for the exchange and request. - - @param url_and_parameters: Extracted url and parameters from self.extract_request_urls. - @param currency_pair: The currency pair of interest to format the url and params on. - @return Tuple of formatted url and formatted parameters. - """ - - url = url_and_parameters.get('historic_rates').get("url") - pair_template = url_and_parameters.get('historic_rates').get("pair_template") - pair_formatted = self.apply_currency_pair_format(currency_pair) - parameters = url_and_parameters.get('historic_rates').get("params") - - parameters.update({key: parameters[key][currency_pair] - for key, val in parameters.items() if isinstance(val, dict)}) - - # Case 1: Currency-Pairs in request parameters: eg. www.test.com?market=BTC-USD - if "alias" in pair_template.keys() and pair_template["alias"]: - parameters[pair_template["alias"]] = pair_formatted - # Case 2: Currency-Pairs directly in URL: eg. www.test.com/BTC-USD - elif pair_formatted: - parameters.update({"currency_pair": pair_formatted}) - - else: - return url, parameters - - variables = [item[1] for item in string.Formatter().parse(url) if item[1] is not None] - url_formatted = url.format(**parameters) - # drop params who are filled directly into the url - parameters = {k: v for k, v in parameters.items() if k not in variables} - - return url_formatted, parameters - - def extract_request_urls(self, currency_pairs: Dict[str, datetime]) -> Dict: - """ Extracts the request url from the yaml-file and implements the parameters. - - @param currency_pairs: Currency-pair with the timestamp of the latest request. - @return: Dict of the extracted url and parameters. - """ - - request_dict = self.yaml_file.get("requests").get("historic_rates").get("request") - request_parameters = dict() - request_parameters["url"] = self.yaml_file.get("api_url", "") + request_dict.get("template", "") - request_parameters["pair_template"] = request_dict.get("pair_template", None) - urls = dict() - parameter = dict() - parameters = request_dict.get("params", False) - - if not parameters: - request_parameters["params"] = {} - urls["historic_rates"] = request_parameters - return urls - - mapping: dict = {"allowed": self._allowed, "function": self._function, - "default": self._default, "type": self._type_con} - - # enumerate mapping dict to sort parameter values accordingly, i.e. {"allowed": 0, "function": 1, ...} - mapping_index = {val: key for key, val in enumerate(mapping.keys())} - - for param, options in parameters.items(): - # Kick out all option keys which are not in the mapping dict or where required: False. - # Sort the dict options according to the mapping-keys to ensure the right order of function calls. - # Otherwise a (valid) specified value might be overwritten by the default value. - options = {k: v for k, v in options.items() if k in mapping.keys()} - options = OrderedDict(sorted(options.items(), key=lambda x: mapping_index.get(x[0]))) - - if not parameters[param].get("required", True): - continue - # Iterate over the functions and fill the params dict with values. Kwargs are needed only partially. - kwargs = {"has_value": None, "currency_pairs": currency_pairs} - for key, val in options.items(): - kwargs.update({"has_value": parameter.get(param, None)}) - parameter[param] = mapping.get(key)(val, **kwargs) - - request_parameters["params"] = parameter - urls["historic_rates"] = request_parameters - return urls - - def _allowed(self, val: dict, **_: dict) -> Any: - """ Extract the configured value from all allowed values. If there is no match, return str "default". - - @param val: dict of allowed key, value pairs. - @param _: unused additional arguments needed in other methods. - @return: value if key in dict, else None. - """ - if isinstance(self.interval, dict): - value = None - else: - value = val.get(self.interval, None) - - if not bool(value): - all_intervals = {"minutes": 1, "hours": 2, "days": 3, "weeks": 4, "months": 5} - self.interval = {v: k for k, v in val.items() if all_intervals.get(k)} - return value - - def _function(self, val: str, **kwargs: dict) -> Dict[str, datetime]: - """ Execute function for all currency-pairs. Function returns the first - timestamp in the DB, or datetime.now() if none exists. - - @param val: contains the function name as string. - @param kwargs: not used but needed for another function. - @return: The currency-pair with the respective timestamp to continue requesting. - """ - if val == "last_timestamp": - return {cp: self._get_first_timestamp(last_ts) for cp, last_ts in kwargs.get("currency_pairs").items()} - - def _default(self, val: str, **kwargs: dict) -> Optional[str]: - """ Returns the default value if kwargs value (the parameter) is None. - - @param val: Default value. - @param kwargs: Parameter value. If None, return default value. - @return: Default value as a string. - """ - - default_val = val if not bool(kwargs.get("has_value")) else kwargs.get("has_value") - if isinstance(self.interval, dict): - self.interval = self.interval.get(default_val, None) - - return default_val if self.interval else None - - def _type_con(self, val: Any, **kwargs: dict) -> Any: - """ Performs type conversions. - - @param val: The conversion values specified under "type". - @param kwargs: The value to be converted. - @return: Converted value. - """ - param_value = kwargs.get("has_value", None) - conv_params = val - # to avoid conversion when only a type declaration was done. If a parameter is of type "int". - if isinstance(conv_params, str) or len(conv_params) < 2: - return param_value - # replace the key "interval" with the interval specified in the configuration file. - conv_params = [self.interval if x == "interval" else x for x in conv_params] - # return {cp: convert_type(param_value[cp], deque(conv_params)) for cp in currency_pairs} - # ToDo: Check if the above line works. The older version needed both if statements below. - if isinstance(param_value, dict): - return {cp: convert_type(param_value[cp], deque(conv_params)) for cp in kwargs.get("currency_pairs")} - elif isinstance(conv_params, list): - return convert_type(param_value, deque(conv_params)) - - def _get_first_timestamp(self, last_ts: datetime) -> datetime: - """ Returns the timestamp to continue requesting with. - - @param last_ts: The oldest timestamp from the previous request - @return: The latest timestamp. - """ - if last_ts: - return last_ts - - if self.end.timestamp() > datetime.utcnow().timestamp(): - return datetime.utcnow() - else: - return self.end - - def format_data(self, responses: Dict) -> Tuple[Optional[List], Optional[List]]: - """ Extracts and formats the response data, according to the mapping keys and path. - Data is then ordered and returned as a tuple. - - @param responses: The response json - @return: Tuple of extracted and formatted data and a list of the mapping keys in the same order. - """ - if not responses: - return None, None - - results = list() - mappings = extract_mappings(self.name, self.yaml_file.get('requests')).get('historic_rates') - mapping_keys = [mapping.key for mapping in mappings] - - # creating dictionary where key is the name of the mapping which holds an empty list - temp_results = dict(zip((key for key in mapping_keys), itertools.repeat([], len(mappings)))) - - try: - - for mapping in mappings: - if "interval" in mapping.types: - mapping.types = replace_list_item(mapping.types, "interval", self.interval) - - temp_results[mapping.key] = mapping.extract_value(responses) - - if isinstance(temp_results[mapping.key], str): - # Bugfix: if value is a single string, it is an iterable, and the string will - # be split in every letter. Therefore it is put into a list. - temp_results[mapping.key] = [temp_results[mapping.key]] - - except Exception: - print("Error extracting values from response.") - return None, None - - else: - # CHANGE: One filed invalid -> all fields invalid. - # changed this in order to avoid responses kicked out just because of one invalid field. - # The response will be filtered out in the DB-Handler if the primary-keys are missing anyways. - if all(value is None and not isinstance(value, datetime) for value in list(temp_results.values())): - return None, None - - # asserting that the extracted lists for each mapping are having the same length - assert (len(results[0]) == len(result) for result in temp_results) - - len_results = {key: len(value) for key, value in temp_results.items() if hasattr(value, "__iter__")} - len_results = max(len_results.values()) if bool(len_results) else 1 - - # update new keys only if not already exists to prevent overwriting! - # temp_results = {"time": time, **temp_results} - result = [v if hasattr(v, "__iter__") - else itertools.repeat(v, len_results) for k, v in temp_results.items()] - - result = list(itertools.zip_longest(*result)) - - return result, list(temp_results.keys()) diff --git a/pandas_datareader/crypto/mapping.py b/pandas_datareader/crypto/mapping.py deleted file mode 100644 index db168afb..00000000 --- a/pandas_datareader/crypto/mapping.py +++ /dev/null @@ -1,347 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" -Module to find, extract and convert values from the exchange responses. - -Classes: - - Mapping -Functions: - - convert_type - - extract_mappings - - is_scalar -""" - -import logging -from collections import deque -from collections.abc import Iterable -from typing import Any, List, Dict, Deque, Tuple - -from pandas_datareader.crypto.utilities import TYPE_CONVERSIONS - - -def convert_type(value: Any, types_queue: Deque[str]) -> Any: - """ - Converts the value via type conversions. - - Helper method to convert the given value via a queue of type conversions. - - @param value: The value to get converted to another type. - @type value: Any - @param types_queue: The queue of type conversion instructions. - @type types_queue: deque - - @return: The converted value. - @rtype: Any - """ - current_type = types_queue.popleft() - - result = value - - while types_queue: - next_type = types_queue.popleft() - - types_tuple = (current_type, next_type) - - if "continue" in types_tuple: - continue - - conversion = TYPE_CONVERSIONS[types_tuple] - - params = list() - - for _ in range(conversion["params"]): - params.append(types_queue.popleft()) - - # Change here to avoid "None" as result value in the params when no value to convert is needed (i.e. when - # methods are called with ("none", ...). - # if not result and isinstance(result, (str, list)): - try: - if result is None: - result = conversion["function"](*params) - else: - result = conversion["function"](result, *params) - - current_type = next_type - except Exception: - return None - - return result - - -class Mapping: - """ - Class representing mapping data and logic. - - Class representing mapping data und further functionality provided - with methods. - - Attributes: - key: - String being the keyword indicating one or several - database table columns. See "database_column_mapping" - in "config.yaml". - path: - An ordered list of keys used for traversal through the - response dict with the intention of returning the value wanted - for the database. - types: - An ordered sequence of types and - additional parameters (if necessary). Is used to conduct - type conversions within the method "extract_value()". - """ - - def __init__(self, - key: str, - path: List[str], - types: List[str]): - """ - Constructor of Mapping. - - Constructor method for constructing method objects. - - @param key: String being the keyword indicating one or several - database table columns. See "database_column_mapping" - in "config.yaml". - @type key: str - @param path: An ordered list of keys used for traversal through the - response dict with the intention of returning the value wanted - for the database. - @type path: list - @param types: An ordered sequence of types and - additional parameters (if necessary). Is used to conduct - type conversions within the method "extract_value()". - @type types: list - """ - self.key = key - self.path = path - self.types = types - - def traverse_path(self, response: Dict[str, Any], path_queue: Deque[str], - currency_pair_info: Tuple[str, str, str] = None) \ - -> Any: - """ - Traverses the path on a response. - - Helper method for traversing the path on the given response dict (subset). - - @param response: The response dict (subset). - @type response: dict - @param path_queue: The queue of path traversal instructions. - @type path_queue: deque - @param currency_pair_info: The formatted String of a currency pair. - For special case that the key of a dictionary is the formatted currency pair string. - @type currency_pair_info: tuple[str, str, str] - - @return: The traversed response dict. - @rtype: Optional[dict] - """ - path_element = path_queue.popleft() - - if path_element == "dict_key": - # Special case to extract value from "dict_key" - traversed = list(response.keys()) - elif path_element == "dict_values": - # Special case to extract value from "dict_values" - traversed = list(response.values()) - elif path_element == "list_key": - # Special case with the currency_pair prior to a list - traversed = list(response.keys()) - elif path_element == "list_values": - traversed = list(response.values()) - elif path_element == []: - # Special case to extract multiple values from a single list ["USD","BTC",...] - traversed = response - elif path_element == "currency_pair" and currency_pair_info[2] is not None: - traversed = response[currency_pair_info[2]] - elif is_scalar(response): - return None - else: # Hier editiert für Kraken sonderfall - if isinstance(response, dict) and path_element not in response.keys(): - return None - else: - traversed = response[path_element] - - return traversed - - def extract_value(self, - # response: List[Dict[str, Any]], - response: Any, - path_queue: Deque[str] = None, - types_queue: Deque[str] = None, - iterate: bool = True, - currency_pair_info: Tuple[str, str, str] = (None, None, None)) -> Any: - """ - Extracts the value specified by "self.path". - - Extracts the value specified by the path sequence and converts it - using the "types" specified. - - @param response: The response dict (JSON) returned by an API request. - @type response: Collection - @param path_queue: The queue of path traversal instructions. - @type path_queue: deque - @param types_queue: The queue of type conversion instructions. - @type types_queue: deque - @param iterate: Whether still an auto-iteration is possible. - @type iterate: bool - @param currency_pair_info: The formatted String of a currency pair. - @type currency_pair_info: tuple[str, str, str] - - @return: The value specified by "path_queue" and converted - using "types_queue". - Can be a list of values which get extracted iteratively from - the response. - @rtype: Any - """ - if path_queue is None: - path_queue = deque(self.path) - - if types_queue is None: - types_queue = deque(self.types) - - if not response: - return None - - if not path_queue: - # TODO: after integration tests, look if clause for first and second currency can be deleted! - if types_queue[0] == "first_currency": - return currency_pair_info[0] - elif types_queue[0] == "second_currency": - return currency_pair_info[1] - return convert_type(None, types_queue) - - while path_queue: - - if iterate and isinstance(response, list): - # Iterate through list of results - result = list() - - # special case for bitfinex - if len(response) == 1: - response = response[0] - continue # because instance of response has to be checked - - for item in response: - - if is_scalar(item): - return self.extract_value(response, - path_queue, - types_queue, - iterate=False) - - result.append( - self.extract_value( - item, - deque(path_queue), - deque(types_queue) - ) - ) - - return result - - elif is_scalar(response): - # Return converted scalar value - return convert_type(response, types_queue) - - # Special case for Bitz to handle empty dicts/lists. - elif not response: - return None - - else: - # Traverse path - response = self.traverse_path(response, path_queue, currency_pair_info=currency_pair_info) - - if types_queue and response is not None: # None to allow to change 0 to boolean. - - if isinstance(response, list): - - result = list() - - for item in response: - result.append( - convert_type(item, deque(types_queue)) - ) - - # for dict_key special_case aka. test_extract_value_list_containing_dict_where_key_is_value() in test_mapping.py - if len(result) == 1: - result = result[0] - - response = result - - else: - response = convert_type(response, types_queue) - - return response - - def __str__(self) -> str: - """String representation of a Mapping""" - string_path = list() - - for item in self.path: - string_path.append(str(item)) - - return " / ".join(string_path) + " -> " + str(self.key) - - -def extract_mappings(exchange_name: str, requests: Dict[str, Any]) -> Dict[str, List[Mapping]]: - """ - Helper-Method which should be only called by the constructor. - Extracts out of a given exchange .yaml-requests-section for each - request the necessary mappings so the values can be extracted from - the response for said request. - - The key-value in the dictionary is the same as the key for the request. - i.e. behind 'ticker' are all the mappings stored which are necessary for - extracting the values out of a ticker-response. - - If there is no mapping specified in the .yaml for a value which is contained - by the response, the value will not be extracted later on because there won't - be a Mapping-object for said value. - - @param exchange_name: str - String representation of the exchange name. - @param requests: Dict[str: List[Mapping]] - Requests-section from a exchange.yaml as dictionary. - Method does not check if dictionary contains viable information. - - @return: - Dictionary with the following structure: - {'request_name': List[Mapping]} - """ - response_mappings = dict() - if requests: - for request in requests: - request_mapping = requests[request] - - if "mapping" in request_mapping.keys(): - mapping = request_mapping["mapping"] - mapping_list = list() - - try: - for entry in mapping: - mapping_list.append(Mapping(entry["key"], entry["path"], entry["type"])) - except KeyError: - print(f"Error loading mappings of {exchange_name} in {request}: {entry}") - logging.error("Error loading mappings of %s in %s: %s", exchange_name, request, entry) - break - - response_mappings[request] = mapping_list - - return response_mappings - - -def is_scalar(value: Any) -> bool: - """ - Indicates whether a value is a scalar or not. - - Convenience function returning a bool whether the provided value is a single value or not. - Strings count as scalar although they are iterable. - - @param value: The value to evaluate concerning whether it is a single value - or multiple values (iterable). - @type value: Any - - @return: Bool indicating whether the provided value is a single value or not. - @rtype: bool - """ - return isinstance(value, str) or not isinstance(value, Iterable) diff --git a/pandas_datareader/crypto/resources/running_exchanges/50x.yaml b/pandas_datareader/crypto/resources/running_exchanges/50x.yaml deleted file mode 100644 index ce193048..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/50x.yaml +++ /dev/null @@ -1,313 +0,0 @@ -# Tickers don't work as they only return the first currency. The second, with the type conversion (none, constant) -# does not work yet. - -name: 50x -exchange: true - -rate_limit: null # no rate limit -# max: null -# unit: null - -api_url: https://rates.50x.com/ - -requests: - currency_pairs: - request: - template: market - pair_template: null - params: - base: - default: USDT - - response: - type: dict - values: - currency_pair: - type: dict - values: - vol: - type: str - rate: - type: str - - mapping: - - key: currency_pair_first - path: - - dict_key - type: - - str - - key: currency_pair_second - path: [] - type: - - none - - constant - - "USDT" - -# tickers: -# request: -# template: market -# pair_template: null -# params: -# base: -# default: "USDT" -# response: -# type: dict -# values: -# currency_pair: -# type: dict -# values: -# vol: -# type: str -# rate: -# type: str -# -# mapping: -# - key: currency_pair_first -# path: -# - dict_key -# type: -# - str -# - key: currency_pair_second -# path: [] -# type: -# - none -# - constant -# - "USDT" -# - key: last_price -# path: -# - dict_values -# - rate -# type: -# - str -# - float -# - key: time -# path: [] -# type: -# - none -# - now -# - key: daily_volume -# path: -# - dict_values -# - vol -# type: -# - str -# - float - - historic_rates: - request: - template: chart - pair_template: - template: "{first}/{second}" - lower_case: false - alias: pair - params: - period: - allowed: - minutes: M1 - hours: H1 - days: D - weeks: W - default: D - end: - function: last_timestamp - type: - - datetime - - timestamp -# start: -# function: last_timestamp -# type: -# - datetime -# - timedelta -# - interval -# - 100 - response: - type: list - values: - type: dict - values: - vol: - type: float - high: - type: float - low: - type: float - open: - type: float - close: - type: float - date: - type: int - - mapping: - - key: time - path: - - date - type: - - float - - from_timestamp - - 0 - - key: open - path: - - open - type: - - float - - key: high - path: - - high - type: - - float - - key: low - path: - - low - type: - - float - - key: close - path: - - close - type: - - float - - key: volume - path: - - vol - type: - - float - - - trades: - request: - template: last_trades/ - pair_template: - template: "{first}/{second}" - lower_case: false - alias: pair - params: null - - response: - type: list - values: - type: dict - values: - a: - type: int - bs: - type: str - ts: - type: float - rate: - type: float - vol1: - type: float - vol2: - type: float - - mapping: - - key: time - path: - - ts - type: - - float - - float - - from_timestamp - - 0 - - key: id - path: - - ts - type: - - float - - int - - key: direction - path: - - bs - type: - - value - - map - - b - - buy - - s - - sell - - key: price - path: - - rate - type: - - float - - key: amount - path: - - vol1 - type: - - float - - order_books: - request: - template: orderbook/ - pair_template: - template: "{first}/{second}" - lower_case: false - alias: pair - params: null - - response: - type: dict - values: - bid: - type: list - values: - type: list - values: - 0: - type: int - 1: - type: int - 2: - type: int - ask: - type: list - values: - type: list - values: - 0: - type: int - 1: - type: int - 2: - type: int - - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bid - - 1 - type: - - float - - key: bids_price - path: - - bid - - 0 - type: - - float - - key: asks_amount - path: - - ask - - 1 - type: - - float - - key: asks_price - path: - - ask - - 0 - type: - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/aax.yaml b/pandas_datareader/crypto/resources/running_exchanges/aax.yaml deleted file mode 100644 index 02f565cd..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/aax.yaml +++ /dev/null @@ -1,192 +0,0 @@ -name: aax -exchange: true -rate_limit: null -api_url: https://api.aax.com/v2/ - -requests: - currency_pairs: - request: - template: instruments - pair_template: null - params: null - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - base: - type: str - quote: - type: str - mapping: - - key: currency_pair_first - path: - - data - - base - type: - - str - - key: currency_pair_second - path: - - data - - quote - type: - - str - - order_books: - request: - template: market/orderbooks - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - level: - max: 50 - default: 50 - - response: - type: dict - values: - asks: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - bids: - type: list - values: - type: list - values: - 0: #price - type: str - 1: #quantity - type: str - e: - type: str - t: - type: int - - mapping: - - key: id - path: - - t - type: - - int - - key: time - path: - - t - type: - - float - - from_timestamp - - 1 - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bids - - [] - - 1 - type: - - str - - float - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - trades: - request: - template: market/trades - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - max: 2000 - default: 200 - - response: - type: dict - values: - trades: - type: list - values: - type: dict - values: - p: - type: str - q: - type: str - t: - type: int - mapping: - - key: id - path: - - trades - - t - type: - - int - - key: time - path: - - trades - - t - type: - - float - - from_timestamp - - 1 - - key: price - path: - - trades - - p - type: - - str - - float_absolut - - key: amount - path: - - trades - - q - type: - - str - - float - - key: direction - path: - - trades - - p - type: - - any - - value - - map - - true - - buy - - false - - sell - diff --git a/pandas_datareader/crypto/resources/running_exchanges/alterdice.yaml b/pandas_datareader/crypto/resources/running_exchanges/alterdice.yaml deleted file mode 100644 index ad4ec9c2..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/alterdice.yaml +++ /dev/null @@ -1,305 +0,0 @@ -name: alterdice -exchange: true - -rate_limit: null - -api_url: "" - -requests: - currency_pairs: - request: - template: https://api.alterdice.com/v1/public/symbols - pair_template: null - params: null - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - id: - type: int - base: - type: str - quote: - type: str - - mapping: - - key: currency_pair_first - path: - - data - - base - type: - - str - - key: currency_pair_second - path: - - data - - quote - type: - - str - - tickers: - request: - template: https://api.alterdice.com/v1/public/ticker - pair_template: - template: "{first}{second}" - lower_case: false - alias: pair - params: null - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - last: - type: str - volume_24H: - type: str - - mapping: - - key: last_price - path: - - data - - last - type: - - str - - float - - key: time - path: [] - type: - - none - - now - - key: daily_volume - path: - - data - - volume_24H - type: - - str - - float - - historic_rates: - request: - template: https://socket.alterdice.com/graph/hist - pair_template: - template: "{first}{second}" - lower_case: false - alias: t - params: - r: - allowed: - hours: 60 - days: D - weeks: W - default: D - end: - function: last_timestamp - type: - - datetime - - timestamp - limit: - default: 1000 - response: - type: list - values: - type: dict - values: - low: # - type: int - high: - type: int - volume: - type: int - time: - type: int - open: - type: int - close: - type: int - - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 0 - - key: open - path: - - open - type: - - int - - div - - 100000000 - - key: high - path: - - high - type: - - int - - div - - 100000000 - - key: low - path: - - low - type: - - int - - div - - 100000000 - - key: close - path: - - close - type: - - int - - div - - 100000000 - - key: volume - path: - - volume - type: - - int - - div - - 100000000 - - - trades: - request: - template: https://api.alterdice.com/v1/public/trades - pair_template: - template: "{first}{second}" - lower_case: false - alias: pair - params: null - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - volume: - type: float - price: - type: float - timestamp: - type: int - type: - type: str - mapping: - - key: time - path: - - data - - timestamp - type: - - float - - from_timestamp - - 0 - - key: id - path: - - data - - timestamp - type: - - int - - key: direction - path: - - data - - type - type: - - str - - key: price - path: - - data - - price - type: - - float - - key: amount - path: - - data - - volume - type: - - float - - order_books: - request: - template: https://api.alterdice.com/v1/public/book - pair_template: - template: "{first}{second}" - lower_case: false - alias: pair - params: null - - response: - type: dict - values: - data: - type: dict - buy: - type: list - values: - type: dict - values: - volume: - type: float - rate: - type: float - sell: - type: list - values: - type: dict - values: - volume: - type: float - rate: - type: float - - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - data - - buy - - volume - type: - - float - - key: bids_price - path: - - data - - buy - - rate - type: - - float - - key: asks_amount - path: - - data - - sell - - volume - type: - - float - - key: asks_price - path: - - data - - sell - - rate - type: - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/ascendex.yaml b/pandas_datareader/crypto/resources/running_exchanges/ascendex.yaml deleted file mode 100644 index d85ed847..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/ascendex.yaml +++ /dev/null @@ -1,401 +0,0 @@ -name: ascendex -exchange: true - -rate_limit: null - -api_url: https://ascendex.com/api/pro/v1/ - -requests: - currency_pairs: - request: - template: products - pair_template: null - params: null - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - baseAsset: - type: str - quoteAsset: - type: str - - mapping: - - key: currency_pair_first - path: - - data - - baseAsset - type: - - str - - key: currency_pair_second - path: - - data - - quoteAsset - type: - - str - - tickers: - request: - template: ticker - pair_template: null - params: null - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - symbol: - type: str - volume: - type: str - ask: - type: list - values: - 0: - type: str - bids: - type: list - values: - 0: - type: str - - - mapping: - - key: currency_pair_first - path: - - data - - symbol - type: - - str - - split - - "/" - - 0 - - key: currency_pair_second - path: - - data - - symbol - type: - - str - - split - - "/" - - 1 - - key: time - path: [] - type: - - none - - now - - key: best_bid - path: - - data - - bid - - 0 - type: - - str - - float - - key: best_ask - path: - - data - - ask - - 0 - type: - - str - - float - - key: daily_volume - path: - - data - - volume - type: - - str - - float - - historic_rates: - request: - template: barhist - pair_template: - template: "{first}/{second}" - lower_case: false - alias: symbol - params: - interval: - allowed: - minutes: 1 - hours: 60 - days: 1d - weeks: 1w - months: 1m - default: 1d - to: - function: last_timestamp - type: - - datetime - - timestampms -# from: -# function: last_timestamp -# type: -# - datatime -# - timedeltams -# - interval -# - 500 - n: - default: 20 - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - data: - type: dict - values: - c: - type: str - h: - type: str - i: - type: str - l: - type: str - o: - type: str - v: - type: str - ts: - type: int - - mapping: - - key: time - path: - - data - - data - - ts - type: - - float - - from_timestamp - - 1 - - key: open - path: - - data - - data - - o - type: - - str - - float - - key: high - path: - - data - - data - - h - type: - - str - - float - - key: low - path: - - data - - data - - l - type: - - str - - float - - key: close - path: - - data - - data - - c - type: - - str - - float - - key: volume - path: - - data - - data - - v - type: - - str - - float - - trades: - request: - template: trades - pair_template: - template: "{first}/{second}" - lower_case: false - alias: symbol - params: - n: - default: 100 - - response: - type: dict - values: - data: - type: dict - values: - data: - type: list - values: - type: dict - values: - seqnum: - type: int - p: - type: str - q: - type: str - ts: - type: int - bm: - type: bool - - mapping: - - key: time - path: - - data - - data - - ts - type: - - float - - from_timestamp - - 1 - - key: id - path: - - data - - data - - seqnum - type: - - int - - key: direction - path: - - data - - data - - bm - type: - - value - - map - - true - - sell - - false - - buy - - key: price - path: - - data - - data - - p - type: - - str - - float - - key: amount - path: - - data - - data - - q - type: - - str - - float - - order_books: - request: - template: depth - pair_template: - template: "{first}/{second}" - lower_case: false - alias: symbol - params: null - - response: - type: dict - values: - data: - type: dict - data: - type: dict - seqnum: - type: int - ts: - type: int - asks: - type: list - values: - type: list - values: - 0: # p - type: str - 1: #qty - type: str - bids: - type: list - values: - type: list - values: - 0: # p - type: str - 1: #qty - type: str - - mapping: - - key: time - path: - - data - - data - - ts - type: - - float - - from_timestamp - - 1 - - key: id - path: - - data - - data - - seqnum - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - data - - data - - bids - - 1 - type: - - str - - float - - key: bids_price - path: - - data - - data - - bids - - 0 - type: - - str - - float - - key: asks_amount - path: - - data - - data - - asks - - 1 - type: - - str - - float - - key: asks_price - path: - - data - - data - - asks - - 0 - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/b2bx.yaml b/pandas_datareader/crypto/resources/running_exchanges/b2bx.yaml deleted file mode 100644 index d20e221f..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/b2bx.yaml +++ /dev/null @@ -1,330 +0,0 @@ -name: b2bx -exchange: true - -rate_limit: - max: 120 - unit: 60 - -api_url: "" - -requests: - currency_pairs: - request: - template: https://api.b2bx.exchange:8443/trading/frontoffice/api/info - pair_template: null - params: null - - response: - type: dict - values: - pairs: - type: dict - values: - currency_pair: - type: dict - - mapping: - - key: currency_pair_first - path: - - pairs - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - pairs - - dict_key - type: - - str - - split - - "_" - - 1 - - - tickers: - request: - template: https://cmc-gate.b2bx.exchange/marketdata/cmc/v1/ticker - pair_template: null - params: null - response: - type: dict - values: - currency_pair: - type: dict - values: - last_price: - type: str - base_volume: - type: str - quote_volume: - type: str - - mapping: - - key: currency_pair_first - path: - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - dict_key - type: - - str - - split - - "_" - - 1 - - key: last_price - path: - - dict_values - - last_price - type: - - str - - float - - key: time - path: [] - type: - - none - - now - - key: daily_volume - path: - - dict_values - - base_volume - type: - - str - - float - - historic_rates: - request: - template: https://api.b2bx.exchange:8443/trading/marketdata/instruments/{currency_pair}/history - pair_template: - template: "{first}_{second}" - lower_case: true - params: - endDate: - function: last_timestamp - type: - - datetime - - format - - "%Y-%m-%dT%H:%M:%S" - startDate: - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 1000 - - from_timestamp - - 0 - - "%Y-%m-%dT%H:%M:%S" - count: - default: 1000 #max - type: - allowed: - minutes: 1m - hours: 1h - days: 1d - weeks: 1w - months: 1M - default: 1d - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - start: - type: str - end: - type: str - open: - type: float - high: - type: float - low: - type: float - close: - type: float - volume: - type: float - quoteVolume: - type: float - - mapping: - - key: time - path: - - data - - start - type: - - str - - dateparser - - key: open - path: - - data - - open - type: - - float - - key: high - path: - - data - - high - type: - - float - - key: low - path: - - data - - low - type: - - float - - key: close - path: - - data - - close - type: - - float - - key: volume - path: - - data - - volume - type: - - float - - - trades: - request: - template: https://cmc-gate.b2bx.exchange/marketdata/cmc/v1/trades/{currency_pair} - pair_template: - template: "{first}_{second}" - lower_case: true - params: null - - response: - type: list - values: - type: dict - values: - tradeID: - type: str - price: - type: str - base_volume: - type: str - quote_volume: - type: str - trade_timestamp: - type: str - type: - type: str - mapping: - - key: time - path: - - trade_timestamp - type: - - str - - float - - from_timestamp - - 0 - - key: id - path: - - tradeID - type: - - str - - int - - key: direction - path: - - type - type: - - str - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - base_volume - type: - - str - - float - - order_books: - request: - template: https://api.b2bx.exchange:8443/trading/marketdata/instruments/{currency_pair}/depth - pair_template: - template: "{first}_{second}" - lower_case: true - params: null - - response: - type: dict - values: - bids: - type: list - values: - type: dict - values: - amount: - type: float - price: - type: float - asks: - type: list - values: - type: dict - values: - amount: - type: float - price: - type: float - version: - type: int - - - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: - - version - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bids - - amount - type: - - float - - key: bids_price - path: - - bids - - price - type: - - float - - key: asks_amount - path: - - asks - - amount - type: - - float - - key: asks_price - path: - - asks - - price - type: - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bankcex.yaml b/pandas_datareader/crypto/resources/running_exchanges/bankcex.yaml deleted file mode 100644 index da663b2d..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bankcex.yaml +++ /dev/null @@ -1,356 +0,0 @@ -name: bankcex -exchange: true - -rate_limit: - max: 300 - unit: 60 - -api_url: https://api.bankcex.com/api/v1/ - -requests: - currency_pairs: - request: - template: exchangeInfo - pair_template: null - params: null - - response: - type: dict - values: - rate_limits: - type: list - symbols: - type: list - values: - type: dict - values: - baseAsset: - type: str - quoteAsset: - type: str - - - mapping: - - key: currency_pair_first - path: - - symbols - - baseAsset - type: - - str - - key: currency_pair_second - path: - - symbols - - quoteAsset - type: - - str - - tickers: - request: - template: returnTicker - pair_template: null - params: null - response: - type: dict - values: - currency_pair: - type: dict - values: - symbol: - type: str - last: - type: float - highestBid: - type: float - lowestAsk: - type: float - quoteVolume: - type: float - baseVolume: - type: float - - - mapping: - - key: currency_pair_first - path: - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - dict_key - type: - - str - - split - - "_" - - 1 - - key: last_price - path: - - dict_values - - last - type: - - float - - key: time - path: [] - type: - - none - - now - - key: best_bid - path: - - dict_values - - highestBid - type: - - float - - key: best_ask - path: - - dict_values - - lowestAsk - type: - - float - - key: daily_volume - path: - - dict_values - - baseVolume - type: - - float - - historic_rates: - request: - template: klines - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - max: 100 - default: 100 - interval: - allowed: - minutes: 1m - hours: 1h - days: 1d - weeks: 1w - default: 1d -# startTime: # not necessary -# function: last_timestamp -# type: -# - datetime -# - timedeltams -# - interval -# - 1000 - endTime: - function: last_timestamp - type: - - datetime - - timestampms - response: - type: list - values: - type: list - values: - 0: # open time - type: int - 1: # open - type: str - 2: # high - type: str - 3: # low - type: str - 4: # close - type: str - 5: # volume - type: str - 6: # close time - type: int - 7: # quote volume - type: str - 8: # number of trades - type: str - - mapping: - - key: time - path: - - 6 - type: - - float - - from_timestamp - - 1 - - key: open - path: - - 1 - type: - - str - - float - - key: high - path: - - 2 - type: - - str - - float - - key: low - path: - - 3 - type: - - str - - float - - key: close - path: - - 4 - type: - - str - - float - - key: volume - path: - - 5 - type: - - str - - float - - - trades: - request: - template: trades - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - default: 500 - - response: - type: list - values: - type: dict - values: - id: - type: str - price: - type: str - qty: - type: str - time: - type: int - isBuyerMaker: - type: bool - isBestMatch: - type: bool - - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: id - path: - - id - type: - - str - - key: direction - path: - - isBuyerMaker - type: - - value - - map - - true - - sell - - false - - buy - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - qty - type: - - str - - float - - order_books: - request: - template: depth - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - max: 1000 - default: 100 - response: - type: dict - values: - lastUpdateId: - type: str - bids: - type: list - values: - type: list - values: - 0: #price - type: str - 1: # qty - type: str - asks: - type: list - values: - type: list - values: - 0: #price - type: str - 1: # qty - type: str - - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bequant.yaml b/pandas_datareader/crypto/resources/running_exchanges/bequant.yaml deleted file mode 100644 index 996552ec..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bequant.yaml +++ /dev/null @@ -1,374 +0,0 @@ -name: bequant -exchange: true - -rate_limit: - max: 6000 - unit: 60 - -api_url: https://api.bequant.io/api/2/public/ - -requests: - currency_pairs: - request: - template: symbol - pair_template: null - params: null - - response: - type: list - values: - type: dict - values: - baseCurrency: - type: str - quoteCurrency: - type: str - - mapping: - - key: currency_pair_first - path: - - baseCurrency - type: - - str - - key: currency_pair_second - path: - - quoteCurrency - type: - - str - - tickers: - request: - template: ticker - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbols - params: null - response: - type: list - values: - type: dict - values: - ask: - type: str - bid: - type: str - last: - type: str - volume: - type: str - volumeQuote: - type: str - timestamp: - type: str - - mapping: - - key: last_price - path: - - last - type: - - str - - float - - key: time - path: - - timestamp - type: - - str - - dateparser - - key: best_bid - path: - - bid - type: - - str - - float - - key: best_ask - path: - - ask - type: - - str - - float - - key: daily_volume - path: - - volume - type: - - str - - float - - historic_rates: - request: - template: candles - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbols - params: - period: - allowed: - minutes: M1 - hours: H1 - days: D1 - weeks: D7 - months: 1M - default: D1 - - till: - function: last_timestamp - type: - - datetime - - format - - "%Y-%m-%dT%H:%M:%S.%fZ" - from: - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 1000 - - from_timestamp - - 0 - - "%Y-%m-%dT%H:%M:%S.%fZ" - sort: - default: DESC - limit: - max: 1000 - default: 1000 - - response: - type: dict - values: - currency_pair: - type: list - values: - type: dict - values: - timestamp: - type: str - open: - type: str - close: - type: str - min: - type: str - max: - type: str - volumeQuote: - type: str - volume: - type: str - - mapping: - - key: time - path: - - list_values - - timestamp - type: - - str - - dateparser - - key: open - path: - - list_values - - open - type: - - str - - float - - key: high - path: - - list_values - - max - type: - - str - - float - - key: low - path: - - list_values - - min - type: - - str - - float - - key: close - path: - - list_values - - close - type: - - str - - float - - key: volume - path: - - list_values - - volume - type: - - str - - float - - trades: - request: - template: trades - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbols - params: -# from: -# function: last_timestamp -# type: -# - datetime -# - timestamp -# till: -# function: last_timestamp -# type: -# - datetime -# - timedelta -# - interval -# - 1000 -# sort: -# default: DESC - limit: - max: 1000 - default: 500 - response: - type: dict - values: - currency_pair: - type: list - values: - type: dict - values: - id: - type: int - price: - type: str - quantity: - type: str - side: - type: str - timestamp: - type: str - - mapping: - - key: time - path: - - list_values - - timestamp - type: - - str - - dateparser - - key: id - path: - - list_values - - id - type: - - int - - key: direction - path: - - list_values - - side - type: - - str - - key: price - path: - - list_values - - price - type: - - str - - float - - key: amount - path: - - list_values - - quantity - type: - - str - - float - - order_books: - request: - template: orderbook - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbols - params: - limit: - default: 100 - - response: - type: dict - values: - currency_pair: - type: dict - values: - timestamp: - type: str - batchingTime: - type: str - ask: - type: list - values: - type: dict - values: - price: - type: str - size: - type: str - bid: - type: list - values: - type: dict - values: - price: - type: str - size: - type: str - - mapping: - - key: time - path: - - dict_values - - timestamp - type: - - str - - dateparser - - key: id - path: - - dict_values - - timestamp - type: - - str - - dateparser - - totimestamp - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - dict_values - - bid - - size - type: - - str - - float - - key: bids_price - path: - - dict_values - - bid - - price - type: - - str - - float - - key: asks_amount - path: - - dict_values - - ask - - size - type: - - str - - float - - key: asks_price - path: - - dict_values - - ask - - price - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bibox.yaml b/pandas_datareader/crypto/resources/running_exchanges/bibox.yaml deleted file mode 100644 index ce282e2f..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bibox.yaml +++ /dev/null @@ -1,416 +0,0 @@ -name: bibox -exchange: true -api_url: https://api.bibox.com/v1/mdata -rate_limit: null -requests: - - tickers: - request: - template: "" - pair_template: null - params: - cmd: - type: str - default: marketAll - response: - type: dict - values: - - type: list - values: - result: - type: dict - values: - - buy: - type: int - high: - type: int - last: - type: float - low: - type: int - sell: - type: int - vol24H: - type: float - last_cny: - type: int - last_usd: - type: int - cmd: - type: str - mapping: - - key: time - path: [] - type: - - none - - now - - key: currency_pair_first - path: - - result - - coin_symbol - type: - - str - - key: currency_pair_second - path: - - result - - currency_symbol - type: - - str - - key: daily_volume - path: - - result - - vol24H - type: - - str - - float - - key: last_price - path: - - result - - last - type: - - str - - float - - currency_pairs: - request: - template: "" - pair_template: null - params: - cmd: - type: str - default: pairList - response: - type: dict - values: - result: - type: list - values: - type: dict - values: - id: - type: int - pair: # e.g. BIX_BTC - type: str - is_hide: - type: int - cmd: - type: str - ver: - type: str - mapping: - - key: currency_pair_first - path: - - result - - pair - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - result - - pair - type: - - str - - split - - "_" - - 1 - - historic_rates: - request: - template: "" - pair_template: # pairs, example: BIX_BTC - template: "{first}_{second}" - lower_case: false - alias: pair - params: - cmd: - type: str - default: kline - period: # k line period - allowed: - minutes: 1min - hours: 1hour - days: day - weeks: week - default: day - size: # how many, 1-1000, if not passed will return 1000 - type: int - default: 1000 - response: - type: dict - values: - result: - type: list - values: - type: dict - values: - time: - type: - - float - - from_timestamp - - 0 - open: - type: - - str - - float - high: - type: - - str - - float - low: - type: - - str - - float - close: - type: - - str - - float - vol: - type: - - str - - int - cmd: - type: str - ver: - type: str - mapping: - - key: time - path: - - result - - time - type: - - float - - from_timestamp - - 1 - - key: open - path: - - result - - open - type: - - str - - float - - key: high - path: - - result - - high - type: - - str - - float - - key: low - path: - - result - - low - type: - - str - - float - - key: close - path: - - result - - close - type: - - str - - float - - key: volume - path: - - result - - vol - type: - - str - - float - - order_books: - request: - template: "" - pair_template: # pairs, example: BIX_BTC - template: "{first}_{second}" - lower_case: false - alias: pair - params: - cmd: - type: str - default: depth - size: # how many, 1-200, if not passed will return 200 - type: int - default: 200 - response: - type: dict - values: - result: - type: dict - values: - update_time: - type: - - float - - from_timestamp - - 0 - asks: - type: list - values: - type: dict - values: - price: - type: - - str - - float - volume: - type: - - str - - float - bids: - type: list - values: - type: dict - values: - price: - type: - - str - - float - volume: - type: - - str - - float - pair: - type: str - cmd: - type: str - ver: - type: str - mapping: - - key: time - path: - - result - - update_time - type: - - float - - from_timestamp - - 1 - - key: asks_price - path: - - result - - asks - - price - type: - - str - - float - - key: asks_amount - path: - - result - - asks - - volume - type: - - str - - float - - key: bids_price - path: - - result - - bids - - price - type: - - str - - float - - key: bids_amount - path: - - result - - bids - - volume - type: - - str - - float - - key: id - path: - - result - - update_time - type: - - int - - key: position - path: [] - type: - - none - - range - - trades: - request: - template: "" - pair_template: # pairs, example: BIX_BTC - template: "{first}_{second}" - lower_case: false - alias: pair - params: - cmd: - type: str - default: deals - size: # how many, 1-200, if not passed will return 200 - type: int - default: 200 - response: - type: dict - values: - result: - type: list - values: - type: dict - values: - id: - type: int - pair: - type: str - price: - type: - - str - amount: - type: - - str - time: - type: - - str - side: # transaction side, 1-bid, 2-ask - type: int - cmd: - type: str - mapping: - - key: price - path: - - result - - price - type: - - str - - float - - key: amount - path: - - result - - amount - type: - - str - - float - - key: time - path: - - result - - time - type: - - str - - float - - from_timestamp - - 1 - - key: direction - path: - - result - - side - type: - - value - - map - - 1 - - buy - - 2 - - sell - - key: id - path: - - result - - time - type: - - str - - int - diff --git a/pandas_datareader/crypto/resources/running_exchanges/bidesk.yaml b/pandas_datareader/crypto/resources/running_exchanges/bidesk.yaml deleted file mode 100644 index e722bc0a..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bidesk.yaml +++ /dev/null @@ -1,304 +0,0 @@ -name: bidesk -is_exchange: true - -api_url: https://api.bidesk.com/ -rate_limit: - max: 1500 - unit: 60 - -requests: - currency_pairs: - request: - template: openapi/v1/brokerInfo - pair_template: null - params: null - - response: - type: dict - values: - symbols: - type: list - values: - type: dict - values: - baseAsset: - type: str - quoteAsset: - type: str - - mapping: - - key: currency_pair_first - path: - - symbols - - baseAsset - type: - - str - - key: currency_pair_second - path: - - symbols - - quoteAsset - type: - - str - - tickers: - request: - template: openapi/quote/v1/ticker/price - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: null - - response: - type: dict - values: - symbol: - type: str - price: - type: str - mapping: - - key: time - path: [] - type: - - none - - now - - key: last_price - path: - - price - type: - - str - - float - - order_books: - request: - template: openapi/quote/v1/depth - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - type: int - max: 1000 - default: 50 - response: - type: dict - values: - time: - type: int - bids: - type: list - values: - type: list - 0: #price - type: str - 1: #qty - type: str - asks: - type: list - values: - type: list - 0: - type: str - 1: - type: str - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: id - path: - - time - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - trades: - request: - template: openapi/quote/v1/trades - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - type: int - max: 1000 - default: 500 - response: - type: list - value: - type: dict - values: - price: - type: str - qty: - typ: str - time: - type: int - isBuyerMaker: - type: bool - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: direction - path: - - isBuyerMaker - type: - - value - - map - - True - - sell - - False - - buy - - key: id - path: - - time - type: - - int - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - qty - type: - - str - - float - - historic_rates: - request: - template: openapi/quote/v1/klines - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - interval: - allowed: - minutes: 1m - hours: 1h - days: 1d - weeks: 1w - months: 1M - default: 1d - limit: - type: int - max: 1000 - default: 1000 - endTime: - function: last_timestamp - type: - - datetime - - timestampms - - response: - type: list - values: - type: list - values: - 0: #timestamp - type: int - 1: #open - type: str - 2: #high - type: str - 3: #low - type: str - 4: #close - type: str - 5: #volume - type: str - 6: #close time - type: int - 7: # quote Asset volume - type: str - 8: # number of trades - type: int - 9: # taker buy base asset volume - type: str - 10: # taker buy quote asset volume - type: str - - mapping: - - key: time - path: - - 0 - type: - - float - - from_timestamp - - 1 - - key: open - path: - - 1 - type: - - str - - float - - key: high - path: - - 2 - type: - - str - - float - - key: low - path: - - 3 - type: - - str - - float - - key: close - path: - - 4 - type: - - str - - float - - key: volume - path: - - 5 - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bigone.yaml b/pandas_datareader/crypto/resources/running_exchanges/bigone.yaml deleted file mode 100644 index a621a096..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bigone.yaml +++ /dev/null @@ -1,341 +0,0 @@ -name: bigone -exchange: true - -rate_limit: - max: 3000 - unit: 60 - -api_url: https://big.one/api/v3/ - -requests: - currency_pairs: - request: - template: asset_pairs - pair_template: null - params: null - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - name: - type: str - - mapping: - - key: currency_pair_first - path: - - data - - name - type: - - str - - split - - "-" - - 0 - - key: currency_pair_second - path: - - data - - name - type: - - str - - split - - "-" - - 1 - - tickers: - request: - template: asset_pairs/{currency_pair}/ticker - pair_template: - template: "{first}-{second}" - lower_case: false - params: null - response: - type: dict - values: - data: - type: dict - values: - bid: - type: dict - values: - price: - type: str - ask: - type: dict - values: - price: - type: str - volume: - type: str - - mapping: - - key: time - path: [] - type: - - none - - now - - key: best_bid - path: - - data - - bid - - price - type: - - str - - float - - key: best_ask - path: - - data - - ask - - price - type: - - str - - float - - key: daily_volume - path: - - data - - volume - type: - - str - - float - - historic_rates: - request: - template: asset_pairs/{currency_pair}/candles - pair_template: - template: "{first}-{second}" - lower_case: false - params: - period: - allowed: - minutes: min1 - hours: hour1 - days: day1 - weeks: week1 - months: months1 - default: day1 - time: - function: last_timestamp - type: - - datetime - - format - - "%Y-%m-%dT%H:%M:%S.%fZ" - limit: - max: 500 - default: 500 - response: - type: dict - values: - type: list - values: - type: dict - values: - close: - type: str - high: - type: str - low: - type: str - open: - type: str - volume: - type: str - time: - type: str - - mapping: - - key: time - path: - - data - - time - type: - - str - - dateparser - - key: open - path: - - data - - open - type: - - str - - float - - key: high - path: - - data - - high - type: - - str - - float - - key: low - path: - - data - - low - type: - - str - - float - - key: close - path: - - data - - close - type: - - str - - float - - key: volume - path: - - data - - volume - type: - - str - - float - - - trades: - request: - template: asset_pairs/{currency_pair}/trades - pair_template: - template: "{first}-{second}" - lower_case: false - params: null - - response: - type: dict - values: - type: list - values: - type: dict - values: - id: - type: int - price: - type: str - amount: - type: str - taker_side: - type: str - created_at: - type: str - mapping: - - key: time - path: - - data - - created_at - type: - - str - - dateparser - - key: id - path: - - data - - id - type: - - int - - key: direction - path: - - data - - taker_side - type: - - value - - map - - ASK - - sell - - BID - - buy - - key: price - path: - - data - - price - type: - - str - - float - - key: amount - path: - - data - - amount - type: - - str - - float - - order_books: - request: - template: asset_pairs/{currency_pair}/depth - pair_template: - template: "{first}-{second}" - lower_case: false - params: - limit: - max: 200 - default: 50 - - response: - type: dict - values: - data: - type: dict - values: - bids: - type: list - values: - type: dict - values: - price: - type: str - quantity: - type: str - asks: - type: list - values: - type: dict - values: - price: - type: str - quantity: - type: str - - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - data - - bids - - quantity - type: - - str - - float - - key: bids_price - path: - - data - - bids - - price - type: - - str - - float - - key: asks_amount - path: - - data - - asks - - quantity - type: - - str - - float - - key: asks_price - path: - - data - - asks - - price - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/binance.yaml b/pandas_datareader/crypto/resources/running_exchanges/binance.yaml deleted file mode 100644 index 6b33b19d..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/binance.yaml +++ /dev/null @@ -1,388 +0,0 @@ -name: binance -exchange: true -api_url: https://api.binance.com/api/ -rate_limit: - max: 1200 - unit: 60 -requests: - currency_pairs: - request: - template: v1/exchangeInfo - pair_template: null - params: null - response: - type: dict - values: - timezone: - type: str # "UTC" - serverTime: - type: - - float - - from_timestamp - - 1 - rateLimits: - type: list - exchangeFilters: - type: list - symbols: - type: list - values: - type: dict - values: - symbol: # i.e. "ETHBTC" - type: str - status: # i.e. "TRADING" - type: str - baseAsset: # i.e. ETH - type: str - baseAssetPrecision: - type: int - quoteAsset: # i.e. "BTC" - type: str - quotePrecision: - type: int - orderTypes: - type: list - icebergAllowed: - type: bool - filters: - type: list - mapping: - - key: currency_pair_first - path: - - symbols - - baseAsset - type: - - str - - key: currency_pair_second - path: - - symbols - - quoteAsset - type: - - str - - tickers: - request: - template: v3/ticker/bookTicker - pair_template: # e.g. BNBBTC - template: "{first}{second}" - lower_case: false - alias: symbol - params: null - response: - type: dict - values: - symbol: - type: str - bidPrice: - type: - - str - - float - bidQty: - type: - - str - - float - askPrice: - type: - - str - - float - askQty: - type: - - str - - float - mapping: - - key: time - path: [] - type: - - none - - now - - key: best_bid - path: - - bidPrice - type: - - str - - float - - key: best_ask - path: - - askPrice - type: - - str - - float - - order_books: - request: - template: v3/depth - pair_template: # e.g. BNBBTC - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - max: 100 - default: 50 - - response: - type: dict - values: - lastUpdateId: - type: int - bids: - type: list - values: - type: list - values: - 0: # price - type: - - str - - float - 1: # quantity - type: - - str - - float - asks: - type: list - values: - type: list - values: - 0: # price - type: - - str - - float - 1: # quantity - type: - - str - - float - mapping: - - key: time - path: [] - type: - - none - - now - - - key: id - path: - - lastUpdateId - type: - - str - - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - trades: - request: - template: v1/trades - pair_template: # e.g. BNBBTC - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - max: 1000 - default: 500 - weight: 1 - response: - type: list - values: - type: dict - values: - id: - type: int - price: - type: - - str - - float - qty: - type: - - str - - float - time: - type: - - float - - from_timestamp - - 1 - isBuyerMaker: - type: bool - isBestMatch: - type: bool - mapping: - - key: id - path: - - id - type: - - int - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - qty - type: - - str - - float - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: direction - path: - - isBuyerMaker - type: - - value - - map - - True - - sell - - False - - buy - - historic_rates: - request: - template: v1/klines - pair_template: # e.g. BNBBTC - template: "{first}{second}" - lower_case: false - alias: symbol - params: - interval: - allowed: - minutes: 1m - hours: 1h - days: 1d - weeks: 1w - months: 1M - default: 1d - startTime: - required: false - endTime: - function: last_timestamp - type: - - datetime - - timestampms - limit: - max: 1000 - default: 1000 - response: - type: list - values: - type: list - values: - 0: # Open time - type: - - float - - from_timestamp - - 1 - 1: # open - type: - - str - - float - 2: # high - type: - - str - - float - 3: # low - type: - - str - - float - 4: # close - type: - - str - - float - 5: # volume - type: - - str - - float - 6: # close time - type: - - float - - from_timestamp - - 1 - 7: # Quote asset volume - type: - - str - - float - 8: # Number of trades - type: int - 9: # Taker buy base asset volume - type: - - str - - float - 10: # Taker buy quote asset volume - type: - - str - - float - 11: # ignore - type: ignore - mapping: - - key: open - path: - - 1 - type: - - str - - float - - key: high - path: - - 2 - type: - - str - - float - - key: low - path: - - 3 - type: - - str - - float - - key: close - path: - - 4 - type: - - str - - float - - key: volume - path: - - 5 - type: - - str - - float - - key: time - path: - - 6 - type: - - float - - from_timestamp - - 1 diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitbay.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitbay.yaml deleted file mode 100644 index 6e725ee3..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bitbay.yaml +++ /dev/null @@ -1,384 +0,0 @@ -name: bitbay -exchange: true - -api_url: https://api.bitbay.net/rest/trading/ -rate_limit: - max: 60 - unit: 60 - -requests: - currency_pairs: - request: - template: ticker - pair_template: null - params: null - response: - type: dict - values: - items: - type: dict - values: - currency_pair: - type: dict - - mapping: - - key: currency_pair_first - path: - - items - - dict_key - type: - - str - - split - - "-" - - 0 - - key: currency_pair_second - path: - - items - - dict_key - type: - - str - - split - - "-" - - 1 - - tickers: - request: - template: ticker - pair_template: null - params: null - response: - type: dict - values: - items: - type: dict - values: - currency_pair: - type: dict - values: - market: - type: dict - values: - time: - type: str - highestBid: - type: str - lowestAsk: - type: str - rate: - type: str - - mapping: - - key: currency_pair_first - path: - - items - - dict_key - type: - - str - - split - - "-" - - 0 - - key: currency_pair_second - path: - - items - - dict_key - type: - - str - - split - - "-" - - 1 - - key: time - path: - - items - - dict_values - - time - type: - - str - - float - - from_timestamp - - 1 - - key: last_price - path: - - items - - dict_values - - rate - type: - - str - - float - - key: best_bid - path: - - items - - dict_values - - highestBid - type: - - str - - float - - key: best_ask - path: - - items - - dict_values - - lowestAsk - type: - - str - - float - - - trades: - request: - template: transactions/{currency_pair} - pair_template: - template: "{first}-{second}" - lower_case: false - params: - limit: - type: int - max: 300 - default: 300 - response: - type: dict - values: - items: - type: list - values: - type: dict - values: - id: - type: str - t: - type: str - a: - type: str - r: - type: str - ty: - type: str - - mapping: - - key: time - path: - - items - - t - type: - - str - - float - - from_timestamp - - 1 - - key: id - path: - - items - - id - type: - - str - - key: price - path: - - items - - r - type: - - str - - float - - key: amount - path: - - items - - a - type: - - str - - float - - key: direction - path: - - items - - ty - type: - - str - - - order_books: - request: - template: orderbook-limited/{currency_pair}/50 #change limit 50 here - pair_template: - template: "{first}-{second}" - lower_case: false - params: null - response: - type: dict - values: - sell: - type: list - values: - type: dict - values: - ra: - type: str - ca: - type: str - sa: - type: str - pa: - type: str - co: - type: int - buy: - type: list - values: - type: dict - values: - ra: - type: str - ca: - type: str - sa: - type: str - pa: - type: str - co: - type: int - timestamp: - type: str - seqNo: - type: str - - mapping: - - key: time - path: - - timestamp - type: - - str - - float - - from_timestamp - - 1 - - key: id - path: - - seqNo - type: - - str - - int - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - buy - - ra - type: - - str - - float - - key: bids_amount - path: - - buy - - ca - type: - - str - - float - - key: asks_price - path: - - sell - - ra - type: - - str - - float - - key: asks_amount - path: - - sell - - ca - type: - - str - - float - - historic_rates: - request: - template: candle/history/{currency_pair}/{frequency} - pair_template: - template: "{first}-{second}" - lower_case: false - params: - to: - type: - - none - - now_timestampms - from: - function: last_timestamp - type: - - datetime - - timedeltams - - interval - - 2000 - - frequency: - allowed: - minutes: 60 - hours: 3600 - days: 86400 - weeks: 604800 - response: - type: dict - values: - items: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: dict - values: - o: - type: str - c: - type: str - h: - type: str - l: - type: str - v: - type: str - mapping: - - key: time - path: - - items - - 0 - type: - - str - - float - - from_timestamp - - 1 - - key: open - path: - - items - - 1 - - o - type: - - str - - float - - key: high - path: - - items - - 1 - - h - type: - - str - - float - - key: low - path: - - items - - 1 - - l - type: - - str - - float - - key: close - path: - - items - - 1 - - c - type: - - str - - float - - key: volume - path: - - items - - 1 - - v - type: - - str - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitfinex.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitfinex.yaml deleted file mode 100644 index 8c3f78cb..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bitfinex.yaml +++ /dev/null @@ -1,365 +0,0 @@ -name: bitfinex - # v1: -#api_url: https://api-pub.bitfinex.com/ -#api_url: https://api.bitfinex.com/ -api_url: '' - -rate_limit: - max: 90 - unit: 60 - -requests: - currency_pairs: - request: - template: https://api.bitfinex.com/v1/symbols_details - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - pair: - type: str - mapping: - - key: currency_pair_first - path: - - pair - type: - - str - - split_at_del_or_index - - ':' - - 3 - - 0 - - - key: currency_pair_second - path: - - pair - type: - - str - - split_at_del_or_index - - ':' - - 3 - - 1 - - - tickers: - request: - template: https://api.bitfinex.com/v1/pubticker/{currency_pair} - pair_template: # i.e. tBTCUSD - template: "{first}{second}" - lower_case: false - params: null - response: - type: dict - values: - mid: - type: str - bid: - type: str - ask: - type: str - last_price: - type: str - low: - type: str - high: - type: str - volume: - type: str - timestamp: - type: str - mapping: # for trading pairs (ex. tBTCUSD) - - key: time - path: - - timestamp - type: - - str - - float - - from_timestamp - - 0 - - key: best_bid - path: - - bid - type: - - str - - float - - key: best_ask - path: - - ask - type: - - str - - float - - key: last_price - path: - - last_price - type: - - str - - float - - key: daily_volume - path: - - volume - type: - - str - - float - - trades: - request: - template: https://api.bitfinex.com/v1/trades/{currency_pair} - pair_template: # i.e. tBTCUSD - template: "{first}{second}" - lower_case: false - params: - limit_trades: # Number of records - default: 999 # max: 10000 - start: # Millisecond start time - required: false - end: # Millisecond end time - required: false - sort: # if = 1 it sorts results returned with old > new - default: -1 - response: - type: list - values: - type: dict - values: - # template on trading pairs (ex. tBTCUSD) - timestamp: # ID - type: int - tid: # MTS: millisecond time stamp - type: - - int - price: # Price: How much was bought (positive) or sold (negative). - type: float - amount: # Amount: Price at which the trade was executed - type: float - exchange: # Exchange Name - type: str - type: # Direction (i.e. Sell/Buy) - type: str - # template on funding currencies (ex. fUSD) - - mapping: # for trading pairs (ex. tBTCUSD) - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 0 - - key: id - path: - - tid - type: - - int - - key: amount - path: - - amount - type: - - float - - key: price - path: - - price - type: - - float - - key: direction - path: - - type - type: - - str - - order_books: - request: - template: https://api.bitfinex.com/v1/book/{currency_pair} - pair_template: # i.e. tBTCUSD - template: "{first}{second}" - lower_case: false - params: - group: # Level of price aggregation (P0, P1, P2, P3, P4, R0) - type: str - default: 1 - limit_bids: # Number of price points ("25", "100") - type: int - default: 50 - limit_asks: # Number of price points ("25", "100") - type: int - default: 50 - response: - type: dict - values: - bids: - type: list - values: - type: dict - values: - price: - type: str - amount: - type: str - timestamp: - type: str - asks: - type: list - values: - type: dict - values: - price: - type: str - amount: - type: str - timestamp: - type: str - - mapping: # for trading pairs (ex. tBTCUSD), if AMOUNT > 0 then bid else ask. - - key: id - path: - - bids - - timestamp - type: - - str - - float - - int - - key: position - path: [] - type: - - none - - range - - key: time - path: - - bids - - timestamp - type: - - str - - float - - from_timestamp - - 0 - - - key: asks_price - path: - - asks - - price - type: - - str - - float - - key: asks_amount - path: - - asks - - amount - type: - - str - - float - - - key: bids_price - path: - - bids - - price - type: - - str - - float - - key: bids_amount - path: - - bids - - amount - type: - - str - - float - - - historic_rates: - request: - template: https://api-pub.bitfinex.com/v2/candles/trade:{frequency}:{currency_pair}/hist - pair_template: # i.e. tBTCUSD - template: "t{first}{second}" - lower_case: false - params: - limit: # Number of candles requested - default: 10000 # max - start: # Filter start (ms) - required: false - end: # Filter end (ms) - function: last_timestamp - type: - - datetime - - timestampms - sort: # if = 1 it sorts results returned with old > new - required: false - - frequency: - allowed: - minutes: 1m - hours: 1h - days: 1D - weeks: 7D - months: 1M - default: 1D - - response: - type: list - values: - # response with Section = "last" - - 0: # MTS: millisecond time stamp - type: - - float - - from_timestamp - - 1 - 1: # OPEN: First execution during the time frame - type: float - 2: # CLOSE: Last execution during the time frame - type: float - 3: # HIGH: Highest execution during the time frame - type: float - 4: # LOW: Lowest execution during the timeframe - type: float - 5: # VOLUME: Quantity of symbol traded within the timeframe - type: float - # response with Section = "hist" - - type: list - values: - 0: # MTS: millisecond time stamp - type: - - float - - from_timestamp - - 1 - 1: # OPEN: First execution during the time frame - type: float - 2: # CLOSE: Last execution during the time frame - type: float - 3: # HIGH: Highest execution during the time frame - type: float - 4: # LOW: Lowest execution during the timeframe - type: float - 5: # VOLUME: Quantity of symbol traded within the timeframe - type: float - mapping: # for trading pairs (ex. tBTCUSD) - - key: time - path: - - 0 - type: - - float - - from_timestamp - - 1 - - key: open - path: - - 1 - type: - - float - - key: close - path: - - 2 - type: - - float - - key: high - path: - - 3 - type: - - float - - key: low - path: - - 4 - type: - - float - - key: volume - path: - - 5 - type: - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitforex.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitforex.yaml deleted file mode 100644 index 4a66f2a2..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bitforex.yaml +++ /dev/null @@ -1,335 +0,0 @@ -name: bitforex -exchange: true - -rate_limit: null - -api_url: https://api.bitforex.com/api/v1/market/ - -requests: - currency_pairs: - request: - template: symbols - pair_template: null - params: null - - response: - type: list - values: - data: - type: list - values: - type: dict - values: - symbol: - type: str - - mapping: - - key: currency_pair_first - path: - - data - - symbol - type: - - str - - split - - "-" - - 2 - - key: currency_pair_second - path: - - data - - symbol - type: - - str - - split - - "-" - - 1 - - tickers: - request: - template: ticker - pair_template: - template: "coin-{second}-{first}" - alias: symbol - lower_case: true - params: null - response: - type: dict - values: - data: - type: dict - values: - buy: - type: float - date: - type: int - last: - type: float - sell: - type: float - vol: - type: float - mapping: - - key: last_price - path: - - data - - last - type: - - float - - key: time - path: - - data - - date - type: - - float - - from_timestamp - - 1 - - key: best_bid - path: - - data - - buy - type: - - float - - key: best_ask - path: - - data - - sell - type: - - float - - key: daily_volume - path: - - data - - vol - type: - - float - - historic_rates: - request: - template: kline - pair_template: - template: "coin-{second}-{first}" - lower_case: true - alias: symbol - params: - size: - max: 600 - default: 600 - ktype: - allowed: - minutes: 1min - hours: 1hour - days: 1day - weeks: 1week - months: 1month - default: 1day - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - close: - type: float - open: - type: float - high: - type: float - low: - type: float - time: - type: float - vol: - type: float - - mapping: - - key: time - path: - - data - - time - type: - - float - - from_timestamp - - 1 - - key: open - path: - - data - - open - type: - - float - - key: high - path: - - data - - high - type: - - float - - key: low - path: - - data - - low - type: - - float - - key: close - path: - - data - - close - type: - - float - - key: volume - path: - - data - - vol - type: - - float - - - trades: - request: - template: trades - pair_template: - template: "coin-{second}-{first}" - lower_case: true - alias: symbol - params: - size: - max: 600 - default: 200 - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - amount: - type: float - direction: - type: int - price: - type: float - tid: - type: int - time: - type: int - - mapping: - - key: time - path: - - data - - time - type: - - float - - from_timestamp - - 1 - - key: id - path: - - data - - tid - type: - - int - - key: direction - path: - - direction - type: - - value - - map - - 1 - - buy - - 2 - - sell - - key: price - path: - - data - - price - type: - - float - - key: amount - path: - - data - - amount - type: - - float - - order_books: - request: - template: depth - pair_template: - template: "coin-{second}-{first}" - lower_case: true - alias: symbol - params: - size: - max: 200 - default: 50 - - response: - type: dict - values: - data: - type: dict - values: - asks: - type: list - values: - type: dict - values: - amount: - type: float - price: - type: float - bids: - type: list - values: - type: dict - values: - amount: - type: float - price: - type: float - - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - data - - bids - - amount - type: - - float - - key: bids_price - path: - - data - - bids - - price - type: - - float - - key: asks_amount - path: - - data - - asks - - amount - type: - - float - - key: asks_price - path: - - data - - asks - - price - type: - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitfront.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitfront.yaml deleted file mode 100644 index 01a133e5..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bitfront.yaml +++ /dev/null @@ -1,251 +0,0 @@ -name: bitfront -exchange: true - -rate_limit: null - -api_url: https://openapi.bitfront.me/v1/market/public/ - -requests: - currency_pairs: - request: - template: /coins/pairPolicy - pair_template: null - params: null - - response: - type: dict - values: - responseData: - type: list - values: - type: dict - marketType: - type: str - coinType: - type: str - - mapping: - - key: currency_pair_first - path: - - responseData - - coinType - type: - - str - - key: currency_pair_second - path: - - responseData - - marketType - type: - - str - - tickers: - request: - template: currentTickValue - pair_template: - template: "{first}.{second}" - lower_case: false - alias: coinPair - params: null - response: - type: dict - values: - responseTime: - type: int - responseData: - type: list - values: - type: dict - values: - bid: - type: float - ask: - type: float - last: - type: float - volume: - type: float - mapping: - - key: last_price - path: - - responseData - - last - type: - - float - - key: time - path: - - responseTime - type: - - float - - from_timestamp - - 1 - - key: best_bid - path: - - responseData - - bid - type: - - float - - key: best_ask - path: - - responseData - - ask - type: - - float - - key: daily_volume - path: - - responseData - - volume - type: - - float - - - order_books: - request: - template: orderBooks - pair_template: - template: "{first}.{second}" - lower_case: false - alias: coinPair - params: - depth: - max: 1000 - default: 50 - - response: - type: dict - values: - responseTime: - type: int - responseData: - type: dict - values: - ASK: - type: list - values: - type: dict - values: - price: - type: float - amount: - type: float - BID: - type: list - values: - type: dict - values: - price: - type: float - amount: - type: float - - mapping: - - key: time - path: - - responseTime - type: - - float - - from_timestamp - - 1 - - key: id - path: - - responseTime - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - responseData - - BID - - amount - type: - - float - - key: bids_price - path: - - responseData - - BID - - price - type: - - float - - key: asks_amount - path: - - responseData - - ASK - - amount - type: - - float - - key: asks_price - path: - - responseData - - ASK - - price - type: - - float - - trades: - request: - template: tradeHistory - pair_template: - template: "{first}.{second}" - lower_case: false - alias: coinPair - params: - max: - default: 100 - - response: - type: dict - values: - responseTime: - type: int - responseData: - type: list - values: - type: dict - values: - transactionID: - type: int - price: - type: float - amount: - type: float - orderSide: - type: str - createdAt: - type: int - - mapping: - - key: time - path: - - responseData - - createdAt - type: - - float - - from_timestamp - - 1 - - key: id - path: - - responseData - - transactionID - type: - - int - - key: direction - path: - - responseData - - orderSide - type: - - str - - key: price - path: - - responseData - - price - type: - - float - - key: amount - path: - - responseData - - amount - type: - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bithumb.yaml b/pandas_datareader/crypto/resources/running_exchanges/bithumb.yaml deleted file mode 100644 index 592a98ec..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bithumb.yaml +++ /dev/null @@ -1,420 +0,0 @@ -name: bithumb -exchange: true -api_url: https://global-openapi.bithumb.pro/openapi/v1/ -rate_limit: - max: 20 - unit: 1 -requests: - - currency_pairs: - request: - template: spot/ticker - pair_template: null - params: - symbol: - type: str - default: ALL - response: - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - p: # dict_key - type: dict - ver: - type: str - vol: - type: str - c: - type: str - s: - type: str - t: - type: str - v: - type: str - h: - type: str - l: - type: str - lev: - type: str - code: - type: str - msg: - type: str - timestamp: - type: int - startTime: - type: null - - mapping: - - key: currency_pair_first - path: - - data - - s - type: - - str - - split - - "-" - - 0 - - key: currency_pair_second - path: - - data - - s - type: - - str - - split - - "-" - - 1 - - tickers: - request: - template: spot/ticker - pair_template: null - params: - symbol: - type: str - default: ALL - response: - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - p: # dict_key - type: dict - ver: - type: str - vol: - type: str - c: - type: str - s: - type: str - t: - type: str - v: - type: str - h: - type: str - l: - type: str - lev: - type: str - code: - type: str - msg: - type: str - timestamp: - type: int - startTime: - type: null - mapping: - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 1 - - key: currency_pair_first - path: - - data - - s - type: - - str - - split - - "-" - - 0 - - key: currency_pair_second - path: - - data - - s - type: - - str - - split - - "-" - - 1 - - key: last_price - path: - - data - - h - type: - - str - - float - - key: daily_volume - path: - - data - - v - type: - - str - - float - - order_books: - request: - template: spot/orderBook - pair_template: # e.g. BTC - template: "{first}-{second}" - alias: symbol - lower_case: false - params: null - response: - type: dict - values: - data: - type: dict - values: - symbol: - type: str - b: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - s: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - code: - type: str - msg: - type: str - timestamp: - type: int - startTime: - type: null - ver: - type: str - - mapping: - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 1 - - key: bids_price - path: - - data - - b - - 0 - type: - - str - - float - - key: bids_amount - path: - - data - - b - - 1 - type: - - str - - float - - key: asks_amount - path: - - data - - s - - 1 - type: - - str - - float - - key: asks_price - path: - - data - - s - - 0 - type: - - str - - float - - key: id - path: - - data - - ver - type: - - str - - int - - key: position - path: [] - type: - - none - - range - - trades: - request: - template: spot/trades - pair_template: # e.g. BTC - template: "{first}-{second}" - alias: symbol - lower_case: false - params: null - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - p: - type: str - ver: - type: str - s: - type: str - t: - type: str - v: - type: str - mapping: - - key: time - path: - - data - - t - type: - - str - - float - - from_timestamp - - 0 - - key: id - path: - - data - - ver - type: - - str - - int - - key: amount - path: - - data - - v - type: - - str - - float - - key: price - path: - - data - - p - type: - - str - - float - - key: direction - path: - - data - - s - type: - - str - - historic_rates: - request: - template: spot/kline - pair_template: - template: "{first}-{second}" - alias: symbol - lower_case: false - params: - type: - allowed: - minutes: m1 - hours: h1 - days: d1 - weeks: w1 - months: M1 - default: m1 - start: - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 1000 - end: - function: last_timestamp - type: - - datetime - - timestamp - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - c: - type: str - s: - type: str - t: - type: str - v: - type: str - h: - type: str - time: - type: str - l: - type: str - o: - type: str - mapping: - - key: time - path: - - data - - time - type: - - str - - float - - from_timestamp - - 0 - - key: open - path: - - data - - o - type: - - str - - float - - key: high - path: - - data - - h - type: - - str - - float - - key: low - path: - - data - - l - type: - - str - - float - - key: close - path: - - data - - c - type: - - str - - float - - key: volume - path: - - data - - v - type: - - str - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitkub.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitkub.yaml deleted file mode 100644 index e5ebcfb2..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bitkub.yaml +++ /dev/null @@ -1,246 +0,0 @@ -name: bitkub -exchange: true - -rate_limit: null -api_url: https://api.bitkub.com - -requests: - currency_pairs: - request: - template: /api/market/symbols - pair_template: null - params: null - - response: - type: dict - values: - result: - type: list - values: - type: dict - values: - symbol: - type: str - - mapping: - - key: currency_pair_first - path: - - result - - symbol - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - result - - symbol - type: - - str - - split - - "_" - - 1 - - tickers: - request: - template: /api/market/ticker - pair_template: null - params: null - response: - type: dict - values: - currency_pair: - type: dict - values: - last: - type: float - lowestAsk: - type: float - highestBid: - type: float - baseVolume: - type: float - - mapping: - - key: currency_pair_first - path: - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - dict_key - type: - - str - - split - - "_" - - 1 - - key: last_price - path: - - dict_values - - last - type: - - float - - key: time - path: [] - type: - - none - - now - - key: best_bid - path: - - dict_values - - highestBid - type: - - float - - key: best_ask - path: - - dict_values - - lowestAsk - type: - - float - - key: daily_volume - path: - - dict_values - - baseVolume - type: - - float - - trades: - request: - template: /api/market/trades - pair_template: - template: "{first}_{second}" - lower_case: false - alias: sym - params: - lmt: - type: int - default: 200 - response: - type: dict - values: - result: - type: list - values: - type: list - values: - 0: # time - type: int - 1: # price - type: float - 2: # quty - type: float - 3: # side - type: str - - mapping: - - key: time - path: - - result - - 0 - type: - - float - - from_timestamp - - 1 - - key: id - path: - - result - - 0 - type: - - int - - key: direction - path: - - result - - 3 - type: - - str - - key: price - path: - - result - - 1 - type: - - float - - key: amount - path: - - result - - 2 - type: - - float - - order_books: - request: - template: /api/market/depth - pair_template: - template: "{first}_{second}" - lower_case: false - alias: sym - params: - lmt: - type: int - default: 50 - - response: - type: dict - values: - bids: - type: list - values: - type: list - values: - 0: # price - type: int - 1: # quantity - type: int - asks: - type: list - values: - type: list - values: - 0: - type: int - 1: - type: int - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bids - - 1 - type: - - float - - key: bids_price - path: - - bids - - 0 - type: - - float - - key: asks_amount - path: - - asks - - 1 - type: - - float - - key: asks_price - path: - - asks - - 0 - type: - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitmart.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitmart.yaml deleted file mode 100644 index 744bccac..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bitmart.yaml +++ /dev/null @@ -1,409 +0,0 @@ -name: bitmart -exchange: true -api_url: https://api-cloud.bitmart.com/spot/v1/ -rate_limit: - max: 600 # 3-90 - unit: 60 -requests: - - currency_pairs: - request: - template: symbols - pair_template: null - params: null - response: - type: dict - values: - data: - type: dict - values: - symbols: - type: list - values: - type: str - mapping: - - key: currency_pair_first - path: - - data - - symbols - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - data - - symbols - type: - - str - - split - - "_" - - 1 - - - tickers: - request: - template: ticker - pair_template: null - params: null - response: - type: dict - values: - data: - type: dict - values: - tickers: - type: list - values: - type: dict - values: - symbol: - type: str - last_price: - type: str - quote_volume: - type: str - base_volume: - type: str - best_ask: - type: str - best_bid: - type: str - mapping: - - key: time - path: [] - type: - - none - - now - - key: currency_pair_first - path: - - data - - tickers - - symbol - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - data - - tickers - - symbol - type: - - str - - split - - "_" - - 1 - - - key: last_price - path: - - data - - tickers - - last_price - type: - - str - - float - - key: best_ask - path: - - data - - tickers - - best_ask - type: - - str - - float - - key: best_bid - path: - - data - - tickers - - best_bid - type: - - str - - float - - key: daily_volume - path: - - data - - tickers - - base_volume - type: - - str - - float - - - historic_rates: - request: - template: symbols/kline - pair_template: # e.g. BMX_ETH - template: "{first}_{second}" - lower_case: false - alias: symbol - params: - step: # in minutes - allowed: - minutes: 1 - hours: 60 - days: 1440 - weeks: 10080 - months: 43200 - default: 1440 # 1d - - from: - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 500 - to: # in milliseconds - function: last_timestamp - type: - - datetime - - timestamp - - response: - type: dict - values: - data: - type: dict - values: - klines: - type: list - values: - type: dict - values: - last_price: - type: str - timestamp: - type: int - volume: - type: str - open: - type: str - close: - type: str - high: - type: str - low: - type: str - mapping: - - key: time - path: - - data - - klines - - timestamp - type: - - float - - from_timestamp - - 0 - - key: open - path: - - data - - klines - - open - type: - - str - - float - - key: high - path: - - data - - klines - - high - type: - - str - - float - - key: low - path: - - data - - klines - - low - type: - - str - - float - - key: close - path: - - data - - klines - - close - type: - - str - - float - - key: volume - path: - - data - - klines - - volume - type: - - str - - float - - order_books: - request: - template: symbols/book - pair_template: # e.g. BMX_ETH - template: "{first}_{second}" - lower_case: false - alias: symbol - params: - precision: # Price precision whose range is defined in symbol details - type: int - required: false - size: - type: int - max: 200 - default: 50 - - response: - type: dict - values: - trace: - type: str - data: - type: dict - values: - buya: - type: list - values: - type: dict - values: - amount: - type: str - total: - type: str - price: - type: str - count: - type: str - sells: - type: list - values: - type: dict - values: - amount: - type: str - total: - type: str - price: - type: str - count: - type: str - - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - data - - buys - - amount - type: - - str - - float - - key: bids_price - path: - - data - - buys - - price - type: - - str - - float - - key: asks_amount - path: - - data - - sells - - amount - type: - - str - - float - - key: asks_price - path: - - data - - sells - - price - type: - - str - - float - - trades: - request: - template: symbols/trades - pair_template: # e.g. BMX_ETH - template: "{first}_{second}" - lower_case: false - alias: symbol - params: null - response: - type: dict - values: - data: - type: dict - values: - trades: - type: list - values: - type: dict - values: - amount: - type: str - order_time: - type: str - price: - type: str - count: - type: str - type: - type: str - mapping: - - key: amount - path: - - data - - trades - - amount - type: - - str - - float - - key: id - path: - - data - - trades - - order_time - type: - - str - - int - - key: time - path: - - data - - trades - - order_time - type: - - float - - from_timestamp - - 1 - - key: price - path: - - data - - trades - - price - type: - - str - - float - - key: direction - path: - - data - - trades - - type - type: - - str diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitopro.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitopro.yaml deleted file mode 100644 index fbf9c46c..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bitopro.yaml +++ /dev/null @@ -1,345 +0,0 @@ -name: bitopro -exchange: true - -rate_limit: - max: 600 - unit: 60 - -api_url: https://api.bitopro.com/v3/ - -requests: - currency_pairs: - request: - template: provisioning/trading-pairs - pair_template: null - params: null - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - base: - type: str - quote: - type: str - - mapping: - - key: currency_pair_first - path: - - data - - base - type: - - str - - key: currency_pair_second - path: - - data - - quote - type: - - str - - tickers: - request: - template: tickers - pair_template: null - params: null - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - pair: - type: str - lastPrice: - type: str - volume24hr: - type: str - - mapping: - - key: currency_pair_first - path: - - data - - pair - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - data - - pair - type: - - str - - split - - "_" - - 1 - - key: last_price - path: - - data - - lastPrice - type: - - str - - float - - key: time - path: [] - type: - - none - - now - - key: daily_volume - path: - - data - - volume24hr - type: - - str - - float - - historic_rates: - request: - template: trading-history/{currency_pair} - pair_template: - template: "{first}_{second}" - lower_case: true - params: - resolution: - allowed: - minutes: 1m - hours: 1h - days: 1d - weeks: 1w - month: 1M - default: 1d - to: - function: last_timestamp - type: - - datetime - - timestamp - from: - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 300 - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - timestamp: - type: int - open: - type: str - high: - type: str - low: - type: str - close: - type: str - volume: - type: str - - mapping: - - key: time - path: - - data - - timestamp - type: - - float - - from_timestamp - - 1 - - key: open - path: - - data - - open - type: - - str - - float - - key: high - path: - - data - - high - type: - - str - - float - - key: low - path: - - data - - low - type: - - str - - float - - key: close - path: - - data - - close - type: - - str - - float - - key: volume - path: - - data - - volume - type: - - str - - float - - - trades: - request: - template: trades/{currency_pair} - pair_template: - template: "{first}_{second}" - lower_case: true - params: null - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - timestamp: - type: int - isBuyer: - type: str - price: - type: str - amount: - type: str - mapping: - - key: time - path: - - data - - timestamp - type: - - float - - from_timestamp - - 0 - - key: id - path: - - data - - timestamp - type: - - int - - key: direction - path: - - data - - isBuyer - type: - - value - - map - - true - - sell - - false - - buy - - key: price - path: - - data - - price - type: - - str - - float - - key: amount - path: - - data - - amount - type: - - str - - float - - order_books: - request: - template: order-book/{currency_pair} - pair_template: - template: "{first}_{second}" - lower_case: true - params: - limit: - default: 20 - - response: - type: dict - values: - asks: - type: list - values: - type: dict - values: - amount: - type: str - count: - type: int - price: - type: str - total: - type: str - bids: - type: list - values: - type: dict - values: - amount: - type: str - count: - type: int - price: - type: str - total: - type: str - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bids - - amount - type: - - str - - float - - key: bids_price - path: - - bids - - price - type: - - str - - float - - key: asks_amount - path: - - asks - - amount - type: - - str - - float - - key: asks_price - path: - - asks - - price - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitrue.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitrue.yaml deleted file mode 100644 index 2a7e6e3e..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bitrue.yaml +++ /dev/null @@ -1,227 +0,0 @@ -name: bitrue -exchange: true - -rate_limit: null - -api_url: https://www.bitrue.com/ - -requests: - currency_pairs: - request: - template: api/v1/exchangeInfo - pair_template: null - params: null - response: - type: dict - values: - timezone: - type: str - serverTime: - type: int - symbols: - type: list - values: - type: dict - values: - symbol: - type: str - status: - type: str - baseAsset: - type: str - quoteAsset: - type: str - mapping: - - key: currency_pair_first - path: - - symbols - - baseAsset - type: - - str - - upper - - key: currency_pair_second - path: - - symbols - - quoteAsset - type: - - str - - upper - - tickers: - request: - template: /api/v1/ticker/price - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: null - - response: - type: dict - values: - symbol: - type: str - price: - type: str - - mapping: - - key: time - path: [] - type: - - none - - now - - key: last_price - path: - - price - type: - - str - - float - - trades: - request: - template: /api/v1/trades - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - type: int - default: 100 #max 1000 - - response: - type: list - values: - type: dict - values: - id: - type: int - price: - type: str - qty: - type: str - time: - type: str - isBuyerMaker: - type: bool - isBestMatch: - type: bool - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: amount - path: - - qty - type: - - str - - float - - key: price - path: - - price - type: - - str - - float - - key: direction - path: - - isBuyerMaker - type: - - value - - map - - true - - sell - - false - - buy - - key: id - path: - - id - type: - - int - - - order_books: - request: - template: /api/v1/depth - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - type: int - default: 100 #max 1000 - response: - type: dict - values: - lastUpdateId: - type: int - bids: - type: list - values: - type: list - values: - 0: # price - type: str - 1: # amount - type: str - asks: - type: list - values: - type: list - values: - 0: # price - type: str - 1: # amount - type: str - mapping: - - key: time - path: - - lastUpdateId - type: - - float - - from_timestamp - - 1 - - key: id - path: - - lastUpdateId - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitso.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitso.yaml deleted file mode 100644 index 1a5cfdb1..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bitso.yaml +++ /dev/null @@ -1,344 +0,0 @@ -#keine moeglichkeit candles/historic_rates abzufragen -name: bitso -exchange: true -api_url: https://api.bitso.com/v3/ -rate_limit: - max: 60 - # 1 minute - unit: 60 -requests: - currency_pairs: - request: - template: available_books/ - pair_template: null - params: null - response: - type: dict - values: - success: - type: bool - payload: - type: list - values: - type: dict - values: - book: # e.g. btc_mxn - type: str - minimum_amount: - type: - - str - maximum_amount: - type: - - str - minimum_price: - type: - - str - maximum_price: - type: - - str - minimum_value: - type: - - str - maximum_value: - type: - - str - mapping: - - key: currency_pair_first - path: - - payload - - book - type: - - str - - splitupper - - "_" - - 0 - - key: currency_pair_second - path: - - payload - - book - type: - - str - - splitupper - - "_" - - 1 - - tickers: - request: - template: ticker - pair_template: null - params: - book: - type: str - default: all - response: - type: dict - values: - success: - type: bool - payload: - type: dict - values: - book: - type: - - str - volume: - type: - - str - high: - type: - - str - last: - type: - - str - low: - type: - - str - vwap: - type: - - str - ask: - type: - - str - bid: - type: - - str - created_at: - type: - - str - mapping: - - key: currency_pair_first - path: - - payload - - book - type: - - str - - split - - '_' - - 0 - - key: currency_pair_second - path: - - payload - - book - type: - - str - - split - - '_' - - 1 - - key: daily_volume - path: - - payload - - volume - type: - - str - - float - - key: last_price - path: - - payload - - last - type: - - str - - float - - key: best_ask - path: - - payload - - ask - type: - - str - - float - - key: best_bid - path: - - payload - - bid - type: - - str - - float - - key: time - path: - - payload - - created_at - type: - - str - - dateparser - - order_books: - request: - template: order_book - pair_template: # e.g. btc_mxn - template: "{first}_{second}" - lower_case: true - alias: book - params: - aggregate: - type: bool - default: true - response: - type: dict - values: - success: - type: bool - payload: - type: dict - values: - asks: - type: list - values: - type: dict - values: - book: - type: str - price: - type: - - str - amount: - type: - - str - bids: - type: list - values: - type: dict - values: - book: - type: str - price: - type: - - str - amount: - type: - - str - updated_at: - type: - - str - sequence: - type: - - str - mapping: - - key: position - path: [] - type: - - none - - range - - key: id - path: - - payload - - sequence - type: - - str - - int - - key: asks_price - path: - - payload - - asks - - price - type: - - str - - float - - key: asks_amount - path: - - payload - - asks - - amount - type: - - str - - float - - key: bids_price - path: - - payload - - bids - - price - type: - - str - - float - - key: bids_amount - path: - - payload - - bids - - amount - type: - - str - - float - - key: time - path: - - payload - - updated_at - type: - - str - - dateparser - - trades: - request: - template: trades - pair_template: # e.g. btc_mxn - template: "{first}_{second}" - lower_case: true - alias: book - params: - marker: # Returns objects that are older or newer (depending on 'sort’) than the object with this ID - type: int - required: false - sort: - type: str - default: desc - limit: - type: int - max: 100 - default: 100 - response: - type: dict - values: - success: - type: bool - payload: - type: list - values: - type: dict - values: - book: - type: str - created_at: - type: - - str - - amount: - type: - - str - maker_side: - type: str - price: - type: - - str - tid: - type: int - mapping: - - key: time - path: - - payload - - created_at - type: - - str - - dateparser - - key: id - path: - - payload - - tid - type: - - int - - key: amount - path: - - payload - - amount - type: - - str - - float - - key: direction - path: - - payload - - maker_side - type: - - str - - key: price - path: - - payload - - price - type: - - str - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitstamp.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitstamp.yaml deleted file mode 100644 index 5ee1f5b0..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bitstamp.yaml +++ /dev/null @@ -1,401 +0,0 @@ -name: bitstamp -exchange: true -api_url: https://www.bitstamp.net/api/v2/ -rate_limit: - max: 60 - unit: 60 -requests: - currency_pairs: - request: - template: trading-pairs-info/ - values: null - params: null - response: - type: list - values: - type: dict - values: - base_decimals: - type: int - minimum_order: - type: str - name: # e.g. LTC/USD - type: str - counter_decimals: - type: int - trading: - type: str - url_symbol: # e.g. ltcusd - type: str - description: # e.g. Litecoin / U.S. dollar - type: str - mapping: - - key: currency_pair_first - path: - - name - - 0 - type: - - str - - split - - "/" - - 0 - - key: currency_pair_second - path: - - name - - 1 - type: - - str - - split - - "/" - - 1 - - tickers: - request: - template: ticker/{currency_pair}/ - pair_template: # e.g. btcusd - template: "{first}{second}" - lower_case: true - params: null - response: - type: dict - values: - last: - type: - - str - - float - high: - type: - - str - - float - low: - type: - - str - - float - vwap: - type: - - str - - float - volume: - type: - - str - - float - bid: - type: - - str - - float - ask: - type: - - str - - float - timestamp: - type: - - str - - float - - from_timestamp - - 0 - open: - type: - - str - - float - mapping: - - key: last_price - path: - - last - type: - - str - - float - - key: daily_volume - path: - - volume - type: - - str - - float - - key: best_bid - path: - - bid - type: - - str - - float - - key: best_ask - path: - - ask - type: - - str - - float - - key: time - path: - - timestamp - type: - - str - - float - - from_timestamp - - 0 - - historic_rates: - request: - template: ohlc/{currency_pair}/ - pair_template: - template: '{first}{second}' - lower_case: true - params: - step: - type: int - allowed: - minutes: 60 - hours: 3600 - days: 86400 - weeks: 259200 - default: 86400 - limit: - type: int - default: 1000 #limit between 1 and 1000 - end: - function: last_timestamp - type: - - datetime - - timestamp - response: - type: dict - values: - data: - type: dict - values: - pair: - - str - ohlc: - type: list - values: - high: - - str - - float - timestamp: - - str - - float - - from_timestamp - - 0 - volume: - - str - - float - low: - - str - - float - open: - - str - - float - close: - - str - - float - mapping: - - key: open - path: - - data - - ohlc - - open - type: - - str - - float - - key: close - path: - - data - - ohlc - - close - type: - - str - - float - - key: high - path: - - data - - ohlc - - high - type: - - str - - float - - key: low - path: - - data - - ohlc - - low - type: - - str - - float - - key: volume - path: - - data - - ohlc - - volume - type: - - str - - float - - key: time - path: - - data - - ohlc - - timestamp - type: - - str - - float - - from_timestamp - - 0 - - order_books: - request: - template: order_book/{currency_pair} - pair_template: # e.g. btcusd - template: "{first}{second}" - lower_case: true - params: - group: - type: int - default: 1 - response: - type: dict - values: - timestamp: - type: - - str - - float - - from_timestamp - - 0 - bids: - type: list - values: - type: list - values: - 0: # price - type: - - str - - float - 1: # amount - type: - - str - - float - asks: - type: list - values: - type: list - values: - 0: # price - type: - - str - - float - 1: # amount - type: - - str - - float - mapping: - - key: time - path: - - timestamp - type: - - str - - float - - from_timestamp - - 0 - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - key: id - path: - - timestamp - type: - - str - - int - - key: position - path: [] - type: - - none - - range - - trades: - request: - template: transactions/{currency_pair} - pair_template: # e.g. btcusd - template: "{first}{second}" - lower_case: true - params: - time: - type: str - default: hour - response: - type: list - values: - type: dict - values: - date: - type: - - str - tid: - type: - - str - price: - type: - - str - amount: - type: - - str - type: # 0 (buy) or 1 (sell). - type: - - int - mapping: - - key: time - path: - - date - type: - - str - - float - - from_timestamp - - 0 - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - amount - type: - - str - - float - - key: direction - path: - - type - type: - - value - - map - - "0" - - buy - - "1" - - sell - - key: id - path: - - tid - type: - - str - - int - diff --git a/pandas_datareader/crypto/resources/running_exchanges/bittrex.yaml b/pandas_datareader/crypto/resources/running_exchanges/bittrex.yaml deleted file mode 100644 index 411eecf7..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bittrex.yaml +++ /dev/null @@ -1,310 +0,0 @@ -name: bittrex -exchange: true -api_docs: https://bittrex.github.io/api/v3 -api_url: https://api.bittrex.com/v3/ -rate_limit: null -requests: - currency_pairs: - request: - template: markets - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - symbol: - type: str - baseCurrencySymbol: - type: str - quoteCurrencySymbol: - type: str - mapping: - - key: currency_pair_first - path: - - baseCurrencySymbol - type: - - str - - key: currency_pair_second - path: - - quoteCurrencySymbol - type: - - str - - tickers: - request: - template: markets/tickers - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - symbol: - type: - - str - lastTradeRate: - type: - - str - - float - bidRate: - type: - - str - - float - askRate: - type: - - str - - float - mapping: - - key: currency_pair_first - path: - - symbol - type: - - str - - split - - '-' - - 0 - - key: currency_pair_second - path: - - symbol - type: - - str - - split - - '-' - - 1 - - key: time - path: [] - type: - - none - - now - - key: last_price - path: - - lastTradeRate - type: - - str - - float - - key: best_bid - path: - - bidRate - type: - - str - - float - - key: best_ask - path: - - askRate - type: - - str - - float - - order_books: - request: - template: markets/{currency_pair}/orderbook - pair_template: - template: "{first}-{second}" - lower_case: false - params: - depth: - type: int - max: 500 - default: 25 - response: - type: dict - values: - bid: - type: list - values: - type: dict - values: - quantity: - type: str - rate: - type: str - ask: - type: list - values: - type: dict - values: - quantity: - type: str - rate: - type: str - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - bid - - rate - type: - - str - - float - - key: bids_amount - path: - - bid - - quantity - type: - - str - - float - - key: asks_price - path: - - ask - - rate - type: - - str - - float - - key: asks_amount - path: - - ask - - quantity - type: - - str - - float - - trades: - request: - template: markets/{currency_pair}/trades - pair_template: - template: "{first}-{second}" - lower_case: true - params: null - response: - type: list - values: - type: dict - values: - id: - type: str - executedAt: - type: str - quantity: - type: str - rate: - type: str - takerSide: - type: str - - mapping: - - key: time - path: - - executedAt - type: - - str - - dateparser - - key: id - path: - - id - type: - - str - - key: price - path: - - rate - type: - - str - - float - - key: amount - path: - - quantity - type: - - str - - float - - key: direction - path: - - takerSide - type: - - str - - historic_rates: - request: - template: markets/{currency_pair}/candles/{frequency}/historical/{from} - pair_template: - template: "{first}-{second}" - lower_case: false - alias: null - params: - frequency: - allowed: - minutes: MINUTE_1 - default: MINUTE_1 - - from: - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 1440 - - from_timestamp - - 0 - - "%Y/%m/%d" - - response: - type: list - values: - type: dict - values: - startsAt: - type: str - open: - type: str - high: - type: str - low: - type: str - close: - type: str - volume: - type: str - quoteVolume: - type: str - mapping: - - key: time - path: - - startsAt - type: - - str - - dateparser - - key: open - path: - - open - type: - - str - - float - - key: high - path: - - high - type: - - str - - float - - key: low - path: - - low - type: - - str - - float - - key: close - path: - - close - type: - - str - - float - - key: volume - path: - - quoteVolume - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitvavo.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitvavo.yaml deleted file mode 100644 index af5d0e49..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bitvavo.yaml +++ /dev/null @@ -1,301 +0,0 @@ -name: bitvavo -exchange: true -rate_limit: - max: 1000 - unit: 60 - -api_url: https://api.bitvavo.com/v2 - -requests: - currency_pairs: - request: - template: /markets - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - markets: - type: str - base: - type: str - quote: - type: str - mapping: - - key: currency_pair_first - path: - - base - type: - - str - - key: currency_pair_second - path: - - quote - type: - - str - - tickers: - request: - template: /ticker/price - pair_template: null - params: null - - response: - type: list - values: - type: dict - values: - market: - type: str - price: - type: str - mapping: - - key: currency_pair_first - path: - - market - type: - - str - - split - - "-" - - 0 - - key: currency_pair_second - path: - - market - type: - - str - - split - - "-" - - 1 - - key: last_price - path: - - price - type: - - str - - float - - - historic_rates: - request: - template: /{currency_pair}/candles - pair_template: - template: "{first}-{second}" - lower_case: false - params: - limit: - default: 1440 - start: - function: last_timestamp - type: - - datetime - - timedeltams - - interval - - 1400 - end: - function: last_timestamp - type: - - datetime - - timestampms - interval: - allowed: - minutes: 1m - hours: 1h - days: 1d - default: 1d - - response: - type: list - values: - type: list - values: - 0: #time - type: int - 1: # open - type: str - 2: # high - type: str - 3: # low - type: str - 4: # close - type: str - 5: # volume - type: str - - mapping: - - key: time - path: - - 0 - type: - - float - - from_timestamp - - 1 - - key: open - path: - - 1 - type: - - str - - float - - key: high - path: - - 2 - type: - - str - - float - - key: low - path: - - 3 - type: - - str - - float - - key: close - path: - - 4 - type: - - str - - float - - key: volume - path: - - 5 - type: - - str - - float - - trades: - request: - template: /{currency_pair}/trades - pair_template: - template: "{first}-{second}" - lower_case: false - params: - limit: - type: int - default: 500 - - response: - type: list - values: - type: dict - values: - id: - type: str - timestamp: - type: int - amount: - type: str - price: - type: str - side: - type: str - - mapping: - - key: id - path: - - id - type: - - str - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 1 - - key: direction - path: - - side - type: - - str - - key: amount - path: - - amount - type: - - str - - float - - key: price - path: - - price - type: - - str - - float - - order_books: - request: - template: /{currency_pair}/book - pair_template: - template: "{first}-{second}" - lower_case: false - params: - depth: - type: int - default: 50 - - response: - type: dict - values: - market: - type: str - nonce: - type: int - bids: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - sells: - type: list - values: - type: list - values: - 0: # price - type: str - 1: # qty - type: str - - mapping: - - key: id - path: - - nonce - type: - - int - - key: position - path: [] - type: - - none - - range - - key: time - path: [] - type: - - none - - now - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitwell.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitwell.yaml deleted file mode 100644 index 17444213..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bitwell.yaml +++ /dev/null @@ -1,338 +0,0 @@ -name: bitwell -exchange: true -rate_limit: null - -api_url: https://openapi.bitwellex.com - -requests: - currency_pairs: - request: - template: /pub/openapi/v1/symbol/spot/all - pair_template: null - params: null - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - base_asset: - type: str - quote_asset: - type: str - - mapping: - - key: currency_pair_first - path: - - data - - quote_asset - type: - - str - - key: currency_pair_second - path: - - data - - base_asset - type: - - str - - tickers: - request: - template: /pub/openapi/v1/hq/quote - pair_template: - template: "{first}_{second}" - lower_case: false - alias: symbol - params: null - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - time: - type: int - highest_bid: - type: float - lowest_ask: - type: float - trade: - type: float - volume_24: - type: float - mapping: - - key: time - path: - - data - - time - type: - - float - - from_timestamp - - 2 - - key: best_bid - path: - - data - - highest_bid - type: - - float - - key: best_ask - path: - - data - - lowest_ask - type: - - float - - key: last_price - path: - - data - - trade - type: - - float - - key: daily_volume - path: - - data - - volume_24 - type: - - float - - - - historic_rates: - request: - template: /pub/openapi/v1/hq/kline - pair_template: - template: "{first}_{second}" - lower_case: false - alias: symbol - params: - type: - allowed: - minutes: 3 - hours: 2 - days: 1 - default: 1 #day - num: - type: int - max: 2880 - default: 2000 - ts: - function: last_timestamp - type: - - datetime - - timestamp - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - time: - type: int - open: - type: float - high: - type: float - low: - type: float - close: - type: float - volume: - type: float - mapping: - - key: time - path: - - data - - time - type: - - float - - from_timestamp - - 0 - - key: open - path: - - data - - open - type: - - float - - key: high - path: - - data - - high - type: - - float - - key: low - path: - - data - - low - type: - - float - - key: close - path: - - data - - close - type: - - float - - key: volume - path: - - data - - volume - type: - - float - - - order_books: - request: - template: /pub/openapi/v1/hq/orderbook - pair_template: - template: "{first}_{second}" - lower_case: false - alias: symbol - params: null - - response: - type: dict - values: - data: - type: dict - values: - ask: - type: list - values: - type: list - values: - 0: - type: float - 1: - type: float - bid: - type: list - values: - type: list - values: - 0: - type: float - 1: - type: float - sn: - type: int - time: - type: int - - mapping: - - key: id - path: - - data - - sn - type: - - int - - key: time - path: - - data - - time - type: - - float - - from_timestamp - - 2 - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - data - - bid - - 1 - type: - - float - - key: asks_amount - path: - - data - - ask - - 1 - type: - - float - - key: bids_price - path: - - data - - bid - - 0 - type: - - float - - key: asks_price - path: - - data - - ask - - 0 - type: - - float - - trades: - request: - template: /pub/openapi/v1/hq/transaction - pair_template: - template: "{first}_{second}" - lower_case: false - alias: symbol - params: null - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - time_us: - type: int - price: - type: float - amount: - type: float - volume: - type: float - direction: - type: int - mapping: - - key: id - path: - - data - - sn - type: - - int - - key: time - path: - - data - - time_us - type: - - float - - from_timestamp - - 2 - - key: price - path: - - data - - price - type: - - float - - key: amount - path: - - data - - volume - type: - - float - - key: direction - path: - - data - - direction - type: - - value - - map - - 1 - - sell - - 2 - - buy \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bitz.yaml b/pandas_datareader/crypto/resources/running_exchanges/bitz.yaml deleted file mode 100644 index 61ce1236..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bitz.yaml +++ /dev/null @@ -1,548 +0,0 @@ -name: bitz -exchange: true -api_url: https://api.bitzapi.com/ -rate_limit: null -requests: - currency_pairs: - request: - template: Market/symbolList - pair_template: null # e.g. 777_btc - params: null - response: - type: dict - values: - status: - type: int - msg: - type: str - data: - type: dict - values: - currency_pairs: # variable key, each available currency pair - type: dict - values: - id: - type: - - str - - int - name: # e.g. ltc_btc - type: str - coinFrom: # ltc - type: str - coinTo: # btc - type: str - numberFloat: - type: - - str - - int - priceFloat: - type: - - str - - int - status: - type: - - str - - int - minTrade: - type: - - str - - float - maxTrade: - type: - - str - - float - time: - type: - - float - - from_timestamp - - 0 - microtime: - type: - - str - - float - - from_timestamp - - 0 - source: - type: str - mapping: - - key: currency_pair_first - path: - - data - - dict_values - - coinFrom - type: - - str - - upper - - key: currency_pair_second - path: - - data - - dict_values - - coinTo - type: - - str - - upper - - order_books: - request: - template: Market/depth - pair_template: # e.g. 777_btc - template: "{first}_{second}" - lower_case: true - alias: symbol - params: null - response: - type: dict - values: - status: - type: int - msg: - type: str - data: - type: dict - values: - asks: - type: list - values: - type: list - values: - 0: # price - type: - - str - 1: # number - type: - - str - 2: # Total price - type: - - str - bids: - type: list - values: - type: list - values: - 0: # price - type: - - str - 1: # number - type: - - str - 2: # Total price - type: - - str - coinPair: - type: str - time: - type: - - int - microtime: - type: - - str - source: - type: str - - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 0 - - key: position - path: [] - type: - - none - - range - - key: id - path: - - time - type: - - int - - key: asks_price - path: - - data - - asks -# - [] - - 0 - type: - - str - - float - - key: asks_amount - path: - - data - - asks -# - [] - - 1 - type: - - str - - float - - key: bids_price - path: - - data - - bids -# - [] - - 0 - type: - - str - - float - - key: bids_amount - path: - - data - - bids -# - [] - - 1 - type: - - str - - float - - - tickers: - request: - template: Market/ticker - pair_template: # e.g. 777_btc - template: "{first}_{second}" - lower_case: true - alias: symbol - params: null - response: - type: dict - values: - status: - type: int - msg: - type: str - data: - type: dict - values: - symbol: - type: str - quoteVolume: - type: - - str - - float - volume: - type: - - str - - float - priceChange24h: - type: - - str - - float - askPrice: - type: - - str - - float - askQty: - type: - - str - - float - bidPrice: - type: - - str - - float - bidQty: - type: - - str - - float - open: - type: - - str - - float - high: - type: - - str - - float - low: - type: - - str - - float - now: - type: - - str - - float - firstId: - type: - - str - - float - lastId: - type: - - str - - float - dealCount: - type: - - str - - float - numberPrecision: - type: - - str - - float - pricePrecision: - type: - - str - - float - cny: - type: - - str - - float - usd: - type: - - str - - float - krw: - type: - - str - - float - time: - type: - - float - - from_timestamp - - 0 - microtime: - type: - - str - - float - - from_timestamp - - 0 - source: - type: str - mapping: - - key: best_ask - path: - - data - - askPrice - type: - - str - - float - - key: best_bid - path: - - data - - bidPrice - type: - - str - - float - - key: daily_volume - path: - - data - - volume - type: - - str - - float - - key: time - path: - - time - type: - - float - - from_timestamp - - 0 - - historic_rates: - request: - template: Market/kline - pair_template: # e.g. 777_btc - template: "{first}_{second}" - lower_case: true - alias: symbol - params: - resolution: - type: str - allowed: - minutes: 1min - hours: 60min - days: 1day - weeks: 1week - months: 1mon - default: 1day - size: # get number range: 1-300 - type: int - min: 1 - max: 300 - required: false - to: # microsecond. Return the data before this microsecond - function: last_timestamp - type: - - datetime - - timestampms - response: - type: dict - values: - status: - type: int - msg: - type: str - data: - type: dict - values: - bars: - type: list - values: - type: dict - values: - time: - type: - - str - open: - type: - - str - - float - high: - type: - - str - - float - low: - type: - - str - - float - close: - type: - - str - - float - volume: - type: - - str - - float - datetime: - type: str - resolution: - type: str - symbol: - type: str - from: - type: - - str - to: - type: - - str - size: - type: - - str - - int - time: - type: - - int - microtime: - type: - - str - source: - type: str - mapping: - - key: time - path: - - data - - bars - - time - type: - - str - - float - - from_timestamp - - 1 - - key: open - path: - - data - - bars - - open - type: - - str - - float - - key: high - path: - - data - - bars - - high - type: - - str - - float - - key: low - path: - - data - - bars - - low - type: - - str - - float - - key: close - path: - - data - - bars - - close - type: - - str - - float - - key: volume - path: - - data - - bars - - volume - type: - - str - - float - - trades: - request: - template: Market/order - pair_template: # e.g. 777_btc - template: "{first}_{second}" - lower_case: true - alias: symbol - params: null - response: - type: dict - values: - status: - type: int - msg: - type: str - data: - type: list - values: - type: dict - values: - id: - type: - - str - t: # time, e.g. 12:58:48 - type: str - T: # timestamp - type: - - int - p: # price - type: - - str - n: # number - type: - - str - s: # type - type: str - mapping: - - key: id - path: - - data - - id - type: - - int - - key: time - path: - - data - - T - type: - - float - - from_timestamp - - 0 - - key: price - path: - - data - - p - type: - - str - - float - - key: amount - path: - - data - - n - type: - - str - - float - - key: direction - path: - - data - - s - type: - - str diff --git a/pandas_datareader/crypto/resources/running_exchanges/bkex.yaml b/pandas_datareader/crypto/resources/running_exchanges/bkex.yaml deleted file mode 100644 index 3c878d2b..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bkex.yaml +++ /dev/null @@ -1,356 +0,0 @@ -name: bkex -exchange: true -api_url: https://api.bkex.cc - -requests: - currency_pairs: - request: - template: /v2/common/symbols - pair_template: null - params: null - response: - type: dict - values: - msg: - type: str - code: - type: str - data: - type: list - values: - type: dict - values: - coinTypes: - type: list - values: - type: dict - values: - symbol: - type: str - mapping: - - key: currency_pair_first - path: - - data - - symbol - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - data - - symbol - type: - - str - - split - - "_" - - 1 - - tickers: - request: - template: /v2/q/ticker/price - pair_template: - template: "{first}_{second}" - lower_case: false - alias: pair - params: null - response: - type: dict - values: - code: - type: int - data: - type: list - values: - type: dict - values: - price: - type: float - symbol: - type: str - mapping: - - key: currency_pair_first - path: - - data - - symbol - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - data - - symbol - type: - - str - - split - - "_" - - 1 - - key: last_price - path: - - data - - price - type: - - float - - key: time - path: [] - type: - - none - - now - - historic_rates: - request: - template: /v2/q/kline - pair_template: - template: "{first}_{second}" - lower_case: false - alias: symbol - params: - period: - allowed: - minutes: 1m - hours: 1h - days: 1d - weeks: 1w - default: 1d - size: - default: 1000 - to: - function: last_timestamp - type: - - datetime - - timestampms - from: - function: last_timestamp - type: - - datetime - - timedeltams - - interval - - 1000 - - - response: - type: dict - values: - msg: - type: str - code: - type: str - data: - type: list - values: - type: dict - values: - ts: # timestamp ms - type: int - close: # closing price - type: float - open: # opening price - type: float - hhigh: # highest price - type: float - low: # lowest price - type: float - volume: #base amount - type: float - mapping: - - key: time - path: - - data - - ts - type: - - float - - from_timestamp - - 1 - - key: low - path: - - data - - low - type: - - float - - key: high - path: - - data - - high - type: - - float - - key: open - path: - - data - - open - type: - - float - - key: close - path: - - data - - close - type: - - float - - key: volume - path: - - data - - volume - type: - - float - - order_books: - request: - template: /v2/q/depth - pair_template: - template: "{first}_{second}" - lower_case: false - alias: symbol - params: - depth: - type: - - int - default: 50 - preicion: - type: int - default: 4 - response: - type: dict - values: - msg: - type: str - code: - type: str - data: - type: dict - values: - bid: - type: list - values: - type: list - values: - 0: # price - type: float - 1: # quantity - type: float - ask: - type: list - values: - type: list - values: - 0: # price - type: float - 1: # quantity - type: float - - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - data - - bid - - 0 - type: - - float - - key: bids_amount - path: - - data - - bid - - 1 - type: - - float - - key: asks_price - path: - - data - - ask - - 0 - type: - - float - - key: asks_amount - path: - - data - - ask - - 1 - type: - - float - - trades: - request: - template: /v2/q/deals - pair_template: - template: "{first}_{second}" - lower_case: false - alias: symbol - params: - size: - type: - - int - default: 50 - response: - type: dict - values: - msg: - type: str - code: - type: str - data: - type: list - values: - type: dict - values: - ts: - type: int - price: - type: float - volume: - type: float - direction: - type: str - mapping: - - key: time - path: - - data - - ts - type: - - float - - from_timestamp - - 1 - - key: id - path: - - data - - ts - type: - - int - - key: direction - path: - - data - - direction - type: - - value - - map - - B - - buy - - S - - sell - - key: price - path: - - data - - price - type: - - float - - key: amount - path: - - data - - volume - type: - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/bleutrade.yaml b/pandas_datareader/crypto/resources/running_exchanges/bleutrade.yaml deleted file mode 100644 index 6906c553..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bleutrade.yaml +++ /dev/null @@ -1,369 +0,0 @@ -#ToDo: API Dokumentation nicht auffindbar. Historic Rates flexibeler Timestamp nicht implementiert. -name: bleutrade -exchange: true -api_url: https://bleutrade.com/api/v3/ -rate_limit: null - -requests: - currency_pairs: - request: - template: public/getmarkets - pair_template: null - params: null - response: - type: dict - values: - success: - type: bool - message: - type: str - result: - type: list - values: - type: dict - values: - MarketName: - type: str # e.g. ETH_BTC - MarketAsset: # e.g. ETH - type: str - BaseAsset: # e.g. BTC - type: str - MarketAssetLong: # e.g. Ethereum - type: str - BaseAssetLong: # e.g. Bitcoin - type: str - IsActive: - type: bool - MinTradeSize: - type: float - InfoMassage: - type: str - mapping: - - key: currency_pair_first - path: - - result - - MarketAsset - type: - - str - - key: currency_pair_second - path: - - result - - BaseAsset - type: - - str - - - tickers: - request: - template: public/getticker - pair_template: - template: "{first}_{second}" - lower_case: false - alias: market - params: null - response: - type: dict - values: - success: - type: bool - message: - type: str - result: - type: list - values: - type: dict - values: - Market: - type: str - Bid: - type: float - Ask: - type: float - Last: - type: float - mapping: - - key: time - path: [] - type: - - none - - now - - key: last_price - path: - - result - - Last - type: - - float - - key: best_bid - path: - - result - - Bid - type: - - float - - key: best_ask - path: - - result - - Ask - type: - - float - - order_books: - request: - template: public/getorderbook - pair_template: # e.g. ETH_BTC - template: "{first}_{second}" - lower_case: false - alias: market - params: - type: - type: str - default: ALL - depth: - type: int - default: 20 - response: - type: dict - values: - success: - type: bool - message: - type: str - result: - type: dict - values: - buy: - type: list - values: - type: dict - values: - Quantity: - type: float - Rate: - type: float - sell: - type: list - values: - type: dict - values: - Quantity: - type: float - Rate: - type: float - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - result - - buy - - Rate - type: - - float - - key: bids_amount - path: - - result - - buy - - Quantity - type: - - float - - key: asks_price - path: - - result - - sell - - Rate - type: - - float - - key: asks_amount - path: - - result - - sell - - Quantity - type: - - float - - trades: - request: - template: public/getmarkethistory - pair_template: # e.g. ETH_BTC - template: "{first}_{second}" - lower_case: false - alias: market - params: - count: - type: int - max: 200 - default: 20 - response: - type: dict - values: - success: - type: bool - message: - type: str - result: - type: list - values: - type: dict - values: - TradeID: - type: int - TimeStamp: - type: - - str - Quantity: - type: float - Price: - type: float - BaseVolumne: - type: float - OrderType: - type: str - Total: - type: float - - mapping: - - key: time - path: - - result - - TimeStamp - type: - - str - - dateparser - - key: id - path: - - result - - TradeID - type: - - int - - key: amount - path: - - result - - Quantity - type: - - float - - key: price - path: - - result - - Price - type: - - float - - key: direction - path: - - result - - OrderType - type: - - str - - historic_rates: - request: - template: public/getcandles - pair_template: # e.g. ETH_BTC - template: "{first}_{second}" - lower_case: false - alias: market - params: - period: - type: str - allowed: -# minutes: 1m #raises an error - hours: 1h - days: 1d - weeks: 1w - default: 1d - response: - type: dict - values: - success: - type: bool - message: - type: str - result: - type: list - values: - type: dict - values: - TimeStamp: - type: - - str - - strptime - - "%Y-%m-%d %H:%M:%S" - Open: - type: - - str - - float - High: - type: - - str - - float - Low: - type: - - str - - float - Close: - type: - - str - - float - Volume: - type: - - str - - float - BaseVolume: - type: - - str - - float - mapping: - - key: time - path: - - result - - TimeStamp - type: - - str - - strptime - - "%Y-%m-%d %H:%M:%S" - - key: open - path: - - result - - Open - type: - - str - - float - - key: high - path: - - result - - High - type: - - str - - float - - key: low - path: - - result - - Low - type: - - str - - float - - key: close - path: - - result - - Close - type: - - str - - float - - key: volume - path: - - result - - Volume - type: - - str - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/btc-alpha.yaml b/pandas_datareader/crypto/resources/running_exchanges/btc-alpha.yaml deleted file mode 100644 index 6ff788c2..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/btc-alpha.yaml +++ /dev/null @@ -1,253 +0,0 @@ -name: btc-alpha -api_docs: https://btc-alpha.github.io/api-docs/ -rate_limit: null - -api_url: https://btc-alpha.com/api/ - -requests: - currency_pairs: - request: - template: v1/pairs/ - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - currency1: - type: str - currency2: - type: str - mapping: - - key: currency_pair_first - path: - - currency1 - type: - - str - - key: currency_pair_second - path: - - currency2 - type: - - str - - historic_rates: - request: - template: charts/{currency_pair}/{frequency}/chart - pair_template: - template: "{first}_{second}" - lower_case: false - params: - limit: - max: 720 - default: 720 - until: - function: last_timestamp - type: - - datetime - - timestamp - frequency: - allowed: - minutes: 5 - hours: 60 - days: D - default: D - - response: - type: list - values: - type: dict - values: - time: - type: int - open: - type: float - high: - type: float - low: - type: float - close: - type: float - volume: - type: float - - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 0 - - key: open - path: - - open - type: - - float - - key: high - path: - - high - type: - - float - - key: low - path: - - low - type: - - float - - key: close - path: - - close - type: - - float - - key: volume - path: - - volume - type: - - float - - - trades: - request: - template: v1/exchanges - pair_template: - template: "{first}_{second}" - lower_case: false - alias: pair - params: - limit: - type: int - default: 100 - - response: - type: list - values: - type: dict - values: - id: - type: int - timestamp: - type: float - price: - type: str - amount: - type: str - type: - type: str - - mapping: - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 0 - - key: id - path: - - id - type: - - int - - key: direction - path: - - type - type: - - str - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - amount - type: - - str - - float - - order_books: - request: - template: v1/orderbook/{currency_pair} - pair_template: - template: "{first}_{second}" - lower_case: false - params: - group: - type: int - default: 1 # group by price - limit_asks: - type: int - default: 50 - limit_bids: - type: int - default: 50 - response: - type: dict - values: - sell: - type: list - values: - type: dict - values: - price: - type: float - id: # id and timestamp only if group=1 - type: int - amount: - type: float - timestamp: - type: float - buy: - type: list - values: - type: dict - values: - price: - type: float - id: - type: int - amount: - type: float - timestamp: - type: float - - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - buy - - amount - type: - - float - - key: bids_price - path: - - buy - - price - type: - - float - - key: asks_amount - path: - - sell - - amount - type: - - float - - key: asks_price - path: - - sell - - price - type: - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/btc_turk.yaml b/pandas_datareader/crypto/resources/running_exchanges/btc_turk.yaml deleted file mode 100644 index 112ab64f..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/btc_turk.yaml +++ /dev/null @@ -1,389 +0,0 @@ -name: btc_turk -is_exchange: true - -api_url: "" #Base Api url changes. Complete URL therefore in templates -rate_limit: - max: 60 - unit: 60 - -requests: - currency_pairs: - request: - template: https://api.btcturk.com/api/v2/ticker - pair_template: null - params: null - response: - type: dict - values: - data: - type: dict - values: - type: list - values: - pair: - type: str - pairNormalized: - type: str - timestamp: - type: int - last: - type: float - high: - type: float - low: - type: float - bid: - type: float - ask: - type: float - open: - type: float - volume: - type: float - - mapping: - - key: currency_pair_first - path: - - data - - pairNormalized - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - data - - pairNormalized - type: - - str - - split - - "_" - - 1 - - tickers: - request: - template: https://api.btcturk.com/api/v2/ticker - pair_template: null - params: null - response: - type: dict - values: - data: - type: dict - values: - type: list - values: - pair: - type: str - pairNormalized: - type: str - timestamp: - type: int - last: - type: float - high: - type: float - low: - type: float - bid: - type: float - ask: - type: float - open: - type: float - volume: - type: float - mapping: - - key: currency_pair_first - path: - - data - - pairNormalized - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - data - - pairNormalized - type: - - str - - split - - "_" - - 1 - - key: time - path: - - data - - timestamp - type: - - float - - from_timestamp - - 1 - - key: best_bid - path: - - data - - bid - type: - - float - - key: daily_volume - path: - - data - - volume - type: - - float - - key: best_ask - path: - - data - - ask - type: - - float - - key: last_price - path: - - data - - last - type: - - float - - order_books: - request: - template: https://api.btcturk.com/api/v2/orderbook - pair_template: # e.g. BTCTRY - template: "{first}{second}" - lower_case: false - alias: pairSymbol - params: - limit: - type: int - default: 100 #max 1000 - response: - type: dict - values: - data: - type: dict - values: - timestamp: - type: int - bids: - type: list - values: - type: list - values: - 0: #price - type: str - 1: # qty - type: str - asks: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - - mapping: - - key: time - path: - - data - - timestamp - type: - - float - - from_timestamp - - 1 - - key: id - path: - - data - - timestamp - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - data - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - data - - bids - - 1 - type: - - str - - float - - key: asks_price - path: - - data - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - data - - asks - - 1 - type: - - str - - float - - trades: - request: - template: https://api.btcturk.com/api/v2/trades - pair_template: # e.g. BTCTRY - template: "{first}{second}" - lower_case: false - alias: pairSymbol - params: - last: - type: int - max: 50 - default: 50 - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - pair: - type: str - pairNormalized: - type: str - date: - type: int - tid: - type: str - price: - type: float - amount: - type: float - side: - type: str - - - mapping: - - key: time - path: - - data - - date - type: - - float - - from_timestamp - - 1 - - key: id - path: - - data - - tid - type: - - str - - int - - key: direction - path: - - data - - side - type: - - str - - key: price - path: - - data - - price - type: - - str - - float - - key: amount - path: - - data - - amount - type: - - str - - float - - historic_rates: # no hint which currency pair is meant - request: - template: https://graph-api.btcturk.com/v1/ohlcs - pair_template: - template: "{first}_{second}" - lower_case: false - alias: pair - params: - to: # from and to params are available. But API returns every data point by default. - function: last_timestamp - type: - - datetime - - timestamp - from: - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 1000 - - response: - type: list - values: - type: dict - values: - time: - type: int - open: - type: float - high: - type: float - low: - type: float - close: - type: float - volume: - type: float - average: - type: float - dailyChangeAmount: - type: float - dailyChangePercentage: - type: float - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 0 - - key: open - path: - - open - type: - - float - - key: high - path: - - high - type: - - float - - key: low - path: - - low - type: - - float - - key: close - path: - - close - type: - - float - - key: volume - path: - - volume - type: - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/btse.yaml b/pandas_datareader/crypto/resources/running_exchanges/btse.yaml deleted file mode 100644 index 094e1af6..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/btse.yaml +++ /dev/null @@ -1,331 +0,0 @@ -name: btse -exchange: true - -rate_limit: - max: 900 - unit: 60 - -api_url: https://api.btse.com/spot/ - -requests: - currency_pairs: - request: - template: api/v3.2/market_summary - pair_template: null - params: null - - response: - type: list - values: - type: dict - values: - symbol: - type: str - base: - type: str - quote: - type: str - mapping: - - key: currency_pair_first - path: - - base - type: - - str - - key: currency_pair_second - path: - - quote - type: - - str - - tickers: - request: - template: api/v3.2/market_summary - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - symbol: - type: str - base: - type: str - quote: - type: str - last: - type: float - lowestAsk: - type: float - highestBid: - type: float - volume: - type: float - - mapping: - - key: currency_pair_first - path: - - base - type: - - str - - key: currency_pair_second - path: - - quote - type: - - str - - key: last_price - path: - - last - type: - - float - - key: time - path: [] - type: - - none - - now - - key: best_bid - path: - - highestBid - type: - - float - - key: best_ask - path: - - lowestAsk - type: - - float - - key: daily_volume - path: - - volume - type: - - float - - historic_rates: - request: - template: api/v3.2/ohlcv - pair_template: - template: "{first}-{second}" - lower_case: false - alias: symbol - params: - resolution: - allowed: - minutes: 1 - hours: 60 - days: 1440 - weeks: 10080 - months: 43200 - default: 1440 - start: - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 200 - end: - function: last_timestamp - type: - - datetime - - timestamp - response: - type: list - values: - type: list - values: - 0: #time - type: int - 1: #open - type: float - 2: #high - type: float - 3: #low - type: float - 4: #close - type: float - 5: #volume - type: float - mapping: - - key: time - path: - - 0 - type: - - float - - from_timestamp - - 0 - - key: open - path: - - 1 - type: - - float - - key: high - path: - - 2 - type: - - float - - key: low - path: - - 3 - type: - - float - - key: close - path: - - 4 - type: - - float - - key: volume - path: - - 5 - type: - - float - - - trades: - request: - template: api/v3.2/trades - pair_template: - template: "{first}-{second}" - lower_case: false - alias: symbol - params: -# startTime: -# function: last_timestamp -# type: -# - timestamp -# - timedelta -# - interval -# - 200 -# - datetime -# endTime: -# function: last_timestamp -# type: -# - timestmap -# - datetime - count: - default: 300 - - response: - type: list - values: - type: dict - values: - price: - type: float - size: - type: float - side: - type: str - serialId: - type: int - timestamp: - type: int - - mapping: - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 1 - - key: id - path: - - serialId - type: - - int - - key: direction - path: - - side - type: - - str - - key: price - path: - - price - type: - - float - - key: amount - path: - - size - type: - - float - - order_books: - request: - template: api/v3.2/orderbook/L2 - pair_template: - template: "{first}-{second}" - lower_case: false - alias: symbol - params: - depth: - default: 50 - - response: - type: dict - values: - timestamp: - type: int - buyQuote: - type: list - values: - type: dict - values: - price: - type: str - size: - type: str - sellQuote: - type: list - values: - type: dict - values: - price: - type: str - size: - type: str - - mapping: - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 1 - - key: id - path: - - timestamp - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - buyQuote - - size - type: - - str - - float - - key: bids_price - path: - - buyQuote - - price - type: - - str - - float - - key: asks_amount - path: - - sellQuote - - size - type: - - str - - float - - key: asks_price - path: - - sellQuote - - price - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/buda.yaml b/pandas_datareader/crypto/resources/running_exchanges/buda.yaml deleted file mode 100644 index 8370ac40..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/buda.yaml +++ /dev/null @@ -1,320 +0,0 @@ -name: buda - -api_url: https://www.buda.com/api/v2/ -rate_limit: null -requests: - currency_pairs: - request: - template: markets - pair_template: null - params: null - response: - type: dict - values: - markets: - type: list - values: - type: dict - values: - id: # e.g. BTC-CLP - type: str - name: # e.g. btc-clp - type: str - base_currency: # i.e. "BTC" - type: str - quote_currency: # i.e. "CLP" - type: str - minimum_order_amount: - type: list - values: - 0: # amount - type: - - str - - float - 1: # currency - type: str - mapping: - - key: currency_pair_first - path: - - markets - - base_currency - type: - - str - - key: currency_pair_second - path: - - markets - - quote_currency - type: - - str - - tickers: - request: - template: markets/{currency_pair}/ticker - pair_template: # e.g. btc-clp - template: "{first}-{second}" - lower_case: true - params: null - response: - type: dict - values: - ticker: - type: dict - values: - last_price: - type: list - values: - 0: # amount - type: - - str - - float - 1: # currency - type: str - market_id: # i.e. "BTC-CLP" - type: str - max_bid: - type: list - values: - 0: # amount - type: - - str - - float - 1: # currency - type: str - min_ask: - type: list - values: - 0: # amount - type: - - str - - float - 1: # currency - type: str - price_variation_24h: - type: - - str - - float - price_variation_7d: - type: - - str - - float - volume: - type: list - values: - 0: # amount - type: - - str - - float - 1: # currency - type: str - mapping: - - key: time - path: [] - type: - - none - - now - - key: last_price - path: - - ticker - - last_price - - 0 - type: - - str - - float - - key: best_bid - path: - - ticker - - max_bid - - 0 - type: - - str - - float - - key: best_ask - path: - - ticker - - min_ask - - 0 - type: - - str - - float - - key: daily_volume - path: - - ticker - - volume - - 0 - type: - - str - - float - - order_books: - request: - template: markets/{currency_pair}/order_book - pair_template: # e.g. btc-clp - template: "{first}-{second}" - lower_case: true - params: null - response: - type: dict - values: - order_book: - type: dict - values: - asks: - type: list - values: - type: list - values: - 0: # price - type: - - str - - float - 1: # amount - type: - - str - - float - bids: - type: list - values: - type: list - values: - 0: # price - type: - - str - - float - 1: # amount - type: - - str - - float - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [ ] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: asks_price - path: - - order_book - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - order_book - - asks - - 1 - type: - - str - - float - - key: bids_price - path: - - order_book - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - order_book - - bids - - 1 - type: - - str - - float - - trades: - request: - template: markets/{currency_pair}/trades - pair_template: # e.g. btc-clp - template: "{first}-{second}" - lower_case: true - params: - timestamp: # Unix Timestamp (int) - required: false - limit: - type: int - max: 100 - default: 50 - response: - type: dict - values: - trades: - type: dict - values: - timestamp: - type: - - str - last_timestamp: - type: - - str - market_id: - type: str - entries: - type: list - values: - type: list - values: - 0: # timestamp - type: - - str - 1: # amount - type: - - str - 2: # price - type: - - str - 3: # direction, i.e. "buy" - type: str - mapping: - - key: time - path: - - trades - - entries - - 0 - type: - - str - - float - - from_timestamp - - 1 - - key: id - path: - - trades - - entries - - 0 - type: - - str - - int - - key: amount - path: - - trades - - entries - - 1 - type: - - str - - float - - key: price - path: - - trades - - entries - - 2 - type: - - str - - float - - key: direction - path: - - trades - - entries - - 3 - type: - - str diff --git a/pandas_datareader/crypto/resources/running_exchanges/bw.yaml b/pandas_datareader/crypto/resources/running_exchanges/bw.yaml deleted file mode 100644 index c3150056..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/bw.yaml +++ /dev/null @@ -1,420 +0,0 @@ -name: bw -exchange: true -rate_limit: null -api_url: https://www.bw.com/api/ - -requests: - currency_pairs: - request: - template: data/v1/tickers - pair_template: null - params: - isUseMarketName: - type: bool - default: "True" - response: - type: dict - values: - datas: - type: dict - values: - currency_pair: - type: list - - mapping: - - key: currency_pair_first - path: - - datas - - list_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - datas - - list_key - type: - - str - - split - - "_" - - 1 - - tickers: - request: - template: data/v1/tickers - pair_template: null - params: - isUseMarketName: - type: bool - default: True - response: - type: dict - values: - datas: - type: dict - values: - currency_pair: - type: list - values: - 0: #MarketID - type: int - 1: #last - type: str - 2: #high - type: str - 3: #low - type: str - 4: #24h Volumne - type: str - 5: #24h price increase - type: str - 6: #recent 6h closing price list - type: str - 7: #buy one price - type: str - 8: #sell one price - type: str - 9: #24h turnover - type: str - mapping: - - key: time - path: [] - type: - - none - - now - - key: currency_pair_first - path: - - datas - - list_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - datas - - list_key - type: - - str - - split - - "_" - - 1 - - key: last_price - path: - - datas - - list_values - - 1 - type: - - str - - float - - key: daily_volume - path: - - datas - - list_values - - 4 - type: - - str - - float - - key: best_bid - path: - - datas - - list_values - - 7 - type: - - str - - float - - key: best_ask - path: - - datas - - list_values - - 8 - type: - - str - - float - - historic_rates: - request: - template: data/v1/klines - pair_template: - template: "{first}_{second}" - lower_case: false - alias: marketName - params: - dataSize: - type: int - default: 500 - type: - allowed: - minutes: 1M - hours: 1H - days: 1D - weeks: 1W - default: 1D - - response: - type: dict - values: - datas: - type: list - values: - type: list - values: - 0: #data Typ - type: str - 1: #market ID - type: int - 2: #market_name - type: str - 3: #timestamp - type: int - 4: #opening Price - type: str - 5: #highest price - type: str - 6: #lowest Price - type: str - 7: #closing Price - type: #str - 8: #volume - type: str - 9: #price_range - type: str - 10: #US Dollar Exchange Rate - type: # str - 11: # K-line Period - type: str - 12: #converted - type: bool - 13: #? - type: str - resMsg: - type: dict - values: - message: - type: str - method: - type: str - code: - type: str - - mapping: - - key: time - path: - - datas - - 3 - type: - - str - - float - - from_timestamp - - 0 - - key: open - path: - - datas - - 4 - type: - - str - - float - - key: close - path: - - datas - - 7 - type: - - str - - float - - key: low - path: - - datas - - 6 - type: - - str - - float - - key: high - path: - - datas - - 5 - type: - - str - - float - - key: volume - path: - - datas - - 8 - type: - - str - - float - - - trades: - request: - template: data/v1/trades - pair_template: - template: "{first}_{second}" - lower_case: false - alias: marketName - params: - dataSize: - type: int - max: 20 - default: 20 - response: - type: dict - values: - datas: - type: list - values: - type: list - values: - 0: #trade data - type: str - 1: # market ID - type: str - 2: # timestamp - type: str - 3: # symbol - type: str - 4: # direction - type: str - 5: # price - type: str - 6: # amount - type: str - mapping: - - key: time - path: - - datas - - 2 - type: - - str - - float - - from_timestamp - - 0 - - key: id - path: - - datas - - 2 - type: - - str - - int - - key: direction - path: - - datas - - 4 - type: - - value - - map - - bid - - sell - - ask - - buy - - key: price - path: - - datas - - 5 - type: - - str - - float - - key: amount - path: - - datas - - 6 - type: - - str - - float - - order_books: - request: - template: data/v1/entrusts - pair_template: - template: "{first}_{second}" - lower_case: false - alias: marketName - params: - dataSize: - type: int - max: 50 - default: 50 - - response: - type: dict - values: - datas: - type: dict - values: - asks: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - bids: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - timestamp: - type: str - mapping: - - key: time - path: - - datas - - timestamp - type: - - str - - float - - from_timestamp - - 0 - - key: id - path: - - datas - - timestamp - type: - - str - - int - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - datas - - bids - - 1 - type: - - str - - float - - key: bids_price - path: - - datas - - bids - - 0 - type: - - str - - float - - key: asks_amount - path: - - datas - - asks - - 1 - type: - - str - - float - - key: asks_price - path: - - datas - - asks - - 0 - type: - - str - - float - diff --git a/pandas_datareader/crypto/resources/running_exchanges/catex.yaml b/pandas_datareader/crypto/resources/running_exchanges/catex.yaml deleted file mode 100644 index 13d4ddf6..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/catex.yaml +++ /dev/null @@ -1,235 +0,0 @@ -name: catex -exchange: true - -rate_limit: null -api_url: https://www.catex.io/api/ - -requests: - currency_pairs: - request: - template: token/currency - pair_template: null - params: - baseCurrency: - default: USDT # USDT, BTC, ETH, DODGE - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - currency: - type: str - baseCurrency: - type: str - - mapping: - - key: currency_pair_first - path: - - data - - currency - type: - - str - - key: currency_pair_second - path: - - data - - baseCurrency - type: - - str - - tickers: - request: - template: token - pair_template: - template: "{first}/{second}" - lower_case: false - alias: pair - params: null - response: - type: dict - values: - data: - type: dict - values: - volume24HoursByCurrency: - type: float - volume24HoursByBaseCurrency: - type: float - priceByBaseCurrency: - type: float - - mapping: - - key: last_price - path: - - data - - priceByBaseCurrency - type: - - float - - key: time - path: [] - type: - - none - - now - - key: daily_volume - path: - - data - - volume24HoursByBaseCurrency - type: - - float - - trades: - request: - template: trading/history - pair_template: - template: "{first}/{second}" - lower_case: false - alias: market - params: - limit: - default: 200 - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - volume: - type: float - price: - type: float - id: - type: str - time: - type: str - type: - type: str - - mapping: - - key: time - path: - - data - - time - type: - - str - - dateparser - - key: id - path: - - data - - id - type: - - str - - key: direction - path: - - data - - type - type: - - str - - key: price - path: - - data - - price - type: - - float - - key: amount - path: - - data - - volume - type: - - float - - order_books: - request: - template: order - pair_template: - template: "{first}/{second}" - lower_case: false - alias: market - params: - limit: - default: 50 - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - asks: - type: list - values: - type: list - values: - 0: #price - type: str - 1: #qty - type: str - bids: - type: list - values: - type: list - values: - 0: #price - type: str - 1: #qty - type: str - timestamp: - type: str - - mapping: - - key: time - path: - - data - - timestamp - type: - - str - - dateparser - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - data - - bids - - 1 - type: - - str - - float - - key: bids_price - path: - - data - - bids - - 0 - type: - - str - - float - - key: asks_amount - path: - - data - - asks - - 1 - type: - - str - - float - - key: asks_price - path: - - data - - asks - - 0 - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/cexio.yaml b/pandas_datareader/crypto/resources/running_exchanges/cexio.yaml deleted file mode 100644 index 91bd5119..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/cexio.yaml +++ /dev/null @@ -1,251 +0,0 @@ -# No HR as the API as is only goes back 2 month. - -name: cexio -is_exchange: true -api_url: https://cex.io/api/ - -requests: - currency_pairs: - request: - template: currency_limits - pair_template: null - params: null - response: - type: dict - values: - e: - type: str - ok: - type: str - data: - type: dict - values: - pairs: - type: list - values: - type: dict - values: - symbol1: - type: str - symbol2: - type: str - mapping: - - key: currency_pair_first - path: - - data - - pairs - - symbol1 - type: - - str - - key: currency_pair_second - path: - - data - - pairs - - symbol2 - type: - - str - - tickers: - request: - template: ticker/{currency_pair} - pair_template: - template: "{first}/{second}" - lower_case: false - alias: null - params: null - response: - type: dict - values: - timestamp: - type: str - low: - type: str - high: - type: str - last: - type: str - volume: - type: str - volume30d: - type: str - bid: - type: str - ask: - type: str - - mapping: - - key: time - path: - - timestamp - type: - - str - - float - - from_timestamp - - 0 - - key: last - path: - - last - type: - - str - - float - - key: best_bid - path: - - bid - type: - - str - - float - - key: best_ask - path: - - ask - type: - - str - - float - - key: daily_volume - path: - - volume - type: - - str - - float - - trades: - request: - template: trade_history/{currency_pair} - pair_template: - template: "{first}/{second}" - lower_case: false - alias: null - params: - since: - type: int - required: false # maximum of 1000 items are returned - - response: - type: list - values: - type: dict - values: - type: - type: str - date: - type: str - amount: - type: str - price: - type: str - tid: - type: str - mapping: - - key: time - path: - - date - type: - - str - - float - - from_timestamp - - 0 - - key: id - path: - - tid - type: - - str - - int - - key: direction - path: - - type - type: - - str - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - amount - type: - - str - - float - - order_books: - request: - template: order_book/{currency_pair} - pair_template: - template: "{first}/{second}" - lower_case: false - alias: null - params: - depth: - type: int - default: 100 # if omitted, whole list is returned - - response: - type: dict - values: - timestamp: - type: int - bids: - type: list - values: - type: list - values: - 0: - type: float - 1: - type: float - asks: - type: list - values: - type: list - values: - 0: - type: float - 1: - type: float - pair: - type: str - id: - type: int - - mapping: - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 0 - - key: id - path: - - id - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bids - - 1 - type: - - float - - key: bids_price - path: - - bids - - 0 - type: - - float - - key: asks_amount - path: - - asks - - 1 - type: - - float - - key: asks_price - path: - - asks - - 0 - type: - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/chiliz.yaml b/pandas_datareader/crypto/resources/running_exchanges/chiliz.yaml deleted file mode 100644 index bd4f34a7..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/chiliz.yaml +++ /dev/null @@ -1,304 +0,0 @@ -name: chiliz -is_exchange: true - -api_url: https://api.chiliz.net/ -rate_limit: - max: 3000 - unit: 60 - -requests: - currency_pairs: - request: - template: openapi/v1/brokerInfo - pair_template: null - params: null - - response: - type: dict - values: - symbols: - type: list - values: - type: dict - values: - baseAsset: - type: str - quoteAsset: - type: str - - mapping: - - key: currency_pair_first - path: - - symbols - - baseAsset - type: - - str - - key: currency_pair_second - path: - - symbols - - quoteAsset - type: - - str - - tickers: - request: - template: openapi/quote/v1/ticker/price - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: null - - response: - type: dict - values: - symbol: - type: str - price: - type: str - mapping: - - key: time - path: [] - type: - - none - - now - - key: last_price - path: - - price - type: - - str - - float - - order_books: - request: - template: openapi/quote/v1/depth - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - type: int - max: 100 - default: 100 - response: - type: dict - values: - time: - type: int - bids: - type: list - values: - type: list - 0: #price - type: str - 1: #qty - type: str - asks: - type: list - values: - type: list - 0: - type: str - 1: - type: str - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: id - path: - - time - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - trades: - request: - template: openapi/quote/v1/trades - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - type: int - max: 1000 - default: 500 - response: - type: list - value: - type: dict - values: - price: - type: str - qty: - typ: str - time: - type: int - isBuyerMaker: - type: bool - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: direction - path: - - isBuyerMaker - type: - - value - - map - - True - - sell - - False - - buy - - key: id - path: - - time - type: - - int - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - qty - type: - - str - - float - - historic_rates: - request: - template: openapi/quote/v1/klines - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - interval: - allowed: - minutes: 1m - hours: 1h - days: 1d - weeks: 1w - months: 1M - default: 1d - limit: - type: int - max: 1000 - default: 1000 - endTime: - function: last_timestamp - type: - - datetime - - timestampms - - response: - type: list - values: - type: list - values: - 0: #timestamp - type: int - 1: #open - type: str - 2: #high - type: str - 3: #low - type: str - 4: #close - type: str - 5: #volume - type: str - 6: #close time - type: int - 7: # quote Asset volume - type: str - 8: # number of trades - type: int - 9: # taker buy base asset volume - type: str - 10: # taker buy quote asset volume - type: str - - mapping: - - key: time - path: - - 0 - type: - - float - - from_timestamp - - 1 - - key: open - path: - - 1 - type: - - str - - float - - key: high - path: - - 2 - type: - - str - - float - - key: low - path: - - 3 - type: - - str - - float - - key: close - path: - - 4 - type: - - str - - float - - key: volume - path: - - 5 - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/coinall.yaml b/pandas_datareader/crypto/resources/running_exchanges/coinall.yaml deleted file mode 100644 index d73fc08d..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/coinall.yaml +++ /dev/null @@ -1,202 +0,0 @@ -name: coinall -exchange: true -api_url: https://www.coinall.com/api/spot/v3/ -rate_limit: - max: 6 - unit: 1 - -requests: - currency_pairs: - request: - template: instruments - pair_template: null - params: null - response: - type: list - vaues: - type: dict - values: - base_currency: - type: str - instrument_id: - type: str - quote_currency: - type: str - size_increment: - type: str - tick_size: - type: str - mapping: - - key: currency_pair_first - path: - - base_currency - type: - - str - - key: currency_pair_second - path: - - quote_currency - type: - - str - - tickers: - request: - template: instruments/ticker - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - best_ask: - type: str - best_bid: - type: str - instrument_id: - type: str - product_id: - type: str - last: - type: str - ask: - type: str - bid: - type: str - open24h: - type: str - high24h: - type: str - low_24h: - type: str - base_volume_24h: - type: str - timestamp: - type: str - quote_volume_24h: - type: str - mapping: - - key: time - path: - - timestamp - type: - - str - - strptime - - "%Y-%m-%dT%H:%M:%S.%fz" - - key: currency_pair_first - path: - - instrument_id - type: - - str - - split - - "-" - - 0 - - key: currency_pair_second - path: - - instrument_id - type: - - str - - split - - "-" - - 1 - - key: last_price - path: - - last - type: - - str - - float - - key: best_bid - path: - - best_bid - type: - - str - - float - - key: best_ask - path: - - best_ask - type: - - str - - float - - - historic_rates: - request: - template: instruments/{currency_pair}/candles - pair_template: - template: "{first}-{second}" - lower_case: false - params: - granularity: - allowed: - minutes: 60 - hours: 3600 - days: 86400 - weeks: 604800 - default: 86400 #1d in seconds - end: - function: last_timestamp - type: - - datetime - - format - - "%Y-%m-%dT%H:%M:%S.%fZ" - - response: - type: list - values: - type: list - values: - 0: #timestamp - type: str - 1: #open - type: str - 2: #high - type: str - 3: #low - type: str - 4: #close - type: str - 5: #volume - type: str - mapping: - - key: time - path: - - [] - - 0 - type: - - str - - strptime - - "%Y-%m-%dT%H:%M:%S.%fz" - - key: open - path: - - [] - - 1 - type: - - str - - float - - key: high - path: - - [] - - 2 - type: - - str - - float - - key: low - path: - - [] - - 3 - type: - - str - - float - - key: close - path: - - [] - - 4 - type: - - str - - float - - key: volume - path: - - [] - - 5 - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/coinbase.yaml b/pandas_datareader/crypto/resources/running_exchanges/coinbase.yaml deleted file mode 100644 index c86b01ce..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/coinbase.yaml +++ /dev/null @@ -1,338 +0,0 @@ -name: coinbase -exchange: true -api_url: https://api.pro.coinbase.com/ -rate_limit: - max: 180 - unit: 60 -requests: - currency_pairs: - request: - template: products/ - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - id: # i.e. "BTC-USD" - type: str - base_currency: # i.e. "BTC" - type: str - quote_currency: # i.e. "USD" - type: str - base_min_size: - type: - - str - base_max_size: - type: - - str - quote_increment: - type: - - str - mapping: - - key: currency_pair_first - path: - - base_currency - type: - - str - - key: currency_pair_second - path: - - quote_currency - type: - - str - - tickers: - request: - template: products/{currency_pair}/ticker - pair_template: # e.g. BTC-USD - template: "{first}-{second}" - lower_case: false - params: null - response: - type: dict - values: - trade_id: - type: int - price: - type: - - str - size: - type: - - str - bid: - type: - - str - ask: - type: - - str - volume: - type: - - str - time: - type: - - str - mapping: - - - key: last_price - path: - - price - type: - - str - - float - - key: best_bid - path: - - bid - type: - - str - - float - - key: best_ask - path: - - ask - type: - - str - - float - - key: daily_volume - path: - - volume - type: - - str - - float - - key: time - path: - - time - type: - - str - - dateparser - - - order_books: - request: - template: products/{currency_pair}/book - pair_template: # e.g. BTC-USD - template: "{first}-{second}" - lower_case: false - params: - level: - type: int - possible: - - 1 # Only the best bid and ask - - 2 # Top 50 bids and asks (aggregated) - - 3 # Full order book (non aggregated), Abuse of Level 3 via polling will cause your access to be limited or blocked. - default: 2 - response: - type: dict - values: - sequence: - type: - - int - bids: - type: list - values: - type: list - values: - 0: # price - type: - - str - 1: # size - type: - - str - 2: # num-orders - type: int - asks: - type: list - values: - type: list - values: - 0: # price - type: - - str - 1: # size - type: - - str - 2: # num-orders - type: int - mapping: - - key: time - path: [] - type: - - none - - now - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - key: position - path: [] - type: - - none - - range - - key: id - path: - - sequence - type: - - int - - - trades: - request: - template: products/{currency_pair}/trades - pair_template: # e.g. BTC-USD - template: "{first}-{second}" - lower_case: false - params: null - response: - type: list - values: - type: dict - values: - time: - type: - - str - trade_id: - type: int - price: - type: - - str - size: - type: - - str - side: - type: str - mapping: - - key: time - path: - - time - type: - - str - - dateparser - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - size - type: - - str - - float - - key: direction - path: - - side - type: - - str - - key: id - path: - - trade_id - type: - - int - - historic_rates: # Historical rates should not be polled frequently. If you need real-time information, use the trade and book endpoints along with the websocket feed. - request: - template: products/{currency_pair}/candles - pair_template: # e.g. BTC-USD - template: "{first}-{second}" - lower_case: false - params: - start: # Start time in ISO 8601 "%Y-%m-%dT%H:%M:%S.%fZ" - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 300 - - from_timestamp - - 0 - - "%Y-%m-%dT%H:%M:%S.%fZ" - end: # End time in ISO 8601 - function: last_timestamp - type: - - datetime - - format - - "%Y-%m-%dT%H:%M:%S.%fZ" - granularity: # Desired timeslice in seconds - type: int - allowed: - minutes: 60 - hours: 3600 - days: 86400 - default: 86400 - response: - type: list # TODO: Header Entry? - values: - type: list - values: - 0: # start time - type: int - 1: # low - type: float - 2: # high - type: float - 3: # open - type: float - 4: # close - type: float - 5: # volume - type: float - mapping: - - key: time - path: - - 0 - type: - - float - - from_timestamp - - 0 - - to_end - - interval - - - key: low - path: - - 1 - type: - - float - - key: high - path: - - 2 - type: - - float - - key: open - path: - - 3 - type: - - float - - key: close - path: - - 4 - type: - - float - - key: volume - path: - - 5 - type: - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/coinbene.yaml b/pandas_datareader/crypto/resources/running_exchanges/coinbene.yaml deleted file mode 100644 index 70621f7b..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/coinbene.yaml +++ /dev/null @@ -1,378 +0,0 @@ -name: coinbene -exchange: true -api_url: https://openapi-exchange.coinbene.com/api/exchange/v2/market/ -rate_limit: - max: 15 - unit: 1 -requests: - currency_pairs: - request: - template: tradePair/list - pair_template: null - params: null - response: - type: dict - values: - code: - type: int - data: - type: list - values: - type: dict - values: - symbol: - type: str - baseAsset: - type: str - quoteAsset: - type: str - mapping: - - key: currency_pair_first - path: - - data - - baseAsset - type: - - str - - key: currency_pair_second - path: - - data - - quoteAsset - type: - - str - - tickers: - request: - template: ticker/one - pair_template: - template: "{first}/{second}" - lower_case: false - alias: symbol - params: null - response: - type: dict - values: - code: - type: int - message: - type: str - data: - type: dict - values: - symbol: - type: str - latestPrice: - type: str - bestBid: - type: str - bestAsk: - type: str - high24h: - type: str - low24h: - type: str - volume24h: - type: str - chg24h: - type: str - chg0h: - type: str - mapping: - - key: time - path: [] - type: - - none - - now - - key: last_price - path: - - data - - latestPrice - type: - - str - - float - - key: best_bid - path: - - data - - bestBid - type: - - str - - float - - key: best_ask - path: - - data - - bestAsk - type: - - str - - float - - trades: - request: - template: trades - pair_template: - template: "{first}/{second}" - lower_case: false - alias: symbol - params: null - response: - type: dict - values: - code: - type: int - data: - type: list - values: - type: list - 0: - type: str - 1: - type: str - 2: - type: str - 3: - type: str - 4: - type: str - mapping: - - key: time - path: - - data - - 4 - type: - - str - - strptime - - "%Y-%m-%dT%H:%M:%S.%fZ" - - key: id - path: - - data - - 4 - type: - - strptime - - totimestamp - - "%Y-%m-%dT%H:%M:%S.%fZ" - - key: amount - path: - - data - - 2 - type: - - str - - float - - key: price - path: - - data - - 1 - type: - - str - - float - - key: direction - path: - - data - - 3 - type: - - str - - historic_rates: - request: - template: instruments/candles - pair_template: - template: "{first}/{second}" - lower_case: false - alias: symbol - params: - period: - allowed: - minutes: 1 - hours: 60 - days: D - weeks: W - months: M - default: D - end: - function: last_timestamp - type: - - datetime - - timestamp - response: - type: dict - values: - code: - type: int - data: - type: list - values: - type: list - values: - 0: #timestamp - type: str - 1: # open - type: str - 2: # high - type: str - 3: # low - type: str - 4: # close - type: str - 5: #volume - type: str - mapping: - - key: time - path: - - data - - 0 - type: - - str - - strptime - - "%Y-%m-%dT%H:%M:%S.%fZ" - - key: open - path: - - data - - 1 - type: - - str - - float - - key: high - path: - - data - - 2 - type: - - str - - float - - key: low - path: - - data - - 3 - type: - - str - - float - - key: close - path: - - data - - 4 - type: - - str - - float - - key: volume - path: - - data - - 5 - type: - - str - - float - - order_books: - request: - template: orderBook - pair_template: - template: "{first}/{second}" - lower_case: false - alias: symbol - params: - depth: - type: int - default: 100 - response: - type: dict - values: - code: - type: int - data: - type: dict - values: - asks: - type: list - values: - type: list - values: - 0: # Price - type: str - 1: # Size - type: str - bids: - type: list - values: - type: list - values: - 0: # Price - type: str - 1: # Size - type: str - mapping: - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: time - path: [] - type: - - none - - now - - key: bids_price - path: - - data - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - data - - bids - - 1 - type: - - str - - float - - key: asks_amount - path: - - data - - asks - - 1 - type: - - str - - float - - key: asks_price - path: - - data - - asks - - 0 - type: - - str - - float - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pandas_datareader/crypto/resources/running_exchanges/coindcx.yaml b/pandas_datareader/crypto/resources/running_exchanges/coindcx.yaml deleted file mode 100644 index 8cdcbe62..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/coindcx.yaml +++ /dev/null @@ -1,221 +0,0 @@ -# Structure of Order-Books not applicable to our program. Tickers not with single request, while CP are not separated. - -name: coindcx -exchange: true - -rate_limit: null - -api_url: "" #Base URL differs - -requests: - currency_pairs: - request: - template: https://api.coindcx.com/exchange/v1/markets_details - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - base_currency_short_name: - type: str - target_currency_short_name: - type: str - - mapping: - - key: currency_pair_first - path: - - target_currency_short_name - type: - - str - - key: currency_pair_second - path: - - base_currency_short_name - type: - - str - - historic_rates: - request: - template: https://public.coindcx.com/market_data/candles - pair_template: - template: "B-{first}_{second}" - lower_case: false - alias: pair - params: - limit: - dafault: 1000 - interval: - allowed: - minutes: 1m - hours: 1h - days: 1d - weeks: 1w -# months: 1M - default: 1d - endTime: - function: last_timestamp - type: - - datetime - - timestampms - startTime: - function: last_timestamp - type: - - datetime - - timedeltams - - interval - - 1000 - response: - type: list - values: - type: dict - values: - open: - type: float - high: - type: float - low: - type: float - close: - type: float - volume: - type: float - time: - type: int - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: open - path: - - open - type: - - float - - key: high - path: - - high - type: - - float - - key: low - path: - - low - type: - - float - - key: close - path: - - close - type: - - float - - key: volume - path: - - volume - type: - - float - - trades: - request: - template: https://public.coindcx.com/market_data/trade_history - pair_template: - template: "B-{first}_{second}" - lower_case: false - alias: pair - params: - limit: - default: 100 - max: 500 - response: - type: list - values: - type: dict - values: - p: - type: float - q: - type: float - s: - type: str - T: - type: int - m: - type: str - - mapping: - - key: direction - path: - - m - type: - - value - - map - - True - - sell - - False - - buy - - key: time - path: - - T - type: - - float - - from_timestamp - - 1 - - key: id - path: - - T - type: - - int - - - key: price - path: - - p - type: - - float - - key: amount - path: - - q - type: - - float -# -# order_books: -# request: -# template: /market_data/orderbook -# pair_template: -# template: "B{first}_{second}" -# lower_case: false -# alias: pair -# params: null -# -# response: -# type: dict -# values: -# bids: -# type: dict -# values: -# -# -# mapping: -# - key: time -# path: -# type: -# - key: id -# path: -# type: -# - key: position -# path: [] -# type: -# - none -# - range -# - key: bids_amount -# path: -# type: -# - key: bids_price -# path: -# type: -# - key: asks_amount -# path: -# type: -# - key: asks_price -# path: -# type: \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/coinegg.yaml b/pandas_datareader/crypto/resources/running_exchanges/coinegg.yaml deleted file mode 100644 index ef9d0b34..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/coinegg.yaml +++ /dev/null @@ -1,310 +0,0 @@ -name: coinegg -exchange: true - -rate_limit: - max: 3000 - unit: 60 - -api_url: https://api.coinegg.fun/ - -requests: - currency_pairs: - request: - template: openapi/v1/brokerInfo - pair_template: null - params: null - - response: - type: dict - values: - symbols: - type: list - values: - type: dict - values: - baseAsset: - type: str - quoteAsset: - type: str - - mapping: - - key: currency_pair_first - path: - - symbols - - baseAsset - type: - - str - - key: currency_pair_second - path: - - symbols - - quoteAsset - type: - - str - - tickers: - request: - template: openapi/quote/v1/ticker/price - pair_template: - template: "{first}{second}" - lower_case: false - alias: sybmol - params: null - response: - type: dict - values: - symbol: - type: str - price: - type: str - - mapping: - - key: last_price - path: - - price - type: - - str - - float - - key: time - path: [] - type: - - none - - now - - historic_rates: - request: - template: openapi/quote/v1/klines - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - interval: - allowed: - minutes: 1m -# hours: 1h - days: 1d - weeks: 1w - months: 1M - default: 1d - endTime: - function: last_timestamp - type: - - datetime - - timestampms -# startTime: #not required with endTime and limit parameter -# function: last_timestamp -# type: -# - datetime -# - timedeltams -# - interval -# - 100 - limit: - type: - - int - default: 1000 - - response: - type: list - values: - type: list - values: - 0: #open time - type: int - 1: #open - type: str - 2: # high - type: str - 3: # low - type: str - 4: # close - type: str - 5: # vol - type: str - 6: # close time - type: int - 7: # quote_vol - type: str - - mapping: - - key: time - path: - - 0 - type: - - float - - from_timestamp - - 1 - - to_end - - interval - - key: open - path: - - 1 - type: - - str - - float - - key: high - path: - - 2 - type: - - str - - float - - key: low - path: - - 3 - type: - - str - - float - - key: close - path: - - 4 - type: - - str - - float - - key: volume - path: - - 5 - type: - - str - - float - - - trades: - request: - template: openapi/quote/v1/trades - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - default: 500 #max: 1000 - - response: - type: list - values: - type: dict - values: - price: - type: str - time: - type: int - qty: - type: str - isBuyerMaker: - type: bool - - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: id - path: - - time - type: - - int - - key: direction - path: - - isBuyerMaker - type: - - value - - map - - true - - sell - - false - - buy - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - qty - type: - - str - - float - - order_books: - request: - template: openapi/quote/v1/depth - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - default: 50 - - response: - type: dict - values: - time: - type: int - bids: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - asks: - type: list - values: - type: list - values: - 0: #price - type: str - 1: #qty - type: str - - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: id - path: - - time - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/coinex.yaml b/pandas_datareader/crypto/resources/running_exchanges/coinex.yaml deleted file mode 100644 index 4768381c..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/coinex.yaml +++ /dev/null @@ -1,411 +0,0 @@ -name: coinex -terms: - terms_url: https://www.coinex.com/service - permission: false - search_targets: - - tag: div - class: article-body-inner -api_url: https://api.coinex.com/v1/ - -rate_limit: null # 20 times per second per IP (for Trading and Account API); no limit on Market API -requests: - currency_pairs: - request: - template: market/info - pair_template: null - params: null - response: - type: dict - values: - code: - type: int - data: - type: dict - values: - currency_pair: - type: dict - values: - name: - type: str - pricing_name: - type: str - trading_name: - type: str - mapping: - - key: currency_pair_first - path: - - data - - dict_values - - trading_name - type: - - str - - key: currency_pair_second - path: - - data - - dict_values - - pricing_name - type: - - str - - tickers: - request: - template: market/ticker - pair_template: - template: "{first}{second}" - lower_case: false - alias: market - params: null - response: - type: dict - values: - code: - type: int - data: - type: dict - values: - date: - type: int - ticker: - type: dict - values: - vol: - type: str - low: - type: str - open: - type: str - high: - type: str - last: - type: str - buy: - type: str - buy_amount: - type: str - sell: - type: str - sell_amount: - type: str - message: - type: str - mapping: - - key: time - path: [] - type: - - none - - now - - key: best_bid - path: - - data - - ticker - - buy - type: - - str - - float - - key: last_price - path: - - data - - ticker - - last - type: - - str - - float - - key: best_ask - path: - - data - - ticker - - sell - type: - - str - - float - - key: daily_volume - path: - - data - - ticker - - vol - type: - - str - - float -# - order_books: - request: - template: market/depth - pair_template: # e.g. BTCBCH - template: "{first}{second}" - lower_case: false - alias: market - params: - merge: - type: float - required: true - default: 0 - limit: - type: int - default: 50 - response: - type: dict - values: - code: - type: int - data: - type: dict - values: - last: - type: - - str - asks: - type: list - values: - type: list - values: - 0: # Order price - type: - - str - 1: # Order amount - type: - - str - bids: - type: list - values: - type: list - values: - 0: # Order price - type: - - str - 1: # Order amount - type: - - str - message: - type: str - mapping: - - key: time - path: - - data - - time - type: - - float - - from_timestamp - - 1 - - key: id - path: - - data - - time - type: - - int - - key: position - path: [] - type: - - none - - range - - key: asks_price - path: - - data - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - data - - asks - - 1 - type: - - str - - float - - key: bids_price - path: - - data - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - data - - bids - - 1 - type: - - str - - float - - trades: - request: - template: market/deals - pair_template: # e.g. BTCBCH - template: "{first}{second}" - lower_case: false - alias: market - params: - last_id: # Transaction history id, send 0 to draw from the latest record. - type: int - default: 0 - limit: - type: int - default: 100 # less than 1,000 - response: - type: dict - values: - code: - type: int - data: - type: list - values: - type: dict - values: - amount: - type: - - str - - float - date: - type: - - int - date_ms: - type: - - int - id: - type: int - price: - type: - - str - - float - type: - type: str - message: - type: str - mapping: - - key: id - path: - - data - - id - type: - - int - - key: amount - path: - - data - - amount - type: - - str - - float - - key: time - path: - - data - - date - type: - - float - - from_timestamp - - 0 - - key: price - path: - - data - - price - type: - - str - - float - - key: direction - path: - - data - - type - type: - - str - - historic_rates: - request: - template: market/kline - pair_template: # e.g. BTCBCH - template: "{first}{second}" - lower_case: false - alias: market - params: - type: - type: str - allowed: - minutes: 1min - hours: 1hour - days: 1day - weeks: 1week - default: 1day - limit: # Less than or equal to 1000 - type: int - max: 1000 - default: 1000 - response: - type: dict - values: - code: - type: int - data: - type: list - values: - type: list - values: - 0: # Time - type: - - int - 1: # open - type: - - str - 2: # close - type: - - str - 3: # highest - type: - - str - 4: # lowest - type: - - str - 5: # volume - type: - - str - 6: # amount - type: - - str - 7: # market - type: str - message: - type: str - mapping: - - key: time - path: - - data - - 0 - type: - - float - - from_timestamp - - 0 - - key: open - path: - - data - - 1 - type: - - str - - float - - key: close - path: - - data - - 2 - type: - - str - - float - - key: high - path: - - data - - 3 - type: - - str - - float - - key: low - path: - - data - - 4 - type: - - str - - float - - key: volume - path: - - data - - 5 - type: - - str - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/coinfield.yaml b/pandas_datareader/crypto/resources/running_exchanges/coinfield.yaml deleted file mode 100644 index 546f3fc1..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/coinfield.yaml +++ /dev/null @@ -1,348 +0,0 @@ -name: coinfield -exchange: true - -rate_limit: null - -api_url: https://api.coinfield.com/v1/ - -requests: - currency_pairs: - request: - template: markets - pair_template: null - params: null - - response: - type: dict - values: - markets: - type: list - values: - type: dict - values: - id: - type: str - name: - type: str - - mapping: - - key: currency_pair_first - path: - - markets - - name - type: - - str - - split - - "/" - - 0 - - key: currency_pair_second - path: - - markets - - name - type: - - str - - split - - "/" - - 1 - - tickers: - request: - template: tickers/{currency_pair} - pair_template: - template: "{first}{second}" - lower_case: true - params: null - response: - type: dict - values: - markets: - type: list - values: - type: dict - values: - timestamp: - type: str - bid: - type: float - ask: - type: float - vol: - type: float - last: - type: float - - mapping: - - key: last_price - path: - - markets - - last - type: - - float - - key: time - path: [] - type: - - none - - now - - key: best_bid - path: - - markets - - bid - type: - - float - - key: best_ask - path: - - markets - - ask - type: - - float - - key: daily_volume - path: - - markets - - vol - type: - - float - - historic_rates: - request: - template: ohlc/{currency_pair} - pair_template: - template: "{first}{second}" - lower_case: true - params: - limit: - default: 400 - period: - allowed: - minutes: 1 - hours: 60 - days: 1440 - weeks: 10080 - default: 1440 - to: - function: last_timestamp - type: - - datetime - - timestamp - from: - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 400 - response: - type: dict - values: - ohlc: - type: list - values: - type: dict - values: - ts: - type: str - o: - type: str - h: - type: str - l: - type: str - c: - type: str - v: - type: str - - mapping: - - key: time - path: - - ohlc - - ts - type: - - str - - dateparser - - key: open - path: - - ohlc - - o - type: - - str - - float - - key: high - path: - - ohlc - - h - type: - - str - - float - - key: low - path: - - ohlc - - l - type: - - str - - float - - key: close - path: - - ohlc - - c - type: - - str - - float - - key: volume - path: - - ohlc - - v - type: - - str - - float - - - trades: - request: - template: trades/{currency_pair} - pair_template: - template: "{first}{second}" - lower_case: true - params: - limit: - default: 200 - - response: - type: dict - values: - trades_hash: - type: str - trades: - type: list - values: - type: dict - values: - id: - type: int - price: - type: str - volume: - type: str - total_value: - type: str - timestamp: - type: str - - - mapping: - - key: time - path: - - trades - - timestamp - type: - - str - - dateparser - - key: id - path: - - trades - - id - type: - - int -# - key: direction -# path: -# type: - - key: price - path: - - trades - - price - type: - - str - - float - - key: amount - path: - - trades - - volume - type: - - str - - float - - order_books: - request: - template: orderbook/{currency_pair} - pair_template: - template: "{first}{second}" - lower_case: true - params: - limit: - default: 50 - - response: - type: dict - values: - asks_hash: - type: str - bids: - type: list - values: - type: dict - values: - id: - type: int - price: - type: str - volume: - type: str - timestamp: - type: str - asks: - type: list - values: - type: dict - values: - id: - type: int - price: - type: str - volume: - type: str - timestamp: - type: str - - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bids - - volume - type: - - str - - float - - key: bids_price - path: - - bids - - price - type: - - str - - float - - key: asks_amount - path: - - asks - - volume - type: - - str - - float - - key: asks_price - path: - - asks - - price - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/coingecko.yaml b/pandas_datareader/crypto/resources/running_exchanges/coingecko.yaml deleted file mode 100644 index 3bcdbd32..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/coingecko.yaml +++ /dev/null @@ -1,116 +0,0 @@ -name: coingecko -exchange: false -api_url: https://api.coingecko.com/api/v3/ -#api_url: https://api.coingecko.com/api/v2/ -rate_limit: - max: 50 - unit: 60 - -requests: - currency_pairs: - request: - template: coins/list - pair_template: null - params: null - - response: - type: list - values: - type: dict - values: - id: - type: str - symbol: - type: str - name: - type: str - - mapping: - - key: currency_pair_first - path: - - id - type: - - str - - key: currency_pair_second - path: [] - type: - - none - - constant - - USD - - historic_rates: - request: - template: coins/{currency_pair}/market_chart - pair_template: - template: "{first}" - lower_case: true - params: - vs_currency: - type: str - default: USD - days: - type: int - default: max - - response: - type: dict - values: - prices: - type: list - values: - type: list - values: - 0: - type: int - 1: - type: float - market_caps: - type: list - values: - type: list - values: - 0: - type: int - 1: - type: float - total_volumes: - type: list - values: - type: list - values: - 0: - type: int - 1: - type: float - - mapping: - - key: time - path: - - prices - - 0 - type: - - float - - from_timestamp - - 1 - - to_end - - interval - - key: close - path: - - prices - - 1 - type: - - float - - key: volume - path: - - total_volumes - - 1 - type: - - float - - key: market_cap - path: - - market_caps - - 1 - type: - - float - - diff --git a/pandas_datareader/crypto/resources/running_exchanges/coinhe.yaml b/pandas_datareader/crypto/resources/running_exchanges/coinhe.yaml deleted file mode 100644 index 8a06582e..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/coinhe.yaml +++ /dev/null @@ -1,333 +0,0 @@ -name: coinhe -exchange: true - -rate_limit: null - -api_url: https://api.coinhe.io/v1/ - -requests: - currency_pairs: - request: - template: market-summary/ - pair_template: null - params: null - - response: - type: list - values: - tyoe: dict - values: - currency_pair: - type: dict - - mapping: - - key: currency_pair_first - path: - - dict_key - type: - - str - - split - - "_" - - 1 - - key: currency_pair_second - path: - - dict_key - type: - - str - - split - - "_" - - 0 - - tickers: - request: - template: market-summary/ - pair_template: null - params: null - response: - type: list - values: - tyoe: dict - values: - currency_pair: - type: dict - values: - lastUpdateTimestamp: - type: int - LastPrice: - type: float - highestBid: - type: float - lowestAsk: - type: float - baseVolume24g: - type: float - quoteVolume24h: - type: float - - mapping: - - key: currency_pair_first - path: - - dict_key - type: - - str - - split - - "_" - - 1 - - key: currency_pair_second - path: - - dict_key - type: - - str - - split - - "_" - - 0 - - key: last_price - path: - - dict_values - - LastPrice - type: - - float - - key: time - path: - - dict_values - - lastUpdateTimestamp - type: - - float - - from_timestamp - - 0 - - key: best_bid - path: - - dict_values - - highestBid - type: - - float - - key: best_ask - path: - - dict_values - - lowestAsk - type: - - float - - key: daily_volume - path: - - dict_values - - baseVolume24h - type: - - float - - key: daily_base_volume - path: - - dict_values - - quoteVolume24h - type: - - float - - historic_rates: - request: - template: candlestick-v2 - pair_template: - template: "{second}_{first}" - lower_case: false - alias: pair - params: - interval: - allowed: - minutes: 5m - days: 1d - default: 5m - timestamp: - function: last_timestamp - type: - - datetime - - timestamp - response: - type: list - values: - type: dict - values: - close: - type: str - high: - type: str - open: - type: str - low: - type: str - volume: - type: str - timestamp: - type: int - - mapping: - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 0 - - key: open - path: - - open - type: - - str - - float - - key: high - path: - - high - type: - - str - - float - - key: low - path: - - low - type: - - str - - float - - key: close - path: - - close - type: - - str - - float - - key: volume - path: - - volume - type: - - str - - float - - - trades: - request: - template: trades/{currency_pair} - pair_template: - template: "{second}_{first}" - lower_case: false -# alias: - params: null - - response: - type: list - values: - type: dict - values: - tradeID: - type: int - price: - type: float - base_volume: - type: float - quote_volume: - type: float - trade_timestamp: - type: int - type: - type: str - - mapping: - - key: time - path: - - trade_timestamp - type: - - float - - from_timestamp - - 0 - - key: id - path: - - tradeID - type: - - int - - key: direction - path: - - type - type: - - str - - key: price - path: - - price - type: - - float - - key: amount - path: - - quote_volume # pair is quoted indirectly - type: - - float - - order_books: - request: - template: orderbook/{currency_pair} - pair_template: - template: "{second}_{first}" - lower_case: false -# alias: - params: null - - response: - type: dict - values: - timestamp: - type: int - bids: - type: list - values: - type: list - values: - 0: #price - type: str - 1: #qty - type: str - asks: - type: list - values: - type: list - values: - 0: #price - type: str - 1: #qty - type: str - - mapping: - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 0 - - key: id - path: - - timestamp - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/coinjar.yaml b/pandas_datareader/crypto/resources/running_exchanges/coinjar.yaml deleted file mode 100644 index 45b377d3..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/coinjar.yaml +++ /dev/null @@ -1,314 +0,0 @@ -name: coinjar -exchange: true - -rate_limit: null - -api_url: "" - -requests: - currency_pairs: - request: - template: https://api.exchange.coinjar.com/products - pair_template: null - params: null - - response: - type: list - values: - type: dict - values: - name: - type: str - - mapping: - - key: currency_pair_first - path: - - name - type: - - str - - split - - "/" - - 0 - - key: currency_pair_second - path: - - name - type: - - str - - split - - "/" - - 1 - - tickers: - request: - template: https://data.exchange.coinjar.com/products/{currency_pair}/ticker - pair_template: - template: "{first}{second}" - lower_case: false - params: null - response: - type: dict - values: - volume_24h: - type: str - last: - type: str - current_time: - type: str - bid: - type: str - ask: - type: str - - mapping: - - key: last_price - path: - - last - type: - - str - - float - - key: time - path: - - current_time - type: - - str - - dateparser - - key: best_bid - path: - - bid - type: - - str - - float - - key: best_ask - path: - - ask - type: - - str - - float - - key: daily_volume - path: - - volume_24h - type: - - str - - float - - historic_rates: - request: - template: https://data.exchange.coinjar.com/products/{currency_pair}/candles - pair_template: - template: "{first}{second}" - lower_case: false - params: - before: - function: last_timestamp - type: - - datetime - - timestamp - after: - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 300 - interval: - allowed: - minutes: 1m - hours: 1h - days: 1d - weeks: 1w - months: 1M - default: 1d - - response: - type: list - values: - type: list - values: - 0: #time - type: str - 1: #open - type: str - 2: #high - type: str - 3: #low - type: str - 4: #close - type: str - 5: #vol - type: str - - mapping: - - key: time - path: - - 0 - type: - - str - - dateparser - - key: open - path: - - 1 - type: - - str - - float - - key: high - path: - - 2 - type: - - str - - float - - key: low - path: - - 3 - type: - - str - - float - - key: close - path: - - 4 - type: - - str - - float - - key: volume - path: - - 5 - type: - - str - - float - - - trades: - request: - template: https://data.exchange.coinjar.com/products/{currency_pair}/trades - pair_template: - template: "{first}{second}" - lower_case: false - params: - limit: - default: 200 - - response: - type: list - values: - type: dict - values: - value: - type: str - timestamp: - type: str - tid: - type: int - taker_side: - type: str - size: - type: str - price: - type: str - - mapping: - - key: time - path: - - timestamp - type: - - str - - dateparser - - key: id - path: - - tid - type: - - int - - key: direction - path: - - taker_side - type: - - str - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - size - type: - - str - - float - - order_books: - request: - template: https://data.exchange.coinjar.com/products/{currency_pair}/book - pair_template: - template: "{first}{second}" - lower_case: false - params: - level: - allowed: - 1: #Best bid/best ask - 2: #Top20 - 3: #Full Book - default: 2 - response: - type: dict - values: - bids: - type: list - values: - type: list - values: - 0: # price - type: str - 1: # qty - type: str - asks: - type: list - values: - type: list - values: - 0: # price - type: str - 1: # qty - type: str - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/coinlist.yaml b/pandas_datareader/crypto/resources/running_exchanges/coinlist.yaml deleted file mode 100644 index 1da79c76..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/coinlist.yaml +++ /dev/null @@ -1,288 +0,0 @@ -name: coinlist -exchange: true - -rate_limit: - max: 200 - unit: 60 - -api_url: http://trade-api.coinlist.co/v1/ - -requests: - currency_pairs: - request: - template: symbols - pair_template: null - params: null - - response: - type: list - values: - symbols: - type: list - values: - type: dict - values: - symbol: - type: str - base_currency: - type: str - quote_currency: - type: str - - mapping: - - key: currency_pair_first - path: - - symbols - - base_currency - type: - - str - - key: currency_pair_second - path: - - symbols - - quote_currency - type: - - str - - tickers: - request: - template: symbols/summary - pair_template: null - params: null - response: - type: dict - values: - currency_pair: - type: dict - values: - last_price: - type: str - lowest_ask: - type: str - highest_bid: - type: str - volume_base_24h: - type: str - volume_quote_24h: - type: str - - mapping: - - key: currency_pair_first - path: - - dict_key - type: - - str - - split - - "-" - - 0 - - key: currency_pair_second - path: - - dict_key - type: - - str - - split - - "-" - - 1 - - key: last_price - path: - - dict_values - - last_price - type: - - str - - float - - key: time - path: [] - type: - - none - - now - - key: best_bid - path: - - dict_values - - highest_bid - type: - - str - - float - - key: best_ask - path: - - dict_values - - lowest_ask - type: - - str - - float - - key: daily_volume - path: - - dict_values - - volume_base_24h - type: - - str - - float - - historic_rates: - request: - template: symbols/{currency_pair}/candles - pair_template: - template: "{first}-{second}" - lower_case: false - params: - granularity: - allowed: - minutes: 1m - hours: 30m - default: 30m -# start_time: -# function: last_timestamp -# type: -# - datetime -# - timedelta -# - interval -# - 300 -# - format -# - "%Y-%m%dT%H:%M:%S.%fZ" - end_time: - function: last_timestamp - type: - - datetime - - format - - "%Y-%m-%dT%H:%M:%S.%fZ" - response: - type: dict - values: - candles: - type: list - values: - type: list - values: - 0: #time - type: str - 1: #open - type: str - 2: #high - type: str - 3: # low - type: str - 4: #close - type: str - 5: #volume - type: str - mapping: - - key: time - path: - - candles - - 0 - type: - - str - - dateparser - - key: open - path: - - candles - - 1 - type: - - str - - float - - key: high - path: - - candles - - 2 - type: - - str - - float - - key: low - path: - - candles - - 3 - type: - - str - - float - - key: close - path: - - candles - - 4 - type: - - str - - float - - key: volume - path: - - candles - - 5 - type: - - str - - float - - order_books: - request: - template: symbols/{currency_pair}/book - pair_template: - template: "{first}-{second}" - lower_case: false - params: null - - response: - type: dict - values: - call_time: - type: str - after_auction_code: - type: str - bids: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - asks: - type: list - values: - type: list - values: - 0: #price - type: str - 1: #qty - type: str - - mapping: - - key: time - path: - - call_time - type: - - str - - dateparser - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/coinpaprika.yaml b/pandas_datareader/crypto/resources/running_exchanges/coinpaprika.yaml deleted file mode 100644 index 654a2722..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/coinpaprika.yaml +++ /dev/null @@ -1,226 +0,0 @@ -# ToDo: Tickers fehlerhaft -name: coinpaprika -exchange: false - -rate_limit: - max: 600 - unit: 60 - -api_url: https://api.coinpaprika.com/v1/ - -requests: - currency_pairs: - request: - template: coins - pair_template: null - params: null - - response: - type: list - values: - type: dict - values: - id: - type: str - name: - type: str - symbol: - type: str - - - mapping: - - key: currency_pair_first - path: - - id - type: - - str - - key: currency_pair_second - path: [] - type: - - none - - constant - - 'USD' - -# pair_infos: -# request: -# template: coins/{currency_pair} -# pair_template: -# template: "{first}" -# lower_case: true -# params: null -# response: -# type: dict -# values: -# first_data_at: -# type: str -# last_data_at: -# type: str -# mapping: -# - key: start -# path: -# - first_data_at -# type: -# - str -# - dateparser -# - key: end -# path: -# - last_data_at -# type: -# - str -# - dateparser -## - historic_rates: - request: - template: tickers/{currency_pair}/historical - pair_template: - template: "{first}" - lower_case: true - params: - start: - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 5000 - end: - function: last_timestamp - type: - - datetime - - timestamp - limit: - default: 5000 # max! - interval: - allowed: - minutes: 5m - hours: 1h - days: 1d - weeks: 7d - months: 30d - default: 1d - - response: - type: list - values: - type: dict - values: - timestamp: - type: str - price: - type: float - volume_24h: - type: float - market_cap: - type: float - - mapping: - - key: time - path: - - timestamp - type: - - str - - dateparser - - key: close - path: - - price - type: - - float - - key: volume - path: - - volume_24h - type: - - float - - key: market_cap - path: - - market_cap - type: - - float - - -# sentiments: -# request: -# template: tickers/{currency_pair}/historical -# pair_template: -# template: "{first}" -# lower_case: true -# params: -# -# historic_rates: -# request: -# template: coins/{currency_pair}/ohlcv/historical -# pair_template: -# template: "{first}" -# lower_case: true -# params: -# start: -# function: last_timestamp -# type: -# - datetime -# - timedelta -# - interval -# - 366 -# limit: -# default: 366 # max value -# quote: -# default: usd # or 'btc' -# -# response: -# type: list -# values: -# type: dict -# values: -# time_open: -# type: str -# time_close: -# type: str -# open: -# type: float -# high: -# type: float -# low: -# type: float -# close: -# type: float -# volume: -# type: float -# market_cap: -# type: float -# -# -# mapping: -# - key: time -# path: -# - time_close -# type: -# - str -# - dateparser -# - key: open -# path: -# - open -# type: -# - float -# - key: high -# path: -# - high -# type: -# - float -# - key: low -# path: -# - low -# type: -# - float -# - key: close -# path: -# - close -# type: -# - float -# - key: volume -# path: -# - volume -# type: -# - float -# - key: market_cap -# path: -# - market_cap -# type: -# - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/coinsbit.yaml b/pandas_datareader/crypto/resources/running_exchanges/coinsbit.yaml deleted file mode 100644 index 41928331..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/coinsbit.yaml +++ /dev/null @@ -1,325 +0,0 @@ -name: coinsbit -exchange: true - -rate_limit: null -api_url: https://coinsbit.io/api/v1/public/ - -requests: - currency_pairs: - request: - template: markets - pair_template: null - params: null - - response: - type: dict - values: - result: - type: list - values: - type: dict - values: - name: - type: str - stock: - type: str - money: - type: str - mapping: - - key: currency_pair_first - path: - - result - - stock - type: - - str - - key: currency_pair_second - path: - - result - - money - type: - - str - - tickers: - request: - template: tickers - pair_template: null - params: null - response: - type: dict - values: - result: - type: dict - values: - currency_pair: - type: dict - values: - at: - type: int - ticker: - type: dict - values: - bid: - type: str - ask: - type: str - last: - type: str - vol: - type: str - - mapping: - - key: currency_pair_first - path: - - result - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - result - - dict_key - type: - - str - - split - - "_" - - 1 - - key: time - path: - - result - - dict_values - - at - type: - - float - - from_timestamp - - 0 - - key: last - path: - - result - - dict_values - - ticker - - last - type: - - str - - float - - key: best_bid - path: - - result - - dict_values - - ticker - - bid - type: - - str - - float - - key: best_ask - path: - - result - - dict_values - - ticker - - ask - type: - - str - - float - - key: daily_volume - path: - - result - - dict_values - - ticker - - vol - type: - - str - - float - - order_books: - request: - template: depth/result - pair_template: - template: "{first}_{second}" - lower_case: false - alias: market - params: - limit: - default: 50 #max=100 - response: - type: dict - values: - asks: - type: list - values: - type: list - values: - 0: #price - type: str - 1: #qty - type: str - bids: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - historic_rates: - request: - template: kline - pair_template: - template: "{first}_{second}" - lower_case: false - alias: market - params: - start: - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 1000 - end: - function: last_timestamp - type: - - datetime - - timestamp - interval: - allowed: #minimum is 86400 -# minutes: 60 -# hours: 3600 - days: 86400 - weeks: 604800 - months: 18144000 - - default: 86400 # 1day - response: - type: dict - values: - result: - type: dict - values: - market: - type: str - start: - type: int - end: - type: int - interval: - type: int - kline: - type: list - values: - type: dict - values: - time: - type: int - open: - type: str - highest: - type: str - lowest: - type: str - close: - type: str - volume: - type: str - amount: - type: str - mapping: - - key: time - path: - - result - - kline - - time - type: - - float - - from_timestamp - - 0 - - key: open - path: - - result - - kline - - open - type: - - str - - float - - key: high - path: - - result - - kline - - highest - type: - - str - - float - - key: low - path: - - result - - kline - - lowest - type: - - str - - float - - key: close - path: - - result - - kline - - close - type: - - str - - key: volume - path: - - result - - kline - - volume - type: - - str - - float - - - - diff --git a/pandas_datareader/crypto/resources/running_exchanges/crex24.yaml b/pandas_datareader/crypto/resources/running_exchanges/crex24.yaml deleted file mode 100644 index 03fa17ff..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/crex24.yaml +++ /dev/null @@ -1,313 +0,0 @@ -name: crex24 -exchange: true -api_url: https://api.crex24.com/v2/public/ -rate_limit: null - -requests: - - currency_pairs: - request: - template: instruments - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - symbol: - type: str - baseCurrency: - type: str - quoteCurrency: - type: str - - - mapping: - - key: currency_pair_first - path: - - baseCurrency - type: - - str - - key: currency_pair_second - path: - - quoteCurrency - type: - - str - - tickers: - request: - template: tickers - pair_template: null - params: null - - response: - type: list - values: - type: dict - values: - instrument: - type: str - last: - type: float - percentChange: - type: float - low: - type: float - high: - type: float - baseVolume: - type: float - quoteVolume: - type: float - volumeInBtc: - type: float - volumeInUsd: - type: float - ask: - type: float - bid: - type: float - timestamp: - type: str - - mapping: - - key: time - path: - - timestamp - type: - - str - - dateparser - - key: currency_pair_first - path: - - instrument - type: - - str - - split - - "-" - - 0 - - key: currency_pair_second - path: - - instrument - type: - - str - - split - - "-" - - 1 - - key: last_price - path: - - last - type: - - float - - key: best_ask - path: - - ask - type: - - float - - key: best_bid - path: - - bid - type: - - float - - key: daily_volume - path: - - baseVolume - type: - - float - - historic_rates: - request: - template: ohlcv - pair_template: - template: "{first}-{second}" - lower_case: false - alias: instrument - params: - granularity: - allowed: - minutes: 1m - hours: 1h - days: 1d - weeks: 1w - default: 1d - limit: - type: int - default: 1000 #between 1-1000, if not specified, default is 100. - response: - type: list - values: - type: dict - values: - timestamp: - type: str - open: - type: float - high: - type: float - low: - type: float - close: - type: float - volume: - type: float - mapping: - - key: time - path: - - timestamp - type: - - str - - dateparser - - key: open - path: - - open - type: - - float - - key: high - path: - - high - type: - - float - - key: low - path: - - low - type: - - float - - key: close - path: - - close - type: - - float - - key: volume - path: - - volume - type: - - float - - trades: - request: - template: recentTrades - pair_template: - template: "{first}-{second}" - lower_case: false - alias: instrument - params: - limit: - type: int - default: 1000 - - response: - type: list - values: - type: dict - values: - timestamp: - type: str - price: - type: float - volume: - type: float - side: - type: float - mapping: - - key: id - path: - - timestamp - type: - - str - - dateparser - - totimestamp - - key: time - path: - - timestamp - type: - - str - - dateparser - - key: direction - path: - - side - type: - - str - - key: price - path: - - price - type: - - float - - key: amount - path: - - volume - type: - - float - - - order_books: - request: - template: orderBook - pair_template: - template: "{first}-{second}" - lower_case: false - alias: instrument - params: - limit: - type: int - default: 50 - response: - type: dict - values: - buyLevels: - type: list - values: - type: dict - values: - price: - type: float - volume: - type: float - sellLevels: - type: list - values: - type: dict - values: - price: - type: float - volume: - type: float - mapping: - - key: id - path: [] - type: - - none - - now_timestamp - - key: time - path: [] - type: - - none - - now - - key: position - path: [] - type: - - none - - now - - key: bids_amount - path: - - buyLevels - - volume - type: - - float - - key: bids_price - path: - - buyLevels - - price - type: - - float - - key: asks_amount - path: - - sellLevels - - volume - type: - - float - - key: asks_price - path: - - sellLevels - - price - type: - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/crosstower.yaml b/pandas_datareader/crypto/resources/running_exchanges/crosstower.yaml deleted file mode 100644 index 9e48e226..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/crosstower.yaml +++ /dev/null @@ -1,364 +0,0 @@ -name: crosstower -exchange: true - -rate_limit: - max: 6000 - unit: 60 - -api_url: https://api.crosstower.com/api/2/ - -requests: - currency_pairs: - request: - template: public/symbol - pair_template: null - params: null - - response: - type: list - values: - type: dict - values: - baseCurrency: - type: str - quoteCurrency: - type: str - - mapping: - - key: currency_pair_first - path: - - baseCurrency - type: - - str - - key: currency_pair_second - path: - - quoteCurrency - type: - - str - - tickers: - request: - template: public/ticker - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbols - params: null - response: - type: list - values: - type: dict - values: - ask: - type: str - bid: - type: str - last: - type: str - volume: - type: str - timestamp: - type: str - volumeQuote: - type: str - - mapping: - - key: last_price - path: - - last - type: - - str - - float - - key: time - path: - - timestamp - type: - - str - - dateparser - - key: best_bid - path: - - bid - type: - - str - - float - - key: best_ask - path: - - ask - type: - - str - - float - - key: daily_volume - path: - - volumeQuote - type: - - str - - float - - historic_rates: - request: - template: public/candles - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbols - params: - period: - allowed: - minutes: M1 - hours: H1 - days: D1 - weeks: W1 - months: 1M - sort: - default: DESC -# from: -# function: last_timestamp -# type: -# - datetime -# - timedelta -# - interval -# - 1000 -# - fromtimestamp -# - "%Y-%m-%dT%H:%M:%S.%fZ" - till: - function: last_timestamp - type: - - datetime - - format - - "%Y-%m-%dT%H:%M:%S.%fZ" - limit: - default: 1000 - response: - type: dict - values: - currency_pair: - type: list - values: - type: dict - values: - timestamp: - type: str - open: - type: str - max: - type: str - min: - type: str - close: - type: str - volume: - type: str - volumeQuote: - type: str - - mapping: - - key: time - path: - - dict_values - - timestamp - type: - - str - - dateparser - - key: open - path: - - dict_values - - open - type: - - str - - float - - key: high - path: - - dict_values - - max - type: - - str - - float - - key: low - path: - - dict_values - - min - type: - - str - - float - - key: close - path: - - dict_values - - close - type: - - str - - float - - key: volume - path: - - dict_values - - volume - type: - - str - - float - - trades: - request: - template: public/trades - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbols - params: -# from: -# function: last_timestamp -# type: -# - datetime -# - timedelta -# - interval -# - 1000 -# - fromtimestamp -# - "%Y-%m-%dT%H:%M:%S.%fZ" -# till: -# function: last_timestamp -# type: -# - datetime -# - format -# - "%Y-%m-%dT%H:%M:%S.%fZ" - limit: - default: 1000 - max: 1000 - - response: - type: dict - values: - currency_pair: - type: list - values: - type: dict - values: - timestamp: - type: str - id: - type: int - price: - type: str - quantity: - type: str - side: - type: str - - mapping: - - key: time - path: - - dict_values - - timestamp - type: - - str - - dateparser - - key: id - path: - - dict_values - - id - type: - - int - - key: direction - path: - - dict_values - - side - type: - - str - - key: price - path: - - dict_values - - price - type: - - str - - float - - key: amount - path: - - dict_values - - quantity - type: - - str - - float - - order_books: - request: - template: public/orderbook - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbols - params: - limit: - default: 50 - max: 0 # to see complete order-book - - response: - type: dict - values: - currency_pair: - type: dict - values: - ask: - type: list - values: - type: dict - price: - type: str - size: - type: str - sell: - type: list - values: - type: dict - price: - type: str - size: - type: str - timestamp: - type: str - mapping: - - key: time - path: - - dict_values - - timestamp - type: - - str - - dateparser - - key: id - path: [] - type: - - none - - now_timestampms - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - dict_values - - bid - - size - type: - - str - - float - - key: bids_price - path: - - dict_values - - bid - - price - type: - - str - - float - - key: asks_amount - path: - - dict_values - - ask - - size - type: - - str - - float - - key: asks_price - path: - - dict_values - - ask - - price - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/crypto.yaml b/pandas_datareader/crypto/resources/running_exchanges/crypto.yaml deleted file mode 100644 index 1549a8fe..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/crypto.yaml +++ /dev/null @@ -1,392 +0,0 @@ -name: crypto -exchange: true -rate_limit: - max: 6000 - unit: 60 - -api_url: https://uat-api.3ona.co/v2/ - -requests: - currency_pairs: - request: - template: public/get-instruments - pair_template: null - params: null - - response: - type: dict - values: - result: - type: dict - values: - instruments: - type: list - values: - type: dict - values: - instrument_name: - type: str - quote_currency: - type: str - base_currency: - type: str - mapping: - - key: currency_pair_first - path: - - result - - instruments - - base_currency - type: - - str - - key: currency_pair_second - path: - - result - - instruments - - quote_currency - type: - - str - - tickers: - request: - template: public/get-ticker - pair_template: null - params: null - response: - type: dict - values: - result: - type: dict - values: - data: - type: list - values: - i: - type: str - b: - type: float - k: - type: float - a: - type: float - t: - type: int - v: - type: float - mapping: - - key: currency_pair_first - path: - - result - - data - - i - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - result - - data - - i - type: - - str - - split - - "_" - - 1 - - key: time - path: - - result - - data - - t - type: - - float - - from_timestamp - - 1 - - key: last_price - path: - - result - - data - - a - type: - - float - - key: best_bid - path: - - result - - data - - b - type: - - float - - key: best_ask - path: - - result - - data - - k - type: - - float - - key: daily_volume - path: - - result - - data - - v - type: - - float - - trades: - request: - template: public/get-trades - pair_template: - template: "{first}_{second}" - lower_case: false - alias: instrument_name - params: null - - response: - type: dict - values: - result: - type: dict - values: - instrument_name: - type: str - data: - type: list - values: - type: dict - values: - dataTime: - type: int - d: #trade id - type: int - s: #side - type: str - p: #price - type: float - q: #quantity - type: float - t: #time - type: int - i: - type: str - mapping: - - key: time - path: - - result - - data - - t - type: - - float - - from_timestamp - - 1 - - key: id - path: - - result - - data - - d - type: - - int - - key: direction - path: - - result - - data - - s - type: - - str - - key: price - path: - - result - - data - - p - type: - - float - - key: amount - path: - - result - - data - - q - type: - - float - - order_books: - request: - template: public/get-book - pair_template: - template: "{first}_{second}" - lower_case: false - alias: instrument_name - params: - depth: - type: int - max: 150 - default: 50 - response: - type: dict - values: - result: - type: dict - values: - data: - type: list - values: - type: dict - values: - bids: - type: list - values: - type: list - values: - 0: #price - type: float - 1: #qty - type: float - asks: - type: list - values: - type: list - values: - 0: #price - type: float - 1: #qty - type: float - t: #timestamp - type: int - mapping: - - key: time - path: - - result - - data - - t - type: - - float - - from_timestamp - - 1 - - key: id - path: - - result - - data - - t - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - result - - data - - bids - - 0 - type: - - float - - key: bids_amount - path: - - result - - data - - bids - - 1 - type: - - float - - key: asks_price - path: - - result - - data - - asks - - 0 - type: - - float - - key: asks_amount - path: - - result - - data - - asks - - 1 - type: - - float - - historic_rates: - request: - template: public/get-candlestick - pair_template: - template: "{first}_{second}" - lower_case: false - alias: instrument_name - params: - timeframe: - allowed: -# minutes: 1M -# hours: 1H - days: 1D - weeks: 1W -# months: 1M - default: 1D - limit: - default: 100 - - response: - type: dict - values: - result: - type: data - values: - type: list - values: - type: dict - values: - t: - type: int - o: - type: float - h: - type: float - l: - type: float - c: - type: float - v: - type: float - mapping: - - key: time - path: - - result - - data - - t - type: - - float - - from_timestamp - - 1 - - key: open - path: - - result - - data - - o - type: - - float - - key: high - path: - - result - - data - - h - type: - - float - - key: low - path: - - result - - data - - l - type: - - float - - key: close - path: - - result - - data - - c - type: - - float - - key: volume - path: - - result - - data - - v - type: - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/currency.yaml b/pandas_datareader/crypto/resources/running_exchanges/currency.yaml deleted file mode 100644 index a245d290..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/currency.yaml +++ /dev/null @@ -1,320 +0,0 @@ -name: currency -exchange: true -api_url: https://marketcap.backend.currency.com/api/v1/ - -rate_limit: null - -requests: - currency_pairs: - request: - template: ticker - pair_template: null - params: null - - response: - type: dict - values: - currency_pair: - type: dict - values: - base_currency: - type: str - quote_currency: - type: str - mapping: - - key: currency_pair_first - path: - - dict_values - - base_currency - type: - - str - - key: currency_pair_second - path: - - dict_values - - quote_currency - type: - - str - - tickers: - request: - template: ticker - pair_template: null - params: null - - response: - type: dict - values: - currency_pair: - type: dict - values: - base_currency: - type: str - quote_currency: - type: str - last_price: - type: float - base_volume: - type: float - lowest_ask_price: - type: float - highest_bid_price: - type: float - mapping: - - key: currency_pair_first - path: - - dict_values - - base_currency - type: - - str - - key: currency_pair_second - path: - - dict_values - - quote_currency - type: - - str - - key: time - path: [] - type: - - none - - now - - key: last_price - path: - - dict_values - - last_price - type: - - float - - key: best_bid - path: - - dict_values - - highest_bid - type: - - float - - key: best_ask - path: - - dict_values - - lowest_ask - type: - - float - - key: daily_volume - path: - - dict_values - - base_volume - type: - - float - - order_books: - request: - template: orderbook - pair_template: - template: "{first}/{second}" - lower_case: false - alias: symbol - params: - depth: - default: 50 - - response: - type: dict - values: - timestamp: - type: int - asks: - type: list - values: - type: list - values: - 0: # price - type: float - 1: # qty - type: float - bids: - type: list - values: - type: list - values: - 0: # price - type: float - 1: # qty - type: float - - mapping: - - key: id - path: - - timestamp - type: - - int - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 1 - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - bids - - 0 - type: - - float - - key: bids_amount - path: - - bids - - 1 - type: - - float - - key: asks_price - path: - - asks - - 0 - type: - - float - - key: asks_amount - path: - - asks - - 1 - type: - - float - - historic_rates: - request: - template: candles - pair_template: - template: "{first}/{second}" - lower_case: false - alias: symbol - params: - interval: - allowed: - minutes: M1 - hours: H1 - days: D1 - weeks: W1 - default: D1 - limit: - default: 1000 - endTime: - function: last_timestamp - type: - - datetime - - timestampms - startTime: - function: last_timestamp - type: - - datetime - - timedeltams - - interval - - 1000 - - response: - type: list - values: - type: list - values: - 0: - type: int - 1: - type: str - 2: - type: str - 3: - type: str - 4: - type: str - mapping: - - key: time - path: - - [] - - 0 - type: - - float - - from_timestamp - - 1 - - key: open - path: - - [] - - 1 - type: - - str - - float - - key: high - path: - - [] - - 2 - type: - - str - - float - - key: low - path: - - [] - - 3 - type: - - str - - float - - key: close - path: - - [] - - 4 - type: - - str - - float - - trades: - request: - template: trades - pair_template: - template: "{first}/{second}" - lower_case: false - alias: symbol - params: null - - response: - type: list - values: - type: dict - values: - tradeID: - type: int - price: - type: float - base_volume: - type: float - quote_volume: - type: float - trade_timestamp: - type: float - type: - type: str - - mapping: - - key: id - path: - - tradeID - type: - - int - - key: time - path: - - trade_timestamp - type: - - float - - from_timestamp - - 0 - - key: direction - path: - - type - type: - - str - - key: price - path: - - price - type: - - float - - key: amount - path: - - base_volume - type: - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/dex-trade.yaml b/pandas_datareader/crypto/resources/running_exchanges/dex-trade.yaml deleted file mode 100644 index a28b224d..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/dex-trade.yaml +++ /dev/null @@ -1,310 +0,0 @@ -name: dex-trade -exchange: true - -rate_limit: null - -api_url: "" - -requests: - currency_pairs: - request: - template: https://api.dex-trade.com/v1/public/symbols - pair_template: null - params: null - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - base: - type: str - quote: - type: str - id: - type: int - - mapping: - - key: currency_pair_first - path: - - data - - base - type: - - str - - key: currency_pair_second - path: - - data - - quote - type: - - str - - tickers: - request: - template: https://api.dex-trade.com/v1/public/ticker - pair_template: - template: "{first}{second}" - lower_case: false - alias: pair - params: null - response: - type: dict - values: - data: - type: dict - values: - last: - type: str - volume_24H: - type: str - - mapping: - - key: last_price - path: - - data - - last - type: - - str - - float - - key: time - path: [] - type: - - none - - now - - key: daily_volume - path: - - data - - volume_24H - type: - - str - - float - - historic_rates: - request: - template: https://socket.dex-trade.com/graph/hist - pair_template: - template: "{first}{second}" - lower_case: false - alias: t - params: - r: - allowed: - minutes: 1 - hours: 60 - days: D - weeks: W - default: D - end: - function: last_timestamp - type: - - datetime - - timestamp - limit: - default: 1000 - - response: - type: list - values: - type: dict - values: - low: - type: float - high: - type: float - volume: - type: float - time: - type: float - open: - type: float - close: - type: float - - - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 0 - - key: open - path: - - open - type: - - int - - div - - 100000000 - - key: high - path: - - high - type: - - int - - div - - 100000000 - - key: low - path: - - low - type: - - int - - div - - 100000000 - - key: close - path: - - close - type: - - int - - div - - 100000000 - - key: volume - path: - - volume - type: - - int - - div - - 100000000 - - trades: - request: - template: https://api.dex-trade.com/v1/public/trades - pair_template: - template: "{first}{second}" - lower_case: false - alias: pair - params: null - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - volume: - type: float - rate: - type: float - price: - type: float - timestamp: - type: int - type: - type: str - - mapping: - - key: time - path: - - data - - timestamp - type: - - float - - from_timestamp - - 0 - - key: id - path: - - data - - timestamp - type: - - int - - key: direction - path: - - data - - type - type: - - str - - key: price - path: - - data - - rate - type: - - float - - key: amount - path: - - data - - volume - type: - - float - - order_books: - request: - template: https://api.dex-trade.com/v1/public/book - pair_template: - template: "{first}{second}" - lower_case: false - alias: pair - params: null - - response: - type: dict - values: - buy: - type: list - values: - type: dict - values: - volume: - type: float - count: - type: float - rate: - type: float - sell: - type: list - values: - type: dict - values: - volume: - type: float - count: - type: float - rate: - type: float - - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - data - - buy - - volume - type: - - float - - key: bids_price - path: - - data - - buy - - rate - type: - - flot - - key: asks_amount - path: - - data - - sell - - volume - type: - - float - - key: asks_price - path: - - data - - sell - - rate - type: - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/digifinex.yaml b/pandas_datareader/crypto/resources/running_exchanges/digifinex.yaml deleted file mode 100644 index 1f80bf12..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/digifinex.yaml +++ /dev/null @@ -1,291 +0,0 @@ -name: digifinex -exchange: true -api_doc: https://docs.digifinex.com/en-ww/v3/#market-data -rate_limit: null -api_url: https://openapi.digifinex.vip/v3/ - -requests: - currency_pairs: - request: - template: markets - pair_template: null - params: null - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - volume_precision: - type: int - price_precision: - type: int - market: - type: str - min_amount: - type: int - min_volume: - type: float - mapping: - - key: currency_pair_first - path: - - data - - market - type: - - str - - splitupper - - "_" - - 0 - - key: currency_pair_second - path: - - data - - market - type: - - str - - splitupper - - "_" - - 1 - - tickers: - request: - template: ticker - pair_template: null - params: null - response: - type: dict - values: - ticker: - type: list - values: - type: dict - values: - vol: - type: float - change: - type: float - base_vol: - type: float - sell: - type: float - last: - type: float - symbol: - type: str - low: - type: float - buy: - type: float - high: - type: float - date: - type: int - code: - type: bool - - mapping: - - key: time - path: [] - type: - - none - - now - - key: currency_pair_first - path: - - ticker - - symbol - type: - - str - - splitupper - - "_" - - 0 - - key: currency_pair_second - path: - - ticker - - symbol - type: - - str - - splitupper - - "_" - - 1 - - key: last_price - path: - - ticker - - last - type: - - float - - key: best_bid - path: - - ticker - - buy - type: - - float - - key: best_ask - path: - - ticker - - sell - type: - - float - - key: daily_volume - path: - - ticker - - vol - type: - - float - - historic_rates: - request: - template: kline - pair_template: - template: "{first}_{second}" - lower_case: true - alias: symbol - params: - period: - allowed: - minutes: 1 - hours: 60 - days: 1D - weeks: 1W - default: 1D - start_time: - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 1000 - end_time: - function: last_timestamp - type: - - datetime - - timestamp - - response: - type: dict - values: - code: - type: dict - data: - type: list - values: - type: list - values: - 0: # timestamp - type: int - 1: # volume - type: float - 2: # close - type: float - 3: # high - type: float - 4: # low - type: float - 5: # open - type: float - mapping: - - key: time - path: - - data - - [] - - 0 - type: - - float - - from_timestamp - - 0 - - key: volume - path: - - data - - [] - - 1 - type: - - float - - key: close - path: - - data - - [] - - 2 - type: - - float - - key: high - path: - - data - - [] - - 3 - type: - - float - - key: low - path: - - data - - [] - - 4 - type: - - float - - key: open - path: - - data - - [] - - 4 - type: - - float - -# trades: -# request: -# template: trades -# pair_template: -# template: "{first}_{second}" -# lower_case: true -# alias: symbol -# params: -# limit: #between 100-500 -# type: int -# default: 100 -# response: -# type: dict -# values: -# data: -# type: list -# values: -# type: dict -# values: -# date: -# type: int -# id: -# type: int -# amount: -# type: float -# type: -# type: str -# price: -# type: float -# mapping: -# - key: trade_time -# path: -# - data -# - date -# type: -# - int -# - fromtimestamp -# - key: trade_amount -# path: -# - data -# - amount -# type: -# - float -# - key: trade_last_price -# path: -# - data -# - price -# type: -# - int -# - key: trade_side -# path: -# - data -# - type -# type: -# - str -# -# order_book: -# request: -# response: -# mapping: \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/exmo.yaml b/pandas_datareader/crypto/resources/running_exchanges/exmo.yaml deleted file mode 100644 index f465d22d..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/exmo.yaml +++ /dev/null @@ -1,285 +0,0 @@ -name: exmo -exchange: true -api_url: https://api.exmo.com/v1.1/ -rate_limit: - max: 600 - unit: 60 - -requests: - currency_pairs: - request: - template: pair_settings - pair_template: - params: - response: - type: dict - values: - currency_pair: - type: dict - mapping: - - key: currency_pair_first - path: - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - dict_key - type: - - str - - split - - "_" - - 1 - - tickers: - request: - template: ticker - pair_template: null - params: null - response: - type: dict - values: - currency_pair: # variable key, each available currency pair - type: dict - values: - buy_price: # current maximum buy price - type: - - str - sell_price: # current minimum sell price - type: - - str - last_trade: # last deal price - type: - - str - high: # maximum deal price within the last 24 hours - type: - - str - low: # minimum deal price within the last 24 hours - type: - - str - avg: # average deal price within the last 24 hours - type: - - str - vol: # the volume of deals within the last 24 hours - type: - - str - vol_curr: # the total value of all deals within the last 24 hours - type: - - str - updated: # date and time of data update - type: - - int - mapping: - - key: time - path: - - dict_values - - updated - type: - - float - - from_timestamp - - 0 - - key: currency_pair_first - path: - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - dict_key - type: - - str - - split - - "_" - - 1 - - key: best_bid - path: - - dict_values - - buy_price - type: - - str - - float - - key: best_ask - path: - - dict_values - - sell_price - type: - - str - - float - - key: last_price - path: - - dict_values - - last_trade - type: - - str - - float - - key: daily_volume - path: - - dict_values - - vol - type: - - str - - float - - trades: - request: - template: trades - pair_template: - template: "{first}_{second}" - lower_case: false - alias: pair - params: - response: - type: dict - values: - currency_pair: # variable key, each available currency pair - type: dict - values: - trade_id: # current maximum buy price - type: - - int - date: # current minimum sell price - type: - - int - type: # last deal price - type: - - str - quantity: # maximum deal price within the last 24 hours - type: - - str - price: # minimum deal price within the last 24 hours - type: - - str - amout: # average deal price within the last 24 hours - type: - - str - mapping: - - key: id - path: - - dict_values - - trade_id - type: - - int - - key: time - path: - - dict_values - - date - type: - - float - - from_timestamp - - 0 - - key: direction - path: - - dict_values - - type - type: - - str - - key: price - path: - - dict_values - - price - type: - - str - - float - - key: amount - path: - - dict_values - - quantity - type: - - str - - float - - order_books: - request: - template: order_book - pair_template: - template: "{first}_{second}" - lower_case: false - alias: pair - params: - limit: - type: int - default: 100 #max: 1000 - - response: - type: dict - values: - currency_pair: - type: dict - values: - ask: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - 2: - type: str - bid: - type: list - values: - type: list - values: - 0: #Price - type: str - 1: #Quantity - type: str - 2: #Amount (-> Price*Quantity) - type: str - - mapping: - - key: id - path: [] - type: - - none - - now_timestamp - - key: time - path: [] - type: - - none - - now - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - dict_values - - bid - - 0 - type: - - str - - float - - key: bids_amount - path: - - dict_values - - bid - - 1 - type: - - str - - float - - key: asks_price - path: - - dict_values - - ask - - 0 - type: - - str - - float - - key: asks_amount - path: - - dict_values - - ask - - 1 - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/exrates.yaml b/pandas_datareader/crypto/resources/running_exchanges/exrates.yaml deleted file mode 100644 index af1c2475..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/exrates.yaml +++ /dev/null @@ -1,318 +0,0 @@ -name: exrates -exchange: true -api_url: '' -api_docs: https://docs.exrates.me/ -rate_limit: - max: 10 - unit: 60 - -requests: - currency_pairs: - request: - template: https://api.exrates.me/v1/public/symbols - pair_template: null - params: null - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - id: - type: int - base: - type: str - quote: - type: str - mapping: - - key: currency_pair_first - path: - - data - - base - type: - - str - - key: currency_pair_second - path: - - data - - quote - type: - - str - - tickers: - request: - template: https://api.exrates.me/v1/public/ticker - pair_template: - template: "{first}{second}" - lower_case: false - alias: pair - params: null - response: - type: dict - values: - status: - type: boolean - data: - type: dict - values: - id: - type: int - pair: - type: str - last: - type: str - open: - type: str - close: - type: str - high: - type: str - low: - type: str - volume_24H: - type: str - mapping: - - key: time - path: [] - type: - - none - - now - - key: price - path: - - data - - last - type: - - str - - float - - key: daily_volume - path: - - data - - volume_24H - type: - - str - - float - - trades: - request: - template: https://api.exrates.me/v1/public/trades - pair_template: - template: "{first}{second}" - lower_case: false - alias: pair - params: null - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - volume: - type: float - rate: - type: float - price: - type: float - timestamp: - type: int - type: - type: str - - mapping: - - key: id - path: - - data - - timestamp - type: - - int - - key: time - path: - - data - - timestamp - type: - - float - - from_timestamp - - 0 - - key: direction - path: - - data - - type - type: - - str - - key: price - path: - - data - - rate - type: - - float - - key: amount - path: - - data - - volume - type: - - float - - order_books: - request: - template: https://api.exrates.me/v1/public/book - pair_template: - template: "{first}{second}" - lower_case: false - alias: pair - params: null - - response: - type: dict - values: - data: - type: dict - values: - buy: - type: list - values: - type: dict - values: - volume: - type: float - count: - type: int - rate: - type: float - sell: - type: list - values: - type: dict - values: - volume: - type: float - count: - type: int - rate: - type: float - mapping: - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - data - - buy - - rate - type: - - float - - key: bids_amount - path: - - data - - buy - - volume - type: - - float - - key: asks_price - path: - - data - - sell - - rate - type: - - float - - key: asks_amount - path: - - data - - sell - - volume - type: - - float - - historic_rates: - request: - template: https://socket.exrates.me/graph/hist - pair_template: - template: "{first}{second}" - lower_case: false - alias: t - params: - end: - function: last_timestamp - type: - - datetime - - timestamp - r: - allowed: - minutes: 1 - hours: 60 - days: D - weeks: W - default: D - limit: - type: int - default: 500 - - response: - type: list - values: - type: dict - values: - low: - type: int - high: - type: int - volume: - type: int - time: - type: int - close: - type: int - open: - type: int - mapping: - - key: open - path: - - open - type: - - int - - div - - 100000000 - - key: high - path: - - high - type: - - int - - div - - 100000000 - - key: low - path: - - low - type: - - int - - div - - 100000000 - - key: close - path: - - close - type: - - int - - div - - 100000000 - - key: volume - path: - - volume - type: - - int - - div - - 100000000 - - key: time - path: - - time - type: - - float - - from_timestamp - - 0 diff --git a/pandas_datareader/crypto/resources/running_exchanges/exx.yaml b/pandas_datareader/crypto/resources/running_exchanges/exx.yaml deleted file mode 100644 index f04a9777..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/exx.yaml +++ /dev/null @@ -1,360 +0,0 @@ -name: exx -exchange: true -api_docs: https://www.exx.com/help/restApi -api_url: https://api.exx.com/data/v1/ -rate_limit: null -requests: - currency_pairs: - request: - template: markets - pair_template: null - params: null - response: - type: dict - values: - currency_pair: # e.g. ltc_cnyt, variable key, each available currency pair - type: dict - values: - amountScale: - type: int - minAmount: - type: - - str - - float - isOpen: - type: boolean - maxLevels: - type: int - priceScale: - type: int - mapping: - - key: currency_pair_first - path: # key not values! - - dict_key - type: - - str - - splitupper - - "_" - - 0 - - key: currency_pair_second - path: # key not values! - - dict_key - type: - - str - - splitupper - - "_" - - 1 - - tickers: - request: - template: tickers - pair_template: null - params: null - response: - type: dict - values: - currency_pairs: # e.g. bts_btc, variable key, each available currency pair - type: dict - values: - high: - type: str - vol: - type: str - monthRiseRate: - type: float - last: - type: str - low: - type: str - buy: - type: str - sell: - type: str - weekRiseRate: - type: float - riseRate: - type: float - mapping: - - key: time - path: [] - type: - - none - - now - - key: currency_pair_first - path: - - dict_key - type: - - str - - splitupper - - "_" - - 0 - - key: currency_pair_second - path: - - dict_key - type: - - str - - splitupper - - "_" - - 1 - - key: daily_volume - path: - - dict_values - - vol - type: - - str - - float - - key: last_price - path: - - dict_values - - last - type: - - str - - float - - key: best_ask - path: - - dict_values - - sell - type: - - str - - float - - key: best_bid - path: - - dict_values - - buy - type: - - str - - float - - order_books: - request: - template: depth - pair_template: # e.g. ltc_cnyt - template: "{first}_{second}" - lower_case: true - alias: currency - params: null - response: - type: dict - values: - asks: - type: list - values: - type: list - values: - 0: # price - type: - - str - 1: # size - type: - - str - bids: - type: list - values: - type: list - values: - 0: # price - type: - - str - 1: # size - type: - - str - timestamp: - type: - - int - mapping: - - key: id - path: - - timestamp - type: - - int - - key: position - path: [] - type: - - none - - range - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 0 - - trades: - request: - template: trades - pair_template: # e.g. ltc_cnyt - template: "{first}_{second}" - lower_case: true - alias: currency - params: null - response: - type: list - values: - type: dict - values: - date: - type: - - float - - from_timestamp - - 0 - amount: - type: float - price: - type: float - trade_type: - type: str - type: - type: str - tid: - type: int - mapping: - - key: time - path: - - date - type: - - float - - from_timestamp - - 0 - - key: id - path: - - tid - type: - - int - - key: amount - path: - - amount - type: - - float - - key: price - path: - - price - type: - - float - - key: direction - path: - - type - type: - - str - - historic_rates: - request: - template: klines - pair_template: # e.g. ltc_cnyt - template: "{first}_{second}" - lower_case: true - alias: market - params: - type: - allowed: - minutes: 1min - hours: 1hour - days: 1day - default: 1day - size: - type: int - required: false - default: 10000 - assist: - type: str #usd, cny - default: none - response: - type: dict - values: - datas: - type: dict - values: - symbol: - type: str - data: - type: list - values: - type: list - values: - 0: # timestamp - type: - - int - 1: # open - type: float - 2: # high - type: float - 3: # low - type: float - 4: # close - type: float - 5: # volume - type: float - - mapping: - - key: time - path: - - datas - - data - - 0 - type: - - float - - from_timestamp - - 1 - - key: open - path: - - datas - - data - - 1 - type: - - float - - key: high - path: - - datas - - data - - 2 - type: - - float - - key: low - path: - - datas - - data - - 3 - type: - - float - - key: close - path: - - datas - - data - - 4 - type: - - float - - key: volume - path: - - datas - - data - - 5 - type: - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/folgory.yaml b/pandas_datareader/crypto/resources/running_exchanges/folgory.yaml deleted file mode 100644 index 0624c0b9..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/folgory.yaml +++ /dev/null @@ -1,284 +0,0 @@ -name: folgory -exchange: true -api_url: https://folgory.com/ - -requests: - currency_pairs: - request: - template: api/v1 - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - cur: - type: str - symbol: - type: str - last: - type: str - high: - type: str - low: - type: str - volume: - type: str - vwap: - type: str - max_bid: - type: str - best_ask: - type: str - best_bid: - type: str - mapping: - - key: currency_pair_first - path: - - [] - - symbol - type: - - str - - split - - / - - 0 - - key: currency_pair_second - path: - - [] - - symbol - type: - - str - - split - - / - - 1 - - tickers: - request: - template: api/v1 - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - cur: - type: str - symbol: - type: str - last: - type: str - high: - type: str - low: - type: str - volume: - type: str - vwap: - type: str - max_bid: - type: str - best_ask: - type: str - best_bid: - type: str - mapping: - - key: currency_pair_first - path: - - [] - - symbol - type: - - str - - split - - / - - 0 - - key: currency_pair_second - path: - - [] - - symbol - type: - - str - - split - - / - - 1 - - key: last_price - path: - - [] - - last - type: - - str - - float - - key: best_bid - path: - - [] - - max_bid - type: - - str - - float - - key: best_ask - path: - - [] - - best_ask - type: - - str - - float - - key: daily_volume - path: - - [] - - volume - type: - - str - - float - - trades: - request: - template: market/trade - pair_template: - template: "{first}_{second}" - lower_case: false - alias: symbol - params: - limit: - type: int - max: 500 - default: 500 - - response: - type: list - values: - type: dict - values: - id: - type: str - amount: - type: str - qty: - type: str - time: - type: str - Type: - type: str - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 0 - - key: id - path: - - id - type: - - str - - int - - key: direction - path: - - Type - type: - - str - - key: price - path: - - amount - type: - - str - - float - - key: amount - path: - - qty - type: - - str - - float - - order_books: - request: - template: market/order_book - pair_template: - template: "{first}_{second}" - lower_case: false - alias: symbol - params: - limit: - type: int - max: 50 - default: 50 - response: - type: dict - values: - data: - type: dict - values: - timestamp: - type: int - asks: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - bids: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - - mapping: - - key: time - path: - - data - - timestamp - type: - - float - - from_timestamp - - 0 - - key: id - path: - - data - - timestamp - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - data - - bids - - 1 - type: - - str - - float - - key: bids_amount - path: - - data - - bids - - 0 - type: - - str - - float - - key: asks_price - path: - - data - - asks - - 1 - type: - - str - - float - - key: asks_amount - path: - - data - - asks - - 0 - type: - - str - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/ftx.yaml b/pandas_datareader/crypto/resources/running_exchanges/ftx.yaml deleted file mode 100644 index dd98c2aa..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/ftx.yaml +++ /dev/null @@ -1,384 +0,0 @@ -name: ftx -is_exchange: true -api_docs: https://docs.ftx.com/#rest-api -api_url: https://ftx.com/api/ -# -rate_limit: - max: 1800 - unit: 60 - -requests: - currency_pairs: - request: - template: markets - pair_template: null - params: null - - response: - type: dict - values: - success: - type: boolean - result: - type: list - values: - type: dict - values: - name: - type: str - baseCurrency: - type: str - quoteCurrency: - type: str - type: - type: str - underlying: - type: str - enabled: - type: boolean - ask: - type: float - bid: - type: float - last: - type: float - postOnly: - type: boolean - priceIncrement: - type: float - sizeIncrement: - type: float - restricted: - type: boolean - - mapping: - - key: currency_pair_first - path: - - result - - baseCurrency - type: - - str - - key: currency_pair_second - path: - - result - - quoteCurrency - type: - - str - - tickers: - request: - template: markets - pair_template: null - params: null - - response: - type: dict - values: - success: - type: boolean - result: - type: list - values: - type: dict - values: - name: - type: str - baseCurrency: - type: str - quoteCurrency: - type: str - type: - type: str - underlying: - type: str - enabled: - type: boolean - ask: - type: float - bid: - type: float - last: - type: float - postOnly: - type: boolean - priceIncrement: - type: float - sizeIncrement: - type: float - restricted: - type: boolean - - mapping: - - key: currency_pair_first - path: - - result - - baseCurrency - type: - - str - - key: currency_pair_second - path: - - result - - quoteCurrency - type: - - str - - key: time - path: [] - type: - - none - - now - - key: last - path: - - result - - last - type: - - float - - key: best_ask - path: - - result - - ask - type: - - float - - key: best_bid - path: - - result - - bid - type: - - float - - historic_rates: - request: - template: markets/{currency_pair}/candles - pair_template: - template: "{first}_{second}" - alias: null - lower_case: false - params: - resolution: - allowed: - seconds: 15 - minutes: 60 - hours: 3600 - days: 86400 - default: 86400 #daily - limit: - type: int - default: 5000 - end_time: - function: last_timestamp - type: - - datetime - - timestamp - - response: - type: dict - values: - success: - type: boolean - result: - type: list - values: - type: dict - values: - close: - type: float - high: - type: float - low: - type: float - open: - type: float - startTime: - type: str - time: - type: int - volume: - type: float - mapping: - - key: time - path: - - result - - time - type: - - float - - from_timestamp - - 1 - - key: open - path: - - result - - open - type: - - float - - key: high - path: - - result - - high - type: - - float - - key: low - path: - - result - - low - type: - - float - - key: close - path: - - result - - close - type: - - float - - key: volume - path: - - result - - volume - type: - - float - - trades: - request: - template: markets/{currency_pair}/trades - pair_template: - template: "{first}_{second}" - alias: null - lower_case: false - params: - limit: - type: int - default: 100 - - response: - type: dict - values: - success: - type: boolean - result: - type: list - values: - type: dict - values: - id: - type: int - liquidation: - type: boolean - price: - type: float - side: - type: str - size: - type: float - time: - type: str - mapping: - - key: time - path: - - result - - time - type: - - str - - strptime - - "%Y-%m-%dT%H:%M:%S.%f+00:00" - - key: id - path: - - result - - id - type: - - int - - key: direction - path: - - result - - side - type: - - str - - key: price - path: - - result - - price - type: - - float - - key: amount - path: - - result - - size - type: - - float - - order_books: - request: - template: markets/{currency_pair}/orderbook - pair_template: - template: "{first}_{second}" - alias: null - lower_case: false - params: - depth: - type: int - default: 200 - - response: - type: dict - values: - success: - type: bool - result: - type: dict - values: - asks: - type: list - values: - type: list - 0: - type: float - 1: - type: float - bids: - type: list - values: - type: list - 0: - type: float - 1: - type: float - - mapping: - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: time - path: [] - type: - - none - - now - - key: bids_price - path: - - result - - bids - - 0 - type: - - float - - key: bids_amount - path: - - result - - bids - - 1 - type: - - float - - key: asks_price - path: - - result - - asks - - 0 - type: - - float - - key: asks_amount - path: - - result - - asks - - 1 - type: - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/gateio.yaml b/pandas_datareader/crypto/resources/running_exchanges/gateio.yaml deleted file mode 100644 index 01312051..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/gateio.yaml +++ /dev/null @@ -1,361 +0,0 @@ -name: gateio -exchange: true -api_url: https://api.gateio.ws/api/v4/spot/ -rate_limit: null -requests: - currency_pairs: - request: - template: currency_pairs - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - id: - type: str - base: - type: str - quote: - type: str - fee: - type: str - min_base_amount: - type: str - min_quote_amount: - type: str - amount_precision: - type: str - precision: - type: int - trade_status: - type: str - mapping: - - key: currency_pair_first - path: - - base - type: - - str - - key: currency_pair_second - path: - - quote - type: - - str - - tickers: - request: - template: tickers - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - currency_pair: - type: str - last: - type: str - lowest_ask: - type: str - highest_bid: - type: str - change_percentage: - type: str - base_volume: - type: str - quote_volume: - type: str - high_24h: - type: str - low_24h: - type: str - mapping: - - key: currency_pair_first - path: - - currency_pair - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - currency_pair - type: - - str - - split - - "_" - - 1 - - key: time - path: [] - type: - - none - - now - - key: last_price - path: - - last - type: - - str - - float - - key: best_bid - path: - - highest_bid - type: - - str - - float - - key: best_ask - path: - - lowest_ask - type: - - str - - float - - key: daily_volume - path: - - quote_volume - type: - - str - - float -# - order_books: - request: - template: order_book - pair_template: - template: "{first}_{second}" - alias: currency_pair - lower_case: true - params: - interval: - type: int - default: 0 - limit: - type: int - default: 30 - - response: - type: dict - values: - asks: - type: list - values: - type: list - values: - 0: # price - type: - - str - 1: # size - type: - - str - bids: - type: list - values: - type: list - values: - 0: - type: - - str - 1: - type: - - str - mapping: - - key: time - path: [] - type: - - none - - now - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - trades: - request: - template: trades - pair_template: - template: "{first}_{second}" - alias: currency_pair - lower_case: true - params: - limit: - type: int - default: 200 - last_id: - type: int - required: false - response: - type: list - values: - type: dict - values: - id: - type: str - create_time: - type: str - side: - type: str - role: - type: str - amount: - type: str - price: - type: str - order_id: - type: str - fee: - type: str - fee_currency: - type: str - point_fee: - type: str - gt_fee: - type: str - - mapping: - - key: time - path: - - create_time - type: - - str - - float - - from_timestamp - - 0 - - key: amount - path: - - amount - type: - - str - - float - - key: direction - path: - - side - type: - - str - - key: price - path: - - price - type: - - str - - float - - key: id - path: - - id - type: - - str - - int - - - historic_rates: - request: - template: candlesticks - pair_template: - template: "{first}_{second}" - alias: currency_pair - lower_case: true - params: - limit: - type: int - default: 1000 - interval: - allowed: - minutes: 1m - hours: 1h - days: 1d - weeks: 1w - default: 1d - to: - function: last_timestamp - type: - - datetime - - timestamp - response: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - 2: - type: str - 3: - type: str - 4: - type: str - 5: - type: str - 6: - type: str - mapping: - - key: time - path: - - 0 - type: - - str - - float - - from_timestamp - - 0 - - key: volume - path: - - 1 - type: - - str - - float - - key: close - path: - - 2 - type: - - str - - float - - key: high - path: - - 3 - type: - - str - - float - - key: low - path: - - 4 - type: - - str - - float - - key: open - path: - - 5 - type: - - str \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/gemini.yaml b/pandas_datareader/crypto/resources/running_exchanges/gemini.yaml deleted file mode 100644 index 6cecc2f6..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/gemini.yaml +++ /dev/null @@ -1,320 +0,0 @@ -# The extraction of the currency_pairs relies on the fact, that every quote_currency is only 3 digits long. -# However this may change in future. - -name: gemini -exchange: true -api_docs: https://docs.gemini.com/rest-api/ -api_url: https://api.gemini.com/ -rate_limit: # For public API entry points, we limit requests to 120 requests per minute, and recommend that you do not exceed 1 request per second. - max: 120 # recommended: 60 - unit: 60 - -requests: - currency_pairs: - request: - template: v1/symbols - pair_template: null - params: null - response: - type: list - values: # each available currency pair, i.e. "btcusd" - type: str - mapping: # TODO split Methode - - key: currency_pair_first - path: - - [] - type: - - str - - slice - - 0 - - -3 - - key: currency_pair_second - path: - - [] - type: - - str - - slice - - -3 - - - - tickers: - request: - template: v1/pricefeed - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - pair: - type: str - price: - type: str - percentageChange24h: - type: str - - mapping: - - key: currency_pair_first - path: - - pair - type: - - str - - slice - - 0 - - -3 - - key: currency_pair_second - path: - - pair - type: - - str - - slice - - -3 - - - - key: last_price - path: - - price - type: - - str - - float - - key: time - path: [] - type: - - none - - now - - order_books: - request: - template: v1/book/{currency_pair} - pair_template: # e.g. btcusd - template: "{first}{second}" - lower_case: true - params: - limit_bids: # Optional. Limit the number of bids (offers to buy) returned. Default is 50. May be 0 to return the full order book on this side. - type: int - default: 50 - limit_asks: # Optional. Limit the number of asks (offers to sell) returned. Default is 50. May be 0 to return the full order book on this side. - type: int - default: 50 - response: - type: dict - values: - bids: # The bids currently on the book. These are offers to buy at a given price - type: list - values: - type: dict - values: - amount: # The total quantity remaining at the price - type: - - str - price: # The price - type: - - str - timestamp: # DO NOT USE - this field is included for compatibility reasons only and is just populated with a dummy value. - type: - - str - asks: # The asks currently on the book. These are offers to sell at a given price - type: list - values: - type: dict - values: - amount: # The total quantity remaining at the price - type: - - str - price: # The price - type: - - str - timestamp: # DO NOT USE - this field is included for compatibility reasons only and is just populated with a dummy value. - type: - - str - mapping: - - key: time - path: - - bids - - timestamp - type: - - str - - float - - from_timestamp - - 0 - - key: id - path: - - bids - - timestamp - type: - - str - - int - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bids - - amount - type: - - str - - float - - key: bids_price - path: - - bids - - price - type: - - str - - float - - key: asks_amount - path: - - asks - - amount - type: - - str - - float - - key: asks_price - path: - - asks - - price - type: - - str - - float - - trades: # This public API endpoint is limited to retrieving seven calendar days of data. - request: - template: v1/trades/{currency_pair} - pair_template: # e.g. btcusd - template: "{first}{second}" - lower_case: true - params: - since: # Optional. Only return trades after this timestamp. If not present, will show the most recent trades. - required: false - limit_trades: # Optional. The maximum number of trades to return. The default is 50. - type: int - default: 50 - include_breaks: # Optional. Whether to display broken trades. False by default. Can be '1' or 'true' to activate - type: bool - required: false - response: - type: list - values: - type: dict - values: - timestamp: # The time that the trade was executed - type: - - int - timestampms: # The time that the trade was executed in milliseconds - type: - - int - tid: # The trade ID number - type: - - int - price: # The price the trade was executed at - type: - - str - amount: # The amount that was traded - type: - - str - exchange: # Will always be "gemini" - type: str - type: - type: str - allowed: - - buy # buy means that an ask was removed from the book by an incoming buy order - - sell # sell means that a bid was removed from the book by an incoming sell order - - auction # auction indicates a bulk trade from an auction - - block # block indicates a block trade - broken: - type: bool # Whether the trade was broken or not. Broken trades will not be displayed by default; use the include_breaks to display them. - mapping: - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 0 - - key: id - path: - - tid - type: - - int - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - amount - type: - - str - - float - - key: direction - path: - - type - type: - - str - - historic_rates: - request: - template: v2/candles/{currency_pair}/{frequency} - pair_template: - template: "{first}{second}" - lower_case: true - params: - frequency: - allowed: - minutes: 1m - hours: 1hr - days: 1day - default: 1day - response: - type: list - values: - type: list - values: - 0: # timestamp - type: int - 1: # open - type: float - 2: # high - type: float - 3: # low - type: float - 4: # close - type: float - 5: # volume - type: float - mapping: - - key: time - path: - - 0 - type: - - float - - from_timestamp - - 1 - - key: open - path: - - 1 - type: - - float - - key: high - path: - - 2 - type: - - float - - key: low - path: - - 3 - type: - - float - - key: close - path: - - 4 - type: - - float - - key: volume - path: - - 5 - type: - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/gopax.yaml b/pandas_datareader/crypto/resources/running_exchanges/gopax.yaml deleted file mode 100644 index 1d628caf..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/gopax.yaml +++ /dev/null @@ -1,301 +0,0 @@ -name: gopax -exchange: true - -rate_limit: - max: 1200 - unit: 60 - -api_url: https://api.gopax.co.kr - -requests: - currency_pairs: - request: - template: /trading-pairs - pair_template: null - params: null - - response: - type: list - values: - type: dict - values: - baseAsset: - type: str - quoteAsset: - type: str - - mapping: - - key: currency_pair_first - path: - - baseAsset - type: - - str - - key: currency_pair_second - path: - - quoteAsset - type: - - str - - tickers: - request: - template: /trading-pairs/{currency_pair}/ticker - pair_template: - template: "{first}-{second}" - lower_case: false - params: null - response: - type: dict - values: - price: - type: float - ask: - type: float - bid: - type: float - volume: - type: float - time: - type: str - - mapping: - - key: last_price - path: - - price - type: - - float - - key: time - path: - - time - type: - - str - - dateparser - - key: best_bid - path: - - bid - type: - - float - - key: best_ask - path: - - ask - type: - - float - - key: daily_volume - path: - - volume - type: - - float - - historic_rates: - request: - template: /trading-pairs/{currency_pair}/candles - pair_template: - template: "{first}-{second}" - lower_case: false - params: - interval: - allowed: - minutes: 1 - hours: 60 - days: 1440 - default: 1440 # e.g. 1 day - start: - default: 0 # better as intervals up to 5000 can lead to zero new prices and the program exits. -# function: last_timestamp -# type: -# - datetime -# - timedeltams -# - interval -# - 5000 - end: - function: last_timestamp - type: - - datetime - - timestampms - - response: - type: list - values: - type: list - values: - 0: #time - type: int - 1: #open - type: float - 2: #high - type: float - 3: #low - type: float - 4: #close - type: float - 5: #volume - type: float - - mapping: - - key: time - path: - - [] - - 0 - type: - - float - - from_timestamp - - 1 - - key: open - path: - - [] - - 1 - type: - - float - - key: high - path: - - [] - - 2 - type: - - float - - key: low - path: - - [] - - 3 - type: - - float - - key: close - path: - - [] - - 4 - type: - - float - - key: volume - path: - - [] - - 5 - type: - - float - - - trades: - request: - template: /trading-pairs/{currency_pair}/trades - pair_template: - template: "{first}-{second}" - lower_case: false - params: null - - response: - type: list - values: - type: dict - values: - date: - type: int - id: - type: int - price: - type: float - amount: - type: float - side: - type: str - - mapping: - - key: time - path: - - date - type: - - float - - from_timestamp - - 0 - - key: id - path: - - id - type: - - int - - key: direction - path: - - side - type: - - str - - key: price - path: - - price - type: - - float - - key: amount - path: - - amount - type: - - float - - order_books: - request: - template: /trading-pairs/{currency_pair}/book - pair_template: - template: "{first}-{second}" - lower_case: false - params: - level: - type: int - default: 2 - - response: - type: dict - values: - sequence: - type: int - bid: - type: list - values: - type: list - values: - 1: #price - type: float - 2: #quantity - type: float - ask: - type: list - values: - type: list - values: - 1: #price - type: float - 2: #quantity - type: float - - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: - - sequence - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bid - - 2 - type: - - float - - key: bids_price - path: - - bid - - 1 - type: - - float - - key: asks_amount - path: - - ask - - 2 - type: - - float - - key: asks_price - path: - - ask - - 1 - type: - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/hbtc.yaml b/pandas_datareader/crypto/resources/running_exchanges/hbtc.yaml deleted file mode 100644 index 88ba65b5..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/hbtc.yaml +++ /dev/null @@ -1,305 +0,0 @@ -name: hbtc -is_exchange: true - -rate_limit: null -api_url: https://api.bhex.com/ - -requests: - currency_pairs: - request: - template: openapi/v1/pairs - pair_template: null - params: null - - response: - type: list - values: - type: dict - values: - symbol: - type: str - quoteToke: - type: str - baseToken: - type: str - mapping: - - key: currency_pair_first - path: - - baseToken - type: - - str - - key: currency_pair_second - path: - - quoteToken - type: - - str - - tickers: - request: - template: openapi/quote/v1/ticker/price - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: null - response: - type: dict - values: - price: - type: str - mapping: - - key: time - path: [] - type: - - none - - now - - key: last_price - path: - - price - type: - - str - - float - - - order_books: - request: - template: openapi/quote/v1/depth/merged - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - type: int - default: 40 - response: - type: dict - values: - time: - type: int - bids: - type: list - values: - type: list - values: - 0: #price - type: str - 1: #quantity - type: str - asks: - type: list - values: - type: list - values: - 0: #price - type: str - 1: #quantity - type: str - - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: id - path: - - time - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - trades: - request: - template: openapi/quote/v1/trades - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - type: int - max: 1000 - default: 500 - response: - type: list - values: - type: dict - values: - price: - type: str - time: - type: int - qty: - type: str - isBuyerMaker: - type: bool - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: id - path: - - time - type: - - int - - key: direction - path: - - isBuyerMaker - type: - - value - - map - - true - - sell - - false - - buy - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - qty - type: - - str - - float - - historic_rates: - request: - template: openapi/quote/v1/klines - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - startTime: - type: int - required: false - endTime: - function: last_timestamp - type: - - datetime - - timestampms - limit: - type: int - max: 1000 - default: 1000 - interval: - allowed: - minutes: 1m - hours: 1h - days: 1d - weeks: 1w - months: 1M - default: 1d - response: - type: list - values: - type: list - values: - 0: #open time - type: int - 1: # open - type: str - 2: #high - type: str - 3: #low - type: str - 4: #close - type: str - 5: #volume - type: str - 6: # close time - type: str - 7: # quote asset volume - type: str - 8: # numb. trades - type: str - 9: # taker buy base asset volume - type: str - 10: # taker buy quote asset volume - type: str - 11: - type: str - - mapping: - - key: time - path: - - 0 - type: - - float - - from_timestamp - - 1 - - key: open - path: - - 1 - type: - - str - - float - - key: high - path: - - 2 - type: - - str - - float - - key: low - path: - - 3 - type: - - str - - float - - key: close - path: - - 4 - type: - - str - - float - - key: volume - path: - - 5 - type: - - str - - float - - - diff --git a/pandas_datareader/crypto/resources/running_exchanges/hitbtc.yaml b/pandas_datareader/crypto/resources/running_exchanges/hitbtc.yaml deleted file mode 100644 index a6905592..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/hitbtc.yaml +++ /dev/null @@ -1,393 +0,0 @@ -name: hitbtc -exchange: true -api_docs: https://api.hitbtc.com/#market-data -api_url: https://api.hitbtc.com/api/2/ -rate_limit: - max: 100 - unit: 1 -requests: - currency_pairs: - request: - template: public/symbol/ - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - id: # Symbol identifier. In the future, the description will simply use the symbol, i.e. "ETHBTC" - type: str - baseCurrency: # i.e. "ETH" - type: str - quoteCurrency: # i.e. "BTC" - type: str - quantityIncrement: - type: - - str - - float - tickSize: - type: - - str - - float - takeLiquidityRate: # Default fee rate - type: - - str - - float - provideLiquidityRate: # Default fee rate for market making trades - type: - - str - - float - feeCurrency: # i.e. "BTC" - type: str - mapping: - - key: currency_pair_first - path: - - baseCurrency - type: - - str - - key: currency_pair_second - path: - - quoteCurrency - type: - - str - - tickers: - request: - template: public/ticker/{currency_pair} - pair_template: # i.e. ETHBTC - template: "{first}{second}" - lower_case: false - params: null - response: - type: list - values: - type: dict - values: - ask: # Best ask price - type: - - str - - float - bid: # Best bid price - type: - - str - - float - last: # Last trade price - type: - - str - - float - open: # Last trade price 24 hours ago - type: - - str - - float - low: # Lowest trade price within 24 hours - type: - - str - - float - high: # Highest trade price within 24 hours - type: - - str - - float - volume: # Total trading amount within 24 hours in base currency - type: - - str - - float - volumeQuote: # Total trading amount within 24 hours in quote currency - type: - - str - - float - timestamp: # Last update or refresh ticker timestamp - type: - - str - symbol: - type: str - mapping: - - key: best_ask - path: - - ask - type: - - str - - float - - key: best_bid - path: - - bid - type: - - str - - float - - key: last_price - path: - - last - type: - - str - - float - - key: daily_volume - path: - - volume - type: - - str - - float - - key: time - path: - - timestamp - type: - - str - - dateparser - - trades: - request: - template: public/trades/{currency_pair} - pair_template: # i.e. ETHBTC - template: "{first}{second}" - lower_case: false - params: - sort: - type: str - default: DESC - by: # Filtration definition. Accepted values: id, timestamp. Default timestamp - type: str - default: timestamp - required: false - from: # Number or Datetime - required: false - till: # Number or Datetime - required: false - limit: - type: int - required: false - offset: - type: int - required: false - response: - type: list - values: - type: dict - values: - id: - type: int - price: - type: - - str - - float - quantity: - type: - - str - - float - side: # Trade side "sell" or "buy" - type: str - timestamp: - type: - - str - mapping: - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - quantity - type: - - str - - float - - key: direction - path: - - side - type: - - str - - key: ime - path: - - timestamp - type: - - str - - dateparser - - key: id - path: - - id - type: - - int - - order_books: - request: - template: public/orderbook/{currency_pair} - pair_template: # i.e. ETHBTC - template: "{first}{second}" - lower_case: false - params: - limit: # Limit of orderbook levels. Set 0 to view full orderbook levels - type: int - default: 100 - response: - type: dict - values: - ask: - type: list - values: - type: dict - values: - price: # Price level - type: - - str - size: # Total volume of orders with the specified price - type: - - str - bid: - type: list - values: - type: dict - values: - price: # Price level - type: - - str - size: # Total volume of orders with the specified price - type: - - str - mapping: - - key: book_time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: asks_price - path: - - ask - - price - type: - - str - - float - - key: asks_amount - path: - - ask - - size - type: - - str - - float - - key: bids_price - path: - - bid - - price - type: - - str - - float - - key: bids_amount - path: - - bid - - size - type: - - str - - float - - historic_rates: - request: - template: public/candles/{currency_pair} - pair_template: # i.e. ETHBTC - template: "{first}{second}" - lower_case: false - params: - period: - type: str - allowed: - minutes: M1 -# hours: H1 - days: D1 - weeks: D7 - months: 1M - default: D1 - sort: - type: str - default: ASC - from: - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 1000 - - from_timestamp - - 0 - - "%Y-%m-%dT%H:%M:%S.%fZ" - till: - function: last_timestamp - type: - - datetime - - format - - "%Y-%m-%dT%H:%M:%S.%fZ" - limit: # Limit of candles, default 100. - type: int - default: 1000 - offset: - type: int - required: false - response: # Result contain candles only with non zero volume. (No trades - no candles) - type: list - values: - type: dict - values: - timestamp: - type: - - str - open: # Open price - type: - - str - close: # Close price - type: - - str - min: # Min price - type: - - str - max: # Max price - type: - - str - volume: # Volume in base currency - type: - - str - volumeQuote: # Volume in quote currency - type: - - str - mapping: - - key: time - path: - - timestamp - type: - - str - - dateparser - - key: open - path: - - open - type: - - str - - float - - key: close - path: - - close - type: - - str - - float - - key: low - path: - - min - type: - - str - - float - - key: high - path: - - max - type: - - str - - float - - key: volume - path: - - volume - type: - - str - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/hoo.yaml b/pandas_datareader/crypto/resources/running_exchanges/hoo.yaml deleted file mode 100644 index d9723730..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/hoo.yaml +++ /dev/null @@ -1,341 +0,0 @@ -name: hoo -exchange: true -api_docs: https://hoo.com/docs-en -rate_limit: - max: 300 - unit: 60 - -api_url: https://api.hoolgd.com/open/v1/ - -requests: - currency_pairs: - request: - template: tickers/market - pair_template: null - params: null - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - price: - type: str - symbol: - type: str - volume: - type: str - - mapping: - - key: currency_pair_first - path: - - data - - symbol - type: - - str - - split - - "-" - - 0 - - key: currency_pair_second - path: - - data - - symbol - type: - - str - - split - - "-" - - 1 - - tickers: - request: - template: tickers/market - pair_template: null - params: null - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - price: - type: str - symbol: - type: str - volume: - type: str - - mapping: - - key: currency_pair_first - path: - - data - - symbol - type: - - str - - split - - "-" - - 0 - - key: currency_pair_second - path: - - data - - symbol - type: - - str - - split - - "-" - - 1 - - key: time - path: [] - type: - - none - - now - - key: daily_volume - path: - - data - - volume - type: - - str - - float - - key: last_price - path: - - data - - price - type: - - str - - float - - historic_rates: - request: - template: kline/market - pair_template: - template: "{first}-{second}" - lower_case: false - alias: symbol - params: - type: - allowed: - minutes: 1Min - hours: 1Hour - days: 1Day - weeks: 1Week - default: 1Day - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - open: - type: str - high: - type: str - low: - type: str - close: - type: str - time: - type: int - volume: - type: str - mapping: - - key: time - path: - - data - - time - type: - - float - - from_timestamp - - 0 - - key: open - path: - - data - - open - type: - - str - - float - - key: high - path: - - data - - high - type: - - str - - float - - key: low - path: - - data - - low - type: - - str - - float - - key: close - path: - - data - - close - type: - - str - - float - - key: volume - path: - - data - - volume - type: - - str - - float - - trades: - request: - template: trade/market - pair_template: - template: "{first}-{second}" - lower_case: false - alias: symbol - params: null - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - amount: - type: str - price: - type: str - time: - type: int - side: - type: str - volume: - type: str - - mapping: - - key: time - path: - - data - - time - type: - - float - - from_timestamp - - 1 - - key: id - path: - - data - - time - type: - - int - - key: direction - path: - - data - - side - type: - - value - - map - - -1 - - buy - - 1 - - sell - - key: price - path: - - data - - price - type: - - str - - float - - key: amount - path: - - data - - volume - type: - - str - - float - - order_books: - request: - template: depth/market - pair_template: - template: "{first}-{second}" - lower_case: false - alias: symbol - params: null - - response: - type: dict - values: - data: - type: dict - values: - bids: - type: list - values: - type: dict - values: - price: - type: str - quantity: - type: str - asks: - type: list - values: - type: dict - values: - price: - type: str - quantity: - type: str - - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - data - - bids - - quantity - type: - - str - - float - - key: bids_price - path: - - data - - bids - - price - type: - - str - - float - - key: asks_amount - path: - - data - - asks - - quantity - type: - - str - - float - - key: asks_price - path: - - data - - asks - - price - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/huobi.yaml b/pandas_datareader/crypto/resources/running_exchanges/huobi.yaml deleted file mode 100644 index 274acc47..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/huobi.yaml +++ /dev/null @@ -1,423 +0,0 @@ -name: huobi -exchange: true -api_docs: https://huobiapi.github.io/docs/spot/v1/en/ -api_url: https://api.huobi.pro/ -rate_limit: - max: 100 - unit: 10 -requests: - currency_pairs: - request: - template: v1/common/symbols - pair_template: null - params: null - response: - type: dict - values: - status: - type: str - data: - type: list - values: - type: dict - values: - base-currency: - type: str - quote-currency: - type: str - price-precision: - type: int - amoint_precision: - type: int - symbol-partition: - type: str - symbol: - type: str - state: - type: str - value-precision: - type: int - min-order-amt: - type: float - max-oder-amt: - type: float - min-order-value: - type: float - laverage-ratio: - type: int - mapping: - - key: currency_pair_first - path: - - data - - base-currency - type: - - str - - upper - - key: currency_pair_second - path: - - data - - quote-currency - type: - - str - - upper - - historic_rates: - request: - template: market/history/kline - pair_template: # i.e. BTC_CQ - template: "{first}{second}" - lower_case: true - alias: symbol - params: - period: - type: str - allowed: - minutes: 1min - hours: 60min - days: 1day - weeks: 1week - months: 1mon - default: 1day - size: - type: int - min: 1 - max: 2000 - default: 2000 - response: - type: dict - values: - status: - type: str - allowed: - - ok - - error - ch: # channel format, i.e. "market.btcusdt.kline.1day" - type: str - ts: # timestamp in millisecond - type: - - int - data: - type: list - values: - type: dict - values: - id: - type: int - amount: - type: float - count: - type: int - open: - type: float - close: - type: float - low: - type: float - high: - type: float - vol: - type: float - mapping: - - key: time - path: - - data - - id - type: - - float - - from_timestamp - - 0 - - key: open - path: - - data - - open - type: - - float - - key: close - path: - - data - - close - type: - - float - - key: low - path: - - data - - low - type: - - float - - key: high - path: - - data - - high - type: - - float - - key: volume - path: - - data - - vol - type: - - float - - tickers: - request: - template: market/detail/merged - pair_template: # i.e. BTC_CQ - template: "{first}{second}" - lower_case: true - alias: symbol - params: null - response: - type: dict - values: - status: - type: str - ch: # channel format, i.e. "market.btcusdt.kline.1day" - type: str - ts: # timestamp in millisecond - type: - - int - tick: - type: dict - values: - amount: - type: float - open: # daily Kline, opening price - type: float - close: # daily Kline, closing price - type: float - high: # daily Kline,the maxmum price - type: float - id: - type: int - count: - type: int - low: # daily Kline, the minimum price - type: float - version: - type: int - ask: - type: list - values: - 0: - type: float - 1: - type: float - bid: - type: list - values: - 0: # price - type: float - 1: # size - type: float - vol: - type: float - mapping: - - key: time - path: - - ts - type: - - float - - from_timestamp - - 1 - - key: daily_volume - path: - - tick - - vol - type: - - float - - key: best_ask - path: - - tick - - ask - - 0 - type: - - float - - key: best_bid - path: - - tick - - bid - - 0 - type: - - float - - order_books: - request: - template: market/depth - pair_template: # i.e. BTC_CQ - template: "{first}{second}" - lower_case: true - alias: symbol - params: - type: - type: str - default: step0 #aggregation level (step5 -->max. aggregation) - response: - type: dict - values: - status: - type: str - ch: - type: str - ts: # timestamp in millisecond - type: - - int - tick: # Depth - type: dict - values: - id: - type: int - ts: - type: - - int - bids: - type: list - values: - type: list - values: - 0: # price - type: int - 1: # amount - type: float - asks: - type: list - values: - type: list - values: - 0: # price - type: int - 1: # amount - type: float - mapping: - - key: time - path: - - tick - - ts - type: - - float - - from_timestamp - - 1 - - key: bids_price - path: - - tick - - bids - - 0 - type: - - int - - key: bids_amount - path: - - tick - - bids - - 1 - type: - - float - - key: asks_price - path: - - tick - - asks - - 0 - type: - - int - - key: asks_amount - path: - - tick - - asks - - 1 - type: - - float - - key: id - path: - - tick - - version - type: - - int - - key: position - path: [] - type: - - none - - range - -# Probleme mit der resoponse. Die können wir nicht mappen, da manchmal zu einem Zeitpunkt mehrere Trades zurückkommen. -# trades: -# request: -# template: market/history/trade -# pair_template: # i.e. BTC_CQ -# template: "{first}{second}" -# alias: symbol -# lower_case: true -# params: -# size: -# type: int -# default: 5 -# response: -# type: dict -# values: -# status: -# type: str -# ch: -# type: str -# ts: -# type: int -# data: -# type: list -# values: -# type: dict -# values: -# id: -# type: int -# ts: # timestamp -# type: int -# data: -# type: list -# values: -# type: dict -# values: -# id: -# type: int -# ts: -# type: int -# trade-id: -# type: int -# amount: -# type: float -# price: -# type: -# - int -# direction: -# type: str -# -# mapping: -# - key: price -# path: -# - data -# - data -# - price -# type: -# - float -# - key: amount -# path: -# - data -# - data -# - amount -# type: -# - float -# - key: direction -# path: -# - data -# - data -# - direction -# type: -# - str -# - key: time -# path: -# - data -# - data -# - ts -# type: -# - int -# - Afrom_timestamp -# - key: id -# path: -# - data -# - data -# - trade-id -# type: -# - int \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/huobi_korea.yaml b/pandas_datareader/crypto/resources/running_exchanges/huobi_korea.yaml deleted file mode 100644 index 48c89493..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/huobi_korea.yaml +++ /dev/null @@ -1,424 +0,0 @@ -name: huobi_korea -exchange: true -api_url: https://api-cloud.huobi.co.kr/ -rate_limit: - max: 100 - unit: 10 -requests: - currency_pairs: - request: - template: v1/common/symbols - pair_template: null - params: null - response: - type: dict - values: - status: - type: str - data: - type: list - values: - type: dict - values: - base-currency: - type: str - quote-currency: - type: str - price-precision: - type: int - amoint_precision: - type: int - symbol-partition: - type: str - symbol: - type: str - state: - type: str - value-precision: - type: int - min-order-amt: - type: float - max-oder-amt: - type: float - min-order-value: - type: float - laverage-ratio: - type: int - mapping: - - key: currency_pair_first - path: - - data - - base-currency - type: - - str - - upper - - key: currency_pair_second - path: - - data - - quote-currency - type: - - str - - upper - - - - historic_rates: - request: - template: market/history/kline - pair_template: # i.e. BTC_CQ - template: "{first}{second}" - lower_case: true - alias: symbol - params: - period: - type: str - allowed: - minutes: 1min - hours: 60min - days: 1day - weeks: 1week - months: 1mon - default: 1day - size: - type: int - min: 1 - max: 2000 - default: 2000 - response: - type: dict - values: - status: - type: str - allowed: - - ok - - error - ch: # channel format, i.e. "market.btcusdt.kline.1day" - type: str - ts: # timestamp in millisecond - type: - - int - data: - type: list - values: - type: dict - values: - id: - type: int - amount: - type: float - count: - type: int - open: - type: float - close: - type: float - low: - type: float - high: - type: float - vol: - type: float - mapping: - - key: time - path: - - data - - id - type: - - float - - from_timestamp - - 0 - - key: open - path: - - data - - open - type: - - float - - key: close - path: - - data - - close - type: - - float - - key: low - path: - - data - - low - type: - - float - - key: high - path: - - data - - high - type: - - float - - key: volume - path: - - data - - vol - type: - - float - - tickers: - request: - template: market/detail/merged - pair_template: # i.e. BTC_CQ - template: "{first}{second}" - lower_case: true - alias: symbol - params: null - response: - type: dict - values: - status: - type: str - ch: # channel format, i.e. "market.btcusdt.kline.1day" - type: str - ts: # timestamp in millisecond - type: - - int - tick: - type: dict - values: - amount: - type: float - open: # daily Kline, opening price - type: float - close: # daily Kline, closing price - type: float - high: # daily Kline,the maxmum price - type: float - id: - type: int - count: - type: int - low: # daily Kline, the minimum price - type: float - version: - type: int - ask: - type: list - values: - 0: - type: float - 1: - type: float - bid: - type: list - values: - 0: # price - type: float - 1: # size - type: float - vol: - type: float - mapping: - - key: time - path: - - ts - type: - - float - - from_timestamp - - 1 - - key: daily_volume - path: - - tick - - vol - type: - - float - - key: best_ask - path: - - tick - - ask - - 0 - type: - - float - - key: best_bid - path: - - tick - - bid - - 0 - type: - - float - - order_books: - request: - template: market/depth - pair_template: # i.e. BTC_CQ - template: "{first}{second}" - lower_case: true - alias: symbol - params: - type: - type: str - default: step0 #aggregation level (step5 -->max. aggregation) - response: - type: dict - values: - status: - type: str - ch: - type: str - ts: # timestamp in millisecond - type: - - int - tick: # Depth - type: dict - values: - id: - type: int - ts: - type: - - int - bids: - type: list - values: - type: list - values: - 0: # price - type: int - 1: # amount - type: float - asks: - type: list - values: - type: list - values: - 0: # price - type: int - 1: # amount - type: float - mapping: - - key: time - path: - - tick - - ts - type: - - float - - from_timestamp - - 1 - - key: bids_price - path: - - tick - - bids - - 0 - type: - - int - - key: bids_amount - path: - - tick - - bids - - 1 - type: - - float - - key: asks_price - path: - - tick - - asks - - 0 - type: - - int - - key: asks_amount - path: - - tick - - asks - - 1 - type: - - float - - key: id - path: - - tick - - version - type: - - int - - key: position - path: [] - type: - - none - - range - -# Probleme mit der resoponse. Die können wir nicht mappen, da manchmal zu einem Zeitpunkt mehrere Trades zurückkommen. -# trades: -# request: -# template: market/history/trade -# pair_template: # i.e. BTC_CQ -# template: "{first}{second}" -# alias: symbol -# lower_case: true -# params: -# size: -# type: int -# default: 5 -# response: -# type: dict -# values: -# status: -# type: str -# ch: -# type: str -# ts: -# type: int -# data: -# type: list -# values: -# type: dict -# values: -# id: -# type: int -# ts: # timestamp -# type: int -# data: -# type: list -# values: -# type: dict -# values: -# id: -# type: int -# ts: -# type: int -# trade-id: -# type: int -# amount: -# type: float -# price: -# type: -# - int -# direction: -# type: str -# -# mapping: -# - key: price -# path: -# - data -# - data -# - price -# type: -# - float -# - key: amount -# path: -# - data -# - data -# - amount -# type: -# - float -# - key: direction -# path: -# - data -# - data -# - direction -# type: -# - str -# - key: time -# path: -# - data -# - data -# - ts -# type: -# - int -# - Afrom_timestamp -# - key: id -# path: -# - data -# - data -# - trade-id -# type: -# - int \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/hydax.yaml b/pandas_datareader/crypto/resources/running_exchanges/hydax.yaml deleted file mode 100644 index dc7c31e7..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/hydax.yaml +++ /dev/null @@ -1,305 +0,0 @@ -name: hydax -is_exchange: true - -api_url: https://api.hydax.com/ -rate_limit: - max: 3000 - unit: 60 - -requests: - currency_pairs: - request: - template: openapi/v1/brokerInfo - pair_template: null - params: null - - response: - type: dict - values: - symbols: - type: list - values: - type: dict - values: - baseAsset: - type: str - quoteAsset: - type: str - - mapping: - - key: currency_pair_first - path: - - symbols - - baseAsset - type: - - str - - key: currency_pair_second - path: - - symbols - - quoteAsset - type: - - str - - tickers: - request: - template: openapi/quote/v1/ticker/price - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: null - - response: - type: dict - values: - symbol: - type: str - price: - type: str - mapping: - - key: time - path: [] - type: - - none - - now - - key: last_price - path: - - price - type: - - str - - float - - order_books: - request: - template: openapi/quote/v1/depth - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - type: int - max: 1000 - default: 50 - response: - type: dict - values: - time: - type: int - bids: - type: list - values: - type: list - 0: #price - type: str - 1: #qty - type: str - asks: - type: list - values: - type: list - 0: - type: str - 1: - type: str - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: id - path: - - time - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - trades: - request: - template: openapi/quote/v1/trades - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - type: int - max: 1000 - default: 500 - response: - type: list - value: - type: dict - values: - price: - type: str - qty: - typ: str - time: - type: int - isBuyerMaker: - type: bool - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: direction - path: - - isBuyerMaker - type: - - value - - map - - True - - sell - - False - - buy - - key: id - path: - - time - type: - - int - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - qty - type: - - str - - float - - historic_rates: - request: - template: openapi/quote/v1/klines - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - interval: - allowed: - minutes: 1m - hours: 1h - days: 1d - weeks: 1w - months: 1M - default: 1d - limit: - type: int - max: 1000 - default: 1000 - endTime: - function: last_timestamp - type: - - datetime - - timestampms - - - response: - type: list - values: - type: list - values: - 0: #timestamp - type: int - 1: #open - type: str - 2: #high - type: str - 3: #low - type: str - 4: #close - type: str - 5: #volume - type: str - 6: #close time - type: int - 7: # quote Asset volume - type: str - 8: # number of trades - type: int - 9: # taker buy base asset volume - type: str - 10: # taker buy quote asset volume - type: str - - mapping: - - key: time - path: - - 0 - type: - - float - - from_timestamp - - 1 - - key: open - path: - - 1 - type: - - str - - float - - key: high - path: - - 2 - type: - - str - - float - - key: low - path: - - 3 - type: - - str - - float - - key: close - path: - - 4 - type: - - str - - float - - key: volume - path: - - 5 - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/idex.yaml b/pandas_datareader/crypto/resources/running_exchanges/idex.yaml deleted file mode 100644 index 741a0e3a..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/idex.yaml +++ /dev/null @@ -1,336 +0,0 @@ -name: idex -exchange: true -api_docs: https://docs.idex.io/#introduction -api_url: https://api.idex.io/ -rate_limit: - max: 300 - unit: 60 -requests: - currency_pairs: - request: - template: v1/markets - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - baseAsset: - type: str - quoteAsset: - type: str - mapping: - - key: currency_pair_first - path: - - baseAsset - type: - - str - - key: currency_pair_second - path: - - quoteAsset - type: - - str - - - tickers: - request: - template: v1/tickers - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - baseAsset: - type: str - quoteAsset: - type: str - baseVolume: - type: str - quoteVolume: - type: str - ask: - type: str - bid: - type: str - time: - type: int - - mapping: - - key: currency_pair_first - path: - - market - type: - - str - - split - - "-" - - 0 - - key: currency_pair_second - path: - - market - type: - - str - - split - - "-" - - 1 - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: best_ask - path: - - bid - type: - - str - - float - - key: best_bid - path: - - bid - type: - - str - - float - - order_books: - request: - template: v1/orderbook - pair_template: # e.g. ETH_SAN - template: "{first}-{second}" - lower_case: false - alias: market - params: - level: - type: int - default: 2 - limit: - type: int - default: 50 - - response: - type: dict - values: - sequence: - type: int - asks: - type: list - values: - type: list - values: - 0: #price - type: - - str - 1: #quantity - type: - - str - bids: - type: list - values: - type: list - values: - 0: #price - type: - - str - 1: #quantity - type: - - str - mapping: - - key: position - path: [] - type: - - none - - range - - key: id - path: - - sequence - type: - - int - - key: time - path: [] - type: - - none - - now - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - trades: - request: - template: v1/trades - pair_template: # e.g. ETH_SAN - template: "{first}-{second}" - lower_case: false - alias: market - params: - limit: - type: int - max: 1000 - default: 200 - response: - type: list - values: - type: dict - values: - fillId: - type: str - quantity: - type: str - price: - type: str - time: - type: int - makerSide: - type: str - sequence: - type: int - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: id - path: - - sequence - type: - - int - - key: amount - path: - - quantity - type: - - str - - float - - key: direction - path: - - makerSide - type: - - value - - map - - sell - - buy - - buy - - sell - - key: price - path: - - price - type: - - str - - float - - historic_rates: - request: - template: v1/candles - pair_template: # e.g. ETH_SAN - template: "{first}-{second}" - lower_case: false - alias: market - params: - interval: - allowed: - minutes: 1m - hours: 1h - days: 1d - default: 1d - limit: - max: 1000 - default: 1000 - end: - function: last_timestamp - type: - - datetime - - timestampms -# start: -# function: last_timestamp -# type: -# - datetime -# - timedeltams -# - interval -# - 1000 - - response: - type: list - values: - type: dict - values: - market: - type: str - start: - type: int - open: - type: str - high: - type: str - low: - type: str - close: - type: str - volume: - type: str - mapping: - - key: time - path: - - start - type: - - float - - from_timestamp - - 1 - - key: open - path: - - open - type: - - str - - float - - key: high - path: - - high - type: - - str - - float - - key: low - path: - - low - type: - - str - - float - - key: close - path: - - close - type: - - str - - float - - key: volume - path: - - volume - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/indodax.yaml b/pandas_datareader/crypto/resources/running_exchanges/indodax.yaml deleted file mode 100644 index 5c6905df..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/indodax.yaml +++ /dev/null @@ -1,247 +0,0 @@ -name: indodax -api_url: https://indodax.com/api/ -is_exchange: True - -requests: - currency_pairs: - request: - template: pairs - pair_template: null - params: null - - response: - type: list - values: - type: dict - values: - id: - type: str - symbol: - type: str - base_currency: - type: str - traded_currency: - type: str - mapping: - - key: currency_pair_first - path: - - traded_currency - type: - - str - - upper - - key: currency_pair_second - path: - - base_currency - type: - - str - - upper - - tickers: - request: - template: ticker_all - pair_template: null - params: null - - response: - type: dict - values: - tickers: - type: dict - values: - currency_pair: - type: dict - values: - high: - type: str - low: - type: str - vol_btc: - type: str - vol_idr: - type: str - last: - type: str - buy: - type: str - sell: - type: str - server_time: - type: int - mapping: - - key: currency_pair_first - path: - - tickers - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - tickers - - dict_key - type: - - str - - split - - "_" - - 1 - - key: time - path: - - tickers - - dict_values - - server_time - type: - - float - - from_timestamp - - 0 - - key: last_price - path: - - tickers - - dict_values - - last - type: - - str - - float - - key: best_bid - path: - - tickers - - dict_values - - buy - type: - - str - - float - - key: best_ask - path: - - tickers - - dict_values - - sell - type: - - str - - float - - order_books: - request: - template: depth/{currency_pair} - pair_template: - template: "{first}{second}" - alias: null - lower_case: true - params: null - - response: - type: dict - values: - buy: - type: list - 0: #price - type: strr - 1: #size - type: str - sell: - type: list - 0: - type: str - 1: - type: str - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - buy - - 1 - type: - - str - - float - - key: bids_price - path: - - buy - - 0 - type: - - str - - float - - key: asks_amount - path: - - sell - - 1 - type: - - str - - float - - key: asks_price - path: - - sell - - 0 - type: - - str - - float - - trades: - request: - template: trades/{currency_pair} - pair_template: - template: "{first}{second}" - alias: null - lower_case: true - params: null - - response: - type: list - values: - type: dict - values: - date: - type: str - price: - type: str - amount: - type: str - tid: - type: str - type: - type: str - mapping: - - key: time - path: - - date - type: - - str - - float - - from_timestamp - - 0 - - key: id - path: - - tid - type: - - str - - int - - key: direction - path: - - type - type: - - str - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - amount - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/korbit.yaml b/pandas_datareader/crypto/resources/running_exchanges/korbit.yaml deleted file mode 100644 index 16401272..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/korbit.yaml +++ /dev/null @@ -1,266 +0,0 @@ -name: korbit -exchange: true -api_url: https://api.korbit.co.kr/v1/ - -rate_limit: - max: 60 - unit: 60 - -requests: - - currency_pairs: - request: - template: ticker/detailed/all - pair_template: null - params: null - - response: - type: dict - values: - currency_pair: - type: dict - values: - timetamp: - type: int - last: - type: str - bid: - type: str - ask: - type: str - volume: - type: str - - mapping: - - key: currency_pair_first - path: - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - dict_key - type: - - str - - split - - "_" - - 1 - - tickers: - request: - template: ticker/detailed/all - pair_template: null - params: null - - response: - type: dict - values: - currency_pair: - type: dict - values: - timetamp: - type: int - last: - type: str - bid: - type: str - ask: - type: str - volume: - type: str - - mapping: - - key: currency_pair_first - path: - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - dict_key - type: - - str - - split - - "_" - - 1 - - key: time - path: - - dict_values - - timestamp - type: - - float - - from_timestamp - - 1 - - key: last_price - path: - - dict_values - - last - type: - - str - - float - - key: best_bid - path: - - dict_values - - bid - type: - - str - - float - - key: best_ask - path: - - dict_values - - ask - type: - - str - - float - - key: daily_volume - path: - - dict_values - - volume - type: - - str - - float - - order_books: - request: - template: orderbook - pair_template: - template: "{first}_{second}" - lower_case: true - alias: currency_pair - params: null - - response: - type: dict - values: - timestamp: - type: int - bids: - type: list - values: - type: list - values: - 0: # price - type: str - 1: # qty - type: str - 2: - type: str - asks: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - 2: - type: str - mapping: - - key: id - path: - - timestamp - type: - - int - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 1 - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - trades: - request: - template: transactions - pair_template: - template: "{first}_{second}" - lower_case: true - alias: currency_pair - params: null - - response: - type: list - values: - type: dict - values: - timestamp: - type: int - tid: - type: str - price: - type: str - amount: - type: str - type: - type: str - mapping: - - key: id - path: - - tid - type: - - str - - int - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 1 - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - amount - type: - - str - - float - - key: direction - path: - - type - type: - - str \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/kucoin.yaml b/pandas_datareader/crypto/resources/running_exchanges/kucoin.yaml deleted file mode 100644 index 2a51a4bd..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/kucoin.yaml +++ /dev/null @@ -1,432 +0,0 @@ -name: kucoin -exchange: true -api_url: https://api.kucoin.com/api/v1/ -rate_limit: - max: 30 - unit: 60 -requests: - currency_pairs: - request: - template: symbols - pair_template: null - params: null - response: - type: dict - values: - code: - type: - - str - - int - data: - type: list - values: - symbol: - type: str - name: - type: str - baseCurrency: - type: str - quoteCurrency: - type: str - baseMinSize: - type: float - quoteMinSize: - type: int - baseMaxSize: - type: int - quoteMaxSize: - type: float - baseIncrement: - type: float - quoteIncrement: - type: float - priceIncrement: - type: float - feeCurrency: - type: str - enableTrading: - type: bool - mapping: - - key: currency_pair_first - path: - - data - - symbol - type: - - str - - split - - "-" - - 0 - - key: currency_pair_second - path: - - data - - symbol - type: - - str - - split - - "-" - - 1 - - tickers: - request: - template: market/allTickers - pair_template: null - params: null - response: - type: dict - values: - code: - type: int - data: - type: dict - values: - ticker: - type: list - values: - type: dict - values: - symbol: # e.g. KCS - type: str - high: - type: float - vol: - type: float - last: - type: float - low: - type: float - buy: - type: float - sell: - type: float - changePrice: - type: float - averagePrice: - type: float - changeRate: - type: float - volValue: - type: float - time: - type: int - mapping: - - key: time - path: - - data - - time - type: - - float - - from_timestamp - - 1 - - key: currency_pair_first - path: - - data - - ticker - - symbol - type: - - str - - split - - "-" - - 0 - - key: currency_pair_second - path: - - data - - ticker - - symbol - type: - - str - - split - - "-" - - 1 - - key: last_price - path: - - data - - ticker - - last - type: - - float - - key: best_bid - path: - - data - - ticker - - buy - type: - - float - - key: best_ask - path: - - data - - ticker - - sell - type: - - float - - key: daily_volume - path: - - data - - ticker - - volValue - type: - - float - - historic_rates: - request: - template: market/candles - pair_template: # e.g. KCS-BTC - template: "{first}-{second}" - lower_case: false - alias: symbol - params: - startAt: - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 1000 - endAt: - function: last_timestamp - type: - - datetime - - timestamp - type: - allowed: - minutes: 1min - hours: 1hour - days: 1day - weeks: 1week - default: 1day - - response: - type: dict - values: - code: - type: str - data: - type: list - values: - type: list - values: - 0: # timestamp - type: - - str - 1: # open - type: - - str - 2: # close - type: - - str - 3: # high - type: - - str - 4: # low - type: - - str - 5: # volume - type: - - str - 6: # amount - type: - - str - mapping: - - key: time - path: - - data - - 0 - type: - - str - - float - - from_timestamp - - 0 - - key: open - path: - - data - - 1 - type: - - str - - float - - key: close - path: - - data - - 2 - type: - - str - - float - - key: high - path: - - data - - 3 - type: - - str - - float - - key: low - path: - - data - - 4 - type: - - str - - float - - key: volume - path: - - data - - 5 - type: - - str - - float - - - order_books: - request: - template: market/orderbook/level2_20 - pair_template: # e.g. KCS-BTC - template: "{first}-{second}" - lower_case: false - alias: symbol - params: null - response: - type: dict - values: - code: - type: str - data: - type: dict - values: - time: - type: int - sequence: - type: str - bids: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - asks: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - mapping: - - key: asks_price - path: - - data - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - data - - asks - - 1 - type: - - str - - float - - key: bids_price - path: - - data - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - data - - bids - - 1 - type: - - str - - float - - key: time - path: - - data - - time - type: - - float - - from_timestamp - - 1 - - key: id - path: - - data - - sequence - type: - - str - - int - - key: position - path: [] - type: - - none - - range - - trades: - request: - template: market/histories - pair_template: - template: "{first}-{second}" - alias: symbol - lower_case: false - params: null - - response: - type: dict - values: - code: - type: str - data: - type: list - values: - type: dict - values: - sequence: - type: str - price: - type: str - size: - type: str - side: - type: str - time: - type: int - mapping: - - key: time - path: - - data - - time - type: - - float - - from_timestamp - - 3 - - key: price - path: - - data - - price - type: - - str - - float - - key: amount - path: - - data - - size - type: - - str - - float - - key: direction - path: - - data - - side - type: - - str - - key: id - path: - - data - - sequence - type: - - str - - int - diff --git a/pandas_datareader/crypto/resources/running_exchanges/latoken.yaml b/pandas_datareader/crypto/resources/running_exchanges/latoken.yaml deleted file mode 100644 index de5934f3..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/latoken.yaml +++ /dev/null @@ -1,225 +0,0 @@ -name: latoken -exchange: true -api_url: https://api.latoken.com/api/v2/ -rate_limit: null - -requests: - - currency_pairs: - request: - template: ticker - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - symbol: - type: str - lastPrice: - type: str - mapping: - - key: currency_pair_first - path: - - symbol - type: - - str - - split - - "/" - - 0 - - key: currency_pair_second - path: - - symbol - type: - - str - - split - - "/" - - 1 - - tickers: - request: - template: ticker - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - symbol: - type: str - lastPrice: - type: str - mapping: - - key: currency_pair_first - path: - - symbol - type: - - str - - split - - "/" - - 0 - - key: currency_pair_second - path: - - symbol - type: - - str - - split - - "/" - - 1 - - key: time - path: [] - type: - - none - - now - - key: last_price - path: - - lastPrice - type: - - str - - float - - - order_books: - request: - template: book/{currency_pair} - pair_template: - template: "{first}/{second}" - lower_case: false - params: - limit: - type: int - max: 1000 - default: 50 - - response: - type: dict - values: - ask: - type: list - values: - type: dict - values: - price: - type: str - quantity: - type: str - bid: - type: list - values: - type: dict - values: - price: - type: str - quantity: - type: str - - mapping: - - key: id - path: [] - type: - - none - - now_timestamp - - key: time - path: [] - type: - - none - - now - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - bid - - price - type: - - str - - float - - key: bids_amount - path: - - bid - - quantity - type: - - str - - float - - key: asks_price - path: - - ask - - price - type: - - str - - float - - key: asks_amount - path: - - ask - - quantity - type: - - str - - float - - - - trades: - request: - template: trade/history/{currency_pair} - pair_template: #BTCETH - template: "{first}/{second}" - lower_case: false - params: - limit: - type: int - default: 100 - - response: - type: list - values: - type: dict - value: - id: - type: int - isMakerBuyer: - type: str - price: - type: str - quantity: - type: str - timestamp: - type: int - mapping: - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 1 - - key: id - path: - - id - type: - - str - - key: direction - path: - - isMakerBuyer - type: - - value - - map - - false - - buy - - true - - sell - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - quantity - type: - - str - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/lbank.yaml b/pandas_datareader/crypto/resources/running_exchanges/lbank.yaml deleted file mode 100644 index 594d53b5..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/lbank.yaml +++ /dev/null @@ -1,333 +0,0 @@ -name: lbank -exchange: true -api_docs: https://github.com/LBank-exchange/lbank-official-api-docs/tree/master/API-For-Spot-EN -api_url: https://api.lbkex.com/v1/ -rate_limit: null - -requests: - tickers: - request: - template: ticker.do - pair_template: null - params: - symbol: - type: str - default: all - response: - type: list - values: - type: dict - values: - symbol: - type: str - ticker: - type: dict - values: - change: - type: float - high: - type: float - latest: - type: float - low: - type: float - turnover: - type: float - vol: - type: float - timestamp: - type: - - int - mapping: - - key: time - path: [] - type: - - none - - now - - key: currency_pair_first - path: - - symbol - type: - - str - - splitupper - - "_" - - 0 - - key: currency_pair_second - path: - - symbol - type: - - str - - splitupper - - "_" - - 1 - - key: last_price - path: - - ticker - - latest - type: - - float - - key: last_price - path: - - ticker - - latest - type: - - float - - key: daily_volume - path: - - ticker - - vol - type: - - float - - currency_pairs: - request: - template: currencyPairs.do - pair_template: null - params: null - response: - type: list - values: # each available currency pair e.g. "bcc_eth","etc_btc"... - type: str - mapping: - - key: currency_pair_first - path: - - [] - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - [] - type: - - str - - split - - "_" - - 1 - - order_books: - request: - template: depth.do - pair_template: # e.g. eth_btc - template: "{first}_{second}" - lower_case: true - alias: symbol - params: - size: - type: int - min: 1 - max: 60 - default: 60 - merge: - type: int - default: 0 - response: - type: dict - values: - asks: - type: list - values: - type: list - values: - 0: # price - type: float - 1: # size - type: float - bids: - type: list - values: - type: list - values: - 0: # price - type: float - 1: # size - type: float - mapping: - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: time - path: [] - type: - - none - - now - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - trades: - request: - template: trades.do - pair_template: # e.g. eth_btc - template: "{first}_{second}" - lower_case: true - alias: symbol - params: - size: - type: int - min: 1 - max: 600 - default: 200 - time: - required: false - response: - type: list - values: - type: dict - values: - date_ms: - type: - - float - - from_timestamp - - 0 - amount: - type: float - price: - type: float - type: - type: str - tid: - type: str - mapping: - - key: id - path: - - tid - type: - - str - - key: time - path: - - date_ms - type: - - float - - from_timestamp - - 1 - - key: amount - path: - - amount - type: - - float - - key: price - path: - - price - type: - - float - - key: direction - path: - - type - type: - - str - - historic_rates: - request: - template: kline.do - pair_template: # e.g. eth_btc - template: "{first}_{second}" - lower_case: true - alias: symbol - params: - size: - type: int - min: 1 - max: 2880 - default: 2880 - type: - allowed: - minutes: minute1 - hours: hour1 - days: day1 - weeks: week1 - months: month1 - default: day1 - time: - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 2880 -# type: int -# default: 1325432318 #01.01.2012 - response: - type: list - values: - type: list - values: - 0: # timestamp - type: - - int - 1: # open - type: float - 2: # high - type: float - 3: # low - type: float - 4: # close - type: float - 5: # volume - type: float - mapping: - - key: time - path: - - 0 - type: - - float - - from_timestamp - - 0 - - key: open - path: - - 1 - type: - - float - - key: high - path: - - 2 - type: - - float - - key: low - path: - - 3 - type: - - float - - key: close - path: - - 4 - type: - - float - - key: volume - path: - - 5 - type: - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/luno.yaml b/pandas_datareader/crypto/resources/running_exchanges/luno.yaml deleted file mode 100644 index 316a3b57..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/luno.yaml +++ /dev/null @@ -1,286 +0,0 @@ -name: luno -is_exchange: true - -api_url: https://api.luno.com/api/1/ -rate_limit: - max: 1 - unit: 1 -requests: - currency_pairs: - request: - template: tickers - pair_template: null - params: null - - response: - type: dict - values: - tickers: - type: list - values: - type: dict - values: - pair: - type: str - timestamp: - type: int - bid: - type: str - ask: - type: str - last_trade: - type: str - rolling_24_hour_volume: - type: str - status: - type: str - mapping: - - key: currency_pair_first - path: - - tickers - - pair - type: - - str - - slice - - 0 - - 3 - - key: currency_pair_second - path: - - tickers - - pair - type: - - str - - slice - - 3 - - 6 - - tickers: - request: - template: tickers - pair_template: null - params: null - response: - type: dict - values: - tickers: - type: list - values: - type: dict - values: - pair: - type: str - timestamp: - type: int - bid: - type: str - ask: - type: str - last_trade: - type: str - rolling_24_hour_volume: - type: str - status: - type: str - mapping: - - key: currency_pair_first - path: - - tickers - - pair - type: - - str - - slice - - 0 - - 3 - - key: currency_pair_second - path: - - tickers - - pair - type: - - str - - slice - - 3 - - 6 - - key: time - path: - - tickers - - timestamp - type: - - float - - from_timestamp - - 1 - - key: last_price - path: - - tickers - - last_trade - type: - - str - - float - - key: best_bid - path: - - tickers - - bid - type: - - str - - float - - key: best_ask - path: - - tickers - - ask - type: - - str - - float - - - order_books: - request: - template: orderbook_top - pair_template: # e.g. XBTZAR - template: "{first}{second}" - lower_case: false - alias: pair - params: null - response: - type: dict - values: - timestamp: - type: - - float - - from_timestamp - - 1 - asks: - type: list - values: - type: dict - values: - price: - type: str - volume: - type: str - - bids: - type: list - values: - type: dict - values: - price: - type: str - volume: - type: str - mapping: - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 1 - - key: asks_price - path: - - asks - - price - type: - - str - - float - - key: asks_amount - path: - - asks - - price - type: - - str - - float - - key: bids_price - path: - - bids - - price - type: - - str - - float - - key: bids_amount - path: - - bids - - price - type: - - str - - float - - key: id - path: - - timestamp - type: - - int - - key: position - path: [] - type: - - none - - range - - - trades: - request: - template: trades - pair_template: # e.g. XBTZAR - template: "{first}{second}" - lower_case: false - alias: pair - params: - since: - type: - - datetime - - totimestamp - required: false - response: - type: dict - values: - trades: - type: list - values: - type: dict - values: - timestamp: - type: int - price: - type: str - volume: - type: str - is_buy: - type: bool - mapping: - - key: time - path: - - trades - - timestamp - type: - - float - - from_timestamp - - 1 - - key: direction - path: - - trades - - is_buy - type: - - value - - map - - true - - 'buy' - - false - - 'sell' - - - key: id - path: - - trades - - sequence - type: - - int - - key: price - path: - - trades - - price - type: - - str - - float - - key: amount - path: - - trades - - volume - type: - - str - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/lykke.yaml b/pandas_datareader/crypto/resources/running_exchanges/lykke.yaml deleted file mode 100644 index 3453078d..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/lykke.yaml +++ /dev/null @@ -1,195 +0,0 @@ -# ToDO: Ticker not working. ErrorCode: Internal Server Error. Try again later. - -name: lykke -exchange: true -rate_limit: null -api_url: https://hft-apiv2.lykke.com/api/ - -requests: - currency_pairs: - request: - template: assetpairs - pair_template: null - params: null - response: - type: dict - values: - payload: - type: list - values: - type: dict - values: - name: - type: str - mapping: - - key: currency_pair_first - path: - - payload - - name - type: - - str - - split - - "/" - - 0 - - key: currency_pair_second - path: - - payload - - name - type: - - str - - split - - "/" - - 1 - - order_books: - request: - template: orderbooks - pair_template: - template: "{first}{second}" - lower_case: false - alias: assetPairId - params: - depth: - type: int - default: 50 - - response: - type: dict - values: - payload: - type: list - values: - type: dict - values: - timestamp: - type: int - bids: - type: list - values: - type: dict - values: - v: - type: float - p: - type: float - asks: - type: list - values: - type: dict - values: - v: - type: float - p: - type: float - - mapping: - - key: time - path: - - payload - - timestamp - type: - - float - - from_timestamp - - 1 - - key: id - path: - - payload - - timestamp - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - payload - - bids - - v - type: - - float - - key: bids_price - path: - - payload - - bids - - p - type: - - float - - key: asks_amount - path: - - payload - - asks - - v - type: - - float - - key: asks_price - path: - - payload - - asks - - p - type: - - float - - - trades: - request: - template: trades/public/{currency_pair} - pair_template: - template: "{first}{second}" - lower_case: false - params: - take: - type: int - default: 200 - response: - type: dict - values: - payload: - type: list - values: - type: dict - values: - timestamp: - type: int - id: - type: str - price: - type: float - volume: - type: float - side: - type: str - mapping: - - key: time - path: - - payload - - timestamp - type: - - float - - from_timestamp - - 1 - - key: direction - path: - - payload - - side - type: - - str - - key: id - path: - - payload - - id - type: - - str - - key: price - path: - - payload - - price - type: - - float - - key: amount - path: - - payload - - volume - type: - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/maicoin.yaml b/pandas_datareader/crypto/resources/running_exchanges/maicoin.yaml deleted file mode 100644 index 346d5b98..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/maicoin.yaml +++ /dev/null @@ -1,314 +0,0 @@ -name: maicoin -exchange: true -api_docs: https://max.maicoin.com/documents/api_list#!/public/getApiV2K -rate_limit: - max: 1200 - unit: 60 - -api_url: https://max-api.maicoin.com/api/v2/ - -requests: - currency_pairs: - request: - template: markets - pair_template: null - params: null - - response: - type: list - values: - type: dict - values: - base_unit: - type: str - quote_unit: - type: str - - mapping: - - key: currency_pair_first - path: - - base_unit - type: - - str - - key: currency_pair_second - path: - - quote_unit - type: - - str - - tickers: - request: - template: tickers/{currency_pair} - pair_template: - template: "{first}{second}" - lower_case: true - params: null - response: - type: dict - values: - at: - type: int - buy: - type: str - sell: - type: str - last: - type: str - vol: - type: str - - - mapping: - - key: last_price - path: - - last - type: - - str - - float - - key: time - path: - - at - type: - - float - - from_timestamp - - 0 - - key: best_bid - path: - - buy - type: - - str - - float - - key: best_ask - path: - - sell - type: - - str - - float - - key: daily_volume - path: - - vol - type: - - str - - float - - historic_rates: - request: - template: k - pair_template: - template: "{first}{second}" - lower_case: true - alias: market - params: - limit: - default: 2000 - timestamp: - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 2000 - period: - allowed: - minutes: 1 - hours: 60 - days: 1440 - weeks: 10080 - default: 1440 - response: - type: list - values: - type: list - values: - 0: #time - type: int - 1: #open - type: float - 2: #high - type: float - 3: #low - type: float - 4: #close - type: float - 5: #vol - type: float - - mapping: - - key: time - path: - - 0 - type: - - float - - from_timestamp - - 0 - - key: open - path: - - 1 - type: - - float - - key: high - path: - - 2 - type: - - float - - key: low - path: - - 3 - type: - - float - - key: close - path: - - 4 - type: - - float - - key: volume - path: - - 5 - type: - - float - - - trades: - request: - template: trades - pair_template: - template: "{first}{second}" - lower_case: true - alias: market - params: - limit: - default: 200 - - response: - type: list - values: - type: dict - values: - id: - type: int - price: - type: str - volume: - type: str - created_at: - type: int - side: - type: str - - mapping: - - key: time - path: - - created_at - type: - - float - - from_timestamp - - 0 - - key: id - path: - - id - type: - - int - - key: direction - path: - - side - type: - - value - - map - - ask - - sell - - bid - - buy - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - volume - type: - - str - - float - - order_books: - request: - template: depth - pair_template: - template: "{first}{second}" - lower_case: true - alias: market - params: - limit: - default: 50 - - response: - type: dict - values: - timestamp: - type: int - asks: - type: list - values: - type: list - values: - 0: #Price - type: str - 1: # Qty - type: str - bids: - type: list - values: - type: list - values: - 0: #Price - type: str - 1: # Qty - type: str - - mapping: - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 0 - - key: id - path: - - timestamp - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/mandala.yaml b/pandas_datareader/crypto/resources/running_exchanges/mandala.yaml deleted file mode 100644 index 3bb77dbd..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/mandala.yaml +++ /dev/null @@ -1,329 +0,0 @@ -name: mandala -exchange: true - -rate_limit: - max: 1200 - unit: 60 - -api_url: "" - -requests: - currency_pairs: - request: - template: https://trade.mandala.exchange/open/v1/common/symbols - pair_template: null - params: null - - response: - type: dict - values: - data: - type: dict - values: - list: - type: list - values: - type: dict - values: - symbol: - type: str - baseAsset: - type: str - quoteAsset: - type: str - - mapping: - - key: currency_pair_first - path: - - data - - list - - baseAsset - type: - - str - - key: currency_pair_second - path: - - data - - list - - quoteAsset - type: - - str - - order_books: - request: - template: https://api.binance.com/api/v3/depth - pair_template: # e.g. BNBBTC - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - max: 100 - default: 50 - - response: - type: dict - values: - lastUpdateId: - type: int - bids: - type: list - values: - type: list - values: - 0: # price - type: - - str - - float - 1: # quantity - type: - - str - - float - asks: - type: list - values: - type: list - values: - 0: # price - type: - - str - - float - 1: # quantity - type: - - str - - float - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: - - lastUpdateId - type: - - int - - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - trades: - request: - template: https://api.binance.com/api/v1/trades - pair_template: # e.g. BNBBTC - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - max: 1000 - default: 500 - weight: 1 - response: - type: list - values: - type: dict - values: - id: - type: int - price: - type: - - str - - float - qty: - type: - - str - - float - time: - type: - - float - - from_timestamp - - 1 - isBuyerMaker: - type: bool - isBestMatch: - type: bool - mapping: - - key: id - path: - - id - type: - - int - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - qty - type: - - str - - float - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: direction - path: - - isBuyerMaker - type: - - value - - map - - True - - sell - - False - - buy - - historic_rates: - request: - template: https://api.binance.com/api/v1/klines - pair_template: # e.g. BNBBTC - template: "{first}{second}" - lower_case: false - alias: symbol - params: - interval: - allowed: - minutes: 1m - hours: 1h - days: 1d - weeks: 1w - months: 1M - default: 1d - startTime: - required: false - endTime: - function: last_timestamp - type: - - datetime - - timestampms -# - timedeltams -# - interval -# - 1000 - limit: - max: 1000 - default: 1000 - response: - type: list - values: - type: list - values: - 0: # Open time - type: - - float - - from_timestamp - - 1 - 1: # open - type: - - str - - float - 2: # high - type: - - str - - float - 3: # low - type: - - str - - float - 4: # close - type: - - str - - float - 5: # volume - type: - - str - - float - 6: # close time - type: - - float - - from_timestamp - - 1 - 7: # Quote asset volume - type: - - str - - float - 8: # Number of trades - type: int - 9: # Taker buy base asset volume - type: - - str - - float - 10: # Taker buy quote asset volume - type: - - str - - float - 11: # ignore - type: ignore - mapping: - - key: open - path: - - 1 - type: - - str - - float - - key: high - path: - - 2 - type: - - str - - float - - key: low - path: - - 3 - type: - - str - - float - - key: close - path: - - 4 - type: - - str - - float - - key: volume - path: - - 5 - type: - - str - - float - - key: time - path: - - 6 - type: - - float - - from_timestamp - - 1 diff --git a/pandas_datareader/crypto/resources/running_exchanges/mercatox.yaml b/pandas_datareader/crypto/resources/running_exchanges/mercatox.yaml deleted file mode 100644 index 87f66265..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/mercatox.yaml +++ /dev/null @@ -1,248 +0,0 @@ -name: mercatox -terms: null -api_url: https://mercatox.com/api/public/v1/ -rate_limit: null -requests: - - currency_pairs: - request: - template: ticker - pair_template: null - params: null - response: - type: dict - values: - currency_pair: - type: dict - mapping: - - key: currency_pair_first - path: - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - dict_key - type: - - str - - split - - "_" - - 1 - - tickers: - request: - template: ticker - pair_template: null - params: null - response: - type: dict - values: - currency_pair: - type: dict - values: - last_price: - type: str - baseVolume: - type: str - quoteVolume: - type: str - lowestAsk: - type: str - highestBid: - type: str - mapping: - - key: time - path: [] - type: - - none - - now - - key: currency_pair_first - path: - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - dict_key - type: - - str - - split - - "_" - - 1 - - key: last_price - path: - - dict_values - - last_price - type: - - str - - float - - key: best_bid - path: - - dict_values - - highestBid - type: - - str - - float - - key: best_ask - path: - - dict_values - - lowestAsk - type: - - str - - float - - key: daily_volume - path: - - dict_values - - base_volume - type: - - str - - float - - trades: - request: - template: trades - pair_template: - template: "{first}_{second}" - lower_case: false - alias: market_pair - params: null - - response: - type: list - values: - type: dict - values: - trade_id: - type: str - price: - type: str - base_volume: - type: str - quote_volume: - type: str - trade_timestamp: - type: str - type: - type: str - - mapping: - - key: time - path: - - trade_timestamp - type: - - str - - float - - from_timestamp - - 0 - - key: id - path: - - trade_id - type: - - str - - int - - key: direction - path: - - type - type: - - str - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - base_volume - type: - - str - - float - - order_books: - request: - template: orderbook - pair_template: - template: "{first}_{second}" - lower_case: false - alias: market_pair - params: null - - response: - type: dict - values: - timestamp: - type: str - asks: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - bids: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - mapping: - - key: time - path: - - timestamp - type: - - str - - float - - from_timestamp - - 0 - - key: id - path: - - timestamp - type: - - str - - int - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/mexo.yaml b/pandas_datareader/crypto/resources/running_exchanges/mexo.yaml deleted file mode 100644 index 997d3b45..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/mexo.yaml +++ /dev/null @@ -1,304 +0,0 @@ -name: mexo -is_exchange: true -api_docs: https://github.com/mexo-tech/Mexo-OpenApi/blob/master/doc/rest-api.md -api_url: https://api.mexo.io/ -rate_limit: - max: 1500 - unit: 60 - -requests: - currency_pairs: - request: - template: openapi/v1/brokerInfo - pair_template: null - params: null - - response: - type: dict - values: - symbols: - type: list - values: - type: dict - values: - baseAsset: - type: str - quoteAsset: - type: str - - mapping: - - key: currency_pair_first - path: - - symbols - - baseAsset - type: - - str - - key: currency_pair_second - path: - - symbols - - quoteAsset - type: - - str - - tickers: - request: - template: openapi/quote/v1/ticker/price - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: null - - response: - type: dict - values: - symbol: - type: str - price: - type: str - mapping: - - key: time - path: [] - type: - - none - - now - - key: last_price - path: - - price - type: - - str - - float - - order_books: - request: - template: openapi/quote/v1/depth - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - type: int - max: 100 - default: 100 - response: - type: dict - values: - time: - type: int - bids: - type: list - values: - type: list - 0: #price - type: str - 1: #qty - type: str - asks: - type: list - values: - type: list - 0: - type: str - 1: - type: str - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: id - path: - - time - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - trades: - request: - template: openapi/quote/v1/trades - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - type: int - max: 1000 - default: 500 - response: - type: list - value: - type: dict - values: - price: - type: str - qty: - typ: str - time: - type: int - isBuyerMaker: - type: bool - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: direction - path: - - isBuyerMaker - type: - - value - - map - - True - - sell - - False - - buy - - key: id - path: - - time - type: - - int - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - qty - type: - - str - - float - - historic_rates: - request: - template: openapi/quote/v1/klines - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - interval: - allowed: - minutes: 1m - hours: 1h - days: 1d - weeks: 1w - months: 1M - default: 1d - limit: - type: int - max: 1000 - default: 1000 - endTime: - function: last_timestamp - type: - - datetime - - timestampms - - response: - type: list - values: - type: list - values: - 0: #timestamp - type: int - 1: #open - type: str - 2: #high - type: str - 3: #low - type: str - 4: #close - type: str - 5: #volume - type: str - 6: #close time - type: int - 7: # quote Asset volume - type: str - 8: # number of trades - type: int - 9: # taker buy base asset volume - type: str - 10: # taker buy quote asset volume - type: str - - mapping: - - key: time - path: - - 0 - type: - - float - - from_timestamp - - 1 - - key: open - path: - - 1 - type: - - str - - float - - key: high - path: - - 2 - type: - - str - - float - - key: low - path: - - 3 - type: - - str - - float - - key: close - path: - - 4 - type: - - str - - float - - key: volume - path: - - 5 - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/mxc.yaml b/pandas_datareader/crypto/resources/running_exchanges/mxc.yaml deleted file mode 100644 index 7b3eb289..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/mxc.yaml +++ /dev/null @@ -1,290 +0,0 @@ -# historic rates require a start time which is not known. -# the new api v2 requires an API key. - -name: mxc -exchange: true -api_url: https://www.mxc.com/ - -requests: - currency_pairs: - request: - template: /open/api/v1/data/markets - pair_template: null - params: null - response: - type: dict - values: - code: - type: str - data: - type: list - values: - currency_pair: - type: str - msg: - type: str - mapping: - - key: currency_pair_first - path: - - data - - [] - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - data - - [] - type: - - str - - split - - "_" - - 1 - - tickers: - request: - template: open/api/v1/data/ticker - pair_template: null - params: null - response: - type: dict - values: - code: - type: str - data: - type: dict - values: - currency_pair: - type: dict - values: - volume: - type: float - high: - type: float - low: - type: float - buy: - type: float - sell: - type: float - open: - type: float - last: - type: float - percentChange: - type: float - msg: - type: str - - mapping: - - key: time - path: [] - type: - - none - - now - - key: currency_pair_first - path: - - data - - dict_key - type: - - str - - splitupper - - "_" - - 0 - - key: currency_pair_second - path: - - data - - dict_key - type: - - str - - splitupper - - "_" - - 1 - - key: daily_volume - path: - - data - - dict_values - - volume - type: - - float - - key: best_ask - path: - - data - - dict_values - - buy - type: - - float - - key: best_bid - path: - - data - - dict_values - - sell - type: - - float - - key: last_price - path: - - data - - dict_values - - last - type: - - float - - - trades: - request: - template: /open/api/v1/data/history - pair_template: - template: "{first}_{second}" - lower_case: false - alias: market - params: null - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - tradeTime: - type: str - tradePrice: - type: str - tradeQuantity: - type: str - tradeType: - type: str - mapping: - - key: id - path: - - data - - tradeTime - type: - - str - - dateparser - - totimestamp - - key: time - path: - - data - - tradeTime - type: - - str - - dateparser - - key: direction - path: - - data - - tradeType - type: - - value - - map - - "1" - - sell - - "2" - - buy - - key: price - path: - - data - - tradeQuantity - type: - - str - - float - - key: amount - path: - - data - - tradePrice - type: - - str - - float - - - - order_books: - request: - template: /open/api/v1/data/depth - pair_template: - template: "{first}_{second}" - lower_case: false - alias: market - params: - depth: - type: int - degfault: 50 - - response: - type: dict - values: - data: - type: dict - values: - asks: - type: list - values: - type: dict - values: - price: - type: str - quantity: - type: str - bids: - type: list - values: - type: dict - values: - price: - type: str - quantity: - type: str - - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - data - - bids - - price - type: - - str - - float - - key: bids_amount - path: - - data - - bids - - quantity - type: - - str - - float - - key: asks_price - path: - - data - - asks - - price - type: - - str - - float - - key: asks_amount - path: - - data - - asks - - quantity - type: - - str - - float - - diff --git a/pandas_datareader/crypto/resources/running_exchanges/nicehash.yaml b/pandas_datareader/crypto/resources/running_exchanges/nicehash.yaml deleted file mode 100644 index 2e5efdbc..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/nicehash.yaml +++ /dev/null @@ -1,255 +0,0 @@ -# Tickers only with no split parameter in the CP -name: nicehash -exchange: true - -rate_limit: null - -api_url: https://api2.nicehash.com/exchange/api/v2/ - -requests: - currency_pairs: - request: - template: info/status - pair_template: null - params: null - - response: - type: dict - values: - symbols: - type: list - values: - type: dict - values: - baseAsset: - type: str - quoteAsset: - type: str - - mapping: - - key: currency_pair_first - path: - - symbols - - baseAsset - type: - - str - - key: currency_pair_second - path: - - symbols - - quoteAsset - type: - - str - - - historic_rates: - request: - template: info/candlesticks - pair_template: - template: "{first}{second}" - lower_case: false - alias: market - params: - resolution: - allowed: - minutes: 1 - hours: 60 - days: 1440 - default: 1440 # daily - from: - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 2000 - to: - function: last_timestamp - type: - - datetime - - timestamp - response: - type: list - values: - type: dict - values: - time: - type: int - open: - type: float - close: - type: float - high: - type: float - low: - type: float - volume: - type: float - quote_volume: - type: float - - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 0 - - key: open - path: - - open - type: - - float - - key: high - path: - - high - type: - - float - - key: low - path: - - low - type: - - float - - key: close - path: - - close - type: - - float - - key: volume - path: - - volume - type: - - float - - trades: - request: - template: info/trades - pair_template: - template: "{first}{second}" - lower_case: false - alias: market - params: - limit: - default: 200 - response: - type: list - values: - type: dict - values: - id: - type: str - dir: - type: str - price: - type: flaot - qty: - type: float - sndQty: - type: float - time: - type: int - - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 2 - - key: id - path: - - id - type: - - str - - key: direction - path: - - dir - type: - - str - - key: price - path: - - price - type: - - float - - key: amount - path: - - qty - type: - - float - - order_books: - request: - template: orderbook - pair_template: - template: "{first}{second}" - lower_case: false - alias: market - params: - limit: - default: 50 - - response: - type: dict - values: - tick: - type: int - buy: - type: list - values: - type: list - values: - 0: - type: float - 1: - type: float - sell: - type: list - values: - type: list - values: - 0: - type: float - 1: - type: float - - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: - - tick - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - buy - - 1 - type: - - float - - key: bids_price - path: - - buy - - 0 - type: - - float - - key: asks_amount - path: - - sell - - 1 - type: - - float - - key: asks_price - path: - - sell - - 0 - type: - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/nominex.yaml b/pandas_datareader/crypto/resources/running_exchanges/nominex.yaml deleted file mode 100644 index b0084fe2..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/nominex.yaml +++ /dev/null @@ -1,225 +0,0 @@ -# Cannot extract bid/sell side from orderbooks. -name: nominex -exchange: true - -rate_limit: null -api_docs: https://developer.nominex.io/#parameters -api_url: https://nominex.io/api/rest/v1/ - -requests: - currency_pairs: - request: - template: pairs - pair_template: null - params: null - - response: - type: list - values: - type: dict - values: - name: - type: str - - mapping: - - key: currency_pair_first - path: - - name - type: - - str - - split - - "/" - - 0 - - key: currency_pair_second - path: - - name - type: - - str - - split - - "/" - - 1 - - tickers: - request: - template: ticker/{currency_pair} - pair_template: - template: "{first}/{second}" - lower_case: false - params: null - response: - type: dict - values: - bid: - type: float - ask: - type: float - baseVolume: - type: float - price: - type: float - - mapping: - - key: last_price - path: - - price - type: - - float - - key: time - path: [] - type: - - none - - now - - key: best_bid - path: - - bid - type: - - float - - key: best_ask - path: - - ask - type: - - float - - key: daily_volume - path: - - baseVolume - type: - - float - - historic_rates: - request: - template: candles/{currency_pair}/{frequency} - pair_template: - template: "{first}/{second}" - lower_case: false - params: - frequency: - allowed: - minutes: TF1M - hours: TF1H - days: TF1D - weeks: TF7D - months: TF1MO - default: TF1D - limit: - default: 400 # max - end: - function: last_timestamp - type: - - datetime - - timestampms - response: - type: list - values: - type: dict - values: - timestamp: - type: int - open: - type: float - close: - type: float - high: - type: float - low: - type: float - volume: - type: float - - - mapping: - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 1 - - key: open - path: - - open - type: - - float - - key: high - path: - - high - type: - - float - - key: low - path: - - low - type: - - float - - key: close - path: - - close - type: - - float - - key: volume - path: - - volume - type: - - float - - - trades: - request: - template: trades/{currency_pair} - pair_template: - template: "{first}/{second}" - lower_case: false - params: - limit: - default: 200 # max - - response: - type: dict - values: - items: - type: list - values: - type: dict - values: - id: - type: int - timestamp: - type: int - amount: - type: float - price: - type: float - side: - type: str - - mapping: - - key: time - path: - - items - - timestamp - type: - - float - - from_timestamp - - 1 - - key: id - path: - - items - - id - type: - - int - - key: direction - path: - - items - - side - type: - - str - - key: price - path: - - items - - price - type: - - float - - key: amount - path: - - items - - amount - type: - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/oceanex.yaml b/pandas_datareader/crypto/resources/running_exchanges/oceanex.yaml deleted file mode 100644 index bc7ff21f..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/oceanex.yaml +++ /dev/null @@ -1,380 +0,0 @@ -name: oceanex -exchange: true - -rate_limit: - max: 3000 - unit: 60 - -api_url: https://api.oceanex.pro/v1/ - -requests: - currency_pairs: - request: - template: markets - pair_template: null - params: null - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - name: - type: str - - mapping: - - key: currency_pair_first - path: - - data - - name - type: - - str - - split - - "/" - - 0 - - key: currency_pair_second - path: - - data - - name - type: - - str - - split - - "/" - - 1 - - tickers: - request: - template: tickers - pair_template: null - params: null - response: - type: dict - values: - data: - type: dict - values: - currency_pair: - type: dict - values: - base_unit: - type: str - quote_unit: - type: str - at: - type: int - sell: - type: str - buy: - type: str - last: - type: str - volume: - type: str - mapping: - - key: currency_pair_first - path: - - data - - dict_values - - base_unit - type: - - str - - key: currency_pair_second - path: - - data - - dict_values - - quote_unit - type: - - str - - key: last_price - path: - - data - - dict_values - - last - type: - - str - - float - - key: time - path: - - data - - dict_values - - at - type: - - float - - from_timestamp - - 0 - - key: best_bid - path: - - data - - dict_values - - buy - type: - - str - - float - - key: best_ask - path: - - data - - dict_values - - sell - type: - - str - - float - - key: daily_volume - path: - - data - - dict_values - - volume - type: - - str - - float - - historic_rates: - request: - template: k - pair_template: - template: "{first}{second}" - lower_case: true - alias: market - params: - limit: - max: null - default: 10000 - period: - allowed: - minutes: 1 - hours: 60 - days: 1440 - default: 1440 #daily - timestamp: - function: last_timestamp # data after that timestamp - type: - - datetime - - timedelta - - interval - - 10000 - response: - type: dict - values: - data: - type: list - values: - type: list - values: - 0: # timestamp - type: int - 1: #open - type: float - 2: #high - type: float - 3: #low - type: float - 4: #close - type: float - 5: #vol - type: float - - mapping: - - key: time - path: - - data - - 0 - type: - - float - - from_timestamp - - 0 - - key: open - path: - - data - - 1 - type: - - float - - key: high - path: - - data - - 2 - type: - - float - - key: low - path: - - data - - 3 - type: - - float - - key: close - path: - - data - - 4 - type: - - float - - key: volume - path: - - data - - 5 - type: - - float - - - trades: - request: - template: trades - pair_template: - template: "{first}{second}" - lower_case: true - alias: market - params: - limit: - default: 200 - - response: - type: dict - values: - data: - type: list - values: - type: dict - values: - id: - type: int - price: - type: str - volume: - type: str - side: - type: str - created_on: - type: int - - - mapping: - - key: time - path: - - data - - created_on - type: - - float - - from_timestamp - - 0 - - key: id - path: - - data - - id - type: - - int - - key: direction - path: - - data - - side - type: - - value - - map - - bid - - buy - - ask - - sell - - key: price - path: - - data - - price - type: - - str - - float - - key: amount - path: - - data - - volume - type: - - str - - float - - order_books: - request: - template: order_book - pair_template: - template: "{first}{second}" - lower_case: true - alias: market - params: - limit: - max: 300 - default: 50 - - response: - type: dict - values: - data: - type: dict - values: - timestamp: - type: int - asks: - type: list - values: - type: list - values: - 0: # price - type: str - 1: #qty - type: str - bids: - type: list - values: - type: list - values: - 0: # price - type: str - 1: #qty - type: str - mapping: - - key: time - path: - - data - - timestamp - type: - - float - - from_timestamp - - 0 - - key: id - path: - - data - - timestamp - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - data - - bids - - 1 - type: - - str - - float - - key: bids_price - path: - - data - - bids - - 0 - type: - - str - - float - - key: asks_amount - path: - - data - - asks - - 1 - type: - - str - - float - - key: asks_price - path: - - data - - asks - - 0 - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/okcoin.yaml b/pandas_datareader/crypto/resources/running_exchanges/okcoin.yaml deleted file mode 100644 index d0846e3b..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/okcoin.yaml +++ /dev/null @@ -1,338 +0,0 @@ -name: okcoin -exchange: true - -api_url: https://www.okcoin.com/api/spot/v3/ -rate_limit: - max: 360 - unit: 60 - -requests: - currency_pairs: - request: - template: instruments - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - base_currency: - type: str - quote_currency: - type: str - mapping: - - key: currency_pair_first - path: - - base_currency - type: - - str - - key: currency_pair_second - path: - - quote_currency - type: - - str - - - tickers: - request: - template: instruments/ticker - pair_template: null # - params: null - response: - type: list - values: - type: dict - values: - instrument_id: - type: str - last: - type: str - bid: - type: str - ask: - type: str - base_volume_24h: - type: str - timestamp: - type: str - quote_volume_24h: - type: str - mapping: - - key: currency_pair_first - path: - - product_id - type: - - str - - split - - "-" - - 0 - - key: currency_pair_second - path: - - product_id - type: - - str - - split - - "-" - - 1 - - key: time - path: - - timestamp - type: - - str - - dateparser - - key: last_price - path: - - last - type: - - str - - float - - key: best_ask - path: - - ask - type: - - str - - float - - key: best_bid - path: - - bid - type: - - str - - float - - key: daily_volume - path: - - base_volume_24h - type: - - str - - float - - order_books: - request: - template: instruments/{currency_pair}/book - pair_template: # e.g. btc_usd - template: "{first}-{second}" - lower_case: false - params: - size: - type: int - min: 1 - max: 200 - required: false - default: 50 - merge: - type: int - possible: - - 1 - - 0.1 - required: false - response: - type: dict - values: - asks: - type: list - values: - type: list - values: - 0: # price - type: str - 1: # size - type: str - bids: - type: list - values: - type: list - values: - 0: # price - type: str - 1: # size - type: str - timestamp: - type: str - mapping: - - key: time - path: - - timestamp - type: - - str - - dateparser - - key: id - path: - - timestamp - type: - - str - - dateparser - - totimestamp - - key: position - path: [] - type: - - none - - range - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - trades: - request: - template: instruments/{currency_pair}/trades - pair_template: # e.g. btc_usd - template: "{first}-{second}" - lower_case: false - params: - limit: - type: int - max: 100 - default: 100 - response: - type: list - values: - type: dict - values: - timestamp: - type: str - price: - type: str - size: - type: str - trade_id: - type: str - side: - type: str - mapping: - - key: time - path: - - timestamp - type: - - str - - dateparser - - key: id - path: - - timestamp - type: - - str - - dateparser - - totimestamp - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - size - type: - - str - - key: direction - path: - - side - type: - - str - - historic_rates: - request: - template: instruments/{currency_pair}/candles - pair_template: # e.g. btc_usd - template: "{first}-{second}" - lower_case: false - params: - granularity: - allowed: - minutes: 60 - hours: 3600 - days: 86400 - weeks: 604800 - default: 86400 # 1 day -# start: #returns only the last 200 entries until end or "today". -# function: last_timestamp -# type: -# - datetime -# - timedelta -# - interval -# - 1000 -# - fromtimestamp -# - "%Y-%m-%dT%H:%M:%S.%fZ" - end: - function: last_timestamp - type: - - datetime - - format - - "%Y-%m-%dT%H:%M:%S.%fZ" # e.g. 2020-11-10T16:00:00.000Z - response: - type: list - values: - type: list - values: - 0: # timestamp - type: str - 1: # open - type: str - 2: # high - type: str - 3: # low - type: str - 4: # close - type: str - 5: # volume - type: str - mapping: - - key: time - path: - - 0 - type: - - str - - dateparser - - key: open - path: - - 1 - type: - - str - - float - - key: high - path: - - 2 - type: - - str - - float - - key: low - path: - - 3 - type: - - str - - float - - key: close - path: - - 4 - type: - - str - - float - - key: volume - path: - - 5 - type: - - str - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/okex.yaml b/pandas_datareader/crypto/resources/running_exchanges/okex.yaml deleted file mode 100644 index 7cde4876..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/okex.yaml +++ /dev/null @@ -1,360 +0,0 @@ -name: okex -exchange: true - -api_url: https://www.okex.com/api/spot/v3/ -rate_limit: - max: 20 - unit: 2 -requests: - currency_pairs: - request: - template: instruments - pair_template: null - params: null - - response: - type: list - values: - type: dict - values: - base_currency: - type: str - category: - type: str - instrument_id: - type: str - min_size: - type: str - quote_currency: - type: str - size_increment: - type: str - tick_size: - type: str - mapping: - - key: currency_pair_first - path: - - base_currency - type: - - str - - lower - - key: currency_pair_second - path: - - quote_currency - type: - - str - - lower - - - tickers: - request: - template: instruments/ticker - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - best_ask: - type: str - best_bid: - type: str - instrument_id: - type: str - product_id: - type: str - last: - type: str - last_qty: - type: str - ask: - type: str - best_ask_size: - type: str - bid: - type: str - best_bid_size: - type: str - open: - type: str - open_24h: - type: str - high_24h: - type: str - low_24h: - type: str - base_volume_24h: - type: str - timestamp: - type: str - qutote_volume_24h: - type: str - - mapping: - - key: currency_pair_first - path: - - instrument_id - type: - - str - - split - - "-" - - 0 - - key: currency_pair_second - path: - - instrument_id - type: - - str - - split - - "-" - - 1 - - key: best_bid - path: - - best_bid - type: - - str - - float - - key: last_price - path: - - last - type: - - str - - float - - key: best_ask - path: - - best_ask - type: - - str - - float - - key: daily_volume - path: - - base_volume_24h - type: - - str - - float -# - order_books: - request: - template: instruments/{currency_pair}/book - pair_template: # e.g. btc_usd - template: "{first}-{second}" - lower_case: false - params: - size: - min: 1 - max: 200 - default: 50 - response: - type: dict - values: - asks: - type: list - values: - type: list - values: - 0: # price - type: float - 1: # size - type: float - bids: - type: list - values: - type: list - values: - 0: # price - type: float - 1: # size - type: float - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: asks_price - path: - - asks - - 0 - type: - - float - - key: asks_amount - path: - - asks - - 1 - type: - - float - - key: bids_price - path: - - bids - - 0 - type: - - float - - key: bids_amount - path: - - bids - - 1 - type: - - float - - trades: - request: - template: instruments/{currency_pair}/trades - pair_template: # e.g. btc_usd - template: "{first}-{second}" - lower_case: false - params: - limit: # get recently 60 pieces of data starting from the given tid (optional) - type: str - required: false - default: 100 - response: - type: list - values: - type: dict - values: - 0: - type: str - 1: - type: str - 2: - type: str - 3: - type: str - 4: - type: str - 5: - type: str - mapping: - - key: time - path: - - dict_values - - 1 - type: - - str - - strptime - - "%Y-%m-%dT%H:%M:%S.%fZ" - - key: price - path: - - dict_values - - 3 - type: - - str - - float - - key: amount - path: - - dict_values - - 4 - type: - - str - - float - - key: direction - path: - - dict_values - - 5 - type: - - str - - key: id - path: - - dict_values - - 2 - type: - - str - - int - - historic_rates: - request: - template: instruments/{currency_pair}/candles - pair_template: # e.g. btc_usd - template: "{first}-{second}" - lower_case: false - params: - granularity: - allowed: - minutes: 60 - hours: 3600 - days: 86400 - weeks: 604800 - default: 86400 # 1day - limit: - default: 300 - start: - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 300 - - from_timestamp - - 0 - - "%Y-%m-%dT%H:%M:%S.%fZ" - end: - function: last_timestamp - type: - - datetime - - format - - "%Y-%m-%dT%H:%M:%S.%fZ" - response: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - 2: - type: str - 3: - type: str - 4: - type: str - 5: - type: str - mapping: - - key: time - path: - - 0 - type: - - str - - strptime - - "%Y-%m-%dT%H:%M:%S.%fZ" - - key: open - path: - - 1 - type: - - str - - float - - key: high - path: - - 2 - type: - - str - - float - - key: low - path: - - 3 - type: - - str - - float - - key: close - path: - - 4 - type: - - str - - float - - key: volume - path: - - 5 - type: - - str - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/omgfin.yaml b/pandas_datareader/crypto/resources/running_exchanges/omgfin.yaml deleted file mode 100644 index 9f17a715..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/omgfin.yaml +++ /dev/null @@ -1,359 +0,0 @@ -#ToDO: HR endpoint is not really working. Frequently returning data is non-json format (status 503) which can not -# be parsed. - -name: omgfin -api_url: https://omgfin.com/api/v1/ -rate_limit: - max: 600 - unit: 60 - - -requests: - - currency_pairs: - request: - template: exchangeInfo - pair_template: null - params: null - - response: - type: dict - values: - symbols: - type: list - values: - type: dict - values: - baseAsset: - type: str - quoteAsset: - type: str - mapping: - - key: currency_pair_first - path: - - symbols - - baseAsset - type: - - str - - key: currency_pair_second - path: - - symbols - - quoteAsset - type: - - str - - tickers: - request: - template: ticker/summary - pair_template: null - params: null - response: - type: dict - values: - currency_pair: - type: dict - values: - last: - type: str - lowestAsk: - type: str - highest_bid: - type: str - percentChange: - type: str - baseVolume: - type: str - quoteVolume: - type: str - high24h: - type: str - low24h: - type: str - mapping: - - key: time - path: [] - type: - - none - - now - - key: currency_pair_first - path: - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - dict_key - type: - - str - - split - - "_" - - 1 - - key: last_price - path: - - dict_values - - last - type: - - str - - float - - key: best_bid - path: - - dict_values - - highestBid - type: - - str - - float - - key: best_ask - path: - - dict_values - - lowestAsk - type: - - str - - float - - key: daily_volume - path: - - dict_values - - baseVolume - type: - - str - - float - - historic_rates: - request: - template: klines - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - interval: - allowed: - minutes: 1m - hours: 1h - days: 1d - weeks: 1w - default: 1d - limit: - default: 300 # max: 300 -# startTime: -# function: last_timestamp -# type: -# - datetime -# - timedeltams -# - interval -# - 300 - endTime: - function: last_timestamp - type: - - datetime - - timestampms - response: - type: list - values: - type: dict - values: - OT: - type: int - O: - type: str - H: - type: str - L: - type: str - C: - type: str - CT: - type: int - QV: - type: str - V: - type: str - - mapping: - - key: time - path: - - CT - type: - - float - - from_timestamp - - 1 - - key: open - path: - - O - type: - - str - - float - - key: high - path: - - H - type: - - str - - float - - key: low - path: - - L - type: - - str - - float - - key: close - path: - - C - type: - - str - - float - - key: volume - path: - - V - type: - - str - - float - - - trades: - request: - template: trades/{currency_pair} - pair_template: - template: "{first}{second}" - lower_case: false - params: - limit: - max: 1000 - default: 500 - - response: - type: list - values: - type: dict - values: - id: - type: int - price: - type: str - qty: - type: str - time: - type: int - isBuyerMaker: - type: str - isBestMatch: - type: str - - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: id - path: - - id - type: - - int - - key: direction - path: - - isBuyerMaker - type: - - value - - map - - True - - sell - - False - - buy - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - qty - type: - - str - - float - - order_books: - request: - template: orderbook/{currency_pair} - pair_template: - template: "{first}{second}" - lower_case: false - params: - limit: - max: 500 - default: 50 - - response: - type: dict - values: - timestamp: - type: int - bids: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - asks: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - - mapping: - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 0 - - key: id - path: - - timestamp - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/p2pb2b.yaml b/pandas_datareader/crypto/resources/running_exchanges/p2pb2b.yaml deleted file mode 100644 index 4f3ff4e0..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/p2pb2b.yaml +++ /dev/null @@ -1,393 +0,0 @@ -# ToDo: Function für einen Offset für HR schreiben. - -name: p2pb2b -exchange: true -rate_limit: - max: 100 - unit: 60 -api_url: https://api.p2pb2b.io/api/v2/public/ - -requests: - currency_pairs: - request: - template: markets - pair_template: null - params: null - response: - type: dict - values: - result: - type: list - values: - type: dict - values: - name: - type: str - stock: - type: str - money: - type: str - mapping: - - key: currency_pair_first - path: - - result - - stock - type: - - str - - key: currency_pair_second - path: - - result - - money - type: - - str - - tickers: - request: - template: tickers - pair_template: null - params: null - response: - type: dict - values: - success: - type: bool - message: - type: str - resulst: - type: dict - values: - currency_pair: - type: dict - values: - at: - type: int - ticker: - type: dict - values: - bid: - type: float - ask: - type: float - low: - type: float - high: - type: float - last: - type: float - vol: - type: float - change: - type: float - mapping: - - key: time - path: - - result - - dict_values - - at - type: - - float - - from_timestamp - - 0 - - key: currency_pair_first - path: - - result - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - result - - dict_key - type: - - str - - split - - "_" - - 1 - - key: last_price - path: - - result - - dict_values - - ticker - - last - type: - - float - - key: best_bid - path: - - result - - dict_values - - ticker - - bid - type: - - float - - key: best_ask - path: - - result - - dict_values - - ticker - - ask - type: - - float - - key: daily_volume - path: - - result - - dict_values - - ticker - - vol - type: - - float - - trades: - request: - template: history - pair_template: - template: "{first}_{second}" - lower_case: false - alias: market - params: - lastId: - type: int - default: 1 - limit: - type: int - default: 100 - response: - type: dict - values: - success: - type: bool - message: - type: str - result: - type: list - values: - type: dict - values: - id: - type: int - type: - type: str - time: - type: int - amount: - type: float - price: - type: float - - mapping: - - key: time - path: - - result - - time - type: - - float - - from_timestamp - - 0 - - key: id - path: - - result - - id - type: - - int - - key: amount - path: - - result - - amount - type: - - float - - key: price - path: - - result - - price - type: - - float - - key: direction - path: - - result - - type - type: - - str - - order_books: - request: - template: depth/result - pair_template: - template: "{first}_{second}" - lower_case: false - alias: market - params: - limit: - type: int - default: 100 - interval: - default: 0 - - response: - type: dict - values: - result: - type: dict - asks: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - bids: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - cache_time: - type: float - current_time: - type: float - mapping: - - key: id - path: - - cache_time - type: - - float - - int - - key: time - path: - - cache_time - type: - - float - - from_timestamp - - 0 - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - result - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - result - - bids - - 1 - type: - - str - - float - - key: asks_price - path: - - result - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - result - - asks - - 1 - type: - - str - - float - - historic_rates: - request: - template: market/kline - pair_template: - template: "{first}_{second}" - lower_case: false - alias: market - params: - interval: - allowed: - minutes: 1m - hours: 1h - days: 1d - default: 1d - limit: - type: int - default: 500 - - response: - type: dict - values: - result: - type: list - values: - type: dict - values: - 0: #time - type: int - 1: #open - type: str - 2: #close - type: str - 3: #high - type: str - 4: #low - type: str - 5: #volume - type: str - 6: #amount - type: str - - mapping: - - key: time - path: - - result - - 0 - type: - - float - - from_timestamp - - 0 - - key: open - path: - - result - - 1 - type: - - str - - float - - key: high - path: - - result - - 3 - type: - - str - - float - - key: low - path: - - result - - 4 - type: - - str - - float - - key: close - path: - - result - - 2 - type: - - str - - float - - key: volume - path: - - result - - 5 - type: - - str - - float - - - diff --git a/pandas_datareader/crypto/resources/running_exchanges/poloniex.yaml b/pandas_datareader/crypto/resources/running_exchanges/poloniex.yaml deleted file mode 100644 index 280bf1c4..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/poloniex.yaml +++ /dev/null @@ -1,354 +0,0 @@ -name: poloniex -exchange: true -api_url: https://poloniex.com/ -rate_limit: null -requests: - currency_pairs: - request: - template: public?command=returnTicker - pair_template: null - params: null - response: - type: dict - values: - currency_pair: # variable key, each currency pair e.g. ltc_btc - type: dict - values: - last: - type: float - lowestAsk: - type: float - highestBid: - type: float - percentChange: - type: float - baseVolume: - type: float - quoteVolume: - type: float - isFrozen: - type: int - high24hr: - type: float - low24hr: - type: float - mapping: - - key: currency_pair_first - path: - - dict_key - type: - - str - - splitupper - - "_" - - 1 - - key: currency_pair_second - path: - - dict_key - type: - - str - - splitupper - - "_" - - 0 - - tickers: - request: - template: public?command=returnTicker - pair_template: null - params: null - response: - type: dict - values: - currency_pair: # variable key, each currency pair e.g. ltc_btc - type: dict - values: - last: - type: float - lowestAsk: - type: float - highestBid: - type: float - percentChange: - type: float - baseVolume: - type: float - quoteVolume: - type: float - isFrozen: - type: int - high24hr: - type: float - low24hr: - type: float - mapping: - - key: time - path: [] - type: - - none - - now - - key: currency_pair_first - path: - - dict_key - type: - - str - - splitupper - - "_" - - 1 - - key: currency_pair_second - path: - - dict_key - type: - - str - - splitupper - - "_" - - 0 - - key: last_price - path: - - dict_values - - last - type: - - float - - key: best_bid - path: - - dict_values - - highestBid - type: - - float - - key: best_ask - path: - - dict_values - - lowestAsk - type: - - float - - key: daily_volume - path: - - dict_values - - base_volume - type: - - float - - historic_rates: - request: - template: public?command=returnChartData - pair_template: - template: "{first}_{second}" - alias: currencyPair - lower_case: false - params: - start: - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 1000 -# type: int -# default: 946684800 # 01.01.2000 - period: - allowed: - minutes: 300 - hours: 7200 - days: 86400 - default: 86400 #1 Day in Seconds - - response: - type: list - values: - type: dict - values: - date: - type: int - high: - type: float - low: - type: float - open: - type: float - close: - type: float - quoteVolume: - type: float - weightedAverage: - type: flaot - - mapping: - - key: time - path: - - date - type: - - float - - from_timestamp - - 0 - - key: close - path: - - close - type: - - float - - key: open - path: - - open - type: - - float - - key: high - path: - - high - type: - - float - - key: low - path: - - low - type: - - float - - key: volume - path: - - volume - type: - - float - - order_books: - request: - template: public?command=returnOrderBook - pair_template: - template: "{first}_{second}" - alias: currencyPair - lower_case: false - params: - depth: - type: int - default: 100 - - response: - type: dict - values: - ask: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: float - bids: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: float - is_frozen: - type: str - seq: - type: int - - mapping: - - key: time - path: [] - type: - - none - - now - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - bids - - 1 - type: - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - float - - key: id - path: - - seq - type: - - int - - key: position - path: [] - type: - - none - - range - - trades: - request: - template: public?command=returnTradeHistory - pair_template: - template: "{first}_{second}" - alias: currencyPair - lower_case: false - params: null - - response: - type: list - values: - type: dict - values: - globalTradeID: - type: int - tradeID: - type: int - date: - type: str - type: - type: str - rate: - type: str - amount: - type: str - total: - type: str - orderNumber: - type: str - mapping: - - key: time - path: - - date - type: - - str - - strptime - - "%Y-%m-%d %H:%M:%S" - - key: id - path: - - tradeID - type: - - str - - int - - key: price - path: - - rate - type: - - str - - float - - key: amount - path: - - amount - type: - - str - - float - - key: direction - path: - - type - type: - - str - - - - - - diff --git a/pandas_datareader/crypto/resources/running_exchanges/stormgain.yaml b/pandas_datareader/crypto/resources/running_exchanges/stormgain.yaml deleted file mode 100644 index ffaa3e66..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/stormgain.yaml +++ /dev/null @@ -1,229 +0,0 @@ -#ToDO: trades do not respond. Either no trades are made or the API is dysfunctional. - -name: stormgain -exchange: true -rate_limit: - -api_url: https://public-api.stormgain.com/api/v1/ - -requests: - currency_pairs: - request: - template: spot/summary - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - base_currency: - type: str - quote_currency: - type: str - - mapping: - - key: currency_pair_first - path: - - base_currency - type: - - str - - key: currency_pair_second - path: - - quote_currency - type: - - str - tickers: - request: - template: spot/summary - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - base_currency: - type: str - quote_currency: - type: str - last_price: - type: str - lowest_ask: - type: str - highest_bid: - type: str - base_volume: - type: str - mapping: - - key: currency_pair_first - path: - - base_currency - type: - - str - - key: currency_pair_second - path: - - quote_currency - type: - - str - - key: last_price - path: - - last_price - type: - - str - - float - - key: best_bid - path: - - highest_bid - type: - - str - - float - - key: best_ask - path: - - lowest_ask - type: - - str - - float - - key: daily_volume - path: - - base_volume - type: - - str - - float - - order_books: - request: - template: orderbook/{currency_pair} - pair_template: - template: "{first}_{second}" - lower_case: false - params: null - - response: - type: dict - values: - timestamp: - type: int - bids: - type: list - values: - type: list - values: - 0: #price - type: str - 1: # quantity - type: str - asks: - type: list - values: - type: list - values: - 0: #price - type: str - 1: # quantity - type: str - mapping: - - key: id - path: - - timestamp - type: - - int - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 1 - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - trades: - request: - template: trade/{currency_pair} - pair_template: - template: "{first}_{second}" - lower_case: false - params: null - - response: - type: list - values: - type: dict - values: - trade_id: - type: int - timestamp: - type: str - type: - type: str - price: - type: str - base_volume: - type: str - quote_volume: - type: str - mapping: - - key: id - path: - - trade_id - type: - - int - - key: time - path: - - timestamp - type: - - str - - float - - from_timestamp - - 1 - - key: direction - path: - - type - type: - - str - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - base_volume - type: - - str - - float - - diff --git a/pandas_datareader/crypto/resources/running_exchanges/therocktrading.yaml b/pandas_datareader/crypto/resources/running_exchanges/therocktrading.yaml deleted file mode 100644 index 032ada09..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/therocktrading.yaml +++ /dev/null @@ -1,340 +0,0 @@ -name: therocktrading -exchange: true - -rate_limit: - max: 600 - unit: 60 - -api_url: https://api.therocktrading.com/v1/ - -requests: - currency_pairs: - request: - template: funds - pair_template: null - params: null - - response: - type: dict - values: - funds: - type: list - values: - type: dict - values: - base_currency: - type: str - trade_currency: - type: str - - - mapping: - - key: currency_pair_first - path: - - funds - - trade_currency - type: - - str - - key: currency_pair_second - path: - - funds - - base_currency - type: - - str - - tickers: - request: - template: funds/{currency_pair}/ticker - pair_template: - template: "{first}{second}" - lower_case: false - params: null - response: - type: dict - values: - date: - type: str - bid: - type: str - ask: - type: str - last: - type: str - volume: - type: str - traded_volume: - type: str - - mapping: - - key: last_price - path: - - last - type: - - str - - float - - key: time - path: - - date - type: - - str - - dateparser - - key: best_bid - path: - - bid - type: - - str - - float - - key: best_ask - path: - - ask - type: - - str - - float - - key: daily_volume - path: - - volume - type: - - str - - float - - historic_rates: - request: - template: funds/{currency_pair}/ohlc_statistics - pair_template: - template: "{first}{second}" - lower_case: false - params: - period: - allowed: - minutes: 1 - hours: 60 -# days: 1440 -# weeks: 10080 -# months: 43200 - default: 60 - before: - function: last_timestamp - type: - - datetime - - format - - "%Y-%m-%dT%H:%M:%S%Z" - after: - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 1000 #max interval 60 DAYS! - - from_timestamp - - 0 - - "%Y-%m-%dT%H:%M:%S%Z" -# default: "2020-03-19T17:25:00.000Z" - sort: - default: DESC - response: - type: list - values: - type: dict - values: - open: - type: float - high: - type: float - low: - type: float - close: - type: float - base_volume: - type: float - trade_volume: - type: float - interval_starts_at: - type: str - interval_ends_at: - type: str - - mapping: - - key: time - path: - - interval_ends_at - type: - - str - - dateparser - - key: open - path: - - open - type: - - float - - key: high - path: - - high - type: - - float - - key: low - path: - - low - type: - - float - - key: close - path: - - close - type: - - float - - key: volume - path: - - traded_volume - type: - - float - - trades: - request: - template: funds/{currency_pair}/trades - pair_template: - template: "{first}{second}" - lower_case: false - params: -# before: -# function: last_timestamp -# type: -# - datetime -# - format -# - "%Y-%m-%dT%H:%M:%S%Z" -# after: -# function: last_timestamp -# type: -# - datetime -# - timedelta -# - interval -# - 1000 -# - fromtimestamp -# - "%Y-%m-%dT%H:%M:%S%Z" - per_page: - max: 250 - default: 250 - - response: - type: dict - values: - type: list - values: - type: dict - values: - trade_id: - type: int - amount: - type: float - price: - type: float - side: - type: str - date: - type: str - - - mapping: - - key: time - path: - - trades - - date - type: - - str - - dateparser - - key: id - path: - - trades - - id - type: - - int - - key: direction - path: - - trades - - side - type: - - str - - key: price - path: - - trades - - price - type: - - float - - key: amount - path: - - trades - - amount - type: - - float - - order_books: - request: - template: funds/{currency_pair}/orderbook - pair_template: - template: "{first}{second}" - lower_case: false - params: - limit: - default: 50 - response: - type: dict - values: - date: - type: str - asks: - type: list - values: - type: dict - values: - price: - type: float - amount: - type: float - bids: - type: list - values: - type: dict - values: - price: - type: float - amount: - type: float - - mapping: - - key: time - path: - - date - type: - - str - - dateparser - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bids - - amount - type: - - float - - key: bids_price - path: - - bids - - price - type: - - float - - key: asks_amount - path: - - asks - - amount - type: - - float - - key: asks_price - path: - - asks - - price - type: - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/tidex.yaml b/pandas_datareader/crypto/resources/running_exchanges/tidex.yaml deleted file mode 100644 index 53ee1022..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/tidex.yaml +++ /dev/null @@ -1,270 +0,0 @@ -name: tidex -exchange: true - -api_url: https://api.tidex.com/api/3/ -rate_limit: null - -requests: - currency_pairs: - request: - template: info - pair_template: null - params: null - response: - type: dict - values: - server_time: - type: - - int - pairs: - type: dict - values: - currency_pair: # each available currency pair e.g. eth_btc - type: dict - values: - decimal_places: - type: int - min_price: - type: float - max_price: - type: float - min_amount: - type: float - hidden: - type: int - fee: - type: float - mapping: - - key: currency_pair_first - path: # key not values! - - pairs - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: # key not values! - - pairs - - dict_key - type: - - str - - split - - "_" - - 1 - - tickers: - request: - template: ticker/{currency_pair}/ - pair_template: # e.g. eth_btc - template: "{first}_{second}" - lower_case: true - params: null - response: - type: dict - values: - currency_pair: # variable key, requested currency pair - type: dict - values: - high: - type: float - low: - type: float - avg: - type: float - vol: # trade volume - type: float - vol_cur: # trade volume in currency - type: float - last: # price of last trade - type: float - buy: - type: float - sell: - type: float - updated: - type: - - float - - from_timestamp - - 0 - mapping: - - key: daily_volume - path: - - dict_values - - vol - type: - - float - - key: last_price - path: - - dict_values - - last - type: - - float - - key: best_ask - path: - - dict_values - - buy - type: - - float - - key: best_bid - path: - - dict_values - - sell - type: - - float - - key: time - path: - - dict_values - - updated - type: - - float - - from_timestamp - - 0 - - order_books: - request: - template: depth/{currency_pair} - pair_template: # e.g. eth_btc - template: "{first}_{second}" - lower_case: true - params: - limit: - type: int - default: 150 - response: - type: dict - values: - currency_pair: # requested currency pair - type: dict - values: - asks: - type: list - values: - type: list - values: - 0: # price - type: float - 1: # size - type: float - bids: - type: list - values: - type: list - values: - 0: # price - type: float - 1: # size - type: float - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: asks_price - path: - - dict_values - - asks - - 0 - type: - - float - - key: asks_amount - path: - - dict_values - - asks - - 1 - type: - - float - - key: bids_price - path: - - dict_values - - bids - - 0 - type: - - float - - key: bids_amount - path: - - dict_values - - bids - - 1 - type: - - float - - trades: - request: - template: trades/{currency_pair} - pair_template: # e.g. eth_btc - template: "{first}_{second}" - lower_case: true - params: - limit: - type: int - default: 150 - response: - type: dict - values: - currency_pair: # requested currency pair - type: list - values: - type: dict - values: - type: - type: str - price: - type: float - amount: - type: float - tid: - type: int - timestamp: - type: - - int - mapping: - - key: direction - path: - - dict_values - - type - type: - - value - - map - - ask - - sell - - bid - - buy - - key: id - path: - - dict_values - - tid - type: - - int - - key: price - path: - - dict_values - - price - type: - - float - - key: amount - path: - - dict_values - - amount - type: - - float - - key: time - path: - - dict_values - - timestamp - type: - - float - - from_timestamp - - 0 diff --git a/pandas_datareader/crypto/resources/running_exchanges/upbit.yaml b/pandas_datareader/crypto/resources/running_exchanges/upbit.yaml deleted file mode 100644 index 0beb46fa..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/upbit.yaml +++ /dev/null @@ -1,320 +0,0 @@ -name: upbit -exchange: true -api_url: https://api.upbit.com/v1/ -rate_limit: null - -requests: - currency_pairs: - request: - template: market/all - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - market: # e.g. KRW-BTC - type: str - korean_name: - type: str - english_name: - type: str - mapping: - - key: currency_pair_first - path: - - market - type: - - str - - split - - "-" - - 1 - - key: currency_pair_second - path: - - market - type: - - str - - split - - "-" - - 0 - - historic_rates: - request: - template: candles/{frequency} - pair_template: # e.g. KRW-BTC - template: "{second}-{first}" - lower_case: false - alias: market - params: - frequency: - allowed: - minutes: minutes/1 - hours: minutes/60 - days: days - weeks: weeks - months: months - default: days - to: - function: last_timestamp - type: - - datetime - - format - - "%Y-%m-%dT%H:%M:%S.%fZ" - count: - type: int - max: 200 - default: 200 - response: - type: list - values: - type: dict - values: - market: - type: str - candle_date_time_utc: - type: - - str - candle_date_time_kst: - type: - - str - opening_price: - type: float - high_price: - type: float - low_price: - type: float - trade_price: - type: float - timestamp: - type: - - int - candle_acc_trade_price: - type: float - candle_acc_trade_volume: - type: float - mapping: - - key: open - path: - - opening_price - type: - - float - - key: high - path: - - high_price - type: - - float - - key: low - path: - - low_price - type: - - float - - key: close - path: - - trade_price - type: - - float - - key: time - path: - - candle_date_time_utc - type: - - str - - dateparser - - key: volume - path: - - candle_acc_trade_volume - type: - - float - - trades: - request: - template: trades/ticks - pair_template: # e.g. KRW-BTC - template: "{second}-{first}" - lower_case: false - alias: market - params: - count: - type: int - default: 1000 - response: - type: list - values: - type: dict - values: - market: - type: str - trade_date_utc: - type: - - str - - strptime - - "%Y-%m-%d" - trade_time_utc: - type: - - str - - strptime - - "%H:%M:%S" - timestamp: - type: - - float - - from_timestamp - - 0 - trade_price: - type: float - trade_volume: - type: float - prev_closing_price: - type: float - change_price: - type: float - ask_bid: # ask or bid - type: str - mapping: - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 1 - - key: price - path: - - trade_price - type: - - float - - key: amount - path: - - trade_volume - type: - - float - - key: direction - path: - - ask_bid - type: - - value - - map - - ASK - - sell - - BID - - buy - - key: id - path: - - sequential_id - type: - - float - - tickers: - request: - template: ticker - pair_template: - template: "{second}-{first}" - lower_case: false - alias: markets - params: null - response: - type: list - values: - type: dict - values: - market: - type: str - trade_date: - type: str - trade_time: - type: str - trade_timestamp: - type: int - trade_price: - type: int - mapping: - - key: time - path: - - trade_timestamp - type: - - float - - from_timestamp - - 1 - - key: last_price - path: - - trade_price - type: - - float - - order_books: - request: - template: orderbook - pair_template: # e.g. KRW-BTC - template: "{second}-{first}" - lower_case: false - alias: markets - params: null - response: - type: list - values: - type: dict - values: - market: - type: str - timestamp: - type: - - float - - from_timestamp - - 0 - total_ask_size: - type: float - total_bid_size: - type: float - orderbook_units: - type: list - values: - type: dict - values: - ask_price: - type: float - bid_price: - type: float - ask_size: - type: float - bid_size: - type: float - mapping: - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 1 - - key: id - path: - - timestamp - type: - - int - - key: position - path: [] - type: - - none - - range - - key: asks_price - path: - - orderbook_units - - ask_price - type: - - float - - key: bids_price - path: - - orderbook_units - - bid_price - type: - - float - - key: asks_amount - path: - - orderbook_units - - ask_size - type: - - float - - key: bids_amount - path: - - orderbook_units - - bid_size - type: - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/vcc.yaml b/pandas_datareader/crypto/resources/running_exchanges/vcc.yaml deleted file mode 100644 index a7b3d7d0..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/vcc.yaml +++ /dev/null @@ -1,296 +0,0 @@ - -#https://vcc.exchange/api/#summary -name: vcc -exchange: true - -rate_limit: null - -api_url: https://api.vcc.exchange/v3 - -requests: - currency_pairs: - request: - template: /summary - pair_template: null - params: null - - response: - type: dict - values: - data: - type: dict - values: - currency_pair: - type: dict - - - mapping: - - key: currency_pair_first - path: - - data - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - data - - dict_key - type: - - str - - split - - "_" - - 1 - - tickers: - request: - template: /summary - pair_template: null - params: null - - response: - type: dict - values: - data: - type: dict - values: - currency_pair: - type: dict - values: - last: - type: str - baseVolume: - type: str - quoteVolume: - type: str - highestBid: - type: str - lowestAsk: - type: str - - - mapping: - - key: currency_pair_first - path: - - data - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - data - - dict_key - type: - - str - - split - - "_" - - 1 - - key: last_price - path: - - data - - dict_values - - last - type: - - str - - float - - key: time - path: [] - type: - - none - - now - - key: best_bid - path: - - data - - dict_values - - highestBid - type: - - str - - float - - key: best_ask - path: - - data - - dict_values - - lowestAsk - type: - - str - - float - - key: daily_base_volume - path: - - data - - dict_values - - baseVolume - type: - - str - - float - - key: daily_volume - path: - - data - - dict_values - - quoteVolume - type: - - str - - float - - trades: - request: - template: /trades/{currency_pair} - pair_template: - template: "{first}_{second}" - lower_case: false -# alias: - params: - count: - max: 1000 - default: 500 - - response: - type: dict - values: - data: - type: list - values: - trade_id: - type: int - price: - type: str - base_volume: - type: str - trade_timestamp: - type: int - type: str - - mapping: - - key: time - path: - - data - - trade_timestamp - type: - - str - - float - - from_timestamp - - 1 - - key: id - path: - - data - - trade_id - type: - - int - - key: direction - path: - - data - - type - type: - - str - - key: price - path: - - data - - price - type: - - str - - float - - key: amount - path: - - data - - base_volume - type: - - str - - float - - order_books: - request: - template: /orderbook/{currency_pair} - pair_template: - template: "{first}_{second}" - lower_case: false - params: - depth: - # possible: [0, 5, 10, 20, 50, 500] #zero is full - default: 50 - level: - # possible: [1, 2, 3] # 1: Best Bid/Ask, 2: Aggregated by Price, 3: Full, no agg. - default: 2 - response: - type: dict - values: - dataVersion: - type: str - data: - type: dict - values: - timestamp: - type: str - bids: - type: list - values: - type: list - values: - 0: #price - type: str - 1: # qty - type: str - asks: - type: list - values: - type: list - values: - 0: #qty - type: str - 1: # price - type: str - mapping: - - key: time - path: - - data - - timestamp - type: - - str - - float - - from_timestamp - - 1 - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - data - - bids - - 1 - type: - - str - - float - - key: bids_price - path: - - data - - bids - - 0 - type: - - str - - float - - key: asks_amount - path: - - data - - asks - - 1 - type: - - str - - float - - key: asks_price - path: - - data - - asks - - 0 - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/vindax.yaml b/pandas_datareader/crypto/resources/running_exchanges/vindax.yaml deleted file mode 100644 index 2f6c7f90..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/vindax.yaml +++ /dev/null @@ -1,350 +0,0 @@ -name: vindax -exchange: true -api_url: https://api.vindax.com/api/v1/ -rate_limit: - max: 6 - unit: 1 - -requests: - currency_pairs: - request: - template: returnTicker - pair_template: null - params: null - response: - type: dict - values: - currency_pair: - type: dict - - mapping: - - key: currency_pair_first - path: - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - dict_key - type: - - str - - split - - "_" - - 1 - - tickers: - request: - template: returnTicker - pair_template: null - params: null - response: - type: dict - values: - currency_pair: - type: dict - values: - quote_volume: - type: str - symbol: - type: str - percentChange: - type: float - last: - type: float - highestBid: - type: float - lowsetAsk: - type: float - baseVolume: - type: float - openTime: - type: int - closeTime: - type: int - high24hr: - type: float - low24hr: - type: float - isFrozen: - type: bool - - mapping: - - key: time - path: [] - type: - - none - - now - - key: currency_pair_first - path: - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - dict_key - type: - - str - - split - - "_" - - 1 - - key: last_price - path: - - dict_values - - last - type: - - float - - key: best_bid - path: - - dict_values - - highestBid - type: - - float - - key: best_ask - path: - - dict_values - - lowsetAsk - type: - - float - - - order_books: - request: - template: depth - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - type: int - max: 1000 - default: 50 - response: - type: dict - values: - lastUpdateId: - type: str - bids: - type: list - values: - type: list - values: - 0: #Price - type: float - 1: #Qty - type: float - asks: - type: list - values: - type: list - values: - 0: - type: float - 1: - type: float - mapping: - - key: id - path: [] - type: - - none - - now_timestamp - - key: time - path: [] - type: - - none - - now - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bids - - 1 - type: - - float - - key: asks_amount - path: - - asks - - 1 - type: - - float - - key: bids_price - path: - - bids - - 0 - type: - - float - - key: asks_price - path: - - asks - - 0 - type: - - float - - - trades: - request: - template: trades - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - type: int - max: 500 - default: 100 - - response: - type: list - values: - type: dict - values: - id: - type: str - price: - type: str - qty: - type: str - time: - type: int - isBuyerMaker: - type: true - isBestMatch: - type: true - mapping: - - key: id - path: - - id - type: - - str - - key: direction - path: - - isBuyerMaker - type: - - value - - map - - true - - sell - - false - - buy - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - qty - type: - - str - - float - - - - historic_rates: - request: - template: klines - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - type: int - max: 500 - default: 1000 - interval: - allowed: - minutes: 1m - hours: 1h - days: 1d - weeks: 1w - default: 1d - endTime: - function: last_timestamp - type: - - datetime - - timestampms - - response: - type: list - values: - type: list - values: - 0: - type: int - 1: - type: str - 2: - type: str - 3: - type: str - 4: - type: str - 5: - type: str - 6: - type: str - 7: - type: str - mapping: - - key: time - path: - - [] - - 6 - type: - - float - - from_timestamp - - 1 - - key: open - path: - - [] - - 1 - type: - - str - - float - - key: high - path: - - [] - - 2 - type: - - str - - float - - key: low - path: - - [] - - 3 - type: - - str - - float - - key: close - path: - - [] - - 4 - type: - - str - - float - - key: volume - path: - - [] - - 5 - type: - - str - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/wazirx.yaml b/pandas_datareader/crypto/resources/running_exchanges/wazirx.yaml deleted file mode 100644 index ea23b051..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/wazirx.yaml +++ /dev/null @@ -1,252 +0,0 @@ -name: wazirx -is_exchange: true - -api_url: https://api.wazirx.com/api/v2/ - -requests: - currency_pairs: - request: - template: market-status - pair_template: null - params: null - response: - type: dict - values: - markets: - type: list - values: - type: dict - values: - baseMarket: - type: str - quoteMarket: - type: str - - mapping: - - key: currency_pair_first - path: - - markets - - baseMarket - type: - - str - - upper - - key: currency_pair_second - path: - - markets - - quoteMarket - type: - - str - - upper - - - tickers: - request: - template: tickers - pair_template: null - params: null - response: - type: dict - values: - currency_pair: - type: dict - values: - base_unit: - type: str - quote_unit: - type: str - last: - type: str - sell: - type: str - buy: - type: str - at: - type: int - volume: - type: str - mapping: - - key: currency_pair_first - path: - - dict_values - - base_unit - type: - - str - - upper - - key: currency_pair_second - path: - - dict_values - - quote_unit - type: - - str - - upper - - key: time - path: - - dict_values - - at - type: - - float - - from_timestamp - - 0 - - key: last_price - path: - - dict_values - - last - type: - - str - - float - - key: best_ask - path: - - dict_values - - sell - type: - - str - - float - - key: best_bid - path: - - dict_values - - buy - type: - - str - - float - - key: daily_volume - path: - - dict_values - - volume - type: - - str - - float - - order_books: - request: - template: depth - pair_template: - template: "{first}{second}" - lower_case: true - alias: market - params: null - - response: - type: dict - values: - timestamp: - type: int - asks: - type: list - values: - type: list - values: - 0: # price - type: str - 1: #volume - type: str - bids: - type: list - values: - type: list - values: - 0: # price - type: str - 1: #volume - type: str - - mapping: - - key: time - path: - - timestamp - type: - - str - - float - - from_timestamp - - 0 - - key: id - path: - - timestamp - type: - - str - - int - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - trades: - request: - template: trades - pair_template: - template: "{first}{second}" - lower_case: true - alias: market - params: null - - response: - type: list - values: - type: dict - values: - id: - type: int - price: - type: str - volume: - type: str - funds: - type: str - market: - type: str - created_at: - type: str - side: - type: null - mapping: - - key: time - path: - - created_at - type: - - str - - dateparser - - key: id - path: - - id - type: - - int - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - volume - type: - - str - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/whitebit.yaml b/pandas_datareader/crypto/resources/running_exchanges/whitebit.yaml deleted file mode 100644 index 5244e6a8..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/whitebit.yaml +++ /dev/null @@ -1,237 +0,0 @@ -name: whitebit -exchange: true -api_url: https://whitebit.com/api/v4/public/ - -requests: - currency_pairs: - request: - template: ticker - pair_template: null - params: null - response: - type: dict - values: - currency_pair: - type: dict - values: - base_id: - type: int - quote_id: - type: int - last_price: - type: str - base_volume: - type: str - quote_volume: - type: str - mapping: - - key: currency_pair_first - path: - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - dict_key - type: - - str - - split - - "_" - - 1 - - - tickers: - request: - template: ticker - pair_template: null - params: null - response: - type: dict - values: - currency_pair: - type: dict - values: - base_id: - type: int - quote_id: - type: int - last_price: - type: str - base_volume: - type: str - quote_volume: - type: str - - - mapping: - - key: currency_pair_first - path: - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - dict_key - type: - - str - - split - - "_" - - 1 - - key: last_price - path: - - dict_values - - last_price - type: - - str - - float - - key: daily_volume - path: - - dict_values - - base_volume - type: - - str - - float - - trades: - request: - template: trades/{currency_pair} - pair_template: - template: "{first}_{second}" - lower_case: false - params: null - response: - type: list - values: - type: dict - values: - tradeID: - type: int - price: - type: str - trade_timestamp: - type: int - base_volume: - type: str - quote_volume: - type: str - type: - type: str - mapping: - - key: id - path: - - tradeID - type: - - int - - key: direction - path: - - type - type: - - str - - key: time - path: - - trade_timestamp - type: - - float - - from_timestamp - - 0 - - key: amount - path: - - quote_volume - type: - - str - - float - - key: price - path: - - price - type: - - str - - float - - order_books: - request: - template: orderbook/{currency_pair} - pair_template: - template: "{first}_{second}" - lower_case: false - params: - depth: - type: int - default: 50 - level: - type: int - default: 2 - response: - type: dict - values: - timestamp: - type: int - asks: - type: list - values: - list: - values: - 0: #price - type: str - 1: #qty - type: str - bids: - type: list - values: - list: - values: - 0: #price - type: str - 1: #qty - type: str - mapping: - - key: time - path: - - timestamp - type: - - float - - from_timestamp - - 0 - - key: position - path: [] - type: - - none - - range - - key: id - path: - - timestamp - type: - - int - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/xt.yaml b/pandas_datareader/crypto/resources/running_exchanges/xt.yaml deleted file mode 100644 index 6360597b..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/xt.yaml +++ /dev/null @@ -1,330 +0,0 @@ - -name: xt -exchange: true -api_docs: https://github.com/xtpub/api-doc/blob/master/rest-api-v1-en.md -rate_limit: - max: 1000 - unit: 60 - -api_url: https://api.xt.com - -requests: - currency_pairs: - request: - template: /data/api/v1/getMarketConfig - pair_template: null - params: null - - response: - type: - type: list - values: - currency_pair: - type: dict - - mapping: - - key: currency_pair_first - path: - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - dict_key - type: - - str - - split - - "_" - - 1 - - tickers: - request: - template: /data/api/v1/getTickers - pair_template: null - params: null - response: - type: dict - values: - currency_pair: - type: dict - values: - price: - type: float - ask: - type: float - bid: - type: float - coinVol: - type: float - mapping: - - key: currency_pair_first - path: - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - dict_key - type: - - str - - split - - "_" - - 1 - - key: last_price - path: - - dict_values - - price - type: - - float - - key: time - path: [] - type: - - none - - now - - key: best_bid - path: - - dict_values - - bid - type: - - float - - key: best_ask - path: - - dict_values - - ask - type: - - float - - key: daily_volume - path: - - dict_values - - coinVol - type: - - float - - historic_rates: - request: - template: /data/api/v1/getKLine - pair_template: - template: "{first}_{second}" - lower_case: true - alias: market - params: - type: - allowed: - minutes: 1min - hours: 1hour - days: 1day - weeks: 7day - months: 30day - default: 1day - since: - function: last_timestamp - type: - - datetime - - timedelta - - interval - - 1000 - response: - type: dict - values: - datas: - type: list - values: - type: list - values: - 0: #time - type: int - 1: #open - type: float - 2: #high - type: float - 3: #low - type: float - 4: #close - type: float - 5: #vol - type: float - 6: #turnover - type: float - - mapping: - - key: time - path: - - datas - - 0 - type: - - float - - from_timestamp - - 0 - - key: open - path: - - datas - - 1 - type: - - float - - key: high - path: - - datas - - 2 - type: - - float - - key: low - path: - - datas - - 3 - type: - - float - - key: close - path: - - datas - - 4 - type: - - float - - key: volume - path: - - datas - - 5 - type: - - float - - - trades: - request: - template: /data/api/v1/getTrades - pair_template: - template: "{first}_{second}" - lower_case: true - alias: market - params: null - - response: - type: list - values: - type: list - values: - 0: #time - type: int - 1: #price - type: float - 2: #quantity - type: float - 3: # directoin - type: str - 4: #id - type: int - - mapping: - - key: time - path: - - [] - - 0 - type: - - float - - from_timestamp - - 1 - - key: id - path: - - [] - - 4 - type: - - int - - key: direction - path: - - [] - - 3 - type: - - value - - map - - bid - - buy - - ask - - sell - - key: price - path: - - [] - - 1 - type: - - float - - key: amount - path: - - [] - - 2 - type: - - float - - order_books: - request: - template: /data/api/v1/getDepth - pair_template: - template: "{first}_{second}" - lower_case: true - alias: market - params: null - - response: - type: dict - values: - asks: - type: list - values: - type: list - values: - 0: #price - type: float - 1: #quantity - type: float - bids: - type: list - values: - type: list - values: - 0: #price - type: float - 1: #quantity - type: float - - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bids - - 1 - type: - - float - - key: bids_price - path: - - bids - - 0 - type: - - float - - key: asks_amount - path: - - asks - - 1 - type: - - float - - key: asks_price - path: - - asks - - 0 - type: - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/xtheta_global.yaml b/pandas_datareader/crypto/resources/running_exchanges/xtheta_global.yaml deleted file mode 100644 index c336d4ad..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/xtheta_global.yaml +++ /dev/null @@ -1,303 +0,0 @@ -name: xtheta_global -is_exchange: true - -api_url: https://api.xthetaglobal.com/ -rate_limit: - max: 1500 - unit: 60 - -requests: - currency_pairs: - request: - template: openapi/v1/brokerInfo - pair_template: null - params: null - - response: - type: dict - values: - symbols: - type: list - values: - type: dict - values: - baseAsset: - type: str - quoteAsset: - type: str - - mapping: - - key: currency_pair_first - path: - - symbols - - baseAsset - type: - - str - - key: currency_pair_second - path: - - symbols - - quoteAsset - type: - - str - - tickers: - request: - template: openapi/quote/v1/ticker/price - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: null - - response: - type: dict - values: - symbol: - type: str - price: - type: str - mapping: - - key: time - path: [] - type: - - none - - now - - key: last_price - path: - - price - type: - - str - - float - - order_books: - request: - template: openapi/quote/v1/depth - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - type: int - max: 100 - default: 100 - response: - type: dict - values: - time: - type: int - bids: - type: list - values: - type: list - 0: #price - type: str - 1: #qty - type: str - asks: - type: list - values: - type: list - 0: - type: str - 1: - type: str - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: id - path: - - time - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - bids - - 0 - type: - - str - - float - - key: bids_amount - path: - - bids - - 1 - type: - - str - - float - - key: asks_price - path: - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - asks - - 1 - type: - - str - - float - - trades: - request: - template: openapi/quote/v1/trades - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - limit: - type: int - max: 1000 - default: 500 - response: - type: list - value: - type: dict - values: - price: - type: str - qty: - typ: str - time: - type: int - isBuyerMaker: - type: bool - mapping: - - key: time - path: - - time - type: - - float - - from_timestamp - - 1 - - key: direction - path: - - isBuyerMaker - type: - - value - - map - - True - - sell - - False - - buy - - key: id - path: - - time - type: - - int - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - qty - type: - - str - - float - - historic_rates: - request: - template: openapi/quote/v1/klines - pair_template: - template: "{first}{second}" - lower_case: false - alias: symbol - params: - interval: - allowed: - minutes: 1m - hours: 1h - days: 1d - weeks: 1w - default: 1d - limit: - type: int - max: 1000 - default: 1000 - endTime: - function: last_timestamp - type: - - datetime - - timestampms - - response: - type: list - values: - type: list - values: - 0: #timestamp - type: int - 1: #open - type: str - 2: #high - type: str - 3: #low - type: str - 4: #close - type: str - 5: #volume - type: str - 6: #close time - type: int - 7: # quote Asset volume - type: str - 8: # number of trades - type: int - 9: # taker buy base asset volume - type: str - 10: # taker buy quote asset volume - type: str - - mapping: - - key: time - path: - - 0 - type: - - float - - from_timestamp - - 1 - - key: open - path: - - 1 - type: - - str - - float - - key: high - path: - - 2 - type: - - str - - float - - key: low - path: - - 3 - type: - - str - - float - - key: close - path: - - 4 - type: - - str - - float - - key: volume - path: - - 5 - type: - - str - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/yobit.yaml b/pandas_datareader/crypto/resources/running_exchanges/yobit.yaml deleted file mode 100644 index 7a3aa4dd..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/yobit.yaml +++ /dev/null @@ -1,265 +0,0 @@ -name: yobit - -api_url: https://yobit.net/api/3/ -rate_limit: - max: 30 - unit: 60 -requests: - currency_pairs: - request: - template: info/ - pair_template: null - params: null - response: - type: dict - values: - server_time: - type: - - int - pairs: - type: dict - values: - currency_pair: # e.g. ltc_btc; each available currency_pair, variable key - type: dict - values: - decimal_places: - type: int - min_price: - type: float - max_price: - type: float - min_amount: - type: float - hidden: - type: int - fee: - type: float - mapping: - - key: currency_pair_first - path: - - pairs - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - pairs - - dict_key - type: - - str - - split - - "_" - - 1 - - tickers: - request: - template: ticker/{currency_pair}/ - pair_template: # e.g. ltc_btc - template: "{first}_{second}" - lower_case: true - params: null - response: - type: dict - values: - currency_pair: # requested currency pair - type: dict - values: - high: - type: float - low: - type: float - avg: - type: float - vol: - type: float - vol_cur: - type: float - last: - type: float - buy: - type: float - sell: - type: float - updated: - type: - - int - mapping: - - key: daily_volume - path: - - dict_values - - vol - type: - - float - - key: last_price - path: - - dict_values - - last - type: - - float - - key: best_bid - path: - - dict_values - - buy - type: - - float - - key: best_ask - path: - - dict_values - - sell - type: - - float - - key: time - path: - - dict_values - - updated - type: - - float - - from_timestamp - - 0 - - order_books: - request: - template: depth/{currency_pair}/ - pair_template: # e.g. ltc_btc - template: "{first}_{second}" - lower_case: true - params: - limit: - type: int - max: 2000 - default: 150 - response: - type: dict - values: - currency_pair: # requested currency pair - type: dict - values: - asks: - type: list - values: - type: list - values: - 0: # price - type: float - 1: # size - type: float - bids: - type: list - values: - type: list - values: - 0: # price - type: float - 1: # size - type: float - mapping: - - key: time - path: [] - type: - - none - - now - - key: position - path: [] - type: - - none - - range - - key: id - path: [] - type: - - none - - now_timestamp - - key: asks_price - path: - - dict_values - - asks - - 0 - type: - - float - - key: asks_amount - path: - - dict_values - - asks - - 1 - type: - - float - - key: bids_price - path: - - dict_values - - bids - - 0 - type: - - float - - key: bids_amount - path: - - dict_values - - bids - - 1 - type: - - float - - trades: - request: - template: trades/{currency_pair}/ - pair_template: # e.g. ltc_btc - template: "{first}_{second}" - lower_case: true - params: - limit: - type: int - max: 2000 - default: 150 - response: - type: dict - values: - currency_pair: # requested currency pair - type: list - values: - type: dict - values: - type: - type: str - price: - type: float - amount: - type: float - tid: - type: int - timestamp: - type: - - int - mapping: - - key: direction - path: - - dict_values - - type - type: - - str - - key: price - path: - - dict_values - - price - type: - - float - - key: amount - path: - - dict_values - - amount - type: - - float - - key: time - path: - - dict_values - - timestamp - type: - - float - - from_timestamp - - 0 - - key: id - path: - - dict_values - - tid - type: - - int diff --git a/pandas_datareader/crypto/resources/running_exchanges/zaif.yaml b/pandas_datareader/crypto/resources/running_exchanges/zaif.yaml deleted file mode 100644 index 9c7d3fe2..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/zaif.yaml +++ /dev/null @@ -1,210 +0,0 @@ -name: zaif -is_exchange: true -api_url: https://api.zaif.jp/api/1/ - -rate_limit: null -requests: - currency_pairs: - request: - template: currency_pairs/all - pair_template: null - params: null - response: - type: list - values: - type: dict - values: - title: - type: str - name: - type: str - mapping: - - key: currency_pair_first - path: - - name - type: - - str - - split - - "/" - - 0 - - key: currency_pair_second - path: - - name - type: - - str - - split - - "/" - - 1 - - tickers: - request: - template: ticker/{currency_pair} - pair_template: - template: "{first}_{second}" - lower_case: true - alias: null - params: null - response: - type: dict - values: - last: - type: float - high: - type: float - low: - type: float - vwap: - type: float - volume: - type: float - bid: - type: float - ask: - type: float - - mapping: - - key: time - path: [] - type: - - none - - now - - key: last_price - path: - - last - type: - - float - - key: best_bid - path: - - bid - type: - - float - - key: best_ask - path: - - ask - type: - - float - - trades: - request: - template: trades/{currency_pair} - pair_template: - template: "{first}_{second}" - lower_case: true - alias: null - params: null - response: - type: list - values: - type: dict - values: - date: - type: int - price: - type: float - amount: - type: float - tid: - type: int - currency_pair: - type: str - trade_type: - type: str - mapping: - - key: time - path: - - date - type: - - float - - from_timestamp - - 0 - - key: id - path: - - tid - type: - - int - - key: direction - path: - - trade_type - type: - - str - - key: price - path: - - price - type: - - float - - key: amount - path: - - amount - type: - - float - - order_books: - request: - template: depth/{currency_pair} - pair_template: - template: "{first}_{second}" - lower_case: true - alias: null - params: null - response: - type: dict - values: - asks: - type: list - values: - type: list - values: - 0: - type: flaot - 1: - type: float - bids: - type: list - values: - type: list - values: - 0: - type: float - 1: - type: float - - mapping: - - key: time - path: [] - type: - - none - - now - - key: id - path: [] - type: - - none - - now_timestamp - - key: position - path: [] - type: - - none - - range - - key: bids_amount - path: - - bids - - 1 - type: - - float - - key: bids_price - path: - - bids - - 0 - type: - - float - - key: asks_price - path: - - asks - - 0 - type: - - float - - key: asks_amount - path: - - asks - - 1 - type: - - float diff --git a/pandas_datareader/crypto/resources/running_exchanges/zb.yaml b/pandas_datareader/crypto/resources/running_exchanges/zb.yaml deleted file mode 100644 index dd56aa37..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/zb.yaml +++ /dev/null @@ -1,322 +0,0 @@ -name: zb -is_exchange: true -api_docs: https://www.zb.com/en/api -api_url: http://api.zb.land/ -rate_limit: - max: 60 - unit: 60 - -requests: - currency_pairs: - request: - template: data/v1/markets - pair_template: null - params: null - - response: - type: dict - values: - currency_pair: - type: dict - values: - priceScale: - type: int - - mapping: - - key: currency_pair_first - path: - - dict_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - dict_key - type: - - str - - split - - "_" - - 1 - - tickers: - request: - template: data/v1/ticker - pair_template: - template: "{first}_{second}" - lower_case: true - alias: market - params: null - - response: - type: dict - values: - date: - type: int - ticker: - type: dict - values: - vol: - type: str - last: - type: str - buy: - type: str - sell: - type: str - mapping: - - key: time - path: - - date - type: - - str - - float - - from_timestamp - - 1 - - key: last_price - path: - - ticker - - last - type: - - str - - float - - key: best_ask - path: - - ticker - - sell - type: - - str - - float - - key: best_bid - path: - - ticker - - buy - type: - - str - - float - - key: daily_volume - path: - - ticker - - vol - type: - - str - - float - - - order_books: - request: - template: data/v1/depth - pair_template: - template: "{first}_{second}" - lower_case: true - alias: market - params: - size: - type: int - max: 50 - default: 50 - response: - type: dict - values: - timestamp: - type: int - bids: - type: list - values: - type: list - 0: #price - type: float - 1: #qty - type: float - asks: - type: list - values: - type: list - 0: - type: float - 1: - type: float - mapping: - - key: timestamp - path: - - timestamp - type: - - float - - from_timestamp - - 0 - - key: id - path: - - timestamp - type: - - int - - key: position - path: [] - type: - - none - - range - - key: bids_price - path: - - bids - - 0 - type: - - float - - key: bids_amount - path: - - bids - - 1 - type: - - float - - key: asks_price - path: - - asks - - 0 - type: - - float - - key: asks_amount - path: - - asks - - 1 - type: - - float - - trades: - request: - template: data/v1/trades - pair_template: - template: "{first}_{second}" - lower_case: true - alias: market - params: null - response: - type: list - value: - type: dict - values: - price: - type: str - amount: - typ: str - date: - type: int - type: - type: str - tid: - type: int - mapping: - - key: time - path: - - date - type: - - float - - from_timestamp - - 0 - - key: direction - path: - - type - type: - - str - - key: id - path: - - tid - type: - - int - - key: price - path: - - price - type: - - str - - float - - key: amount - path: - - amount - type: - - str - - float - - historic_rates: - request: - template: data/v1/kline - pair_template: - template: "{first}_{second}" - lower_case: true - alias: market - params: - type: - allowed: - minutes: 1min - days: 1day - hours: 1hour - weeks: 1week - default: 1day - since: - function: last_timestamp - type: - - datetime - - timedeltams - - interval - - 1000 - limit: - type: int - max: 1000 - default: 1000 - - - response: - type: dict - values: - data: - type: list - values: - 0: #timestamp - type: int - 1: #open - type: float - 2: #high - type: float - 3: #low - type: float - 4: #close - type: float - 5: #volume - type: float - - mapping: - - key: time - path: - - data - - 0 - type: - - float - - from_timestamp - - 1 - - key: open - path: - - data - - 1 - type: - - float - - key: high - path: - - data - - 2 - type: - - float - - key: low - path: - - data - - 3 - type: - - float - - key: close - path: - - data - - 4 - type: - - float - - key: volume - path: - - data - - 5 - type: - - float \ No newline at end of file diff --git a/pandas_datareader/crypto/resources/running_exchanges/zbg.yaml b/pandas_datareader/crypto/resources/running_exchanges/zbg.yaml deleted file mode 100644 index 80e3cbcc..00000000 --- a/pandas_datareader/crypto/resources/running_exchanges/zbg.yaml +++ /dev/null @@ -1,405 +0,0 @@ -# Trade direction is available but not certain what is meant... -name: zbg -exchange: true -api_url: https://kline.zbg.com/ - -rate_limit: - max: 1000 - unit: 60 - -requests: - currency_pairs: - request: - template: /exchange/api/v1/common/symbols - pair_template: null - params: null - - response: - type: dict - values: - datas: - type: list - values: - type: dict - values: - symbol: - type: str - base-currency: - type: str - quote-currency: - type: str - - mapping: - - key: currency_pair_first - path: - - datas - - base-currency - type: - - str - - key: currency_pair_second - path: - - datas - - quote-currency - type: - - str - - - tickers: - request: - template: api/data/v1/tickers - pair_template: null - params: - isUseMarketName: - type: str - default: true - response: - type: dict - values: - datas: - type: dict - values: - currency_pair: - type: list - values: - 0: #marketId - type: str - 1: #last price - type: str - 2: #highest price - type: str - 3: #lowest - type: str - 4: #24h volume - type: str - 5: #24h change - type: str - 6: # - type: str - 7: #top buying price - type: str - 8: #top selling price - type: str - 9: #24h volume in unit of buyers currency - type: str - mapping: - - key: time - path: [] - type: - - none - - now - - key: currency_pair_first - path: - - datas - - list_key - type: - - str - - split - - "_" - - 0 - - key: currency_pair_second - path: - - datas - - list_key - type: - - str - - split - - "_" - - 1 - - key: last_price - path: - - datas - - list_values - - 1 - type: - - str - - float - - key: daily_volume - path: - - datas - - list_values - - 4 - type: - - str - - float - - key: best_bid - path: - - datas - - list_values - - 7 - type: - - str - - float - - key: best_ask - path: - - datas - - list_values - - 8 - type: - - str - - float - - - historic_rates: - request: - template: api/data/v1/klines - pair_template: - template: "{first}_{second}" - lower_case: false - alias: marketName - params: - type: - allowed: - minutes: 1M - hours: 1H - days: 1D - weeks: 1W - default: 1D - dataSize: - type: int - default: 10000 - - response: - type: dict - values: - datas: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - 2: # pair - type: str - 3: # time - type: str - 4: # open - type: str - 5: # high - type: str - 6: # low - type: str - 7: # close - type: str - 8: # base volume - type: str - 13: # quote volume - type: str - mapping: - - key: time - path: - - datas - - 3 - type: - - str - - float - - from_timestamp - - 0 - - key: open - path: - - datas - - 4 - type: - - str - - float - - key: high - path: - - datas - - 5 - type: - - str - - float - - key: low - path: - - datas - - 6 - type: - - str - - float - - key: close - path: - - datas - - 7 - type: - - str - - float - - key: volume - path: - - datas - - 8 - type: - - str - - float - - trades: - request: - template: /api/data/v1/trades - pair_template: - template: "{first}_{second}" - lower_case: false - alias: marketName - params: - dataSize: - type: int - max: 1000 - default: 1000 - - response: - type: dict - values: - datas: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - 2: # time - type: str - 3: # pair - type: str - 4: # direction - type: str - 5: # price - type: str - 6: # qty - type: str - mapping: - - key: id - path: - - datas - - 2 - type: - - str - - int - - key: time - path: - - datas - - 2 - type: - - str - - float - - from_timestamp - - 0 - - key: price - path: - - datas - - 5 - type: - - str - - float - - key: amount - path: - - datas - - 6 - type: - - str - - float -# - key: direction # not certain what bid and ask for a direction is -# path: -# - datas -# - 4 -# type: -# - map -# - values -# - bid -# - sell -# - ask -# - buy - - order_books: - request: - template: api/data/v1/entrusts - pair_template: - template: "{first}_{second}" - lower_case: false - alias: marketName - params: - dataSize: - type: int - max: 200 - default: 50 - - response: - type: dict - values: - datas: - type: dict - values: - asks: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - bids: - type: list - values: - type: list - values: - 0: - type: str - 1: - type: str - timestamp: - type: str - mapping: - - key: id - path: - - datas - - timestamp - type: - - str - - int - - key: position - path: [] - type: - - none - - range - - key: time - path: - - datas - - timestamp - type: - - str - - float - - from_timestamp - - 0 - - key: bids_amount - path: - - datas - - bids - - 1 - type: - - str - - float - - key: bids_price - path: - - datas - - bids - - 0 - type: - - str - - float - - key: asks_price - path: - - datas - - asks - - 0 - type: - - str - - float - - key: asks_amount - path: - - datas - - asks - - 1 - type: - - str - - float diff --git a/pandas_datareader/crypto/time_helper.py b/pandas_datareader/crypto/time_helper.py deleted file mode 100644 index e89b4c50..00000000 --- a/pandas_datareader/crypto/time_helper.py +++ /dev/null @@ -1,131 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" -Contains helper classes to manage dates and times. - -Classes: -- TimeHelper: Used to create/convert timezone aware (UTC+0) dates and times. - -Enums: -- TimeUnit: Used to indicate the unit of timestamps. -""" - -from datetime import datetime, timezone -from enum import IntEnum - -from datetime_periods import period -from dateutil.parser import parse - - -class TimeUnit(IntEnum): - """ - An enumeration to indicate the unit of timestamps. - """ - SECONDS = 0 - MILLISECONDS = 1 - MICROSECONDS = 2 - NANOSECONDS = 3 - - -class TimeHelper: - """ - A helper class to create/convert dates and times. - - It ensures that all dates and times are timezone aware (UTC+0). - - freq_map is used to convert specific strings from plural into singular. - """ - freq_map = { - "minutes": "minute", - "hours": "hour", - "days": "day", - "weeks": "week", - "months": "month" - } - - @staticmethod - def now() -> datetime: - """ - Get the current datetime (UTC+0). - - The accuracy is limited to milliseconds and the remaining microseconds are cleared. - - @return: The current datetime (UTC+0). - @rtype: datetime - """ - now = datetime.now(tz=timezone.utc) - return now.replace(microsecond=now.microsecond - now.microsecond % 1000) - - @staticmethod - def now_timestamp(unit: TimeUnit = TimeUnit.SECONDS) -> float: - """ - Get the timestamp of the current datetime (UTC+0). - - @param unit: The desired time unit of the timestamp. - @type unit: TimeUnit - - @return: The timestamp of the current datetime (UTC+0). - @rtype: float - """ - return TimeHelper.to_timestamp(TimeHelper.now(), unit) - - @staticmethod - def from_string(representation: str) -> datetime: - """ - Get a datetime (UTC+0) from a given representation. - - @param representation: The string that represents a datetime. - @type representation: str - - @return: The datetime (UTC+0) of the given representation. - @rtype: datetime - """ - return parse(representation).replace(tzinfo=timezone.utc) - - @staticmethod - def from_timestamp(timestamp: float, unit: TimeUnit = TimeUnit.SECONDS) -> datetime: - """ - Get a datetime (UTC+0) from a given timestamp. - - @param timestamp: The timestamp whose datetime is to be obtained. - @type timestamp: float - @param unit: The time unit in which the timestamp is given. - @type unit: TimeUnit - - @return: The datetime (UTC+0) of the given timestamp. - @rtype: datetime - """ - timestamp_in_sec: float = timestamp / (1000 ** int(unit)) - return datetime.fromtimestamp(timestamp_in_sec, tz=timezone.utc) - - @staticmethod - def to_timestamp(date_time: datetime, unit: TimeUnit = TimeUnit.SECONDS) -> float: - """ - Convert a datetime to a timestamp. - - @param date_time: The datetime to be converted. - @type date_time: datetime - @param unit: The desired time unit of the timestamp. - @type unit: TimeUnit - - @return: The timestamp of the given datetime in the desired time unit. - @rtype: float - """ - return date_time.replace(tzinfo=timezone.utc).timestamp() * (1000 ** int(unit)) - - @staticmethod - def start_end_conversion(date_time: datetime, frequency: str, to_end: bool = True) -> datetime: - """ - Returns the beginning/end of a period. - - @param date_time: The datetime object to be converted. - @type date_time: datetime - @param frequency: The underlying period frequency. - @type frequency: str - @param to_end: boolean, return end of period. Default: True - @type to_end: bool - - @return: datetime of start/end of period. - @rtype: datetime - """ - return period(date_time, TimeHelper.freq_map[frequency])[int(to_end)] diff --git a/pandas_datareader/crypto/utilities.py b/pandas_datareader/crypto/utilities.py deleted file mode 100644 index 93ee6edf..00000000 --- a/pandas_datareader/crypto/utilities.py +++ /dev/null @@ -1,460 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" -Module providing several utility functions needed across the whole program. - -Functions: - - TYPE_CONVERSION: Dict providing functions for type conversions. - - COMPARATOR: Dict providing function for comparison. - - read_config: Function reading the config-file. - - yaml_loader: Function for loading yaml-files. - - load_program_config: Function loading the program configuration. - - provide_ssl_context: Function providing an SSL-context if none is available. - - get_exchange_names: Function returning all exchanges. - - replace_list_item: Function replacing a specific item from a list. - - get_all_exchanges_and_methods: Function returning all exchanges and supported request methods. - - prepend_spaces_to_columns: Function prepending spaces to columns for readability. - - handler: Exception handler logging uncaught exceptions. - - signal_handler: Function recognizing kill signals and raising SystemExit. - - init_logger: Function initializing the global logger. -""" -import calendar -import datetime -import logging -import os -from datetime import timedelta -from typing import Any, Optional, Dict, List, Union - -import dateutil.parser -import yaml -import pandas as pd - - -from pandas_datareader.crypto.time_helper import TimeHelper, TimeUnit -import pandas_datareader.crypto._paths as _paths - -TYPE_CONVERSIONS = { - ("float", "from_timestamp"): { - "function": TimeHelper.from_timestamp, - "params": 1 - }, - ("bool", "int"): { - "function": int, - "params": 0 - }, - ("float", "int"): { - "function": int, - "params": 0 - }, - ("int", "bool"): { - "function": bool, - "params": 0 - }, - ("int", "div"): { - "function": lambda integer, div: integer / (1 * div), - "params": 1 - }, - ("any", "value"): { - "function": lambda number: float(number) > 0, - "params": 0 - }, - ("str", "bool"): { - "function": lambda string: string.lower() == "true", - "params": 0 - }, - ("str", "int"): { - "function": int, - "params": 0 - }, - ("str", "float"): { - "function": float, - "params": 0 - }, - ("str", "float_absolut"): { - "function": lambda string: abs(float(string)), - "params": 0 - }, - ("str", "floatNA"): { - "function": lambda string: float(string) if string != "N/A" else None, - "params": 0 - }, - ("str", "strptime"): { - "function": lambda string, *args: datetime.datetime.strptime(string, args[0]), - "params": 1 - }, - ("strptime_w_f", "strptime_wo_f"): { - "function": lambda string, *args: datetime.datetime.strptime(string.split(".")[0], *args), - "params": 1 - }, - ("str", "split"): { - "function": lambda string, *args: string.split(args[0])[args[1]] if args[0] in string else None, - "params": 2 - }, - ("str", "splitupper"): { - "function": lambda string, *args: string.split(args[0])[args[1]].upper(), - "params": 2 - }, - ("str", "slice"): { - "function": lambda string, *args: string[args[0]:args[1]], - "params": 2 - }, - ("str", "upper"): { - "function": lambda string: string.upper(), - "params": 0 - }, - ("str", "lower"): { - "function": lambda string: string.lower(), - "params": 0 - }, - ("str", "dateparser"): { - "function": dateutil.parser.parse, - "params": 0 - }, - ("datetime", "strftime"): { - "function": lambda time, *args: datetime.datetime.strftime(time, args[0]), - "params": 1 - }, - ("dateparser", "totimestamp"): { - "function": lambda time: int(time.timestamp()), - "params": 0 - }, - ("datetime", "totimestamp"): { - "function": lambda time: int(time.timestamp()), - "params": 0 - }, - ("datetime", "totimestampms"): { - "function": lambda time: int(round(time.timestamp() * 1000)), - "params": 0 - }, - ("datetime", "utctotimestamp"): { - "function": lambda time: calendar.timegm(time.utctimetuple()), - "params": 0 - }, - ("strptime", "totimestamp"): { - "function": lambda string, *args: int(datetime.datetime.timestamp(datetime.datetime.strptime(string, args[0]))), - "params": 1 - }, - ("none", "nowstrptime"): { - "function": lambda arg: TimeHelper.now().replace(hour=0, minute=0, second=0, microsecond=0), - "params": 0 - }, - ("none", "now"): { - "function": TimeHelper.now, - "params": 0 - }, - ("none", "now_format"): { - "function": lambda spec: format(TimeHelper.now(), spec), - "params": 1 - }, - ("none", "constant"): { # Returns the first argument - "function": lambda *args: args[0], - "params": 1 - }, - ("none", "range"): { - "function": lambda: range(1), - "params": 0 - }, - ("value", "map"): { - # translate into buy/sell. Args: {0: 'buy', 1:'sell'} and arg[0] is the response value (i.e. 0/1) - "function": lambda *args: {args[1]: args[2], args[3]: args[4]}[args[0]], - "params": 4 - }, - ("str", "split_at_del_or_index"): { - "function": lambda string, *args: string.split(args[0])[args[2]] if len(string) != len( - string.split(args[0])[0]) else string[:args[1]] if args[2] == 0 else string[args[1]:], - "params": 3 # delimiter, index, 0 or 1 aka. left or right - }, - ("none", "now_timestamp"): { - "function": lambda: int(TimeHelper.now_timestamp()), - "params": 0 - }, - ("none", "now_timestampms"): { - "function": lambda: int(TimeHelper.now_timestamp(TimeUnit.MILLISECONDS)), - "params": 0 - }, - ("now", "timedelta"): { - "function": lambda delta: int(TimeHelper.to_timestamp(TimeHelper.now() - timedelta(days=int(delta)))), - "params": 1 - }, - ("datetime", "timedelta"): { - "function": lambda time, interval, delta: int( - TimeHelper.to_timestamp(time - timedelta(**{interval: int(delta)}))), - "params": 2 - }, - ("utcfromtimestamp", "timedelta"): { - "function": lambda time, interval, value: TimeHelper.from_timestamp(time) - timedelta( - **{interval: value}) if - isinstance(time, int) else dateutil.parser.parse(time) - timedelta(**{interval: value}), - "params": 2 - }, - ("datetime", "timedeltams"): { - "function": lambda time, interval, delta: int( - TimeHelper.to_timestamp(time - timedelta(**{interval: int(delta)}))) * 1000, - "params": 2 - }, - ("datetime", "timestamp"): { - "function": lambda time: int(TimeHelper.to_timestamp(time)), - "params": 0 - }, - ("datetime", "timestampms"): { - "function": lambda time: int(TimeHelper.to_timestamp(time)) * 1000, - "params": 0 - }, - ("datetime", "format"): { - "function": format, - "params": 1 - }, - ("timedelta", "from_timestamp"): { - "function": lambda time, unit, spec: format(TimeHelper.from_timestamp(time, unit), spec), - "params": 2 - }, - ("from_timestamp", "to_start"): { - "function": lambda time, interval: TimeHelper.start_end_conversion(time, interval, False), - "params": 1 - }, - ("from_timestamp", "to_end"): { - "function": lambda time, interval: TimeHelper.start_end_conversion(time, interval, True), - "params": 1 - } -} -""" - Type Conversions used to convert extracted values from the API-Response into the desired type ("first", "second"). - The values are specified in the .yaml-file of each exchange under the "mapping" of each method. - The function is called in the Mapping Class of utilities.py under the method convert_types(). - - "first": - The actual type extracted from the API-Request (.json) - "second": - The desired type to convert - "function": - the actual function to apply - "params": - the number of additional parameters needed -""" - -COMPARATOR = {"equal": lambda x, y: x == y, - "lower": lambda x, y: x < y, - "lower_or_equal": lambda x, y: x <= y, - "equal_or_lower": lambda x, y: x <= y, - "higher": lambda x, y: x > y, - "higher_or_equal": lambda x, y: x >= y, - "equal_or_higher": lambda x, y: x >= y} -""" -Dict providing basic compare functionality. -""" - - -def read_config(file: Optional[str] = None, - section: Optional[str] = None, - reset: bool = False) -> Dict[str, Any]: - """ - @param file: Name of the config file. - @type file: str - @param section: Name of the section the information is stored in. - @type section: str - @param reset: Reset global config file to None. - @type reset: bool - - @return: Parameters for the program as a dictionary. - Keys are the names of the parameters in the config-file. - @rtype: dict[str, Any] - - @raise KeyError: If the section does not exist in the config. - """ - if reset and not file: - GlobalConfig().set_file() - - if file: - GlobalConfig().set_file(file) - - while True: - try: - filename = GlobalConfig().file - config_yaml = open(filename, encoding="UTF-8") - break - except FileNotFoundError: - try: - available_files = os.listdir(os.path.dirname(filename)) - available_files = [file for file in available_files if not - os.path.isdir(os.path.join(os.path.dirname(filename), file))] - print(f"File not found. Retry! \nAvailable file(s): {', '.join(available_files)}") - except FileNotFoundError: - print("File not found. Retry!") - finally: - GlobalConfig().set_file() - - - config_dict = yaml.load(config_yaml, Loader=yaml.FullLoader) - config_yaml.close() - - if section is None: - return config_dict - - for general_section in config_dict.keys(): - if section == general_section: - return config_dict[general_section] - - for nested_section in config_dict[general_section].keys(): - if section == nested_section: - return config_dict[general_section][nested_section] - - raise KeyError() - - -def yaml_loader(exchange: str, path: str = None) -> Dict[str, Any]: - """ - Loads, reads and returns the data of a .yaml-file specified by the param exchange. - - @param exchange: The file name to load (exchange). - @type exchange: str - - @param path: path to the yaml-files - @type path: str - - @return: Returns a dict of the loaded data from the .yaml-file. - @rtype: dict - - @raise Exception: If the .yaml file could not be evaluated for a given exchange. - """ - exchange = exchange.replace(" ", "") - - path = _paths.all_paths.get("yaml_path") - - try: - with open(path.joinpath(".".join([exchange.lower(), "yaml"])), "r", encoding="UTF-8") as file: - return yaml.load(file, Loader=yaml.FullLoader) - - except FileNotFoundError as error: - print(f"\nFile {path.joinpath('.'.join([exchange.lower(), 'yaml']))} not found.") - # logging.exception("Error loading yaml of %s.\n", exchange) - # raise SystemExit from error - - # except Exception as error: - # print(f"\nError loading yaml of {exchange}. ") - # logging.exception("Error loading yaml of %s.\n", exchange) - # raise SystemExit from error - - -# def load_program_config(return_path: bool = False) -> Union[str, Dict]: -# """ -# Loads the program configuration from a predefined directory. If the file is not found, it will return -# the template with default settings. -# @return: Program config. -# @rtype: dict -# """ -# path = _paths.all_paths.get("program_config_path") -# -# if return_path: -# return path -# -# try: -# with open(path, "r", encoding="UTF-8") as file: -# return yaml.load(file, Loader=yaml.FullLoader) -# -# except FileNotFoundError: -# path = "resources/templates/program_config.yaml" -# with open(path, "r", encoding="UTF-8") as file: -# return yaml.load(file, Loader=yaml.FullLoader) -# -# -# def get_exchange_names(yaml_path: str = None) -> Optional[List[str]]: -# """ -# Gives information about all exchange that the program will send -# requests to. This means if the name of a exchange is not part of the -# list that is returned, the program will not send any request to said -# exchange. -# @param: yaml-path -# @type yaml_path: str -# @return: Names from all the exchange, which have a .yaml-file in -# the directory described in YAML_PATH. -# @rtype: list[str] -# """ -# if not yaml_path: -# yaml_path = _paths.all_paths.get("yaml_path") -# path_to_resources = Path.joinpath(_paths.all_paths.get("path_absolut"), Path(yaml_path)) -# -# try: -# exchanges = os.listdir(path_to_resources) -# exchanges = [x.split(".yaml")[0] for x in exchanges if x.endswith(".yaml")] -# exchanges.sort() -# except FileNotFoundError: -# print(f"YAML files not found. The path {path_to_resources} is incorrect.") -# logging.error("Exchange YAML-files not found. Path %s seems incorrect.", path_to_resources) -# return -# -# return exchanges - - - -def replace_list_item(replace_list: list, condition: str, value: str) -> list: - """ - Replaces a specific value from a list. - @param replace_list: The list in which the value needs to be replaced - @param condition: The value to be updated - @param value: The new value - @return: Updated list - """ - for i, item in enumerate(replace_list): - if item == condition: - replace_list[i] = value - return replace_list - - -# def get_all_exchanges_and_methods() -> Dict[str, dict]: -# """ -# Returns the exchange names and all supported methods. -# @return: List of exchanges with supported request methods. -# @rtype: list -# """ -# result_dict = dict() -# yaml_path = _paths.all_paths.get("yaml_path") -# -# exchanges = get_exchange_names(yaml_path=yaml_path) -# for exchange in exchanges: -# file = yaml_loader(exchange, path=yaml_path) -# result_dict.update({exchange: {method: True for method in list(file.get("requests").keys())}}) -# -# return result_dict - - -def prepend_spaces_to_columns(dataframe: pd.DataFrame, space_count: int = 3) -> pd.DataFrame: - """ - Adds spaced between pd.DataFrame columns for easy readability. - @param dataframe: Dataframe to append spaced to - @type: pd.DataFrame - @param space_count: Number of spaces - @type: int - @return: DataFrame with appended spaced. - @rtype: pd.DataFrame - """ - dataframe.replace(pd.NA, False, inplace=True) - spaces = " " * space_count - - # ensure every column name has the leading spaces: - if isinstance(dataframe.columns, pd.MultiIndex): - for i in range(dataframe.columns.nlevels): - level_new = [spaces + str(s) for s in dataframe.columns.levels[i]] - dataframe.columns.set_levels(level_new, level=i, inplace=True) - else: - dataframe.columns = spaces + dataframe.columns - - # ensure every element has the leading spaces: - dataframe = dataframe.astype(str) - dataframe = spaces + dataframe - return dataframe - - - -def split_str_to_list(string: str, splitter: str = ",") -> List[str]: - """ - Splits a string into a list of string. - - @param string: A long string. - @param splitter: The splitting parameter. - - @return: List of strings. - """ - items = string.rsplit(splitter) - - # remove possible blanks from strings - return [item.replace(" ", "") for item in items] diff --git a/pandas_datareader/data.py b/pandas_datareader/data.py index c2d6223a..96bd4269 100644 --- a/pandas_datareader/data.py +++ b/pandas_datareader/data.py @@ -38,6 +38,7 @@ from pandas_datareader.yahoo.daily import YahooDailyReader from pandas_datareader.yahoo.options import Options as YahooOptions from pandas_datareader.yahoo.quotes import YahooQuotesReader +from pandas_datareader.crypto import CryptoReader __all__ = [ "get_components_yahoo", @@ -61,6 +62,7 @@ "get_dailysummary_iex", "get_data_stooq", "DataReader", + "get_data_crypto" ] @@ -136,6 +138,10 @@ def get_sector_performance_av(*args, **kwargs): return AVSectorPerformanceReader(*args, **kwargs).read() +def get_data_crypto(*args, **kwargs): + return CryptoReader(*args, **kwargs).read() + + def get_markets_iex(*args, **kwargs): """ Returns near-real time volume data across markets segregated by tape diff --git a/pandas_datareader/tests/test_cryptoreader.py b/pandas_datareader/tests/test_cryptoreader.py new file mode 100644 index 00000000..fa3e93b6 --- /dev/null +++ b/pandas_datareader/tests/test_cryptoreader.py @@ -0,0 +1,78 @@ +import pytest +import pandas as pd + +from pandas_datareader.crypto import CryptoReader +from pandas_datareader.crypto_utils.mapping import extract_mappings +from pandas_datareader.crypto_utils.utilities import yaml_loader + + +class TestCryptoReader: + """Test class for the CryptoReader.""" + + exchange_name = "coinbase" + symbols = "btc-usd" + kwargs = {"interval": "days"} + CryptoReader = CryptoReader(exchange_name, symbols, **kwargs) + + def test_get_all_exchanges(self): + """ Test to return a list of all available exchanges.""" + + result = self.CryptoReader.get_all_exchanges() + assert isinstance(result, list) + + def test_read(self): + """ Test the request from a particular exchange""" + + result = self.CryptoReader.read() + + assert isinstance(result, pd.DataFrame) + assert not result.empty + + def test_request_new_symbol(self): + """ Test to request NEW symbols""" + + result = self.CryptoReader.read('eth-usd') + + assert isinstance(result, pd.DataFrame) + assert not result.empty + + def test_extract_mappings(self): + """ Test to extract the mapping keys and values from the yaml files""" + + result = extract_mappings(self.CryptoReader.name, + self.CryptoReader.yaml_file.get('requests')).get('historic_rates') + + assert isinstance(result, list) + assert result + # ToDo: Check for necessary values in mappings. + + def test_all_exchanges_have_mappings(self): + """ Test if all exchange yaml-files have a specified mapping.""" + + exchanges = self.CryptoReader.get_all_exchanges() + assert isinstance(exchanges, list) + assert exchanges + + for exchange in exchanges: + file = yaml_loader(exchange) + result = extract_mappings(exchange, file.get('requests')).get('historic_rates') + + assert isinstance(result, list) + assert result + + def test_extract_values_from_response(self): + """ Tests to correctly extract the values from a specified response""" + + pass + + def test_iterate_requests_until_no_further_timestamp(self): + """ Tests to iterate the request with updated timestamps until no more timestamp is collected + or start time is reached. + """ + + pass + + def test_empty_response(self): + """ Test the behavior for an valid but empty response""" + + pass From c9264d59698101bb53201ae7c71454c58f6ed32c Mon Sep 17 00:00:00 2001 From: Steffen Date: Mon, 15 Nov 2021 11:21:08 +0100 Subject: [PATCH 03/25] Added utilities. --- pandas_datareader/crypto_utils/__init__.py | 0 pandas_datareader/crypto_utils/_paths.py | 14 + pandas_datareader/crypto_utils/exchange.py | 272 ++++++++++++++ pandas_datareader/crypto_utils/mapping.py | 347 ++++++++++++++++++ pandas_datareader/crypto_utils/time_helper.py | 131 +++++++ pandas_datareader/crypto_utils/utilities.py | 307 ++++++++++++++++ 6 files changed, 1071 insertions(+) create mode 100644 pandas_datareader/crypto_utils/__init__.py create mode 100644 pandas_datareader/crypto_utils/_paths.py create mode 100644 pandas_datareader/crypto_utils/exchange.py create mode 100644 pandas_datareader/crypto_utils/mapping.py create mode 100644 pandas_datareader/crypto_utils/time_helper.py create mode 100644 pandas_datareader/crypto_utils/utilities.py diff --git a/pandas_datareader/crypto_utils/__init__.py b/pandas_datareader/crypto_utils/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pandas_datareader/crypto_utils/_paths.py b/pandas_datareader/crypto_utils/_paths.py new file mode 100644 index 00000000..76ac7204 --- /dev/null +++ b/pandas_datareader/crypto_utils/_paths.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +This module is preparing the python path to access all modules. +""" +import os +import sys +from pathlib import Path + +# sys.path.insert(0, os.path.dirname(__file__)) + +all_paths = { + "yaml_path": Path(os.path.dirname(os.path.realpath(__file__))).joinpath("resources/"), +} diff --git a/pandas_datareader/crypto_utils/exchange.py b/pandas_datareader/crypto_utils/exchange.py new file mode 100644 index 00000000..3caa2588 --- /dev/null +++ b/pandas_datareader/crypto_utils/exchange.py @@ -0,0 +1,272 @@ +from typing import Tuple, Any, Dict, Union, List, Optional + +from datetime import datetime +import string +from collections import OrderedDict, deque +import itertools + +from pandas_datareader.crypto_utils.utilities import yaml_loader, replace_list_item +from pandas_datareader.crypto_utils.mapping import extract_mappings +from pandas_datareader.crypto_utils.mapping import convert_type +from pandas_datareader.base import _BaseReader + + +class Exchange(_BaseReader): + """ Class for every exchange supported. The class extracts the request url, fits parameters, + extracts the values from the response json and performs type-conversions. + """ + + def __init__(self, name: str, symbols, interval: str, **kwargs): + super(Exchange, self).__init__(symbols, **kwargs) + self.name = name + self.yaml_file = yaml_loader(self.name) + self.interval: Union[str, Dict] = interval + self.rate_limit = self.get_rate_limit() + + def get_rate_limit(self) -> int: + """ Calculates the rate-limit of an exchange. + + @return: The rate limit, i.e. time to "sleep" to not violate the limit per minute. + """ + if self.yaml_file.get("rate_limit"): + if self.yaml_file["rate_limit"]["max"] <= 0: + rate_limit = 0 + else: + rate_limit = self.yaml_file["rate_limit"]["unit"] / self.yaml_file["rate_limit"]["max"] + else: + rate_limit = 0 + + return rate_limit + + def apply_currency_pair_format(self, currency_pair: str) -> str: + """ Helper method that applies the format described in the yaml for the specific + request on the given currency-pair. + + @param currency_pair: String repr of the currency-pair + @return: String of the formatted currency-pair. Example: BTC and ETH -> "btc_eth" + """ + + first, second = currency_pair.split("-") + + request_url_and_params = self.yaml_file.get("requests").get("historic_rates").get("request") + pair_template_dict = request_url_and_params["pair_template"] + pair_template = pair_template_dict["template"] + + formatted_string: str = pair_template.format(first=first, second=second) + + if pair_template_dict["lower_case"]: + formatted_string = formatted_string.lower() + + return formatted_string + + def get_formatted_url_and_params(self, url_and_parameters: Any, currency_pair: str) -> Tuple[str, Dict]: + """ Formats the request url, inserts the currency-pair representation and/or + extracts the parameters specified for the exchange and request. + + @param url_and_parameters: Extracted url and parameters from self.extract_request_urls. + @param currency_pair: The currency pair of interest to format the url and params on. + @return Tuple of formatted url and formatted parameters. + """ + + url = url_and_parameters.get('historic_rates').get("url") + pair_template = url_and_parameters.get('historic_rates').get("pair_template") + pair_formatted = self.apply_currency_pair_format(currency_pair) + parameters = url_and_parameters.get('historic_rates').get("params") + + parameters.update({key: parameters[key][currency_pair] + for key, val in parameters.items() if isinstance(val, dict)}) + + # Case 1: Currency-Pairs in request parameters: eg. www.test.com?market=BTC-USD + if "alias" in pair_template.keys() and pair_template["alias"]: + parameters[pair_template["alias"]] = pair_formatted + # Case 2: Currency-Pairs directly in URL: eg. www.test.com/BTC-USD + elif pair_formatted: + parameters.update({"currency_pair": pair_formatted}) + + else: + return url, parameters + + variables = [item[1] for item in string.Formatter().parse(url) if item[1] is not None] + url_formatted = url.format(**parameters) + # drop params who are filled directly into the url + parameters = {k: v for k, v in parameters.items() if k not in variables} + + return url_formatted, parameters + + def extract_request_urls(self, currency_pairs: Dict[str, datetime]) -> Dict: + """ Extracts the request url from the yaml-file and implements the parameters. + + @param currency_pairs: Currency-pair with the timestamp of the latest request. + @return: Dict of the extracted url and parameters. + """ + + request_dict = self.yaml_file.get("requests").get("historic_rates").get("request") + request_parameters = dict() + request_parameters["url"] = self.yaml_file.get("api_url", "") + request_dict.get("template", "") + request_parameters["pair_template"] = request_dict.get("pair_template", None) + urls = dict() + parameter = dict() + parameters = request_dict.get("params", False) + + if not parameters: + request_parameters["params"] = {} + urls["historic_rates"] = request_parameters + return urls + + mapping: dict = {"allowed": self._allowed, "function": self._function, + "default": self._default, "type": self._type_con} + + # enumerate mapping dict to sort parameter values accordingly, i.e. {"allowed": 0, "function": 1, ...} + mapping_index = {val: key for key, val in enumerate(mapping.keys())} + + for param, options in parameters.items(): + # Kick out all option keys which are not in the mapping dict or where required: False. + # Sort the dict options according to the mapping-keys to ensure the right order of function calls. + # Otherwise a (valid) specified value might be overwritten by the default value. + options = {k: v for k, v in options.items() if k in mapping.keys()} + options = OrderedDict(sorted(options.items(), key=lambda x: mapping_index.get(x[0]))) + + if not parameters[param].get("required", True): + continue + # Iterate over the functions and fill the params dict with values. Kwargs are needed only partially. + kwargs = {"has_value": None, "currency_pairs": currency_pairs} + for key, val in options.items(): + kwargs.update({"has_value": parameter.get(param, None)}) + parameter[param] = mapping.get(key)(val, **kwargs) + + request_parameters["params"] = parameter + urls["historic_rates"] = request_parameters + return urls + + def _allowed(self, val: dict, **_: dict) -> Any: + """ Extract the configured value from all allowed values. If there is no match, return str "default". + + @param val: dict of allowed key, value pairs. + @param _: unused additional arguments needed in other methods. + @return: value if key in dict, else None. + """ + if isinstance(self.interval, dict): + value = None + else: + value = val.get(self.interval, None) + + if not bool(value): + all_intervals = {"minutes": 1, "hours": 2, "days": 3, "weeks": 4, "months": 5} + self.interval = {v: k for k, v in val.items() if all_intervals.get(k)} + return value + + def _function(self, val: str, **kwargs: dict) -> Dict[str, datetime]: + """ Execute function for all currency-pairs. Function returns the first + timestamp in the DB, or datetime.now() if none exists. + + @param val: contains the function name as string. + @param kwargs: not used but needed for another function. + @return: The currency-pair with the respective timestamp to continue requesting. + """ + if val == "last_timestamp": + return {cp: self._get_first_timestamp(last_ts) for cp, last_ts in kwargs.get("currency_pairs").items()} + + def _default(self, val: str, **kwargs: dict) -> Optional[str]: + """ Returns the default value if kwargs value (the parameter) is None. + + @param val: Default value. + @param kwargs: Parameter value. If None, return default value. + @return: Default value as a string. + """ + + default_val = val if not bool(kwargs.get("has_value")) else kwargs.get("has_value") + if isinstance(self.interval, dict): + self.interval = self.interval.get(default_val, None) + + return default_val if self.interval else None + + def _type_con(self, val: Any, **kwargs: dict) -> Any: + """ Performs type conversions. + + @param val: The conversion values specified under "type". + @param kwargs: The value to be converted. + @return: Converted value. + """ + param_value = kwargs.get("has_value", None) + conv_params = val + # to avoid conversion when only a type declaration was done. If a parameter is of type "int". + if isinstance(conv_params, str) or len(conv_params) < 2: + return param_value + # replace the key "interval" with the interval specified in the configuration file. + conv_params = [self.interval if x == "interval" else x for x in conv_params] + # return {cp: convert_type(param_value[cp], deque(conv_params)) for cp in currency_pairs} + # ToDo: Check if the above line works. The older version needed both if statements below. + if isinstance(param_value, dict): + return {cp: convert_type(param_value[cp], deque(conv_params)) for cp in kwargs.get("currency_pairs")} + elif isinstance(conv_params, list): + return convert_type(param_value, deque(conv_params)) + + def _get_first_timestamp(self, last_ts: datetime) -> datetime: + """ Returns the timestamp to continue requesting with. + + @param last_ts: The oldest timestamp from the previous request + @return: The latest timestamp. + """ + if last_ts: + return last_ts + + if self.end.timestamp() > datetime.utcnow().timestamp(): + return datetime.utcnow() + else: + return self.end + + def format_data(self, responses: Dict) -> Tuple[Optional[List], Optional[List]]: + """ Extracts and formats the response data, according to the mapping keys and path. + Data is then ordered and returned as a tuple. + + @param responses: The response json + @return: Tuple of extracted and formatted data and a list of the mapping keys in the same order. + """ + if not responses: + return None, None + + results = list() + mappings = extract_mappings(self.name, self.yaml_file.get('requests')).get('historic_rates') + mapping_keys = [mapping.key for mapping in mappings] + + # creating dictionary where key is the name of the mapping which holds an empty list + temp_results = dict(zip((key for key in mapping_keys), itertools.repeat([], len(mappings)))) + + try: + + for mapping in mappings: + if "interval" in mapping.types: + mapping.types = replace_list_item(mapping.types, "interval", self.interval) + + temp_results[mapping.key] = mapping.extract_value(responses) + + if isinstance(temp_results[mapping.key], str): + # Bugfix: if value is a single string, it is an iterable, and the string will + # be split in every letter. Therefore it is put into a list. + temp_results[mapping.key] = [temp_results[mapping.key]] + + except Exception: + print("Error extracting values from response.") + return None, None + + else: + # CHANGE: One filed invalid -> all fields invalid. + # changed this in order to avoid responses kicked out just because of one invalid field. + # The response will be filtered out in the DB-Handler if the primary-keys are missing anyways. + if all(value is None and not isinstance(value, datetime) for value in list(temp_results.values())): + return None, None + + # asserting that the extracted lists for each mapping are having the same length + assert (len(results[0]) == len(result) for result in temp_results) + + len_results = {key: len(value) for key, value in temp_results.items() if hasattr(value, "__iter__")} + len_results = max(len_results.values()) if bool(len_results) else 1 + + # update new keys only if not already exists to prevent overwriting! + # temp_results = {"time": time, **temp_results} + result = [v if hasattr(v, "__iter__") + else itertools.repeat(v, len_results) for k, v in temp_results.items()] + + result = list(itertools.zip_longest(*result)) + + return result, list(temp_results.keys()) diff --git a/pandas_datareader/crypto_utils/mapping.py b/pandas_datareader/crypto_utils/mapping.py new file mode 100644 index 00000000..72cfa1e2 --- /dev/null +++ b/pandas_datareader/crypto_utils/mapping.py @@ -0,0 +1,347 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Module to find, extract and convert values from the exchange responses. + +Classes: + - Mapping +Functions: + - convert_type + - extract_mappings + - is_scalar +""" + +import logging +from collections import deque +from collections.abc import Iterable +from typing import Any, List, Dict, Deque, Tuple + +from pandas_datareader.crypto_utils.utilities import TYPE_CONVERSIONS + + +def convert_type(value: Any, types_queue: Deque[str]) -> Any: + """ + Converts the value via type conversions. + + Helper method to convert the given value via a queue of type conversions. + + @param value: The value to get converted to another type. + @type value: Any + @param types_queue: The queue of type conversion instructions. + @type types_queue: deque + + @return: The converted value. + @rtype: Any + """ + current_type = types_queue.popleft() + + result = value + + while types_queue: + next_type = types_queue.popleft() + + types_tuple = (current_type, next_type) + + if "continue" in types_tuple: + continue + + conversion = TYPE_CONVERSIONS[types_tuple] + + params = list() + + for _ in range(conversion["params"]): + params.append(types_queue.popleft()) + + # Change here to avoid "None" as result value in the params when no value to convert is needed (i.e. when + # methods are called with ("none", ...). + # if not result and isinstance(result, (str, list)): + try: + if result is None: + result = conversion["function"](*params) + else: + result = conversion["function"](result, *params) + + current_type = next_type + except Exception: + return None + + return result + + +class Mapping: + """ + Class representing mapping data and logic. + + Class representing mapping data und further functionality provided + with methods. + + Attributes: + key: + String being the keyword indicating one or several + database table columns. See "database_column_mapping" + in "config.yaml". + path: + An ordered list of keys used for traversal through the + response dict with the intention of returning the value wanted + for the database. + types: + An ordered sequence of types and + additional parameters (if necessary). Is used to conduct + type conversions within the method "extract_value()". + """ + + def __init__(self, + key: str, + path: List[str], + types: List[str]): + """ + Constructor of Mapping. + + Constructor method for constructing method objects. + + @param key: String being the keyword indicating one or several + database table columns. See "database_column_mapping" + in "config.yaml". + @type key: str + @param path: An ordered list of keys used for traversal through the + response dict with the intention of returning the value wanted + for the database. + @type path: list + @param types: An ordered sequence of types and + additional parameters (if necessary). Is used to conduct + type conversions within the method "extract_value()". + @type types: list + """ + self.key = key + self.path = path + self.types = types + + def traverse_path(self, response: Dict[str, Any], path_queue: Deque[str], + currency_pair_info: Tuple[str, str, str] = None) \ + -> Any: + """ + Traverses the path on a response. + + Helper method for traversing the path on the given response dict (subset). + + @param response: The response dict (subset). + @type response: dict + @param path_queue: The queue of path traversal instructions. + @type path_queue: deque + @param currency_pair_info: The formatted String of a currency pair. + For special case that the key of a dictionary is the formatted currency pair string. + @type currency_pair_info: tuple[str, str, str] + + @return: The traversed response dict. + @rtype: Optional[dict] + """ + path_element = path_queue.popleft() + + if path_element == "dict_key": + # Special case to extract value from "dict_key" + traversed = list(response.keys()) + elif path_element == "dict_values": + # Special case to extract value from "dict_values" + traversed = list(response.values()) + elif path_element == "list_key": + # Special case with the currency_pair prior to a list + traversed = list(response.keys()) + elif path_element == "list_values": + traversed = list(response.values()) + elif path_element == []: + # Special case to extract multiple values from a single list ["USD","BTC",...] + traversed = response + elif path_element == "currency_pair" and currency_pair_info[2] is not None: + traversed = response[currency_pair_info[2]] + elif is_scalar(response): + return None + else: # Hier editiert für Kraken sonderfall + if isinstance(response, dict) and path_element not in response.keys(): + return None + else: + traversed = response[path_element] + + return traversed + + def extract_value(self, + # response: List[Dict[str, Any]], + response: Any, + path_queue: Deque[str] = None, + types_queue: Deque[str] = None, + iterate: bool = True, + currency_pair_info: Tuple[str, str, str] = (None, None, None)) -> Any: + """ + Extracts the value specified by "self.path". + + Extracts the value specified by the path sequence and converts it + using the "types" specified. + + @param response: The response dict (JSON) returned by an API request. + @type response: Collection + @param path_queue: The queue of path traversal instructions. + @type path_queue: deque + @param types_queue: The queue of type conversion instructions. + @type types_queue: deque + @param iterate: Whether still an auto-iteration is possible. + @type iterate: bool + @param currency_pair_info: The formatted String of a currency pair. + @type currency_pair_info: tuple[str, str, str] + + @return: The value specified by "path_queue" and converted + using "types_queue". + Can be a list of values which get extracted iteratively from + the response. + @rtype: Any + """ + if path_queue is None: + path_queue = deque(self.path) + + if types_queue is None: + types_queue = deque(self.types) + + if not response: + return None + + if not path_queue: + # TODO: after integration tests, look if clause for first and second currency can be deleted! + if types_queue[0] == "first_currency": + return currency_pair_info[0] + elif types_queue[0] == "second_currency": + return currency_pair_info[1] + return convert_type(None, types_queue) + + while path_queue: + + if iterate and isinstance(response, list): + # Iterate through list of results + result = list() + + # special case for bitfinex + if len(response) == 1: + response = response[0] + continue # because instance of response has to be checked + + for item in response: + + if is_scalar(item): + return self.extract_value(response, + path_queue, + types_queue, + iterate=False) + + result.append( + self.extract_value( + item, + deque(path_queue), + deque(types_queue) + ) + ) + + return result + + elif is_scalar(response): + # Return converted scalar value + return convert_type(response, types_queue) + + # Special case for Bitz to handle empty dicts/lists. + elif not response: + return None + + else: + # Traverse path + response = self.traverse_path(response, path_queue, currency_pair_info=currency_pair_info) + + if types_queue and response is not None: # None to allow to change 0 to boolean. + + if isinstance(response, list): + + result = list() + + for item in response: + result.append( + convert_type(item, deque(types_queue)) + ) + + # for dict_key special_case aka. test_extract_value_list_containing_dict_where_key_is_value() in test_mapping.py + if len(result) == 1: + result = result[0] + + response = result + + else: + response = convert_type(response, types_queue) + + return response + + def __str__(self) -> str: + """String representation of a Mapping""" + string_path = list() + + for item in self.path: + string_path.append(str(item)) + + return " / ".join(string_path) + " -> " + str(self.key) + + +def extract_mappings(exchange_name: str, requests: Dict[str, Any]) -> Dict[str, List[Mapping]]: + """ + Helper-Method which should be only called by the constructor. + Extracts out of a given exchange .yaml-requests-section for each + request the necessary mappings so the values can be extracted from + the response for said request. + + The key-value in the dictionary is the same as the key for the request. + i.e. behind 'ticker' are all the mappings stored which are necessary for + extracting the values out of a ticker-response. + + If there is no mapping specified in the .yaml for a value which is contained + by the response, the value will not be extracted later on because there won't + be a Mapping-object for said value. + + @param exchange_name: str + String representation of the exchange name. + @param requests: Dict[str: List[Mapping]] + Requests-section from a exchange.yaml as dictionary. + Method does not check if dictionary contains viable information. + + @return: + Dictionary with the following structure: + {'request_name': List[Mapping]} + """ + response_mappings = dict() + if requests: + for request in requests: + request_mapping = requests[request] + + if "mapping" in request_mapping.keys(): + mapping = request_mapping["mapping"] + mapping_list = list() + + try: + for entry in mapping: + mapping_list.append(Mapping(entry["key"], entry["path"], entry["type"])) + except KeyError: + print(f"Error loading mappings of {exchange_name} in {request}: {entry}") + logging.error("Error loading mappings of %s in %s: %s", exchange_name, request, entry) + break + + response_mappings[request] = mapping_list + + return response_mappings + + +def is_scalar(value: Any) -> bool: + """ + Indicates whether a value is a scalar or not. + + Convenience function returning a bool whether the provided value is a single value or not. + Strings count as scalar although they are iterable. + + @param value: The value to evaluate concerning whether it is a single value + or multiple values (iterable). + @type value: Any + + @return: Bool indicating whether the provided value is a single value or not. + @rtype: bool + """ + return isinstance(value, str) or not isinstance(value, Iterable) diff --git a/pandas_datareader/crypto_utils/time_helper.py b/pandas_datareader/crypto_utils/time_helper.py new file mode 100644 index 00000000..e89b4c50 --- /dev/null +++ b/pandas_datareader/crypto_utils/time_helper.py @@ -0,0 +1,131 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Contains helper classes to manage dates and times. + +Classes: +- TimeHelper: Used to create/convert timezone aware (UTC+0) dates and times. + +Enums: +- TimeUnit: Used to indicate the unit of timestamps. +""" + +from datetime import datetime, timezone +from enum import IntEnum + +from datetime_periods import period +from dateutil.parser import parse + + +class TimeUnit(IntEnum): + """ + An enumeration to indicate the unit of timestamps. + """ + SECONDS = 0 + MILLISECONDS = 1 + MICROSECONDS = 2 + NANOSECONDS = 3 + + +class TimeHelper: + """ + A helper class to create/convert dates and times. + + It ensures that all dates and times are timezone aware (UTC+0). + + freq_map is used to convert specific strings from plural into singular. + """ + freq_map = { + "minutes": "minute", + "hours": "hour", + "days": "day", + "weeks": "week", + "months": "month" + } + + @staticmethod + def now() -> datetime: + """ + Get the current datetime (UTC+0). + + The accuracy is limited to milliseconds and the remaining microseconds are cleared. + + @return: The current datetime (UTC+0). + @rtype: datetime + """ + now = datetime.now(tz=timezone.utc) + return now.replace(microsecond=now.microsecond - now.microsecond % 1000) + + @staticmethod + def now_timestamp(unit: TimeUnit = TimeUnit.SECONDS) -> float: + """ + Get the timestamp of the current datetime (UTC+0). + + @param unit: The desired time unit of the timestamp. + @type unit: TimeUnit + + @return: The timestamp of the current datetime (UTC+0). + @rtype: float + """ + return TimeHelper.to_timestamp(TimeHelper.now(), unit) + + @staticmethod + def from_string(representation: str) -> datetime: + """ + Get a datetime (UTC+0) from a given representation. + + @param representation: The string that represents a datetime. + @type representation: str + + @return: The datetime (UTC+0) of the given representation. + @rtype: datetime + """ + return parse(representation).replace(tzinfo=timezone.utc) + + @staticmethod + def from_timestamp(timestamp: float, unit: TimeUnit = TimeUnit.SECONDS) -> datetime: + """ + Get a datetime (UTC+0) from a given timestamp. + + @param timestamp: The timestamp whose datetime is to be obtained. + @type timestamp: float + @param unit: The time unit in which the timestamp is given. + @type unit: TimeUnit + + @return: The datetime (UTC+0) of the given timestamp. + @rtype: datetime + """ + timestamp_in_sec: float = timestamp / (1000 ** int(unit)) + return datetime.fromtimestamp(timestamp_in_sec, tz=timezone.utc) + + @staticmethod + def to_timestamp(date_time: datetime, unit: TimeUnit = TimeUnit.SECONDS) -> float: + """ + Convert a datetime to a timestamp. + + @param date_time: The datetime to be converted. + @type date_time: datetime + @param unit: The desired time unit of the timestamp. + @type unit: TimeUnit + + @return: The timestamp of the given datetime in the desired time unit. + @rtype: float + """ + return date_time.replace(tzinfo=timezone.utc).timestamp() * (1000 ** int(unit)) + + @staticmethod + def start_end_conversion(date_time: datetime, frequency: str, to_end: bool = True) -> datetime: + """ + Returns the beginning/end of a period. + + @param date_time: The datetime object to be converted. + @type date_time: datetime + @param frequency: The underlying period frequency. + @type frequency: str + @param to_end: boolean, return end of period. Default: True + @type to_end: bool + + @return: datetime of start/end of period. + @rtype: datetime + """ + return period(date_time, TimeHelper.freq_map[frequency])[int(to_end)] diff --git a/pandas_datareader/crypto_utils/utilities.py b/pandas_datareader/crypto_utils/utilities.py new file mode 100644 index 00000000..e54a9569 --- /dev/null +++ b/pandas_datareader/crypto_utils/utilities.py @@ -0,0 +1,307 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Module providing several utility functions needed across the whole program. + +Functions: + - TYPE_CONVERSION: Dict providing functions for type conversions. + - COMPARATOR: Dict providing function for comparison. + - read_config: Function reading the config-file. + - yaml_loader: Function for loading yaml-files. + - load_program_config: Function loading the program configuration. + - provide_ssl_context: Function providing an SSL-context if none is available. + - get_exchange_names: Function returning all exchanges. + - replace_list_item: Function replacing a specific item from a list. + - get_all_exchanges_and_methods: Function returning all exchanges and supported request methods. + - prepend_spaces_to_columns: Function prepending spaces to columns for readability. + - handler: Exception handler logging uncaught exceptions. + - signal_handler: Function recognizing kill signals and raising SystemExit. + - init_logger: Function initializing the global logger. +""" + +from typing import Any, Optional, Dict, List + +import calendar +import datetime +import os +from datetime import timedelta +import dateutil.parser +import yaml + +from pandas_datareader.crypto_utils.time_helper import TimeHelper, TimeUnit +import pandas_datareader.crypto_utils._paths as _paths + +TYPE_CONVERSIONS = { + ("float", "from_timestamp"): { + "function": TimeHelper.from_timestamp, + "params": 1 + }, + ("bool", "int"): { + "function": int, + "params": 0 + }, + ("float", "int"): { + "function": int, + "params": 0 + }, + ("int", "bool"): { + "function": bool, + "params": 0 + }, + ("int", "div"): { + "function": lambda integer, div: integer / (1 * div), + "params": 1 + }, + ("any", "value"): { + "function": lambda number: float(number) > 0, + "params": 0 + }, + ("str", "bool"): { + "function": lambda string: string.lower() == "true", + "params": 0 + }, + ("str", "int"): { + "function": int, + "params": 0 + }, + ("str", "float"): { + "function": float, + "params": 0 + }, + ("str", "float_absolut"): { + "function": lambda string: abs(float(string)), + "params": 0 + }, + ("str", "floatNA"): { + "function": lambda string: float(string) if string != "N/A" else None, + "params": 0 + }, + ("str", "strptime"): { + "function": lambda string, *args: datetime.datetime.strptime(string, args[0]), + "params": 1 + }, + ("strptime_w_f", "strptime_wo_f"): { + "function": lambda string, *args: datetime.datetime.strptime(string.split(".")[0], *args), + "params": 1 + }, + ("str", "split"): { + "function": lambda string, *args: string.split(args[0])[args[1]] if args[0] in string else None, + "params": 2 + }, + ("str", "splitupper"): { + "function": lambda string, *args: string.split(args[0])[args[1]].upper(), + "params": 2 + }, + ("str", "slice"): { + "function": lambda string, *args: string[args[0]:args[1]], + "params": 2 + }, + ("str", "upper"): { + "function": lambda string: string.upper(), + "params": 0 + }, + ("str", "lower"): { + "function": lambda string: string.lower(), + "params": 0 + }, + ("str", "dateparser"): { + "function": dateutil.parser.parse, + "params": 0 + }, + ("datetime", "strftime"): { + "function": lambda time, *args: datetime.datetime.strftime(time, args[0]), + "params": 1 + }, + ("dateparser", "totimestamp"): { + "function": lambda time: int(time.timestamp()), + "params": 0 + }, + ("datetime", "totimestamp"): { + "function": lambda time: int(time.timestamp()), + "params": 0 + }, + ("datetime", "totimestampms"): { + "function": lambda time: int(round(time.timestamp() * 1000)), + "params": 0 + }, + ("datetime", "utctotimestamp"): { + "function": lambda time: calendar.timegm(time.utctimetuple()), + "params": 0 + }, + ("strptime", "totimestamp"): { + "function": lambda string, *args: int(datetime.datetime.timestamp(datetime.datetime.strptime(string, args[0]))), + "params": 1 + }, + ("none", "nowstrptime"): { + "function": lambda arg: TimeHelper.now().replace(hour=0, minute=0, second=0, microsecond=0), + "params": 0 + }, + ("none", "now"): { + "function": TimeHelper.now, + "params": 0 + }, + ("none", "now_format"): { + "function": lambda spec: format(TimeHelper.now(), spec), + "params": 1 + }, + ("none", "constant"): { # Returns the first argument + "function": lambda *args: args[0], + "params": 1 + }, + ("none", "range"): { + "function": lambda: range(1), + "params": 0 + }, + ("value", "map"): { + # translate into buy/sell. Args: {0: 'buy', 1:'sell'} and arg[0] is the response value (i.e. 0/1) + "function": lambda *args: {args[1]: args[2], args[3]: args[4]}[args[0]], + "params": 4 + }, + ("str", "split_at_del_or_index"): { + "function": lambda string, *args: string.split(args[0])[args[2]] if len(string) != len( + string.split(args[0])[0]) else string[:args[1]] if args[2] == 0 else string[args[1]:], + "params": 3 # delimiter, index, 0 or 1 aka. left or right + }, + ("none", "now_timestamp"): { + "function": lambda: int(TimeHelper.now_timestamp()), + "params": 0 + }, + ("none", "now_timestampms"): { + "function": lambda: int(TimeHelper.now_timestamp(TimeUnit.MILLISECONDS)), + "params": 0 + }, + ("now", "timedelta"): { + "function": lambda delta: int(TimeHelper.to_timestamp(TimeHelper.now() - timedelta(days=int(delta)))), + "params": 1 + }, + ("datetime", "timedelta"): { + "function": lambda time, interval, delta: int( + TimeHelper.to_timestamp(time - timedelta(**{interval: int(delta)}))), + "params": 2 + }, + ("utcfromtimestamp", "timedelta"): { + "function": lambda time, interval, value: TimeHelper.from_timestamp(time) - timedelta( + **{interval: value}) if + isinstance(time, int) else dateutil.parser.parse(time) - timedelta(**{interval: value}), + "params": 2 + }, + ("datetime", "timedeltams"): { + "function": lambda time, interval, delta: int( + TimeHelper.to_timestamp(time - timedelta(**{interval: int(delta)}))) * 1000, + "params": 2 + }, + ("datetime", "timestamp"): { + "function": lambda time: int(TimeHelper.to_timestamp(time)), + "params": 0 + }, + ("datetime", "timestampms"): { + "function": lambda time: int(TimeHelper.to_timestamp(time)) * 1000, + "params": 0 + }, + ("datetime", "format"): { + "function": format, + "params": 1 + }, + ("timedelta", "from_timestamp"): { + "function": lambda time, unit, spec: format(TimeHelper.from_timestamp(time, unit), spec), + "params": 2 + }, + ("from_timestamp", "to_start"): { + "function": lambda time, interval: TimeHelper.start_end_conversion(time, interval, False), + "params": 1 + }, + ("from_timestamp", "to_end"): { + "function": lambda time, interval: TimeHelper.start_end_conversion(time, interval, True), + "params": 1 + } +} +""" + Type Conversions used to convert extracted values from the API-Response into the desired type ("first", "second"). + The values are specified in the .yaml-file of each exchange under the "mapping" of each method. + The function is called in the Mapping Class of utilities.py under the method convert_types(). + + "first": + The actual type extracted from the API-Request (.json) + "second": + The desired type to convert + "function": + the actual function to apply + "params": + the number of additional parameters needed +""" + + +def yaml_loader(exchange: str) -> Dict[str, Any]: + """ + Loads, reads and returns the data of a .yaml-file specified by the param exchange. + + @param exchange: The file name to load (exchange). + @type exchange: str + + @return: Returns a dict of the loaded data from the .yaml-file. + @rtype: dict + + @raise Exception: If the .yaml file could not be evaluated for a given exchange. + """ + exchange = exchange.replace(" ", "") + + path = _paths.all_paths.get("yaml_path") + + try: + with open(path.joinpath(".".join([exchange.lower(), "yaml"])), "r", encoding="UTF-8") as file: + return yaml.load(file, Loader=yaml.FullLoader) + + except FileNotFoundError: + print(f"\nFile {path.joinpath('.'.join([exchange.lower(), 'yaml']))} not found.") + + +def get_exchange_names() -> Optional[List[str]]: + """ + Gives information about all exchange that the program will send + requests to. This means if the name of a exchange is not part of the + list that is returned, the program will not send any request to said + exchange. + + @return: Names from all the exchange, which have a .yaml-file in + the directory described in YAML_PATH. + """ + path_to_resources = _paths.all_paths.get("yaml_path") + + try: + exchanges = os.listdir(path_to_resources) + exchanges = [x.split(".yaml")[0] for x in exchanges if x.endswith(".yaml")] + exchanges.sort() + except FileNotFoundError: + print(f"YAML files not found. The path {path_to_resources} is incorrect.") + return + + return exchanges + + +def replace_list_item(replace_list: list, condition: str, value: str) -> list: + """ + Replaces a specific value from a list. + @param replace_list: The list in which the value needs to be replaced + @param condition: The value to be updated + @param value: The new value + @return: Updated list + """ + for i, item in enumerate(replace_list): + if item == condition: + replace_list[i] = value + return replace_list + + +def split_str_to_list(string: str, splitter: str = ",") -> List[str]: + """ + Splits a string into a list of string. + + @param string: A long string. + @param splitter: The splitting parameter. + + @return: List of strings. + """ + items = string.rsplit(splitter) + + # remove possible blanks from strings + return [item.replace(" ", "") for item in items] From 974da1e156c5acad1e3ac371197739afca7e71a0 Mon Sep 17 00:00:00 2001 From: Steffen Date: Tue, 16 Nov 2021 15:09:56 +0100 Subject: [PATCH 04/25] Some more Unit-Tests --- pandas_datareader/tests/test_cryptoreader.py | 72 ++++++++++++++++---- 1 file changed, 57 insertions(+), 15 deletions(-) diff --git a/pandas_datareader/tests/test_cryptoreader.py b/pandas_datareader/tests/test_cryptoreader.py index fa3e93b6..28f774b8 100644 --- a/pandas_datareader/tests/test_cryptoreader.py +++ b/pandas_datareader/tests/test_cryptoreader.py @@ -1,4 +1,6 @@ import pytest + +import datetime import pandas as pd from pandas_datareader.crypto import CryptoReader @@ -7,21 +9,22 @@ class TestCryptoReader: - """Test class for the CryptoReader.""" + """ Unit tests for the CryptoReader.""" - exchange_name = "coinbase" - symbols = "btc-usd" - kwargs = {"interval": "days"} + exchange_name = 'coinbase' + symbols = 'btc-usd' + kwargs = {'interval': 'days'} CryptoReader = CryptoReader(exchange_name, symbols, **kwargs) def test_get_all_exchanges(self): """ Test to return a list of all available exchanges.""" result = self.CryptoReader.get_all_exchanges() + assert isinstance(result, list) def test_read(self): - """ Test the request from a particular exchange""" + """ Test the request from a particular exchange.""" result = self.CryptoReader.read() @@ -29,22 +32,22 @@ def test_read(self): assert not result.empty def test_request_new_symbol(self): - """ Test to request NEW symbols""" + """ Test to request NEW symbols.""" result = self.CryptoReader.read('eth-usd') + assert 'eth-usd' in self.CryptoReader.symbols.keys() assert isinstance(result, pd.DataFrame) assert not result.empty def test_extract_mappings(self): - """ Test to extract the mapping keys and values from the yaml files""" + """ Test to extract the mapping keys and values from the yaml files.""" result = extract_mappings(self.CryptoReader.name, self.CryptoReader.yaml_file.get('requests')).get('historic_rates') assert isinstance(result, list) assert result - # ToDo: Check for necessary values in mappings. def test_all_exchanges_have_mappings(self): """ Test if all exchange yaml-files have a specified mapping.""" @@ -60,19 +63,58 @@ def test_all_exchanges_have_mappings(self): assert isinstance(result, list) assert result - def test_extract_values_from_response(self): - """ Tests to correctly extract the values from a specified response""" + def test_necessary_values_in_mappings(self): + """ Test if all necessary values are in the mappings.""" + # ToDo + pass + def test_extract_values_from_response(self): + """ Tests to correctly extract the values from a specified response.""" + # ToDo pass def test_iterate_requests_until_no_further_timestamp(self): """ Tests to iterate the request with updated timestamps until no more timestamp is collected - or start time is reached. - """ - + or start time is reached.""" + # ToDo pass def test_empty_response(self): - """ Test the behavior for an valid but empty response""" - + """ Test the behavior for an valid but empty response.""" + # ToDo pass + + def test_sort_result_columns(self): + """ Test to sort the columns of the response.""" + + ordered_cols = ['open', 'high', 'low', 'close'] + response = pd.DataFrame({'high': range(0, 5), 'close': range(0, 5), + 'open': range(0, 5), 'low': range(0, 5)}) + response = self.CryptoReader._sort_columns(dataframe=response) + + assert all(ordered_cols == response.columns) + + def test_ensure_correct_column_names(self): + """ Test to ensure specific column names.""" + + response = pd.DataFrame({'High': range(0, 5), 'CLOSE': range(0, 5), + 'oPen': range(0, 5), 'low': range(0, 5)}) + response = self.CryptoReader._sort_columns(dataframe=response) + + assert response.columns == 'low' + + def test_cut_response_and_set_index(self): + """ Test to cut the response to the initially defined start/end dates.""" + + response = pd.DataFrame({'open': range(0, 100), + 'time': pd.period_range(end='2020-12-31', periods=100, freq="d")}) + + self.CryptoReader.start = datetime.datetime(2020, 12, 1) + self.CryptoReader.end = datetime.datetime(2020, 12, 20) + + response = self.CryptoReader._index_and_cut_dataframe(response) + + assert response.shape[0] == 20 + assert min(response.index).to_timestamp() == self.CryptoReader.start + assert max(response.index).to_timestamp() == self.CryptoReader.end + From ae6b2687a7a974d53381f24c859e1d1ccf0a38a1 Mon Sep 17 00:00:00 2001 From: Steffen Date: Tue, 16 Nov 2021 17:58:53 +0100 Subject: [PATCH 05/25] -New Exception Class 'EmptyResponseError' -More Unit-Tests -Refactoring --- pandas_datareader/crypto.py | 11 +- pandas_datareader/crypto_utils/__init__.py | 2 + pandas_datareader/crypto_utils/_paths.py | 2 + pandas_datareader/crypto_utils/exchange.py | 8 +- pandas_datareader/crypto_utils/utilities.py | 16 +-- pandas_datareader/exceptions.py | 4 + pandas_datareader/tests/test_cryptoreader.py | 121 +++++++++++++------ 7 files changed, 104 insertions(+), 60 deletions(-) diff --git a/pandas_datareader/crypto.py b/pandas_datareader/crypto.py index 9ddde85c..93d2b9b3 100644 --- a/pandas_datareader/crypto.py +++ b/pandas_datareader/crypto.py @@ -1,3 +1,6 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + from typing import Dict, List from sys import stdout @@ -17,7 +20,7 @@ class CryptoReader(Exchange): """ def __init__(self, exchange_name: str, symbols, interval: str = 'days', **kwargs): - """ Constructor. + """ Constructor. Inherits from the Exchange and _BaseReader class. @param exchange_name: String repr of the exchange name @param symbols: Currency pair to request (i.e. BTC-USD) @@ -37,7 +40,7 @@ def get_all_exchanges() -> List: return get_exchange_names() def _await_rate_limit(self): - """ Sleep in order to not violate the rate limit.""" + """ Sleep in order to not violate the rate limit, measured in requests per minute.""" time.sleep(self.rate_limit) @@ -61,6 +64,7 @@ def _print_timestamp(timestamp): @param timestamp: The timestamp """ + stdout.write("Requesting from: \r{}".format(timestamp)) stdout.flush() @@ -91,6 +95,7 @@ def _get_data(self) -> Dict: @return: Response json """ + # Ensure that the currency-pairs are seperated in a list if isinstance(self.symbols, str): self.symbols = split_str_to_list(self.symbols) @@ -113,13 +118,13 @@ def _request(self, new_symbols: str = None) -> pd.DataFrame: to collect the full time-series. @param new_symbols: New currency-pair to request, if they differ from the constructor. - @return df: pd.DataFrame of the returned data. """ if new_symbols: if isinstance(new_symbols, str): new_symbols = split_str_to_list(new_symbols) + # Create a new dict with new symbols as keys and the end timestamp as values. self.symbols = dict.fromkeys(new_symbols, self.end) result = list() diff --git a/pandas_datareader/crypto_utils/__init__.py b/pandas_datareader/crypto_utils/__init__.py index e69de29b..faa18be5 100644 --- a/pandas_datareader/crypto_utils/__init__.py +++ b/pandas_datareader/crypto_utils/__init__.py @@ -0,0 +1,2 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- diff --git a/pandas_datareader/crypto_utils/_paths.py b/pandas_datareader/crypto_utils/_paths.py index 76ac7204..4e036a22 100644 --- a/pandas_datareader/crypto_utils/_paths.py +++ b/pandas_datareader/crypto_utils/_paths.py @@ -1,8 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- + """ This module is preparing the python path to access all modules. """ + import os import sys from pathlib import Path diff --git a/pandas_datareader/crypto_utils/exchange.py b/pandas_datareader/crypto_utils/exchange.py index 3caa2588..7cbfdb94 100644 --- a/pandas_datareader/crypto_utils/exchange.py +++ b/pandas_datareader/crypto_utils/exchange.py @@ -1,3 +1,6 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + from typing import Tuple, Any, Dict, Union, List, Optional from datetime import datetime @@ -9,6 +12,7 @@ from pandas_datareader.crypto_utils.mapping import extract_mappings from pandas_datareader.crypto_utils.mapping import convert_type from pandas_datareader.base import _BaseReader +from pandas_datareader.exceptions import EmptyResponseError class Exchange(_BaseReader): @@ -223,7 +227,8 @@ def format_data(self, responses: Dict) -> Tuple[Optional[List], Optional[List]]: @return: Tuple of extracted and formatted data and a list of the mapping keys in the same order. """ if not responses: - return None, None + raise EmptyResponseError + # return None, None results = list() mappings = extract_mappings(self.name, self.yaml_file.get('requests')).get('historic_rates') @@ -233,7 +238,6 @@ def format_data(self, responses: Dict) -> Tuple[Optional[List], Optional[List]]: temp_results = dict(zip((key for key in mapping_keys), itertools.repeat([], len(mappings)))) try: - for mapping in mappings: if "interval" in mapping.types: mapping.types = replace_list_item(mapping.types, "interval", self.interval) diff --git a/pandas_datareader/crypto_utils/utilities.py b/pandas_datareader/crypto_utils/utilities.py index e54a9569..e8d22b5c 100644 --- a/pandas_datareader/crypto_utils/utilities.py +++ b/pandas_datareader/crypto_utils/utilities.py @@ -1,22 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- + """ Module providing several utility functions needed across the whole program. - -Functions: - - TYPE_CONVERSION: Dict providing functions for type conversions. - - COMPARATOR: Dict providing function for comparison. - - read_config: Function reading the config-file. - - yaml_loader: Function for loading yaml-files. - - load_program_config: Function loading the program configuration. - - provide_ssl_context: Function providing an SSL-context if none is available. - - get_exchange_names: Function returning all exchanges. - - replace_list_item: Function replacing a specific item from a list. - - get_all_exchanges_and_methods: Function returning all exchanges and supported request methods. - - prepend_spaces_to_columns: Function prepending spaces to columns for readability. - - handler: Exception handler logging uncaught exceptions. - - signal_handler: Function recognizing kill signals and raising SystemExit. - - init_logger: Function initializing the global logger. """ from typing import Any, Optional, Dict, List diff --git a/pandas_datareader/exceptions.py b/pandas_datareader/exceptions.py index a186d400..bb87554b 100644 --- a/pandas_datareader/exceptions.py +++ b/pandas_datareader/exceptions.py @@ -16,3 +16,7 @@ class UnstableAPIWarning(Warning): class ImmediateDeprecationError(Exception): pass + +class EmptyResponseError(Exception): + pass + diff --git a/pandas_datareader/tests/test_cryptoreader.py b/pandas_datareader/tests/test_cryptoreader.py index 28f774b8..19ae21da 100644 --- a/pandas_datareader/tests/test_cryptoreader.py +++ b/pandas_datareader/tests/test_cryptoreader.py @@ -1,11 +1,14 @@ -import pytest +#!/usr/bin/env python +# -*- coding: utf-8 -*- +import pytest import datetime import pandas as pd from pandas_datareader.crypto import CryptoReader from pandas_datareader.crypto_utils.mapping import extract_mappings from pandas_datareader.crypto_utils.utilities import yaml_loader +from pandas_datareader.exceptions import EmptyResponseError class TestCryptoReader: @@ -40,50 +43,12 @@ def test_request_new_symbol(self): assert isinstance(result, pd.DataFrame) assert not result.empty - def test_extract_mappings(self): - """ Test to extract the mapping keys and values from the yaml files.""" - - result = extract_mappings(self.CryptoReader.name, - self.CryptoReader.yaml_file.get('requests')).get('historic_rates') - - assert isinstance(result, list) - assert result - - def test_all_exchanges_have_mappings(self): - """ Test if all exchange yaml-files have a specified mapping.""" - - exchanges = self.CryptoReader.get_all_exchanges() - assert isinstance(exchanges, list) - assert exchanges - - for exchange in exchanges: - file = yaml_loader(exchange) - result = extract_mappings(exchange, file.get('requests')).get('historic_rates') - - assert isinstance(result, list) - assert result - - def test_necessary_values_in_mappings(self): - """ Test if all necessary values are in the mappings.""" - # ToDo - pass - - def test_extract_values_from_response(self): - """ Tests to correctly extract the values from a specified response.""" - # ToDo - pass - - def test_iterate_requests_until_no_further_timestamp(self): + def test_iterate_requests_until_end(self): """ Tests to iterate the request with updated timestamps until no more timestamp is collected or start time is reached.""" # ToDo pass - def test_empty_response(self): - """ Test the behavior for an valid but empty response.""" - # ToDo - pass - def test_sort_result_columns(self): """ Test to sort the columns of the response.""" @@ -118,3 +83,79 @@ def test_cut_response_and_set_index(self): assert min(response.index).to_timestamp() == self.CryptoReader.start assert max(response.index).to_timestamp() == self.CryptoReader.end + +class TestExchange: + """ Unit tests for the Exchange class.""" + + exchange_name = 'coinbase' + symbols = 'btc-usd' + kwargs = {'interval': 'days'} + CryptoReader = CryptoReader(exchange_name, symbols, **kwargs) + + def test_extract_mappings(self): + """ Test to extract the mapping keys and values from the yaml files.""" + + result = extract_mappings(self.CryptoReader.name, + self.CryptoReader.yaml_file.get('requests')).get('historic_rates') + + assert isinstance(result, list) + assert result + + def test_all_exchanges_have_mappings_and_necessary_values(self): + """ Test if all exchange yaml-files have a specified mapping.""" + + exchanges = self.CryptoReader.get_all_exchanges() + assert isinstance(exchanges, list) + assert exchanges + + for exchange in exchanges: + file = yaml_loader(exchange) + result = extract_mappings(exchange, file.get('requests')).get('historic_rates') + assert isinstance(result, list) + assert result + + def test_necessary_values_in_mappings(self): + """ Test if all necessary values are in the mappings.""" + + exchanges = self.CryptoReader.get_all_exchanges() + assert isinstance(exchanges, list) + assert exchanges + + for exchange in exchanges: + file = yaml_loader(exchange) + mappings = extract_mappings(exchange, file.get('requests')).get('historic_rates') + + for mapping in mappings: + assert all([item in mapping.__dict__.keys() for item in ['key', 'path', 'types']]) + assert all([val is not None for k, val in mapping.__dict__.items()]) + + def test_extract_request_url(self): + """ Test to extract the request url and parameters.""" + # ToDo + pass + + def test_format_request_url_and_params(self): + """ Test to correctly format the request url and parameters.""" + # ToDo + pass + + def test_all_exchange_apis(self): + """ Test if the API of every exchange is correctly implemented and functional.""" + # ToDo + pass + + def test_extract_values_from_response(self): + """ Tests to correctly extract the values from a specified response.""" + # ToDo + pass + + def test_empty_response(self): + """ Test the behavior for an valid but empty response.""" + resp = [] + with pytest.raises(EmptyResponseError): + self.CryptoReader.format_data(resp) + + def test_format_data(self): + """ Test to correctly extract the response values.""" + # ToDo + pass From 8d34acffce161351a912d0085637044e9e603f37 Mon Sep 17 00:00:00 2001 From: Steffen Date: Wed, 17 Nov 2021 12:49:22 +0100 Subject: [PATCH 06/25] Unit test class for exchange.py --- pandas_datareader/crypto.py | 29 +++++++++-------- pandas_datareader/crypto_utils/exchange.py | 34 ++++++++++++++------ pandas_datareader/tests/test_cryptoreader.py | 13 +++----- 3 files changed, 44 insertions(+), 32 deletions(-) diff --git a/pandas_datareader/crypto.py b/pandas_datareader/crypto.py index 93d2b9b3..b339e7fa 100644 --- a/pandas_datareader/crypto.py +++ b/pandas_datareader/crypto.py @@ -1,34 +1,44 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -from typing import Dict, List +from typing import Dict, List, Union +from abc import ABC from sys import stdout import pandas as pd import time +from datetime import datetime import pytz from pandas_datareader.crypto_utils.exchange import Exchange from pandas_datareader.crypto_utils.utilities import split_str_to_list, get_exchange_names -class CryptoReader(Exchange): +class CryptoReader(Exchange, ABC): """ Class to request the data from a given exchange for a given currency-pair. The class inherits from Exchange to extract and format the request urls, as well as to extract and format the values from the response json. The requests are performed by the _BaseReader. """ - def __init__(self, exchange_name: str, symbols, interval: str = 'days', **kwargs): + def __init__(self, + exchange_name: str, + symbols: str, + start: Union[str, datetime] = None, + end: Union[str, datetime] = None, + interval: str = None, + **kwargs): """ Constructor. Inherits from the Exchange and _BaseReader class. @param exchange_name: String repr of the exchange name @param symbols: Currency pair to request (i.e. BTC-USD) + @param start: The start time of the request, handed over to the BaseReader. + @param end: The end time of the request, handed over to the BaseReader. @param interval: Candle interval (i.e. minutes, hours, days, weeks, months) @param kwargs: Additional arguments for the _BaseReader class. """ - super(CryptoReader, self).__init__(exchange_name, symbols, interval, **kwargs) + super(CryptoReader, self).__init__(exchange_name, interval, symbols, start, end, **kwargs) @staticmethod def get_all_exchanges() -> List: @@ -68,15 +78,6 @@ def _print_timestamp(timestamp): stdout.write("Requesting from: \r{}".format(timestamp)) stdout.flush() - def read(self, new_symbols: str = None) -> pd.DataFrame: - """ Read the data. - - @param new_symbols: Set new currency-pair different from the initial one. - @return: pd.DataFrame of requested data - """ - - return self._request(new_symbols) - def _index_and_cut_dataframe(self, dataframe: pd.DataFrame) -> pd.DataFrame: """ Set index and cut data according to user specification. @@ -113,7 +114,7 @@ def _get_data(self) -> Dict: self._await_rate_limit() return resp.json() - def _request(self, new_symbols: str = None) -> pd.DataFrame: + def read(self, new_symbols: str = None) -> pd.DataFrame: """ Requests and extracts the data. Requests may be performed iteratively over time to collect the full time-series. diff --git a/pandas_datareader/crypto_utils/exchange.py b/pandas_datareader/crypto_utils/exchange.py index 7cbfdb94..117039c6 100644 --- a/pandas_datareader/crypto_utils/exchange.py +++ b/pandas_datareader/crypto_utils/exchange.py @@ -3,6 +3,7 @@ from typing import Tuple, Any, Dict, Union, List, Optional +from abc import ABC from datetime import datetime import string from collections import OrderedDict, deque @@ -15,22 +16,29 @@ from pandas_datareader.exceptions import EmptyResponseError -class Exchange(_BaseReader): +class Exchange(_BaseReader, ABC): """ Class for every exchange supported. The class extracts the request url, fits parameters, - extracts the values from the response json and performs type-conversions. - """ + extracts the values from the response json and performs type-conversions.""" - def __init__(self, name: str, symbols, interval: str, **kwargs): - super(Exchange, self).__init__(symbols, **kwargs) - self.name = name + def __init__(self, exchange_name: str, interval: str = 'days', *args, **kwargs): + """ Constructor. + + @param exchange_name: The exchange name. + @param interval: The candle interval. + @param args: Additional ordered arguments for the BaseReader. + @param kwargs: Additional keyword arguments for the BaseReader. + """ + + super(Exchange, self).__init__(*args, **kwargs) + self.name = exchange_name self.yaml_file = yaml_loader(self.name) - self.interval: Union[str, Dict] = interval + self.interval: str = interval self.rate_limit = self.get_rate_limit() - def get_rate_limit(self) -> int: + def get_rate_limit(self) -> Union[int, float]: """ Calculates the rate-limit of an exchange. - @return: The rate limit, i.e. time to "sleep" to not violate the limit per minute. + @return: The rate limit, i.e. time to "sleep" to not violate the limit in seconds. """ if self.yaml_file.get("rate_limit"): if self.yaml_file["rate_limit"]["max"] <= 0: @@ -191,13 +199,17 @@ def _type_con(self, val: Any, **kwargs: dict) -> Any: @param kwargs: The value to be converted. @return: Converted value. """ + param_value = kwargs.get("has_value", None) conv_params = val + # to avoid conversion when only a type declaration was done. If a parameter is of type "int". if isinstance(conv_params, str) or len(conv_params) < 2: return param_value + # replace the key "interval" with the interval specified in the configuration file. conv_params = [self.interval if x == "interval" else x for x in conv_params] + # return {cp: convert_type(param_value[cp], deque(conv_params)) for cp in currency_pairs} # ToDo: Check if the above line works. The older version needed both if statements below. if isinstance(param_value, dict): @@ -211,6 +223,7 @@ def _get_first_timestamp(self, last_ts: datetime) -> datetime: @param last_ts: The oldest timestamp from the previous request @return: The latest timestamp. """ + if last_ts: return last_ts @@ -219,13 +232,14 @@ def _get_first_timestamp(self, last_ts: datetime) -> datetime: else: return self.end - def format_data(self, responses: Dict) -> Tuple[Optional[List], Optional[List]]: + def format_data(self, responses: Union[Dict, List]) -> Tuple[Optional[List], Optional[List]]: """ Extracts and formats the response data, according to the mapping keys and path. Data is then ordered and returned as a tuple. @param responses: The response json @return: Tuple of extracted and formatted data and a list of the mapping keys in the same order. """ + if not responses: raise EmptyResponseError # return None, None diff --git a/pandas_datareader/tests/test_cryptoreader.py b/pandas_datareader/tests/test_cryptoreader.py index 19ae21da..83091c3b 100644 --- a/pandas_datareader/tests/test_cryptoreader.py +++ b/pandas_datareader/tests/test_cryptoreader.py @@ -16,8 +16,7 @@ class TestCryptoReader: exchange_name = 'coinbase' symbols = 'btc-usd' - kwargs = {'interval': 'days'} - CryptoReader = CryptoReader(exchange_name, symbols, **kwargs) + CryptoReader = CryptoReader(exchange_name, symbols) def test_get_all_exchanges(self): """ Test to return a list of all available exchanges.""" @@ -86,11 +85,10 @@ def test_cut_response_and_set_index(self): class TestExchange: """ Unit tests for the Exchange class.""" - + # ToDo: Create test-exchange yaml file and use it instead for this class. exchange_name = 'coinbase' symbols = 'btc-usd' - kwargs = {'interval': 'days'} - CryptoReader = CryptoReader(exchange_name, symbols, **kwargs) + CryptoReader = CryptoReader(exchange_name, symbols) def test_extract_mappings(self): """ Test to extract the mapping keys and values from the yaml files.""" @@ -118,16 +116,15 @@ def test_necessary_values_in_mappings(self): """ Test if all necessary values are in the mappings.""" exchanges = self.CryptoReader.get_all_exchanges() - assert isinstance(exchanges, list) - assert exchanges for exchange in exchanges: file = yaml_loader(exchange) mappings = extract_mappings(exchange, file.get('requests')).get('historic_rates') for mapping in mappings: + # Check if the object dict contains all necessary keys and not-None values. assert all([item in mapping.__dict__.keys() for item in ['key', 'path', 'types']]) - assert all([val is not None for k, val in mapping.__dict__.items()]) + assert all([val is not None for _, val in mapping.__dict__.items()]) def test_extract_request_url(self): """ Test to extract the request url and parameters.""" From 7f4dca6e38577255cf4e49870a65bc4b34672d9b Mon Sep 17 00:00:00 2001 From: Steffen Date: Wed, 17 Nov 2021 17:06:58 +0100 Subject: [PATCH 07/25] Basis for an asynchronous API tester. --- pandas_datareader/crypto_utils/test_apis.py | 42 +++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 pandas_datareader/crypto_utils/test_apis.py diff --git a/pandas_datareader/crypto_utils/test_apis.py b/pandas_datareader/crypto_utils/test_apis.py new file mode 100644 index 00000000..6a27d257 --- /dev/null +++ b/pandas_datareader/crypto_utils/test_apis.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from typing import List, Tuple, Optional + +import asyncio +import requests + + +class ApiTest: + """ Tests several api responses concurrently.""" + + def __init__(self): + self.loop = asyncio.get_event_loop() + self.futures = [] + + def create_futures(self, urls: List): + """ Creates a list of awaitable futures. + + @param urls: List of urls to request. + """ + + self.futures = [self.loop.run_in_executor(None, requests.get, url) for url in urls] + + async def perform_request(self) -> Tuple: + """ Performs the request. + + @return: Tuple of all collected response codes. + """ + + return await asyncio.gather(*future.status for future in self.futures) + + async def run(self) -> Optional[bool]: + """ Starts the event loop. + + @return: True if all request status codes are okay. + """ + + status_list = self.loop.run_until_complete(self.perform_request()) + assert all(status_list) + + return True From b3cec30feada899fda70368b3ea9799bbe400cec Mon Sep 17 00:00:00 2001 From: Steffen Date: Sat, 20 Nov 2021 16:26:30 +0100 Subject: [PATCH 08/25] Added CryptoReader.get_currency_pairs(). --- pandas_datareader/crypto.py | 49 ++- pandas_datareader/crypto_utils/exchange.py | 64 ++- .../crypto_utils/resources/binance.yaml | 388 ++++++++++++++++++ pandas_datareader/crypto_utils/utilities.py | 28 +- 4 files changed, 494 insertions(+), 35 deletions(-) create mode 100644 pandas_datareader/crypto_utils/resources/binance.yaml diff --git a/pandas_datareader/crypto.py b/pandas_datareader/crypto.py index b339e7fa..fc5a2e0a 100644 --- a/pandas_datareader/crypto.py +++ b/pandas_datareader/crypto.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -from typing import Dict, List, Union +from typing import Dict, List, Union, Optional from abc import ABC from sys import stdout @@ -9,9 +9,11 @@ import time from datetime import datetime import pytz +import requests.exceptions from pandas_datareader.crypto_utils.exchange import Exchange from pandas_datareader.crypto_utils.utilities import split_str_to_list, get_exchange_names +from pandas_datareader.crypto_utils.utilities import sort_columns, print_timestamp class CryptoReader(Exchange, ABC): @@ -49,34 +51,26 @@ def get_all_exchanges() -> List: return get_exchange_names() - def _await_rate_limit(self): - """ Sleep in order to not violate the rate limit, measured in requests per minute.""" - - time.sleep(self.rate_limit) + def get_currency_pairs(self) -> Optional[pd.DataFrame]: + """ Requests all supported currency pairs from the exchange. - @staticmethod - def _sort_columns(dataframe: pd.DataFrame) -> pd.DataFrame: - """ Sort columns in OHLCV order. - - @param dataframe: Requested data with unordered columns - @return: pd.DataFrame with ordered columns + @return: A list of all listed currency pairs. """ - # remove columns not returned by the exchange and maintain order. - columns = ['open', 'high', 'low', 'close', 'volume', 'market_cap'] - columns = sorted(set(columns).intersection(dataframe.columns), key=columns.index) - - return dataframe.loc[:, columns] + param_dict = self.extract_request_urls(None, "currency_pairs") + url = param_dict.get("currency_pairs").get("url", None) + try: + resp = self._get_response(url, params=None, headers=None) + resp = self.format_currency_pairs(resp.json()) + except (requests.exceptions.MissingSchema, Exception): + return None - @staticmethod - def _print_timestamp(timestamp): - """ Prints the actual request timestamp. + return pd.DataFrame(resp, columns=["Exchange", "Base", "Quote"]) - @param timestamp: The timestamp - """ + def _await_rate_limit(self): + """ Sleep in order to not violate the rate limit, measured in requests per minute.""" - stdout.write("Requesting from: \r{}".format(timestamp)) - stdout.flush() + time.sleep(self.rate_limit) def _index_and_cut_dataframe(self, dataframe: pd.DataFrame) -> pd.DataFrame: """ Set index and cut data according to user specification. @@ -89,7 +83,7 @@ def _index_and_cut_dataframe(self, dataframe: pd.DataFrame) -> pd.DataFrame: dataframe.sort_index(inplace=True) dataframe = dataframe.loc[pytz.utc.localize(self.start): pytz.utc.localize(self.end)] - return self._sort_columns(dataframe) + return sort_columns(dataframe) def _get_data(self) -> Dict: """ Requests the data and returns the response json. @@ -107,7 +101,6 @@ def _get_data(self) -> Dict: url, params = self.get_formatted_url_and_params(param_dict, *self.symbols.keys()) # Perform the request - self._print_timestamp(list(self.symbols.values())[0]) resp = self._get_response(url, params=params, headers=None) # Await the rate-limit to avoid ip ban. @@ -136,8 +129,14 @@ def read(self, new_symbols: str = None) -> pd.DataFrame: # perform request and extract data. resp = self._get_data() data, mappings = self.format_data(resp) + # break if no data is returned if not data: break + # or all returned data points already exist. + elif result == data or all([datapoint in result for datapoint in data]): + break + + print_timestamp(list(self.symbols.values())[0]) # Append new data to the result list result = result + data diff --git a/pandas_datareader/crypto_utils/exchange.py b/pandas_datareader/crypto_utils/exchange.py index 117039c6..c4b43254 100644 --- a/pandas_datareader/crypto_utils/exchange.py +++ b/pandas_datareader/crypto_utils/exchange.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -from typing import Tuple, Any, Dict, Union, List, Optional +from typing import Tuple, Any, Dict, Union, List, Optional, Iterator from abc import ABC from datetime import datetime @@ -68,22 +68,26 @@ def apply_currency_pair_format(self, currency_pair: str) -> str: if pair_template_dict["lower_case"]: formatted_string = formatted_string.lower() + else: + formatted_string = formatted_string.upper() return formatted_string - def get_formatted_url_and_params(self, url_and_parameters: Any, currency_pair: str) -> Tuple[str, Dict]: + def get_formatted_url_and_params(self, url_and_parameters: Any, currency_pair: str, + request_type: str = 'historic_rates') -> Tuple[str, Dict]: """ Formats the request url, inserts the currency-pair representation and/or extracts the parameters specified for the exchange and request. @param url_and_parameters: Extracted url and parameters from self.extract_request_urls. @param currency_pair: The currency pair of interest to format the url and params on. + @param request_type: The request type. Default: "historic_rates". Possible: "historic_rates", "currency_pairs". @return Tuple of formatted url and formatted parameters. """ - url = url_and_parameters.get('historic_rates').get("url") - pair_template = url_and_parameters.get('historic_rates').get("pair_template") + url = url_and_parameters.get(request_type).get("url") + pair_template = url_and_parameters.get(request_type).get("pair_template") pair_formatted = self.apply_currency_pair_format(currency_pair) - parameters = url_and_parameters.get('historic_rates').get("params") + parameters = url_and_parameters.get(request_type).get("params") parameters.update({key: parameters[key][currency_pair] for key, val in parameters.items() if isinstance(val, dict)}) @@ -105,14 +109,16 @@ def get_formatted_url_and_params(self, url_and_parameters: Any, currency_pair: s return url_formatted, parameters - def extract_request_urls(self, currency_pairs: Dict[str, datetime]) -> Dict: + def extract_request_urls(self, currency_pairs: Optional[Dict[str, datetime]], + request_type: str = "historic_rates") -> Dict: """ Extracts the request url from the yaml-file and implements the parameters. @param currency_pairs: Currency-pair with the timestamp of the latest request. + @param request_type: Request name, default: "historic_rates". Possible: "historic_rates", "currency_pairs". @return: Dict of the extracted url and parameters. """ - request_dict = self.yaml_file.get("requests").get("historic_rates").get("request") + request_dict = self.yaml_file.get("requests").get(request_type).get("request") request_parameters = dict() request_parameters["url"] = self.yaml_file.get("api_url", "") + request_dict.get("template", "") request_parameters["pair_template"] = request_dict.get("pair_template", None) @@ -122,7 +128,7 @@ def extract_request_urls(self, currency_pairs: Dict[str, datetime]) -> Dict: if not parameters: request_parameters["params"] = {} - urls["historic_rates"] = request_parameters + urls[request_type] = request_parameters return urls mapping: dict = {"allowed": self._allowed, "function": self._function, @@ -147,7 +153,7 @@ def extract_request_urls(self, currency_pairs: Dict[str, datetime]) -> Dict: parameter[param] = mapping.get(key)(val, **kwargs) request_parameters["params"] = parameter - urls["historic_rates"] = request_parameters + urls[request_type] = request_parameters return urls def _allowed(self, val: dict, **_: dict) -> Any: @@ -288,3 +294,43 @@ def format_data(self, responses: Union[Dict, List]) -> Tuple[Optional[List], Opt result = list(itertools.zip_longest(*result)) return result, list(temp_results.keys()) + + def format_currency_pairs(self, response: Tuple[str, dict]) -> Optional[Iterator[Tuple[str, str, str]]]: + """ + Extracts the currency-pairs of out of the given json-response + that was collected from the Rest-API of this exchange. + + Process is similar to @see{self.format_ticker()}. + + @param response: + Raw json-response from the Rest-API of this exchange that needs be formatted. + @return: + Iterator containing tuples of the following structure: + (self.name, name of first currency-pair, name of second currency-pair) + """ + + results = {"currency_pair_first": [], + "currency_pair_second": []} + mappings = extract_mappings(self.name, self.yaml_file.get('requests')).get('currency_pairs') + + for mapping in mappings: + results[mapping.key] = mapping.extract_value(response) + + if isinstance(results[mapping.key], str): + # If the result is only one currency, it will be split into every letter. + # To avoid this, put it into a list. + results[mapping.key] = [results[mapping.key]] + + # Check if all dict values do have the same length + values = list(results.values()) + # Get the max length from all dict values + len_results = {key: len(value) for key, value in results.items() if hasattr(value, "__iter__")} + len_results = max(len_results.values()) if bool(len_results) else 1 + + if not all(len(value) == len_results for value in values): + # Update all dict values with equal length + results.update({k: itertools.repeat(*v, len_results) for k, v in results.items() if len(v) == 1}) + + return list(itertools.zip_longest(itertools.repeat(self.name, len_results), + results["currency_pair_first"], + results["currency_pair_second"])) diff --git a/pandas_datareader/crypto_utils/resources/binance.yaml b/pandas_datareader/crypto_utils/resources/binance.yaml new file mode 100644 index 00000000..6b33b19d --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/binance.yaml @@ -0,0 +1,388 @@ +name: binance +exchange: true +api_url: https://api.binance.com/api/ +rate_limit: + max: 1200 + unit: 60 +requests: + currency_pairs: + request: + template: v1/exchangeInfo + pair_template: null + params: null + response: + type: dict + values: + timezone: + type: str # "UTC" + serverTime: + type: + - float + - from_timestamp + - 1 + rateLimits: + type: list + exchangeFilters: + type: list + symbols: + type: list + values: + type: dict + values: + symbol: # i.e. "ETHBTC" + type: str + status: # i.e. "TRADING" + type: str + baseAsset: # i.e. ETH + type: str + baseAssetPrecision: + type: int + quoteAsset: # i.e. "BTC" + type: str + quotePrecision: + type: int + orderTypes: + type: list + icebergAllowed: + type: bool + filters: + type: list + mapping: + - key: currency_pair_first + path: + - symbols + - baseAsset + type: + - str + - key: currency_pair_second + path: + - symbols + - quoteAsset + type: + - str + + tickers: + request: + template: v3/ticker/bookTicker + pair_template: # e.g. BNBBTC + template: "{first}{second}" + lower_case: false + alias: symbol + params: null + response: + type: dict + values: + symbol: + type: str + bidPrice: + type: + - str + - float + bidQty: + type: + - str + - float + askPrice: + type: + - str + - float + askQty: + type: + - str + - float + mapping: + - key: time + path: [] + type: + - none + - now + - key: best_bid + path: + - bidPrice + type: + - str + - float + - key: best_ask + path: + - askPrice + type: + - str + - float + + order_books: + request: + template: v3/depth + pair_template: # e.g. BNBBTC + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + max: 100 + default: 50 + + response: + type: dict + values: + lastUpdateId: + type: int + bids: + type: list + values: + type: list + values: + 0: # price + type: + - str + - float + 1: # quantity + type: + - str + - float + asks: + type: list + values: + type: list + values: + 0: # price + type: + - str + - float + 1: # quantity + type: + - str + - float + mapping: + - key: time + path: [] + type: + - none + - now + + - key: id + path: + - lastUpdateId + type: + - str + + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + + trades: + request: + template: v1/trades + pair_template: # e.g. BNBBTC + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + max: 1000 + default: 500 + weight: 1 + response: + type: list + values: + type: dict + values: + id: + type: int + price: + type: + - str + - float + qty: + type: + - str + - float + time: + type: + - float + - from_timestamp + - 1 + isBuyerMaker: + type: bool + isBestMatch: + type: bool + mapping: + - key: id + path: + - id + type: + - int + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - True + - sell + - False + - buy + + historic_rates: + request: + template: v1/klines + pair_template: # e.g. BNBBTC + template: "{first}{second}" + lower_case: false + alias: symbol + params: + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + months: 1M + default: 1d + startTime: + required: false + endTime: + function: last_timestamp + type: + - datetime + - timestampms + limit: + max: 1000 + default: 1000 + response: + type: list + values: + type: list + values: + 0: # Open time + type: + - float + - from_timestamp + - 1 + 1: # open + type: + - str + - float + 2: # high + type: + - str + - float + 3: # low + type: + - str + - float + 4: # close + type: + - str + - float + 5: # volume + type: + - str + - float + 6: # close time + type: + - float + - from_timestamp + - 1 + 7: # Quote asset volume + type: + - str + - float + 8: # Number of trades + type: int + 9: # Taker buy base asset volume + type: + - str + - float + 10: # Taker buy quote asset volume + type: + - str + - float + 11: # ignore + type: ignore + mapping: + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float + - key: time + path: + - 6 + type: + - float + - from_timestamp + - 1 diff --git a/pandas_datareader/crypto_utils/utilities.py b/pandas_datareader/crypto_utils/utilities.py index e8d22b5c..536302e3 100644 --- a/pandas_datareader/crypto_utils/utilities.py +++ b/pandas_datareader/crypto_utils/utilities.py @@ -7,12 +7,14 @@ from typing import Any, Optional, Dict, List +import os +from sys import stdout import calendar import datetime -import os from datetime import timedelta import dateutil.parser import yaml +import pandas as pd from pandas_datareader.crypto_utils.time_helper import TimeHelper, TimeUnit import pandas_datareader.crypto_utils._paths as _paths @@ -291,3 +293,27 @@ def split_str_to_list(string: str, splitter: str = ",") -> List[str]: # remove possible blanks from strings return [item.replace(" ", "") for item in items] + + +def sort_columns(dataframe: pd.DataFrame) -> pd.DataFrame: + """ Sort columns in OHLCV order. + + @param dataframe: Requested data with unordered columns + @return: pd.DataFrame with ordered columns + """ + + # remove columns not returned by the exchange and maintain order. + columns = ['open', 'high', 'low', 'close', 'volume', 'market_cap'] + columns = sorted(set(columns).intersection(dataframe.columns), key=columns.index) + + return dataframe.loc[:, columns] + + +def print_timestamp(timestamp): + """ Prints the actual request timestamp. + + @param timestamp: The timestamp + """ + + stdout.write("Requesting from: \r{}".format(timestamp)) + stdout.flush() From 29b0470e8e2d44294909020dbecc22e77305d2be Mon Sep 17 00:00:00 2001 From: Steffen Date: Sat, 20 Nov 2021 17:05:48 +0100 Subject: [PATCH 09/25] - Bugfix: end date. End date is recovered once the iterative requesting is done. - Added CryptoReader.check_symbols() to check if the symbols are available at an exchange. --- pandas_datareader/crypto.py | 22 +++++++++++++++++++--- pandas_datareader/crypto_utils/exchange.py | 1 + 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/pandas_datareader/crypto.py b/pandas_datareader/crypto.py index fc5a2e0a..fd362182 100644 --- a/pandas_datareader/crypto.py +++ b/pandas_datareader/crypto.py @@ -51,7 +51,7 @@ def get_all_exchanges() -> List: return get_exchange_names() - def get_currency_pairs(self) -> Optional[pd.DataFrame]: + def get_currency_pairs(self, raw_data: bool = False) -> Optional[pd.DataFrame]: """ Requests all supported currency pairs from the exchange. @return: A list of all listed currency pairs. @@ -65,7 +65,15 @@ def get_currency_pairs(self) -> Optional[pd.DataFrame]: except (requests.exceptions.MissingSchema, Exception): return None - return pd.DataFrame(resp, columns=["Exchange", "Base", "Quote"]) + return pd.DataFrame(resp, columns=["Exchange", "Base", "Quote"]) if not raw_data else resp + + def _check_symbols(self) -> bool: + """ Checks if the specified currency-pair is listed on the exchange""" + + currency_pairs = self.get_currency_pairs(raw_data=True) + symbols = self.symbols.keys() + + return all([(self.name, *symbol.upper().split("-")) in currency_pairs for symbol in symbols]) def _await_rate_limit(self): """ Sleep in order to not violate the rate limit, measured in requests per minute.""" @@ -96,6 +104,10 @@ def _get_data(self) -> Dict: self.symbols = split_str_to_list(self.symbols) self.symbols = dict.fromkeys(self.symbols, self.end) + # Check if the provided currency-pair is listed on the exchange. + if not self._check_symbols(): + raise KeyError(f"At least one of the provided currency-pairs is not listed on '{self.name}'.") + # Extract and format the url and parameters for the request param_dict = self.extract_request_urls(self.symbols) url, params = self.get_formatted_url_and_params(param_dict, *self.symbols.keys()) @@ -160,4 +172,8 @@ def read(self, new_symbols: str = None) -> pd.DataFrame: # If there is data put it into a pd.DataFrame, set index and cut it to fit the initial start/end time. if result: result = pd.DataFrame(result, columns=mappings) - return self._index_and_cut_dataframe(result) + result = self._index_and_cut_dataframe(result) + + # Reset the self.end date may be used before before for iteration. + self.end = self._base_end + return result diff --git a/pandas_datareader/crypto_utils/exchange.py b/pandas_datareader/crypto_utils/exchange.py index c4b43254..53a087c2 100644 --- a/pandas_datareader/crypto_utils/exchange.py +++ b/pandas_datareader/crypto_utils/exchange.py @@ -34,6 +34,7 @@ def __init__(self, exchange_name: str, interval: str = 'days', *args, **kwargs): self.yaml_file = yaml_loader(self.name) self.interval: str = interval self.rate_limit = self.get_rate_limit() + self._base_end = kwargs.get("end", datetime.utcnow()) def get_rate_limit(self) -> Union[int, float]: """ Calculates the rate-limit of an exchange. From ae8aadc810b78da22817cfd87243377706a1e284 Mon Sep 17 00:00:00 2001 From: Steffen Date: Mon, 22 Nov 2021 14:03:49 +0100 Subject: [PATCH 10/25] - Refactoring - Bugfix CryptoReader._check_symbols - Bugfix reset _BaseReader after a complete run. --- pandas_datareader/__init__.py | 2 ++ pandas_datareader/crypto.py | 19 ++++++---- pandas_datareader/crypto_utils/exchange.py | 26 +++++++++++++- pandas_datareader/crypto_utils/mapping.py | 28 ++++++--------- pandas_datareader/crypto_utils/time_helper.py | 35 ++++++++++--------- pandas_datareader/crypto_utils/utilities.py | 2 +- pandas_datareader/tests/test_cryptoreader.py | 11 ++++-- requirements.txt | 1 + 8 files changed, 78 insertions(+), 46 deletions(-) diff --git a/pandas_datareader/__init__.py b/pandas_datareader/__init__.py index a792a806..2ab84c1b 100644 --- a/pandas_datareader/__init__.py +++ b/pandas_datareader/__init__.py @@ -28,6 +28,7 @@ get_records_iex, get_summary_iex, get_tops_iex, + get_data_crypto ) PKG = os.path.dirname(__file__) @@ -62,6 +63,7 @@ "get_data_tiingo", "get_iex_data_tiingo", "get_data_alphavantage", + "get_data_crypto", "test", ] diff --git a/pandas_datareader/crypto.py b/pandas_datareader/crypto.py index fd362182..17c1de9b 100644 --- a/pandas_datareader/crypto.py +++ b/pandas_datareader/crypto.py @@ -51,9 +51,10 @@ def get_all_exchanges() -> List: return get_exchange_names() - def get_currency_pairs(self, raw_data: bool = False) -> Optional[pd.DataFrame]: + def get_currency_pairs(self, raw_data: bool = False) -> Optional[Union[pd.DataFrame, List]]: """ Requests all supported currency pairs from the exchange. + @param raw_data: Return the raw data as a list of tuples. @return: A list of all listed currency pairs. """ @@ -71,12 +72,12 @@ def _check_symbols(self) -> bool: """ Checks if the specified currency-pair is listed on the exchange""" currency_pairs = self.get_currency_pairs(raw_data=True) - symbols = self.symbols.keys() + symbols = self.symbols.keys() if isinstance(self.symbols, dict) else [self.symbols] - return all([(self.name, *symbol.upper().split("-")) in currency_pairs for symbol in symbols]) + return all([(self.name, *symbol.lower().split("-")) in currency_pairs for symbol in symbols]) def _await_rate_limit(self): - """ Sleep in order to not violate the rate limit, measured in requests per minute.""" + """ Sleep time in order to not violate the rate limit, measured in requests per minute.""" time.sleep(self.rate_limit) @@ -106,7 +107,8 @@ def _get_data(self) -> Dict: # Check if the provided currency-pair is listed on the exchange. if not self._check_symbols(): - raise KeyError(f"At least one of the provided currency-pairs is not listed on '{self.name}'.") + raise KeyError(f"The provided currency-pair is not listed on '{self.name.capitalize()}'. " + f"Call CryptoReader.get_currency_pairs() for an overview.") # Extract and format the url and parameters for the request param_dict = self.extract_request_urls(self.symbols) @@ -117,6 +119,7 @@ def _get_data(self) -> Dict: # Await the rate-limit to avoid ip ban. self._await_rate_limit() + return resp.json() def read(self, new_symbols: str = None) -> pd.DataFrame: @@ -174,6 +177,8 @@ def read(self, new_symbols: str = None) -> pd.DataFrame: result = pd.DataFrame(result, columns=mappings) result = self._index_and_cut_dataframe(result) - # Reset the self.end date may be used before before for iteration. - self.end = self._base_end + # ToDo: Make decorator from function call? + # Reset the self.end date of the _BaseReader for further requesting. + self.reset_base_reader() + return result diff --git a/pandas_datareader/crypto_utils/exchange.py b/pandas_datareader/crypto_utils/exchange.py index 53a087c2..55bdbe15 100644 --- a/pandas_datareader/crypto_utils/exchange.py +++ b/pandas_datareader/crypto_utils/exchange.py @@ -4,6 +4,7 @@ from typing import Tuple, Any, Dict, Union, List, Optional, Iterator from abc import ABC +import inspect from datetime import datetime import string from collections import OrderedDict, deque @@ -34,7 +35,29 @@ def __init__(self, exchange_name: str, interval: str = 'days', *args, **kwargs): self.yaml_file = yaml_loader(self.name) self.interval: str = interval self.rate_limit = self.get_rate_limit() - self._base_end = kwargs.get("end", datetime.utcnow()) + self.args = args + self.kwargs = kwargs + + def reset_base_reader(self): + """ Reset the _BaseReader with the initial values to allow further requesting with the same CryptoReader + instance. The self.end attribute gets manipulated during iterative requests which would lead to + falsely specified parameters afterwards. The symbols must remain as they may be changed after initialization""" + + # Get all args from the _BaseReader class and remove "self". + args = inspect.getfullargspec(_BaseReader)[0] + args.remove("self") + args = dict.fromkeys(args) + + # Update the empty dict of args with already existing *args and **kwargs. + args.update(dict(zip(args, self.args))) + args.update(**self.kwargs) + + # If the attribute was changed after initialization, keep the change and remove None values from the dict + args.update({'symbols': self.symbols}) + args = {k: v for k, v in args.items() if v is not None} + + # Init the parent class. + super(Exchange, self).__init__(**args) def get_rate_limit(self) -> Union[int, float]: """ Calculates the rate-limit of an exchange. @@ -316,6 +339,7 @@ def format_currency_pairs(self, response: Tuple[str, dict]) -> Optional[Iterator for mapping in mappings: results[mapping.key] = mapping.extract_value(response) + results[mapping.key] = [item.lower() for item in results[mapping.key]] if isinstance(results[mapping.key], str): # If the result is only one currency, it will be split into every letter. diff --git a/pandas_datareader/crypto_utils/mapping.py b/pandas_datareader/crypto_utils/mapping.py index 72cfa1e2..d8b9d307 100644 --- a/pandas_datareader/crypto_utils/mapping.py +++ b/pandas_datareader/crypto_utils/mapping.py @@ -1,5 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- + """ Module to find, extract and convert values from the exchange responses. @@ -20,8 +21,7 @@ def convert_type(value: Any, types_queue: Deque[str]) -> Any: - """ - Converts the value via type conversions. + """ Converts the value via type conversions. Helper method to convert the given value via a queue of type conversions. @@ -69,8 +69,7 @@ def convert_type(value: Any, types_queue: Deque[str]) -> Any: class Mapping: - """ - Class representing mapping data and logic. + """ Class representing mapping data and logic. Class representing mapping data und further functionality provided with methods. @@ -94,8 +93,7 @@ def __init__(self, key: str, path: List[str], types: List[str]): - """ - Constructor of Mapping. + """ Constructor of Mapping. Constructor method for constructing method objects. @@ -117,10 +115,8 @@ def __init__(self, self.types = types def traverse_path(self, response: Dict[str, Any], path_queue: Deque[str], - currency_pair_info: Tuple[str, str, str] = None) \ - -> Any: - """ - Traverses the path on a response. + currency_pair_info: Tuple[str, str, str] = None) -> Any: + """ Traverses the path on a response. Helper method for traversing the path on the given response dict (subset). @@ -155,7 +151,7 @@ def traverse_path(self, response: Dict[str, Any], path_queue: Deque[str], traversed = response[currency_pair_info[2]] elif is_scalar(response): return None - else: # Hier editiert für Kraken sonderfall + else: # Special case for kraken. if isinstance(response, dict) and path_element not in response.keys(): return None else: @@ -170,8 +166,7 @@ def extract_value(self, types_queue: Deque[str] = None, iterate: bool = True, currency_pair_info: Tuple[str, str, str] = (None, None, None)) -> Any: - """ - Extracts the value specified by "self.path". + """ Extracts the value specified by "self.path". Extracts the value specified by the path sequence and converts it using the "types" specified. @@ -284,8 +279,7 @@ def __str__(self) -> str: def extract_mappings(exchange_name: str, requests: Dict[str, Any]) -> Dict[str, List[Mapping]]: - """ - Helper-Method which should be only called by the constructor. + """ Helper-Method which should be only called by the constructor. Extracts out of a given exchange .yaml-requests-section for each request the necessary mappings so the values can be extracted from the response for said request. @@ -308,6 +302,7 @@ def extract_mappings(exchange_name: str, requests: Dict[str, Any]) -> Dict[str, Dictionary with the following structure: {'request_name': List[Mapping]} """ + response_mappings = dict() if requests: for request in requests: @@ -331,8 +326,7 @@ def extract_mappings(exchange_name: str, requests: Dict[str, Any]) -> Dict[str, def is_scalar(value: Any) -> bool: - """ - Indicates whether a value is a scalar or not. + """ Indicates whether a value is a scalar or not. Convenience function returning a bool whether the provided value is a single value or not. Strings count as scalar although they are iterable. diff --git a/pandas_datareader/crypto_utils/time_helper.py b/pandas_datareader/crypto_utils/time_helper.py index e89b4c50..26f58c6f 100644 --- a/pandas_datareader/crypto_utils/time_helper.py +++ b/pandas_datareader/crypto_utils/time_helper.py @@ -1,5 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- + """ Contains helper classes to manage dates and times. @@ -18,9 +19,8 @@ class TimeUnit(IntEnum): - """ - An enumeration to indicate the unit of timestamps. - """ + """ An enumeration to indicate the unit of timestamps.""" + SECONDS = 0 MILLISECONDS = 1 MICROSECONDS = 2 @@ -28,13 +28,13 @@ class TimeUnit(IntEnum): class TimeHelper: - """ - A helper class to create/convert dates and times. + """ A helper class to create/convert dates and times. It ensures that all dates and times are timezone aware (UTC+0). freq_map is used to convert specific strings from plural into singular. """ + freq_map = { "minutes": "minute", "hours": "hour", @@ -45,21 +45,20 @@ class TimeHelper: @staticmethod def now() -> datetime: - """ - Get the current datetime (UTC+0). + """ Get the current datetime (UTC+0). The accuracy is limited to milliseconds and the remaining microseconds are cleared. @return: The current datetime (UTC+0). @rtype: datetime """ + now = datetime.now(tz=timezone.utc) return now.replace(microsecond=now.microsecond - now.microsecond % 1000) @staticmethod def now_timestamp(unit: TimeUnit = TimeUnit.SECONDS) -> float: - """ - Get the timestamp of the current datetime (UTC+0). + """ Get the timestamp of the current datetime (UTC+0). @param unit: The desired time unit of the timestamp. @type unit: TimeUnit @@ -67,12 +66,12 @@ def now_timestamp(unit: TimeUnit = TimeUnit.SECONDS) -> float: @return: The timestamp of the current datetime (UTC+0). @rtype: float """ + return TimeHelper.to_timestamp(TimeHelper.now(), unit) @staticmethod def from_string(representation: str) -> datetime: - """ - Get a datetime (UTC+0) from a given representation. + """ Get a datetime (UTC+0) from a given representation. @param representation: The string that represents a datetime. @type representation: str @@ -80,12 +79,12 @@ def from_string(representation: str) -> datetime: @return: The datetime (UTC+0) of the given representation. @rtype: datetime """ + return parse(representation).replace(tzinfo=timezone.utc) @staticmethod def from_timestamp(timestamp: float, unit: TimeUnit = TimeUnit.SECONDS) -> datetime: - """ - Get a datetime (UTC+0) from a given timestamp. + """ Get a datetime (UTC+0) from a given timestamp. @param timestamp: The timestamp whose datetime is to be obtained. @type timestamp: float @@ -95,13 +94,14 @@ def from_timestamp(timestamp: float, unit: TimeUnit = TimeUnit.SECONDS) -> datet @return: The datetime (UTC+0) of the given timestamp. @rtype: datetime """ + timestamp_in_sec: float = timestamp / (1000 ** int(unit)) + return datetime.fromtimestamp(timestamp_in_sec, tz=timezone.utc) @staticmethod def to_timestamp(date_time: datetime, unit: TimeUnit = TimeUnit.SECONDS) -> float: - """ - Convert a datetime to a timestamp. + """ Convert a datetime to a timestamp. @param date_time: The datetime to be converted. @type date_time: datetime @@ -111,12 +111,12 @@ def to_timestamp(date_time: datetime, unit: TimeUnit = TimeUnit.SECONDS) -> floa @return: The timestamp of the given datetime in the desired time unit. @rtype: float """ + return date_time.replace(tzinfo=timezone.utc).timestamp() * (1000 ** int(unit)) @staticmethod def start_end_conversion(date_time: datetime, frequency: str, to_end: bool = True) -> datetime: - """ - Returns the beginning/end of a period. + """ Returns the beginning/end of a period. @param date_time: The datetime object to be converted. @type date_time: datetime @@ -128,4 +128,5 @@ def start_end_conversion(date_time: datetime, frequency: str, to_end: bool = Tru @return: datetime of start/end of period. @rtype: datetime """ + return period(date_time, TimeHelper.freq_map[frequency])[int(to_end)] diff --git a/pandas_datareader/crypto_utils/utilities.py b/pandas_datareader/crypto_utils/utilities.py index 536302e3..9cb600e9 100644 --- a/pandas_datareader/crypto_utils/utilities.py +++ b/pandas_datareader/crypto_utils/utilities.py @@ -292,7 +292,7 @@ def split_str_to_list(string: str, splitter: str = ",") -> List[str]: items = string.rsplit(splitter) # remove possible blanks from strings - return [item.replace(" ", "") for item in items] + return [item.replace(" ", "").lower() for item in items] def sort_columns(dataframe: pd.DataFrame) -> pd.DataFrame: diff --git a/pandas_datareader/tests/test_cryptoreader.py b/pandas_datareader/tests/test_cryptoreader.py index 83091c3b..f05bf16b 100644 --- a/pandas_datareader/tests/test_cryptoreader.py +++ b/pandas_datareader/tests/test_cryptoreader.py @@ -7,7 +7,7 @@ from pandas_datareader.crypto import CryptoReader from pandas_datareader.crypto_utils.mapping import extract_mappings -from pandas_datareader.crypto_utils.utilities import yaml_loader +from pandas_datareader.crypto_utils.utilities import yaml_loader, sort_columns from pandas_datareader.exceptions import EmptyResponseError @@ -42,6 +42,11 @@ def test_request_new_symbol(self): assert isinstance(result, pd.DataFrame) assert not result.empty + def test_check_symbols(self): + """ Test checking if the provided currency-pair is listed on an exchange.""" + # ToDo + pass + def test_iterate_requests_until_end(self): """ Tests to iterate the request with updated timestamps until no more timestamp is collected or start time is reached.""" @@ -54,7 +59,7 @@ def test_sort_result_columns(self): ordered_cols = ['open', 'high', 'low', 'close'] response = pd.DataFrame({'high': range(0, 5), 'close': range(0, 5), 'open': range(0, 5), 'low': range(0, 5)}) - response = self.CryptoReader._sort_columns(dataframe=response) + response = sort_columns(dataframe=response) assert all(ordered_cols == response.columns) @@ -63,7 +68,7 @@ def test_ensure_correct_column_names(self): response = pd.DataFrame({'High': range(0, 5), 'CLOSE': range(0, 5), 'oPen': range(0, 5), 'low': range(0, 5)}) - response = self.CryptoReader._sort_columns(dataframe=response) + response = sort_columns(dataframe=response) assert response.columns == 'low' diff --git a/requirements.txt b/requirements.txt index 25c6f68a..a8db557d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ lxml pandas>=0.23 requests>=2.19.0 +# ToDo: Add packages \ No newline at end of file From 66a3fed37bc28be62aebb875c0e3e181d79fd492 Mon Sep 17 00:00:00 2001 From: Steffen Date: Mon, 22 Nov 2021 16:13:40 +0100 Subject: [PATCH 11/25] -Bugfix CryptoReader.check_symbols --- pandas_datareader/crypto.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pandas_datareader/crypto.py b/pandas_datareader/crypto.py index 17c1de9b..55303e69 100644 --- a/pandas_datareader/crypto.py +++ b/pandas_datareader/crypto.py @@ -3,6 +3,7 @@ from typing import Dict, List, Union, Optional +import warnings from abc import ABC from sys import stdout import pandas as pd @@ -74,6 +75,10 @@ def _check_symbols(self) -> bool: currency_pairs = self.get_currency_pairs(raw_data=True) symbols = self.symbols.keys() if isinstance(self.symbols, dict) else [self.symbols] + if currency_pairs is None: + warnings.warn("Currency-pair request is dysfunctional. Check of valid symbol specification is skipped.") + return True + return all([(self.name, *symbol.lower().split("-")) in currency_pairs for symbol in symbols]) def _await_rate_limit(self): @@ -88,10 +93,14 @@ def _index_and_cut_dataframe(self, dataframe: pd.DataFrame) -> pd.DataFrame: @return: pd.DataFrame with specified length and proper index. """ + # Reindex dataframe and cut it to the specified timestamps. dataframe.set_index("time", inplace=True) dataframe.sort_index(inplace=True) dataframe = dataframe.loc[pytz.utc.localize(self.start): pytz.utc.localize(self.end)] + # Remove duplicates if any exist. Keep the first appearance and drop all after. + dataframe.drop_duplicates(keep="first", inplace=True) + return sort_columns(dataframe) def _get_data(self) -> Dict: @@ -100,7 +109,7 @@ def _get_data(self) -> Dict: @return: Response json """ - # Ensure that the currency-pairs are seperated in a list + # Ensure that the currency-pairs are seperated in a list. if isinstance(self.symbols, str): self.symbols = split_str_to_list(self.symbols) self.symbols = dict.fromkeys(self.symbols, self.end) @@ -144,6 +153,7 @@ def read(self, new_symbols: str = None) -> pd.DataFrame: # perform request and extract data. resp = self._get_data() data, mappings = self.format_data(resp) + # break if no data is returned if not data: break From 7096a5fe510f1bbc7c52a0155390a2cdc9178464 Mon Sep 17 00:00:00 2001 From: Steffen Date: Wed, 24 Nov 2021 11:52:27 +0100 Subject: [PATCH 12/25] -Refactoring -Implemented predefined _BaseReader methods. --- pandas_datareader/crypto.py | 155 ++++++++--------- pandas_datareader/crypto_utils/exchange.py | 169 +++++++++++-------- pandas_datareader/data.py | 18 +- pandas_datareader/tests/test_cryptoreader.py | 9 + 4 files changed, 195 insertions(+), 156 deletions(-) diff --git a/pandas_datareader/crypto.py b/pandas_datareader/crypto.py index 55303e69..9756ad0e 100644 --- a/pandas_datareader/crypto.py +++ b/pandas_datareader/crypto.py @@ -13,7 +13,7 @@ import requests.exceptions from pandas_datareader.crypto_utils.exchange import Exchange -from pandas_datareader.crypto_utils.utilities import split_str_to_list, get_exchange_names +from pandas_datareader.crypto_utils.utilities import get_exchange_names from pandas_datareader.crypto_utils.utilities import sort_columns, print_timestamp @@ -26,10 +26,10 @@ class CryptoReader(Exchange, ABC): def __init__(self, exchange_name: str, - symbols: str, + symbols: Union[str, dict], start: Union[str, datetime] = None, end: Union[str, datetime] = None, - interval: str = None, + interval: str = "days", **kwargs): """ Constructor. Inherits from the Exchange and _BaseReader class. @@ -43,88 +43,19 @@ def __init__(self, super(CryptoReader, self).__init__(exchange_name, interval, symbols, start, end, **kwargs) - @staticmethod - def get_all_exchanges() -> List: - """ Get all supported exchange names. - - @return List of exchange names. - """ - - return get_exchange_names() - - def get_currency_pairs(self, raw_data: bool = False) -> Optional[Union[pd.DataFrame, List]]: - """ Requests all supported currency pairs from the exchange. - - @param raw_data: Return the raw data as a list of tuples. - @return: A list of all listed currency pairs. - """ - - param_dict = self.extract_request_urls(None, "currency_pairs") - url = param_dict.get("currency_pairs").get("url", None) - try: - resp = self._get_response(url, params=None, headers=None) - resp = self.format_currency_pairs(resp.json()) - except (requests.exceptions.MissingSchema, Exception): - return None - - return pd.DataFrame(resp, columns=["Exchange", "Base", "Quote"]) if not raw_data else resp - - def _check_symbols(self) -> bool: - """ Checks if the specified currency-pair is listed on the exchange""" - - currency_pairs = self.get_currency_pairs(raw_data=True) - symbols = self.symbols.keys() if isinstance(self.symbols, dict) else [self.symbols] - - if currency_pairs is None: - warnings.warn("Currency-pair request is dysfunctional. Check of valid symbol specification is skipped.") - return True - - return all([(self.name, *symbol.lower().split("-")) in currency_pairs for symbol in symbols]) - - def _await_rate_limit(self): - """ Sleep time in order to not violate the rate limit, measured in requests per minute.""" - - time.sleep(self.rate_limit) - - def _index_and_cut_dataframe(self, dataframe: pd.DataFrame) -> pd.DataFrame: - """ Set index and cut data according to user specification. - - @param dataframe: Requested raw data - @return: pd.DataFrame with specified length and proper index. - """ - - # Reindex dataframe and cut it to the specified timestamps. - dataframe.set_index("time", inplace=True) - dataframe.sort_index(inplace=True) - dataframe = dataframe.loc[pytz.utc.localize(self.start): pytz.utc.localize(self.end)] - - # Remove duplicates if any exist. Keep the first appearance and drop all after. - dataframe.drop_duplicates(keep="first", inplace=True) - - return sort_columns(dataframe) - def _get_data(self) -> Dict: """ Requests the data and returns the response json. @return: Response json """ - # Ensure that the currency-pairs are seperated in a list. - if isinstance(self.symbols, str): - self.symbols = split_str_to_list(self.symbols) - self.symbols = dict.fromkeys(self.symbols, self.end) - - # Check if the provided currency-pair is listed on the exchange. - if not self._check_symbols(): - raise KeyError(f"The provided currency-pair is not listed on '{self.name.capitalize()}'. " - f"Call CryptoReader.get_currency_pairs() for an overview.") - # Extract and format the url and parameters for the request - param_dict = self.extract_request_urls(self.symbols) - url, params = self.get_formatted_url_and_params(param_dict, *self.symbols.keys()) + self.param_dict = "historic_rates" + # self.get_formatted_url_and_params(self.param_dict, *self.symbols.keys()) + self.url_and_params = "historic_rates" # Perform the request - resp = self._get_response(url, params=params, headers=None) + resp = self._get_response(self.url, params=self.params, headers=None) # Await the rate-limit to avoid ip ban. self._await_rate_limit() @@ -140,10 +71,12 @@ def read(self, new_symbols: str = None) -> pd.DataFrame: """ if new_symbols: - if isinstance(new_symbols, str): - new_symbols = split_str_to_list(new_symbols) - # Create a new dict with new symbols as keys and the end timestamp as values. - self.symbols = dict.fromkeys(new_symbols, self.end) + self.symbol_setter(new_symbols) + + # Check if the provided currency-pair is listed on the exchange. + if not self._check_symbols(): + raise KeyError(f"The provided currency-pair is not listed on '{self.name.capitalize()}'. " + f"Call CryptoReader.get_currency_pairs() for an overview.") result = list() # Repeat until no "older" timestamp is delivered. Cryptocurrency exchanges often restrict the amount of @@ -189,6 +122,66 @@ def read(self, new_symbols: str = None) -> pd.DataFrame: # ToDo: Make decorator from function call? # Reset the self.end date of the _BaseReader for further requesting. - self.reset_base_reader() + self.reset_request_start_date() return result + + @staticmethod + def get_all_exchanges() -> List: + """ Get all supported exchange names. + + @return List of exchange names. + """ + + return get_exchange_names() + + def get_currency_pairs(self, raw_data: bool = False) -> Optional[Union[pd.DataFrame, List]]: + """ Requests all supported currency pairs from the exchange. + + @param raw_data: Return the raw data as a list of tuples. + @return: A list of all listed currency pairs. + """ + + self.param_dict = "currency_pairs" + self.url_and_params = "currency_pairs" + try: + resp = self._get_response(self.url, params=None, headers=None) + resp = self.format_currency_pairs(resp.json()) + except (requests.exceptions.MissingSchema, Exception): + return None + + return pd.DataFrame(resp, columns=["Exchange", "Base", "Quote"]) if not raw_data else resp + + def _check_symbols(self) -> bool: + """ Checks if the specified currency-pair is listed on the exchange""" + + currency_pairs = self.get_currency_pairs(raw_data=True) + symbols = self.symbols.keys() if isinstance(self.symbols, dict) else [self.symbols] + + if currency_pairs is None: + warnings.warn("Currency-pair request is dysfunctional. Check of valid symbol specification is skipped.") + return True + + return all([(self.name, *symbol.lower().split("-")) in currency_pairs for symbol in symbols]) + + def _await_rate_limit(self): + """ Sleep time in order to not violate the rate limit, measured in requests per minute.""" + + time.sleep(self.rate_limit) + + def _index_and_cut_dataframe(self, dataframe: pd.DataFrame) -> pd.DataFrame: + """ Set index and cut data according to user specification. + + @param dataframe: Requested raw data + @return: pd.DataFrame with specified length and proper index. + """ + + # Reindex dataframe and cut it to the specified timestamps. + dataframe.set_index("time", inplace=True) + dataframe.sort_index(inplace=True) + dataframe = dataframe.loc[pytz.utc.localize(self.start): pytz.utc.localize(self.end)] + + # Remove duplicates if any exist. Keep the first appearance and drop all after. + # dataframe.drop_duplicates(keep="first", inplace=True) + + return sort_columns(dataframe) diff --git a/pandas_datareader/crypto_utils/exchange.py b/pandas_datareader/crypto_utils/exchange.py index 55bdbe15..4554d3a0 100644 --- a/pandas_datareader/crypto_utils/exchange.py +++ b/pandas_datareader/crypto_utils/exchange.py @@ -4,13 +4,12 @@ from typing import Tuple, Any, Dict, Union, List, Optional, Iterator from abc import ABC -import inspect from datetime import datetime import string from collections import OrderedDict, deque import itertools -from pandas_datareader.crypto_utils.utilities import yaml_loader, replace_list_item +from pandas_datareader.crypto_utils.utilities import yaml_loader, replace_list_item, split_str_to_list from pandas_datareader.crypto_utils.mapping import extract_mappings from pandas_datareader.crypto_utils.mapping import convert_type from pandas_datareader.base import _BaseReader @@ -37,85 +36,48 @@ def __init__(self, exchange_name: str, interval: str = 'days', *args, **kwargs): self.rate_limit = self.get_rate_limit() self.args = args self.kwargs = kwargs + self._param_dict = None + self._url_and_params = None - def reset_base_reader(self): - """ Reset the _BaseReader with the initial values to allow further requesting with the same CryptoReader - instance. The self.end attribute gets manipulated during iterative requests which would lead to - falsely specified parameters afterwards. The symbols must remain as they may be changed after initialization""" + self.symbol_setter(self.symbols) - # Get all args from the _BaseReader class and remove "self". - args = inspect.getfullargspec(_BaseReader)[0] - args.remove("self") - args = dict.fromkeys(args) + @property + def param_dict(self): + return self._param_dict - # Update the empty dict of args with already existing *args and **kwargs. - args.update(dict(zip(args, self.args))) - args.update(**self.kwargs) + @property + def url_and_params(self): + return self._url_and_params - # If the attribute was changed after initialization, keep the change and remove None values from the dict - args.update({'symbols': self.symbols}) - args = {k: v for k, v in args.items() if v is not None} + @property + def url(self): + return self._url_and_params.get("url") - # Init the parent class. - super(Exchange, self).__init__(**args) + @property + def params(self): + return self._url_and_params.get("params") - def get_rate_limit(self) -> Union[int, float]: - """ Calculates the rate-limit of an exchange. - - @return: The rate limit, i.e. time to "sleep" to not violate the limit in seconds. - """ - if self.yaml_file.get("rate_limit"): - if self.yaml_file["rate_limit"]["max"] <= 0: - rate_limit = 0 - else: - rate_limit = self.yaml_file["rate_limit"]["unit"] / self.yaml_file["rate_limit"]["max"] - else: - rate_limit = 0 - - return rate_limit - - def apply_currency_pair_format(self, currency_pair: str) -> str: - """ Helper method that applies the format described in the yaml for the specific - request on the given currency-pair. - - @param currency_pair: String repr of the currency-pair - @return: String of the formatted currency-pair. Example: BTC and ETH -> "btc_eth" - """ - - first, second = currency_pair.split("-") - - request_url_and_params = self.yaml_file.get("requests").get("historic_rates").get("request") - pair_template_dict = request_url_and_params["pair_template"] - pair_template = pair_template_dict["template"] - - formatted_string: str = pair_template.format(first=first, second=second) - - if pair_template_dict["lower_case"]: - formatted_string = formatted_string.lower() - else: - formatted_string = formatted_string.upper() - - return formatted_string - - def get_formatted_url_and_params(self, url_and_parameters: Any, currency_pair: str, - request_type: str = 'historic_rates') -> Tuple[str, Dict]: + @url_and_params.setter + def url_and_params(self, request_type): """ Formats the request url, inserts the currency-pair representation and/or extracts the parameters specified for the exchange and request. - @param url_and_parameters: Extracted url and parameters from self.extract_request_urls. - @param currency_pair: The currency pair of interest to format the url and params on. @param request_type: The request type. Default: "historic_rates". Possible: "historic_rates", "currency_pairs". @return Tuple of formatted url and formatted parameters. """ - - url = url_and_parameters.get(request_type).get("url") - pair_template = url_and_parameters.get(request_type).get("pair_template") + currency_pair = list(self.symbols.keys())[0] + url = self.param_dict.get(request_type).get("url") + pair_template = self.param_dict.get(request_type).get("pair_template") pair_formatted = self.apply_currency_pair_format(currency_pair) - parameters = url_and_parameters.get(request_type).get("params") + parameters = self.param_dict.get(request_type).get("params") parameters.update({key: parameters[key][currency_pair] for key, val in parameters.items() if isinstance(val, dict)}) + if not parameters and not pair_template: + self._url_and_params = {'url': url, 'params': parameters} + return + # Case 1: Currency-Pairs in request parameters: eg. www.test.com?market=BTC-USD if "alias" in pair_template.keys() and pair_template["alias"]: parameters[pair_template["alias"]] = pair_formatted @@ -124,20 +86,22 @@ def get_formatted_url_and_params(self, url_and_parameters: Any, currency_pair: s parameters.update({"currency_pair": pair_formatted}) else: - return url, parameters + self._url_and_params = {'url': url, 'params': parameters} + return + # return url, parameters variables = [item[1] for item in string.Formatter().parse(url) if item[1] is not None] url_formatted = url.format(**parameters) - # drop params who are filled directly into the url + # Drop params who are filled directly into the url parameters = {k: v for k, v in parameters.items() if k not in variables} - return url_formatted, parameters + self._url_and_params = {'url': url_formatted, 'params': parameters} + # return url_formatted, parameters - def extract_request_urls(self, currency_pairs: Optional[Dict[str, datetime]], - request_type: str = "historic_rates") -> Dict: + @param_dict.setter + def param_dict(self, request_type: str): """ Extracts the request url from the yaml-file and implements the parameters. - @param currency_pairs: Currency-pair with the timestamp of the latest request. @param request_type: Request name, default: "historic_rates". Possible: "historic_rates", "currency_pairs". @return: Dict of the extracted url and parameters. """ @@ -153,7 +117,9 @@ def extract_request_urls(self, currency_pairs: Optional[Dict[str, datetime]], if not parameters: request_parameters["params"] = {} urls[request_type] = request_parameters - return urls + self._param_dict = urls + return + # return urls mapping: dict = {"allowed": self._allowed, "function": self._function, "default": self._default, "type": self._type_con} @@ -171,14 +137,14 @@ def extract_request_urls(self, currency_pairs: Optional[Dict[str, datetime]], if not parameters[param].get("required", True): continue # Iterate over the functions and fill the params dict with values. Kwargs are needed only partially. - kwargs = {"has_value": None, "currency_pairs": currency_pairs} + kwargs = {"has_value": None, "currency_pairs": self.symbols} for key, val in options.items(): kwargs.update({"has_value": parameter.get(param, None)}) parameter[param] = mapping.get(key)(val, **kwargs) request_parameters["params"] = parameter urls[request_type] = request_parameters - return urls + self._param_dict = urls def _allowed(self, val: dict, **_: dict) -> Any: """ Extract the configured value from all allowed values. If there is no match, return str "default". @@ -339,12 +305,12 @@ def format_currency_pairs(self, response: Tuple[str, dict]) -> Optional[Iterator for mapping in mappings: results[mapping.key] = mapping.extract_value(response) - results[mapping.key] = [item.lower() for item in results[mapping.key]] if isinstance(results[mapping.key], str): # If the result is only one currency, it will be split into every letter. # To avoid this, put it into a list. results[mapping.key] = [results[mapping.key]] + results[mapping.key] = [item.lower() for item in results[mapping.key]] # Check if all dict values do have the same length values = list(results.values()) @@ -359,3 +325,58 @@ def format_currency_pairs(self, response: Tuple[str, dict]) -> Optional[Iterator return list(itertools.zip_longest(itertools.repeat(self.name, len_results), results["currency_pair_first"], results["currency_pair_second"])) + + def reset_request_start_date(self): + """ Reset the end date for the symbols in order to be able to restart a request from the end date.""" + + key = list(self.symbols.keys())[0] + self.symbols.update({key: self.end}) + + def get_rate_limit(self) -> Union[int, float]: + """ Calculates the rate-limit of an exchange. + + @return: The rate limit, i.e. time to "sleep" to not violate the limit in seconds. + """ + if self.yaml_file.get("rate_limit"): + if self.yaml_file["rate_limit"]["max"] <= 0: + rate_limit = 0 + else: + rate_limit = self.yaml_file["rate_limit"]["unit"] / self.yaml_file["rate_limit"]["max"] + else: + rate_limit = 0 + + return rate_limit + + def apply_currency_pair_format(self, currency_pair: str) -> str: + """ Helper method that applies the format described in the yaml for the specific + request on the given currency-pair. + + @param currency_pair: String repr of the currency-pair + @return: String of the formatted currency-pair. Example: BTC and ETH -> "btc_eth" + """ + + first, second = currency_pair.split("-") + + request_url_and_params = self.yaml_file.get("requests").get("historic_rates").get("request") + pair_template_dict = request_url_and_params["pair_template"] + pair_template = pair_template_dict["template"] + + formatted_string: str = pair_template.format(first=first, second=second) + + if pair_template_dict["lower_case"]: + formatted_string = formatted_string.lower() + else: + formatted_string = formatted_string.upper() + + return formatted_string + + def symbol_setter(self, new_symbols: Union[str, dict]): + """ Prepare the symbols and transform them from a string into a dict. + + @param new_symbols: String repr of the new symbols, seperated by hyphen. + """ + + if isinstance(new_symbols, str): + new_symbols = split_str_to_list(new_symbols) + # Create a new dict with new symbols as keys and the end timestamp as values. + self.symbols = dict.fromkeys(new_symbols, self.end) diff --git a/pandas_datareader/data.py b/pandas_datareader/data.py index 96bd4269..e3270201 100644 --- a/pandas_datareader/data.py +++ b/pandas_datareader/data.py @@ -3,7 +3,7 @@ """ # flake8: noqa - +import os import warnings from pandas.util._decorators import deprecate_kwarg @@ -39,6 +39,7 @@ from pandas_datareader.yahoo.options import Options as YahooOptions from pandas_datareader.yahoo.quotes import YahooQuotesReader from pandas_datareader.crypto import CryptoReader +from pandas_datareader.crypto_utils.utilities import get_exchange_names __all__ = [ "get_components_yahoo", @@ -366,6 +367,7 @@ def DataReader( "av-intraday", "econdb", "naver", + *crypto_exchanges ] if data_source not in expected_source: @@ -674,6 +676,17 @@ def DataReader( session=session, ).read() + elif data_source in crypto_exchanges: + return CryptoReader( + exchange_name=data_source, + symbols=name, + start=start, + end=end, + retry_count=retry_count, + pause=pause, + session=session, + ).read() + else: msg = "data_source=%r is not implemented" % data_source raise NotImplementedError(msg) @@ -693,3 +706,6 @@ def Options(symbol, data_source=None, session=None): return YahooOptions(symbol, session=session) else: raise NotImplementedError("currently only yahoo supported") + +crypto_exchanges = get_exchange_names() + diff --git a/pandas_datareader/tests/test_cryptoreader.py b/pandas_datareader/tests/test_cryptoreader.py index f05bf16b..7c7355a6 100644 --- a/pandas_datareader/tests/test_cryptoreader.py +++ b/pandas_datareader/tests/test_cryptoreader.py @@ -42,6 +42,15 @@ def test_request_new_symbol(self): assert isinstance(result, pd.DataFrame) assert not result.empty + def test_reset_request_start_date(self): + """ Test resetting the request start date.""" + + key = list(self.CryptoReader.symbols.keys())[0] + self.CryptoReader.symbols.update({key: datetime.datetime(2020, 1, 1)}) + self.CryptoReader.reset_request_start_date() + + assert self.CryptoReader.symbols.get(key).date() == datetime.datetime.now().date() + def test_check_symbols(self): """ Test checking if the provided currency-pair is listed on an exchange.""" # ToDo From 78c79c8a3de2cc31c2431687886084e1eace3608 Mon Sep 17 00:00:00 2001 From: Steffen Date: Wed, 24 Nov 2021 12:12:13 +0100 Subject: [PATCH 13/25] -Added **kwargs to the DataReader class. --- pandas_datareader/crypto.py | 4 ---- pandas_datareader/data.py | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pandas_datareader/crypto.py b/pandas_datareader/crypto.py index 9756ad0e..49a07dd8 100644 --- a/pandas_datareader/crypto.py +++ b/pandas_datareader/crypto.py @@ -120,7 +120,6 @@ def read(self, new_symbols: str = None) -> pd.DataFrame: result = pd.DataFrame(result, columns=mappings) result = self._index_and_cut_dataframe(result) - # ToDo: Make decorator from function call? # Reset the self.end date of the _BaseReader for further requesting. self.reset_request_start_date() @@ -181,7 +180,4 @@ def _index_and_cut_dataframe(self, dataframe: pd.DataFrame) -> pd.DataFrame: dataframe.sort_index(inplace=True) dataframe = dataframe.loc[pytz.utc.localize(self.start): pytz.utc.localize(self.end)] - # Remove duplicates if any exist. Keep the first appearance and drop all after. - # dataframe.drop_duplicates(keep="first", inplace=True) - return sort_columns(dataframe) diff --git a/pandas_datareader/data.py b/pandas_datareader/data.py index e3270201..ec334b0b 100644 --- a/pandas_datareader/data.py +++ b/pandas_datareader/data.py @@ -287,6 +287,7 @@ def DataReader( pause=0.1, session=None, api_key=None, + **kwargs ): """ Imports data from a number of online sources. @@ -685,6 +686,7 @@ def DataReader( retry_count=retry_count, pause=pause, session=session, + **kwargs ).read() else: From 47fafce2f0e0d34a86e3da99a89b81835d6dcd1a Mon Sep 17 00:00:00 2001 From: Steffen Date: Wed, 24 Nov 2021 12:52:52 +0100 Subject: [PATCH 14/25] -Added more unit tests --- pandas_datareader/tests/test_cryptoreader.py | 49 ++++++++++++++++---- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/pandas_datareader/tests/test_cryptoreader.py b/pandas_datareader/tests/test_cryptoreader.py index 7c7355a6..cc03e647 100644 --- a/pandas_datareader/tests/test_cryptoreader.py +++ b/pandas_datareader/tests/test_cryptoreader.py @@ -53,8 +53,9 @@ def test_reset_request_start_date(self): def test_check_symbols(self): """ Test checking if the provided currency-pair is listed on an exchange.""" - # ToDo - pass + with pytest.raises(KeyError): + self.CryptoReader.symbols = {" - ": datetime.datetime.today()} + self.CryptoReader.read() def test_iterate_requests_until_end(self): """ Tests to iterate the request with updated timestamps until no more timestamp is collected @@ -140,15 +141,31 @@ def test_necessary_values_in_mappings(self): assert all([item in mapping.__dict__.keys() for item in ['key', 'path', 'types']]) assert all([val is not None for _, val in mapping.__dict__.items()]) - def test_extract_request_url(self): + def test_extract_param_dict(self): """ Test to extract the request url and parameters.""" - # ToDo - pass - def test_format_request_url_and_params(self): + request_types = ["historic_rates", "currency_pairs"] + + for request_type in request_types: + self.CryptoReader.param_dict = request_type + + assert isinstance(self.CryptoReader.param_dict, dict) + assert request_type in self.CryptoReader.param_dict.keys() + assert isinstance(self.CryptoReader.param_dict.get(request_type), dict) + assert "url" in self.CryptoReader.param_dict.get(request_type).keys() + + def test_format_url_and_params(self): """ Test to correctly format the request url and parameters.""" - # ToDo - pass + + request_types = ["historic_rates", "currency_pairs"] + + for request_type in request_types: + self.CryptoReader.param_dict = request_type + self.CryptoReader.url_and_params = request_type + + assert isinstance(self.CryptoReader.url_and_params, dict) + assert isinstance(self.CryptoReader.url, str) + assert isinstance(self.CryptoReader.params, dict) def test_all_exchange_apis(self): """ Test if the API of every exchange is correctly implemented and functional.""" @@ -168,5 +185,17 @@ def test_empty_response(self): def test_format_data(self): """ Test to correctly extract the response values.""" - # ToDo - pass + + request_types = ["historic_rates", "currency_pairs"] + + for request_type in request_types: + self.CryptoReader.param_dict = request_type + self.CryptoReader.url_and_params = request_type + + resp = self.CryptoReader._get_data() + data, mappings = self.CryptoReader.format_data(resp) + + assert isinstance(data, list) + assert isinstance(mappings, list) + assert all([len(item) == len(mappings) for item in data]) + From 9663586936ed67de716e1638d75ba40a898bbcc6 Mon Sep 17 00:00:00 2001 From: Steffen Date: Wed, 24 Nov 2021 13:03:15 +0100 Subject: [PATCH 15/25] -Refactoring --- pandas_datareader/crypto.py | 10 ++++--- pandas_datareader/crypto_utils/exchange.py | 34 +++++++++++++++++----- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/pandas_datareader/crypto.py b/pandas_datareader/crypto.py index 49a07dd8..8b572f7e 100644 --- a/pandas_datareader/crypto.py +++ b/pandas_datareader/crypto.py @@ -38,7 +38,7 @@ def __init__(self, @param start: The start time of the request, handed over to the BaseReader. @param end: The end time of the request, handed over to the BaseReader. @param interval: Candle interval (i.e. minutes, hours, days, weeks, months) - @param kwargs: Additional arguments for the _BaseReader class. + @param **kwargs: Additional kw-arguments for the _BaseReader class. """ super(CryptoReader, self).__init__(exchange_name, interval, symbols, start, end, **kwargs) @@ -67,7 +67,7 @@ def read(self, new_symbols: str = None) -> pd.DataFrame: to collect the full time-series. @param new_symbols: New currency-pair to request, if they differ from the constructor. - @return df: pd.DataFrame of the returned data. + @return: pd.DataFrame of the returned data. """ if new_symbols: @@ -129,7 +129,7 @@ def read(self, new_symbols: str = None) -> pd.DataFrame: def get_all_exchanges() -> List: """ Get all supported exchange names. - @return List of exchange names. + @return: List of exchange names. """ return get_exchange_names() @@ -175,9 +175,11 @@ def _index_and_cut_dataframe(self, dataframe: pd.DataFrame) -> pd.DataFrame: @return: pd.DataFrame with specified length and proper index. """ - # Reindex dataframe and cut it to the specified timestamps. + # Reindex dataframe and cut it to the specified start and end dates. dataframe.set_index("time", inplace=True) dataframe.sort_index(inplace=True) + # Returned timestamps from the exchanges are converted into UTC and therefore timezone aware. + # Make start and end dates timezone aware in order to make them comparable. dataframe = dataframe.loc[pytz.utc.localize(self.start): pytz.utc.localize(self.end)] return sort_columns(dataframe) diff --git a/pandas_datareader/crypto_utils/exchange.py b/pandas_datareader/crypto_utils/exchange.py index 4554d3a0..1317d4d8 100644 --- a/pandas_datareader/crypto_utils/exchange.py +++ b/pandas_datareader/crypto_utils/exchange.py @@ -42,19 +42,39 @@ def __init__(self, exchange_name: str, interval: str = 'days', *args, **kwargs): self.symbol_setter(self.symbols) @property - def param_dict(self): + def param_dict(self) -> Optional[Dict]: + """ Returns a dict of parameters. + + @return: Dict of parameters + """ + return self._param_dict @property - def url_and_params(self): + def url_and_params(self) -> Optional[Dict]: + """ Returns a dict of FORMATTED url and parameters. + + @return: Dict of url and parameters + """ + return self._url_and_params @property - def url(self): + def url(self) -> str: + """ Returns the formatted url. + + @return: String of the formatted url. + """ + return self._url_and_params.get("url") @property - def params(self): + def params(self) -> Dict: + """ Returns the formatted parameters. + + @return: Dict of all formatted parameters. + """ + return self._url_and_params.get("params") @url_and_params.setter @@ -88,7 +108,6 @@ def url_and_params(self, request_type): else: self._url_and_params = {'url': url, 'params': parameters} return - # return url, parameters variables = [item[1] for item in string.Formatter().parse(url) if item[1] is not None] url_formatted = url.format(**parameters) @@ -96,7 +115,6 @@ def url_and_params(self, request_type): parameters = {k: v for k, v in parameters.items() if k not in variables} self._url_and_params = {'url': url_formatted, 'params': parameters} - # return url_formatted, parameters @param_dict.setter def param_dict(self, request_type: str): @@ -119,7 +137,6 @@ def param_dict(self, request_type: str): urls[request_type] = request_parameters self._param_dict = urls return - # return urls mapping: dict = {"allowed": self._allowed, "function": self._function, "default": self._default, "type": self._type_con} @@ -153,6 +170,7 @@ def _allowed(self, val: dict, **_: dict) -> Any: @param _: unused additional arguments needed in other methods. @return: value if key in dict, else None. """ + if isinstance(self.interval, dict): value = None else: @@ -171,6 +189,7 @@ def _function(self, val: str, **kwargs: dict) -> Dict[str, datetime]: @param kwargs: not used but needed for another function. @return: The currency-pair with the respective timestamp to continue requesting. """ + if val == "last_timestamp": return {cp: self._get_first_timestamp(last_ts) for cp, last_ts in kwargs.get("currency_pairs").items()} @@ -238,7 +257,6 @@ def format_data(self, responses: Union[Dict, List]) -> Tuple[Optional[List], Opt if not responses: raise EmptyResponseError - # return None, None results = list() mappings = extract_mappings(self.name, self.yaml_file.get('requests')).get('historic_rates') From 6ec945837991da48d6a0f5252c45fec5092d1e5a Mon Sep 17 00:00:00 2001 From: Steffen Date: Wed, 24 Nov 2021 15:08:40 +0100 Subject: [PATCH 16/25] -Unit test for mapping.py --- pandas_datareader/crypto_utils/exchange.py | 9 +- pandas_datareader/crypto_utils/mapping.py | 4 +- pandas_datareader/crypto_utils/test_apis.py | 42 - pandas_datareader/tests/test_cryptoreader.py | 823 +++++++++++++++++++ 4 files changed, 829 insertions(+), 49 deletions(-) delete mode 100644 pandas_datareader/crypto_utils/test_apis.py diff --git a/pandas_datareader/crypto_utils/exchange.py b/pandas_datareader/crypto_utils/exchange.py index 1317d4d8..4551b06d 100644 --- a/pandas_datareader/crypto_utils/exchange.py +++ b/pandas_datareader/crypto_utils/exchange.py @@ -25,8 +25,8 @@ def __init__(self, exchange_name: str, interval: str = 'days', *args, **kwargs): @param exchange_name: The exchange name. @param interval: The candle interval. - @param args: Additional ordered arguments for the BaseReader. - @param kwargs: Additional keyword arguments for the BaseReader. + @param args: Additional ordered arguments for the _BaseReader. + @param kwargs: Additional keyword arguments for the _BaseReader. """ super(Exchange, self).__init__(*args, **kwargs) @@ -85,6 +85,7 @@ def url_and_params(self, request_type): @param request_type: The request type. Default: "historic_rates". Possible: "historic_rates", "currency_pairs". @return Tuple of formatted url and formatted parameters. """ + currency_pair = list(self.symbols.keys())[0] url = self.param_dict.get(request_type).get("url") pair_template = self.param_dict.get(request_type).get("pair_template") @@ -183,10 +184,10 @@ def _allowed(self, val: dict, **_: dict) -> Any: def _function(self, val: str, **kwargs: dict) -> Dict[str, datetime]: """ Execute function for all currency-pairs. Function returns the first - timestamp in the DB, or datetime.now() if none exists. + timestamp, or datetime.now() if none exists. @param val: contains the function name as string. - @param kwargs: not used but needed for another function. + @param kwargs: Contains the last timestamp. @return: The currency-pair with the respective timestamp to continue requesting. """ diff --git a/pandas_datareader/crypto_utils/mapping.py b/pandas_datareader/crypto_utils/mapping.py index d8b9d307..7e95f48b 100644 --- a/pandas_datareader/crypto_utils/mapping.py +++ b/pandas_datareader/crypto_utils/mapping.py @@ -12,7 +12,6 @@ - is_scalar """ -import logging from collections import deque from collections.abc import Iterable from typing import Any, List, Dict, Deque, Tuple @@ -160,7 +159,6 @@ def traverse_path(self, response: Dict[str, Any], path_queue: Deque[str], return traversed def extract_value(self, - # response: List[Dict[str, Any]], response: Any, path_queue: Deque[str] = None, types_queue: Deque[str] = None, @@ -188,6 +186,7 @@ def extract_value(self, the response. @rtype: Any """ + if path_queue is None: path_queue = deque(self.path) @@ -317,7 +316,6 @@ def extract_mappings(exchange_name: str, requests: Dict[str, Any]) -> Dict[str, mapping_list.append(Mapping(entry["key"], entry["path"], entry["type"])) except KeyError: print(f"Error loading mappings of {exchange_name} in {request}: {entry}") - logging.error("Error loading mappings of %s in %s: %s", exchange_name, request, entry) break response_mappings[request] = mapping_list diff --git a/pandas_datareader/crypto_utils/test_apis.py b/pandas_datareader/crypto_utils/test_apis.py deleted file mode 100644 index 6a27d257..00000000 --- a/pandas_datareader/crypto_utils/test_apis.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -from typing import List, Tuple, Optional - -import asyncio -import requests - - -class ApiTest: - """ Tests several api responses concurrently.""" - - def __init__(self): - self.loop = asyncio.get_event_loop() - self.futures = [] - - def create_futures(self, urls: List): - """ Creates a list of awaitable futures. - - @param urls: List of urls to request. - """ - - self.futures = [self.loop.run_in_executor(None, requests.get, url) for url in urls] - - async def perform_request(self) -> Tuple: - """ Performs the request. - - @return: Tuple of all collected response codes. - """ - - return await asyncio.gather(*future.status for future in self.futures) - - async def run(self) -> Optional[bool]: - """ Starts the event loop. - - @return: True if all request status codes are okay. - """ - - status_list = self.loop.run_until_complete(self.perform_request()) - assert all(status_list) - - return True diff --git a/pandas_datareader/tests/test_cryptoreader.py b/pandas_datareader/tests/test_cryptoreader.py index cc03e647..bd996efc 100644 --- a/pandas_datareader/tests/test_cryptoreader.py +++ b/pandas_datareader/tests/test_cryptoreader.py @@ -1,11 +1,18 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +""" +Test module for the classes: + - CryptoReader, + - Exchange, + - Mapping. +""" import pytest import datetime import pandas as pd from pandas_datareader.crypto import CryptoReader +from pandas_datareader.crypto_utils.mapping import Mapping from pandas_datareader.crypto_utils.mapping import extract_mappings from pandas_datareader.crypto_utils.utilities import yaml_loader, sort_columns from pandas_datareader.exceptions import EmptyResponseError @@ -199,3 +206,819 @@ def test_format_data(self): assert isinstance(mappings, list) assert all([len(item) == len(mappings) for item in data]) + +class TestMapping: + """ Test class for Mapping.""" + + # pylint: disable=too-many-public-methods + + def test_extract_value_split_index_zero(self): + """ Test of splitting a str and taking the index zero.""" + + mapping = Mapping("exchange_name", + ["product_id"], + ["str", "split", "-", 0]) + result = mapping.extract_value({ + "product_id": "BTC-ETH" + }) + assert result == "BTC" + + def test_extract_value_split_index_one(self): + """ Test of splitting a str and taking the index one.""" + + mapping = Mapping("exchange_name", + ["product_id"], + ["str", "split", "-", 1]) + result = mapping.extract_value({ + "product_id": "BTC-ETH" + }) + assert result == "ETH" + + def test_extract_value_split_index_two(self): + """ Test of splitting a str and taking the index two.""" + + mapping = Mapping("exchange_name", + ["product_id"], + ["str", "split", "-", 2]) + result = mapping.extract_value({ + "product_id": "BTC-ETH-USD" + }) + assert result == "USD" + + def test_extract_value_slice_first_half(self): + """ Test of slicing a str and taking the first half.""" + + mapping = Mapping("exchange_name", + ["product_id"], + ["str", "slice", 0, 3]) + result = mapping.extract_value({ + "product_id": "BTCETH" + }) + assert result == "BTC" + + def test_extract_value_slice_second_half(self): + """ Test of slicing a str and taking the second half.""" + + mapping = Mapping("exchange_name", + ["product_id"], + ["str", "slice", 3, 6]) + result = mapping.extract_value({ + "product_id": "BTCETH" + }) + assert result == "ETH" + + def test_extract_value_str_to_bool_true(self): + """ Test of conversion from str to bool in case of True.""" + + mapping = Mapping("active", + ["active"], + ["str", "bool"]) + + result = mapping.extract_value({ + "active": "True" + }) + + assert isinstance(result, bool) + assert result + + def test_extract_value_str_to_bool_true_lowercase(self): + """ Test of conversion from str to bool in case of lowercase True.""" + + mapping = Mapping("active", + ["active"], + ["str", "bool"]) + + result = mapping.extract_value({ + "active": "true" + }) + + assert isinstance(result, bool) + assert result + + def test_extract_value_str_to_bool_true_uppercase(self): + """ Test of conversion from str to bool in case of uppercase True.""" + + mapping = Mapping("active", + ["active"], + ["str", "bool"]) + + result = mapping.extract_value({ + "active": "TRUE" + }) + + assert isinstance(result, bool) + assert result + + def test_extract_value_str_to_bool_false(self): # + """ Test of conversion from str to bool in case of False.""" + + mapping = Mapping("active", + ["active"], + ["str", "bool"]) + + result = mapping.extract_value({ + "active": "False" + }) + + assert isinstance(result, bool) + assert not result + + def test_extract_value_str_to_bool_false_lowercase(self): + """ Test of conversion from str to bool in case of lowercase False.""" + + mapping = Mapping("active", + ["active"], + ["str", "bool"]) + + result = mapping.extract_value({ + "active": "false" + }) + + assert isinstance(result, bool) + assert not result + + def test_extract_value_str_to_bool_false_uppercase(self): + """ Test of conversion from str to bool in case of uppercase False.""" + + mapping = Mapping("active", + ["active"], + ["str", "bool"]) + + result = mapping.extract_value({ + "active": "FALSE" + }) + + assert isinstance(result, bool) + assert not result + + def test_extract_value_str_to_bool_false_anything(self): + """ Test of conversion from str to bool in case of anything.""" + + mapping = Mapping("active", + ["active"], + ["str", "bool"]) + + result = mapping.extract_value({ + "active": "anything" + }) + + assert isinstance(result, bool) + assert not result + + def test_extract_value_bool_to_int_true(self): + """ Test of conversion from bool to int in case of True.""" + + mapping = Mapping("active", + ["active"], + ["bool", "int"]) + + result = mapping.extract_value({ + "active": True + }) + + assert isinstance(result, int) + assert result == 1 + + def test_extract_value_bool_to_int_false(self): + """ Test of conversion from bool to int in case of False.""" + + mapping = Mapping("active", + ["active"], + ["bool", "int"]) + + result = mapping.extract_value({ + "active": False + }) + + assert isinstance(result, int) + assert result == 0 + + def test_extract_value_int_to_bool_one(self): + """ Test of conversion from int to bool in case of one.""" + + mapping = Mapping("active", + ["active"], + ["int", "bool"]) + + result = mapping.extract_value({ + "active": 1 + }) + + assert isinstance(result, bool) + assert result + + def test_extract_value_int_to_bool_zero(self): + """ Test of conversion from int to bool in case of zero.""" + + mapping = Mapping("active", + ["active"], + ["int", "bool"]) + + result = mapping.extract_value({ + "active": 0 + }) + + assert isinstance(result, bool) + assert not result + + def test_extract_value_int_to_bool_two(self): + """ Test of conversion from int to bool in case of two.""" + + mapping = Mapping("active", + ["active"], + ["int", "bool"]) + + result = mapping.extract_value({ + "active": 2 + }) + + assert isinstance(result, bool) + assert result + + def test_extract_value_int_to_bool_neg_two(self): + """ Test of conversion from int to bool in case of negative two.""" + + mapping = Mapping("active", + ["active"], + ["int", "bool"]) + + result = mapping.extract_value({ + "active": -2 + }) + + assert isinstance(result, bool) + assert result + + def test_extract_value_int_fromtimestamp(self): + """ Test of conversion from an int timestamp to datetime.""" + + mapping = Mapping("time", + ["time"], + ["float", "from_timestamp", "0"]) + + result = mapping.extract_value({ + "time": 1538122622 + }) + + assert isinstance(result, datetime.datetime) + # Different results depending on timezone + # self.assertEqual(result, datetime.datetime(2018, 9, 28, 8, 17, 2)) + + def test_extract_value_int_utcfromtimestamp(self): + """ Test of conversion from an int UTC timestamp to datetime.""" + + mapping = Mapping("time", + ["time"], + ["float", "from_timestamp", "1"]) + + result = mapping.extract_value({ + "time": 1538122622 + }) + + assert isinstance(result, datetime.datetime) + + def test_extract_value_int_fromtimestampms(self): + """ Test of conversion from an int timestamp with ms to datetime.""" + + mapping = Mapping("time", + ["time"], + ["float", "from_timestamp", "1"]) + + result = mapping.extract_value({ + "time": 1538122622123 + }) + + assert isinstance(result, datetime.datetime) + assert result.microsecond == 123000 + + def test_extract_value_float_fromtimestamp(self): + """ Test of conversion from a float timestamp to datetime.""" + + mapping = Mapping("time", + ["time"], + ["float", "from_timestamp", "0"]) + + result = mapping.extract_value({ + "time": 1538122622.123 + }) + + assert isinstance(result, datetime.datetime) + assert result.microsecond == 123000 + + def test_extract_value_float_utcfromtimestamp(self): + """ Test of conversion from a float UTC timestamp to datetime.""" + + mapping = Mapping("time", + ["time"], + ["float", "from_timestamp", "0"]) + + result = mapping.extract_value({ + "time": 1538122622.123 + }) + + assert isinstance(result, datetime.datetime) + assert result.microsecond == 123000 + + def test_extract_value_str_to_int_zero(self): + """ Test of conversion from str to int in case of zero.""" + + mapping = Mapping("number", + ["number"], + ["str", "int"]) + + result = mapping.extract_value({ + "number": "0" + }) + + assert isinstance(result, int) + assert result == 0 + + def test_extract_value_str_to_int_one(self): + """ Test of conversion from str to int in case of one.""" + + mapping = Mapping("number", + ["number"], + ["str", "int"]) + + result = mapping.extract_value({ + "number": "1" + }) + + assert isinstance(result, int) + assert result == 1 + + def test_extract_value_str_to_int_two(self): + """ Test of conversion from str to int in case of two.""" + + mapping = Mapping("number", + ["number"], + ["str", "int"]) + + result = mapping.extract_value({ + "number": "2" + }) + + assert isinstance(result, int) + assert result == 2 + + def test_extract_value_str_to_int_twelve(self): + """ Test of conversion from str to int in case of twelve.""" + + mapping = Mapping("number", + ["number"], + ["str", "int"]) + + result = mapping.extract_value({ + "number": "12" + }) + + assert isinstance(result, int) + assert result == 12 + + def test_extract_value_str_to_int_neg_one(self): + """ Test of conversion from str to int in case negative one.""" + + mapping = Mapping("number", + ["number"], + ["str", "int"]) + + result = mapping.extract_value({ + "number": "-1" + }) + + assert isinstance(result, int) + assert result == -1 + + def test_extract_value_str_to_float_zero(self): + """ Test of conversion from str to float in case of zero.""" + + mapping = Mapping("number", + ["number"], + ["str", "float"]) + + result = mapping.extract_value({ + "number": "0.0" + }) + + assert isinstance(result, float) + assert result == 0.0 + + def test_extract_value_str_to_float_one(self): + """ Test of conversion from str to float in case of one.""" + + mapping = Mapping("number", + ["number"], + ["str", "float"]) + + result = mapping.extract_value({ + "number": "1.0" + }) + + assert isinstance(result, float) + assert result == 1.0 + + def test_extract_value_str_to_float_two(self): + """ Test of conversion from str to float in case of two.""" + + mapping = Mapping("number", + ["number"], + ["str", "float"]) + + result = mapping.extract_value({ + "number": "2.0" + }) + + assert isinstance(result, float) + assert result == 2.0 + + def test_extract_value_str_to_float_twelve(self): + """ Test of conversion from str to float in case of twelve.""" + + mapping = Mapping("number", + ["number"], + ["str", "float"]) + + result = mapping.extract_value({ + "number": "12.0" + }) + + assert isinstance(result, float) + assert result == 12.0 + + def test_extract_value_str_to_float_pi(self): + """ Test of conversion from str to float in case of Pi.""" + + mapping = Mapping("number", + ["number"], + ["str", "float"]) + + result = mapping.extract_value({ + "number": "3.141592654" + }) + + assert isinstance(result, float) + assert result == 3.141592654 + + def test_extract_value_str_to_float_neg_one(self): + """ Test of conversion from str to float in case of negative one.""" + + mapping = Mapping("number", + ["number"], + ["str", "float"]) + + result = mapping.extract_value({ + "number": "-1.0" + }) + + assert isinstance(result, float) + assert result == -1.0 + + def test_extract_value_str_to_float_neg_pi(self): + """ Test of conversion from str to float in case of negative Pi.""" + + mapping = Mapping("number", + ["number"], + ["str", "float"]) + + result = mapping.extract_value({ + "number": "-3.141592654" + }) + + assert isinstance(result, float) + assert result == -3.141592654 + + def test_extract_value_datetime_totimestamp(self): + """ Test of conversion from datetome to timestamp.""" + + mapping = Mapping("date", + ["date"], + ["datetime", "totimestamp"]) + + result = mapping.extract_value({ + "date": datetime.datetime(2018, 10, 11, 11, 20) + }) + + assert isinstance(result, int) + # Different results depending on timezone + # self.assertEqual(result, 1539249600) + + def test_extract_value_datetime_totimestampms(self): + """ Test of conversion from datetome to timestamp with ms.""" + + mapping = Mapping("date", + ["date"], + ["datetime", "totimestampms"]) + + result = mapping.extract_value({ + "date": datetime.datetime(2018, 10, 11, 11, 20, 0, 123000) + }) + + assert isinstance(result, int) + # Different results depending on timezone + # self.assertEqual(result, 1539249600123) + + def test_extract_value_datetime_utctotimestamp(self): + """ Test of conversion from datetome to UTC timestamp.""" + + mapping = Mapping("date", + ["date"], + ["datetime", "utctotimestamp"]) + + result = mapping.extract_value({ + "date": datetime.datetime(2018, 10, 11, 11, 20, 0) + }) + + assert isinstance(result, int) + # Different results depending on timezone + + def test_extract_value_str_strptime_date(self): + """ Test of conversion timestring via strptime in case of a date.""" + + mapping = Mapping("date", + ["date"], + ["str", "strptime", "%Y-%m-%d"]) + + result = mapping.extract_value({ + "date": "2018-10-11" + }) + + assert isinstance(result, datetime.datetime) + assert result == datetime.datetime(2018, 10, 11) + + def test_extract_value_str_strptime_datetime(self): + """ Test of conversion timestring via strptime in case of a datetime.""" + + mapping = Mapping("date", + ["date"], + ["str", "strptime", "%Y-%m-%d %H:%M"]) + + result = mapping.extract_value({ + "date": "2018-10-11 12:06" + }) + + assert isinstance(result, datetime.datetime) + assert result == datetime.datetime(2018, 10, 11, 12, 6) + + def test_extract_value_datetime_strftime_date(self): + """ Test of conversion from datetime via strftime in case of a date.""" + + mapping = Mapping("date", + ["date"], + ["datetime", "strftime", "%Y-%m-%d"]) + + result = mapping.extract_value({ + "date": datetime.datetime(2018, 10, 11) + }) + + assert isinstance(result, str) + assert result == "2018-10-11" + + def test_extract_value_datetime_strftime_datetime(self): + """ Test of conversion from datetime via strftime in case of a dt.""" + + mapping = Mapping("date", + ["date"], + ["datetime", "strftime", "%Y-%m-%d %H:%M"]) + + result = mapping.extract_value({ + "date": datetime.datetime(2018, 10, 11, 12, 6) + }) + + assert isinstance(result, str) + assert result == "2018-10-11 12:06" + + def test_extract_value_dict_key(self): + """ Test of extract value for dict_keys without further processing.""" + + mapping = Mapping("pair", + ["dict_key"], + ["str"]) + + result = mapping.extract_value({ + "BTC_USD": "value", + "ETH_EUR": "value" + }) + + assert isinstance(result, list) + assert result == ["BTC_USD", "ETH_EUR"] + + def test_extract_value_dict_key_split_index_zero(self): + """ Test of extract value for dict_keys with split and index 0.""" + + mapping = Mapping("pair", + ["dict_key"], + ["str", "split", "_", 0]) + + result = mapping.extract_value({ + "BTC_USD": "value", + "ETH_EUR": "value" + }) + + assert isinstance(result, list) + assert result == ["BTC", "ETH"] + + def test_extract_value_dict_key_split_index_one(self): + """ Test of extract value for dict_keys with split and index 1.""" + + mapping = Mapping("pair", + ["dict_key"], + ["str", "split", "_", 1]) + + result = mapping.extract_value({ + "BTC_USD": "value", + "ETH_EUR": "value" + }) + + assert isinstance(result, list) + assert result == ["USD", "EUR"] + + def test_extract_value_where_pair_can_not_be_split(self): + """ Test extract value for special case where value is currency pair but cannot be extracted + since there is no delimiter for splitting the pair.""" + mapping = Mapping("first", + [], + ["first_currency"]) + result = mapping.extract_value(['ETHBTC', 'XRPBTC'], currency_pair_info=('XRP', 'BTC', 'XRPBTC')) + assert result == "XRP" + + mapping = Mapping('second', + [], + ["second_currency"]) + result = mapping.extract_value(['ETHBTC', 'XRPBTC'], currency_pair_info=('ETH', 'BTC', 'ETHBTC')) + assert result == "BTC" + + def test_extract_value_list(self): + """Test of extracting all elements in a list.""" + mapping = Mapping("number_as_string", + [[]], + ['str']) + value_list = ['1.0', '1.1', '1.2', '1.3', '2.4', '2.5', '3.6', '3.7'] + result = mapping.extract_value(value_list) + + assert value_list == result + + def test_extract_value_list_containing_dict_with_key(self): + """ Test of extract value for a list that contains a dict for each index with a known key.""" + + # list element directly holds value behind key + mapping = Mapping('first_currency', + ['first'], + ['str']) + + extract_list = [{'first': 'BTC'}, + {'first': 'ETH'}, + {'first': 'XRP'}, + {'first': 'DOGE'}, + {'first': 'XSA'}, + {'first': 'TEST'}] + result = mapping.extract_value(extract_list) + value_list = ['BTC', 'ETH', 'XRP', 'DOGE', 'XSA', 'TEST'] + assert value_list == result + + # list element holds dict that holds another dict which holds the value behind key + mapping = Mapping('first_currency', + ['a', 'first'], # ['dict_values', 'first'] works also since it's only one level + ['str']) + + extract_list = [{'a': {'first': 'BTC', 'second': 'should not matter'}}, + {'a': {'first': 'ETH', 'second': 'should not matter'}}, + {'a': {'first': 'XRP', 'second': 'should not matter'}}, + {'a': {'first': 'DOGE', 'second': 'should not matter'}}, + {'a': {'first': 'XSA', 'second': 'should not matter'}}, + {'a': {'first': 'TEST', 'second': 'should not matter'}}] + result = mapping.extract_value(extract_list) + assert value_list == result + + # list element with few more levels of dictionaries + mapping = Mapping('first_currency', + ['a', 'b', 'c', 'd', 'first'], + ['str']) + + extract_list = [ + {'a': {'b': {'c': {'d': {'first': 'BTC', 'second': 'should not matter'}, 'dist': 'other_value'}}}}, + {'a': {'b': {'c': {'d': {'first': 'ETH', 'second': 'should not matter'}}, 'dist': 'other_value'}}}, + {'a': {'b': {'c': {'d': {'first': 'XRP', 'second': 'should not matter'}}}, 'dist': 'other_value'}}, + {'a': {'b': {'c': {'d': {'first': 'DOGE', 'second': 'should not matter'}}}}, 'dist': 'other_value'}, + {'a': {'b': {'c': {'d': {'first': 'XSA', 'second': 'should not matter'}}}, 'dist': 'other_value'}}, + {'a': {'b': {'c': {'d': {'first': 'TEST', 'second': 'should not matter'}}, 'dist': 'other_value'}}}] + result = mapping.extract_value(extract_list) + assert value_list == result + + def test_extract_values_dict_values(self): + """ Test of extract values for the special case that each key of a dictionary holds the values.""" + mapping = Mapping('first_currency', + ['dict_values'], + ['str']) + + extract_dict = {'1': 'XRP', + 2: 'ETH', + '3': 'BTC', + 4: 'DOGE'} + result = mapping.extract_value(extract_dict) + value_list = ['XRP', 'ETH', 'BTC', 'DOGE'] + assert value_list == result + + # extracting dicts with dict_values -> aka flattening the json + mapping = Mapping('first_currency', + ['dict_values', 'first'], + ['str']) + + extract_dict = {'1': {'first': 'XRP', 'second': 'Whatever'}, + 2: {'first': 'ETH', 'second': 'Whatever'}, + '3': {'first': 'BTC', 'second': 'Whatever'}, + 4: {'first': 'DOGE', 'second': 'Whatever'}} + result = mapping.extract_value(extract_dict) + value_list = ['XRP', 'ETH', 'BTC', 'DOGE'] + assert value_list == result + + # How to not use dict_values, since other values will be filtered also + mapping = Mapping('first_currency', + ['dict_values', 'dict_values', 'dict_values', 'dict_values', 'first'], + ['str']) + extract_list = [ + {'a': {'b': {'c': {'d': {'first': 'BTC', 'second': 'should not matter'}, 'dist': 'other_value'}}}}, + {'a': {'b': {'c': {'d': {'first': 'ETH', 'second': 'should not matter'}}, 'dist': 'other_value'}}}, + {'a': {'b': {'c': {'d': {'first': 'XRP', 'second': 'should not matter'}}}, 'dist': 'other_value'}}, + {'a': {'b': {'c': {'d': {'first': 'DOGE', 'second': 'should not matter'}}}}, 'dist': 'other_value'}, + {'a': {'b': {'c': {'d': {'first': 'XSA', 'second': 'should not matter'}}}, 'dist': 'other_value'}}, + {'a': {'b': {'c': {'d': {'first': 'TEST', 'second': 'should not matter'}}, 'dist': 'other_value'}}}] + + with pytest.raises(TypeError): + mapping.extract_value(extract_list) + + def test_extract_value_list_containing_dict_where_key_is_value(self): + """ Test of extract value for a list that contains a dict that contains a dict. + The first dict only has one key, which is the value we search for.""" + mapping = Mapping('second_currency', + ['dict_key'], + ['str', 'split', '_', 1]) + extract_list = [{'btc_eth': {'other': 'values'}}, + {'btc_eur': {'other': 'values'}}, + {'btc_usd': {'other': 'values'}}, + {'btc_usdt': {'other': 'values'}}] + value_list = ['eth', 'eur', 'usd', 'usdt'] + result = mapping.extract_value(extract_list) + assert value_list == result + + def test_extract_value_list_containing_dict_where_pair_is_key_to_values(self): + """ Test of extract value for a list that contains dicts that hold a single dict. + The key is the formatted currency pair that is needed to gain access to the value.""" + mapping = Mapping('value', + ['currency_pair', 1], + ['str', 'float']) + extract_dict = {'btc_eth': {1: '123.456'}, + 'btc_xrp': {1: '789.101'}, + 'xrp_eth': {1: '112.131'}, + 'doge_btc': {1: '415.161'}} + value_list = [415.161, 112.131, 789.101, 123.456] + + # note that currency pair infos are from bottom to top if compared to extract_dict + currency_pair_infos = (('doge', 'BTC', 'doge_btc'), + ('xrp', 'eth', 'xrp_eth'), + ('btc', 'xrp', 'btc_xrp'), + ('btc', 'eth', 'btc_eth')) + + result = [] + for currency_pair_info in currency_pair_infos: + result.append(mapping.extract_value(extract_dict, currency_pair_info=currency_pair_info)) + assert value_list == result + + def test_extract_value_dict_containing_list(self): + """ Test of extract value where the response is a dict and the known key contains a list of the values.""" + mapping = Mapping('first_currency', + ['data'], + ['str', 'split', '_', 0]) + extract_dict = {'data': ['eth_btc', 'usd_btc', 'xrp_eth', 'eth_xrp'], + 'other_stuff': 'that does not matter'} + value_list = ['eth', 'usd', 'xrp', 'eth'] + result = mapping.extract_value(extract_dict) + assert value_list == result + + def test_extract_value_dict_containing_list_containing_dict_with_value(self): + """ Test of extract value where the response is a dict and + a known key contains a list of dicts that hold the value.""" + + mapping = Mapping('value', + ['data', 'value'], + ['str', 'float']) + extract_dict = {'data': [{'value': '1.12'}, + {'value': '1.44'}, + {'value': '1.34'}, + {'value': '1.89'}]} + value_list = [1.12, 1.44, 1.34, 1.89] + result = mapping.extract_value(extract_dict) + assert value_list == result + + def test_extract_value_dict_containing_list_containing_dict_where_key_is_value(self): + """ Test of extract value where the response is a dict and a known key + contains a list of dicts with a single key that is the value.""" + mapping = Mapping('second_currency', + ['data', 'dict_key'], + ['str', 'split', '_', 1]) + extract_dict = {'data': [{'eth_btc': {'other': 'values'}}, + {'btc_xrp': {'other': 'values'}}, + {'tsla_usd': {'other': 'values'}}, + {'usdt_eth': {'other': 'values'}}]} + value_list = ['btc', 'xrp', 'usd', 'eth'] + result = mapping.extract_value(extract_dict) + assert value_list == result From 0d4c0b17ac13b39aaf5bcf51ec51810d7a6a2f11 Mon Sep 17 00:00:00 2001 From: Steffen Date: Wed, 24 Nov 2021 17:23:34 +0100 Subject: [PATCH 17/25] - Added .rst-file - Updated requirements --- docs/source/readers/crypto.rst | 8 ++++++++ docs/source/readers/index.rst | 1 + requirements.txt | 5 ++++- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 docs/source/readers/crypto.rst diff --git a/docs/source/readers/crypto.rst b/docs/source/readers/crypto.rst new file mode 100644 index 00000000..eeb991f5 --- /dev/null +++ b/docs/source/readers/crypto.rst @@ -0,0 +1,8 @@ +Cryptocurrency Data Reader +-------------------------- + +.. py:module:: pandas_datareader.crypto + +.. autoclass:: CryptoReader + :members: + :inherited-members: read \ No newline at end of file diff --git a/docs/source/readers/index.rst b/docs/source/readers/index.rst index 310f4175..129be57b 100644 --- a/docs/source/readers/index.rst +++ b/docs/source/readers/index.rst @@ -22,3 +22,4 @@ Data Readers tsp world-bank yahoo + crypto diff --git a/requirements.txt b/requirements.txt index a8db557d..ccd7756b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,7 @@ lxml pandas>=0.23 requests>=2.19.0 -# ToDo: Add packages \ No newline at end of file +pytz +datetime_periods +pyyaml +python-dateutil \ No newline at end of file From 8c3065bf628dab6e8267dffd44569463d7f1d14c Mon Sep 17 00:00:00 2001 From: Steffen Date: Thu, 25 Nov 2021 16:49:36 +0100 Subject: [PATCH 18/25] -Updates exchanges -Bugfix Coinpaprika splitting currency-pairs. -Currency-pair split now with "/", e.g. btc/usd. --- docs/source/remote_data.rst | 44 ++++++++++++++++++++ pandas_datareader/crypto.py | 18 ++++---- pandas_datareader/crypto_utils/exchange.py | 11 +++-- pandas_datareader/tests/test_cryptoreader.py | 16 +++++-- 4 files changed, 73 insertions(+), 16 deletions(-) diff --git a/docs/source/remote_data.rst b/docs/source/remote_data.rst index 70793d62..9e19b10e 100644 --- a/docs/source/remote_data.rst +++ b/docs/source/remote_data.rst @@ -44,6 +44,7 @@ Currently the following sources are supported: - :ref:`Tiingo` - :ref:`World Bank` - :ref:`Yahoo Finance` + - :ref:`Cryptocurrency Data` It should be noted, that various sources support different kinds of data, so not all sources implement the same methods and the data elements returned might also differ. @@ -762,3 +763,46 @@ The following endpoints are available: dividends = web.DataReader('IBM', 'yahoo-dividends', start, end) dividends.head() + + +.. _remote_data.crypto: + +Cryptocurrency Data +=================== + +Access historical data feed from the most popular and liquid exchanges and platforms and return OHLCV candles. +Platforms such as ``Coingecko`` or ``Coinpaprika`` return in addition the global turnover volume and market capitalization. + +The ``CryptoReader`` offers helpful methods to print all supported exchanges/platforms and their listed +currency-pairs: + +.. ipython:: python + + from pandas_datareader.crypto import CryptoReader + CryptoReader.get_all_exchanges() + +Data can be retrieved with the ``DataReader`` class, which takes the following arguments: + +* ``name`` - the currency-pair of interest +* ``data_source`` - the name of the exchange or platform +* ``start`` - start date +* ``end`` - end date +* ``interval`` - the candle interval (e.g. "minutes", "hours", "days") + +.. ipython:: python + + import pandas_datareader.data as web + df = web.DataReader("btc/usd", "coinbase") + df.head() + +Additionally, the ``CryptoReader`` can be used directly: + +.. ipython:: python + + from pandas_datareader.crypto import CryptoReader + reader = CryptoReader("btc/usd", "coinbase", interval="minutes", start="2021-10-01", end="2021-10-31") + df = reader.read() + df.head() + + df = reader.read("eth/usd") + df.head() diff --git a/pandas_datareader/crypto.py b/pandas_datareader/crypto.py index 8b572f7e..cc0da8c1 100644 --- a/pandas_datareader/crypto.py +++ b/pandas_datareader/crypto.py @@ -15,6 +15,7 @@ from pandas_datareader.crypto_utils.exchange import Exchange from pandas_datareader.crypto_utils.utilities import get_exchange_names from pandas_datareader.crypto_utils.utilities import sort_columns, print_timestamp +from pandas_datareader.exceptions import EmptyResponseError class CryptoReader(Exchange, ABC): @@ -27,7 +28,7 @@ class CryptoReader(Exchange, ABC): def __init__(self, exchange_name: str, symbols: Union[str, dict], - start: Union[str, datetime] = None, + start: Union[str, datetime] = datetime(2009, 1, 1), end: Union[str, datetime] = None, interval: str = "days", **kwargs): @@ -85,13 +86,14 @@ def read(self, new_symbols: str = None) -> pd.DataFrame: while True: # perform request and extract data. resp = self._get_data() - data, mappings = self.format_data(resp) - - # break if no data is returned - if not data: + try: + data, mappings = self.format_data(resp) + # Break if no data is returned + except EmptyResponseError: break + # or all returned data points already exist. - elif result == data or all([datapoint in result for datapoint in data]): + if result == data or all([datapoint in result for datapoint in data]): break print_timestamp(list(self.symbols.values())[0]) @@ -158,10 +160,10 @@ def _check_symbols(self) -> bool: symbols = self.symbols.keys() if isinstance(self.symbols, dict) else [self.symbols] if currency_pairs is None: - warnings.warn("Currency-pair request is dysfunctional. Check of valid symbol specification is skipped.") + warnings.warn("Currency-pair request is dysfunctional. Check for valid symbols is skipped.") return True - return all([(self.name, *symbol.lower().split("-")) in currency_pairs for symbol in symbols]) + return all([(self.name, *symbol.lower().split("/")) in currency_pairs for symbol in symbols]) def _await_rate_limit(self): """ Sleep time in order to not violate the rate limit, measured in requests per minute.""" diff --git a/pandas_datareader/crypto_utils/exchange.py b/pandas_datareader/crypto_utils/exchange.py index 4551b06d..a9e9f947 100644 --- a/pandas_datareader/crypto_utils/exchange.py +++ b/pandas_datareader/crypto_utils/exchange.py @@ -29,7 +29,7 @@ def __init__(self, exchange_name: str, interval: str = 'days', *args, **kwargs): @param kwargs: Additional keyword arguments for the _BaseReader. """ - super(Exchange, self).__init__(*args, **kwargs) + super(Exchange, self).__init__(timeout=10, *args, **kwargs) self.name = exchange_name self.yaml_file = yaml_loader(self.name) self.interval: str = interval @@ -95,7 +95,7 @@ def url_and_params(self, request_type): parameters.update({key: parameters[key][currency_pair] for key, val in parameters.items() if isinstance(val, dict)}) - if not parameters and not pair_template: + if not pair_template and request_type == "currency_pairs": self._url_and_params = {'url': url, 'params': parameters} return @@ -373,8 +373,11 @@ def apply_currency_pair_format(self, currency_pair: str) -> str: @param currency_pair: String repr of the currency-pair @return: String of the formatted currency-pair. Example: BTC and ETH -> "btc_eth" """ - - first, second = currency_pair.split("-") + try: + first, second = currency_pair.split("/") + except ValueError as e: + raise Exception("Base and quote currency are indistinguishable." + " Currencies must be split by '/': %s" % currency_pair) from e request_url_and_params = self.yaml_file.get("requests").get("historic_rates").get("request") pair_template_dict = request_url_and_params["pair_template"] diff --git a/pandas_datareader/tests/test_cryptoreader.py b/pandas_datareader/tests/test_cryptoreader.py index bd996efc..e950e821 100644 --- a/pandas_datareader/tests/test_cryptoreader.py +++ b/pandas_datareader/tests/test_cryptoreader.py @@ -22,7 +22,7 @@ class TestCryptoReader: """ Unit tests for the CryptoReader.""" exchange_name = 'coinbase' - symbols = 'btc-usd' + symbols = 'btc/usd' CryptoReader = CryptoReader(exchange_name, symbols) def test_get_all_exchanges(self): @@ -43,9 +43,9 @@ def test_read(self): def test_request_new_symbol(self): """ Test to request NEW symbols.""" - result = self.CryptoReader.read('eth-usd') + result = self.CryptoReader.read('eth/usd') - assert 'eth-usd' in self.CryptoReader.symbols.keys() + assert 'eth/usd' in self.CryptoReader.symbols.keys() assert isinstance(result, pd.DataFrame) assert not result.empty @@ -60,7 +60,15 @@ def test_reset_request_start_date(self): def test_check_symbols(self): """ Test checking if the provided currency-pair is listed on an exchange.""" + with pytest.raises(KeyError): + self.CryptoReader.symbols = {" / ": datetime.datetime.today()} + self.CryptoReader.read() + + def test_check_wrong_splitting_symbol(self): + """ Test checking if the provided currency-pair is listed on an exchange.""" + + with pytest.raises(BaseException): self.CryptoReader.symbols = {" - ": datetime.datetime.today()} self.CryptoReader.read() @@ -109,7 +117,7 @@ class TestExchange: """ Unit tests for the Exchange class.""" # ToDo: Create test-exchange yaml file and use it instead for this class. exchange_name = 'coinbase' - symbols = 'btc-usd' + symbols = 'btc/usd' CryptoReader = CryptoReader(exchange_name, symbols) def test_extract_mappings(self): From 2841ddd300fc45e6009de66ec40c3a6714facffd Mon Sep 17 00:00:00 2001 From: Steffen Date: Thu, 25 Nov 2021 17:07:00 +0100 Subject: [PATCH 19/25] -Updates exchanges -Bugfix Coinpaprika splitting currency-pairs. -Currency-pair split now with "/", e.g. btc/usd. --- .../crypto_utils/resources/50x.yaml | 312 +++++++++++++ .../crypto_utils/resources/alterdice.yaml | 305 +++++++++++++ .../crypto_utils/resources/ascendex.yaml | 401 ++++++++++++++++ .../crypto_utils/resources/b2bx.yaml | 333 ++++++++++++++ .../crypto_utils/resources/bankcex.yaml | 356 +++++++++++++++ .../crypto_utils/resources/bequant.yaml | 374 +++++++++++++++ .../crypto_utils/resources/bibox.yaml | 416 +++++++++++++++++ .../crypto_utils/resources/bidesk.yaml | 304 ++++++++++++ .../crypto_utils/resources/bigone.yaml | 341 ++++++++++++++ .../crypto_utils/resources/bitbay.yaml | 384 ++++++++++++++++ .../crypto_utils/resources/bitfinex.yaml | 365 +++++++++++++++ .../crypto_utils/resources/bitforex.yaml | 335 ++++++++++++++ .../crypto_utils/resources/bithumb.yaml | 420 +++++++++++++++++ .../crypto_utils/resources/bitmart.yaml | 409 +++++++++++++++++ .../crypto_utils/resources/bitopro.yaml | 345 ++++++++++++++ .../crypto_utils/resources/bitstamp.yaml | 401 ++++++++++++++++ .../crypto_utils/resources/bittrex.yaml | 310 +++++++++++++ .../crypto_utils/resources/bitvavo.yaml | 301 ++++++++++++ .../crypto_utils/resources/bitwell.yaml | 338 ++++++++++++++ .../crypto_utils/resources/bkex.yaml | 356 +++++++++++++++ .../crypto_utils/resources/bleutrade.yaml | 369 +++++++++++++++ .../crypto_utils/resources/btc-alpha.yaml | 253 ++++++++++ .../crypto_utils/resources/btc_turk.yaml | 389 ++++++++++++++++ .../crypto_utils/resources/btse.yaml | 331 ++++++++++++++ .../crypto_utils/resources/bw.yaml | 420 +++++++++++++++++ .../crypto_utils/resources/chiliz.yaml | 304 ++++++++++++ .../crypto_utils/resources/coinbase.yaml | 338 ++++++++++++++ .../crypto_utils/resources/coinbene.yaml | 378 +++++++++++++++ .../crypto_utils/resources/coindcx.yaml | 221 +++++++++ .../crypto_utils/resources/coinegg.yaml | 310 +++++++++++++ .../crypto_utils/resources/coinex.yaml | 411 +++++++++++++++++ .../crypto_utils/resources/coinfield.yaml | 348 ++++++++++++++ .../crypto_utils/resources/coingecko.yaml | 116 +++++ .../crypto_utils/resources/coinhe.yaml | 333 ++++++++++++++ .../crypto_utils/resources/coinjar.yaml | 310 +++++++++++++ .../crypto_utils/resources/coinlist.yaml | 288 ++++++++++++ .../crypto_utils/resources/coinpaprika.yaml | 226 +++++++++ .../crypto_utils/resources/coinsbit.yaml | 325 +++++++++++++ .../crypto_utils/resources/crex24.yaml | 313 +++++++++++++ .../crypto_utils/resources/crosstower.yaml | 364 +++++++++++++++ .../crypto_utils/resources/crypto.com.yaml | 392 ++++++++++++++++ .../crypto_utils/resources/currency.com.yaml | 320 +++++++++++++ .../crypto_utils/resources/deepcoin.yaml | 211 +++++++++ .../crypto_utils/resources/dex-trade.yaml | 310 +++++++++++++ .../crypto_utils/resources/digifinex.yaml | 291 ++++++++++++ .../crypto_utils/resources/exrates.yaml | 318 +++++++++++++ .../crypto_utils/resources/ftx.yaml | 384 ++++++++++++++++ .../crypto_utils/resources/gateio.yaml | 362 +++++++++++++++ .../crypto_utils/resources/gemini.yaml | 320 +++++++++++++ .../crypto_utils/resources/gopax.yaml | 301 ++++++++++++ .../crypto_utils/resources/hbtc.yaml | 305 +++++++++++++ .../crypto_utils/resources/hitbtc.yaml | 393 ++++++++++++++++ .../crypto_utils/resources/hoo.yaml | 341 ++++++++++++++ .../crypto_utils/resources/huobi.yaml | 423 +++++++++++++++++ .../crypto_utils/resources/huobi_korea.yaml | 424 +++++++++++++++++ .../crypto_utils/resources/idex.yaml | 336 ++++++++++++++ .../crypto_utils/resources/kucoin.yaml | 432 ++++++++++++++++++ .../crypto_utils/resources/lbank.yaml | 333 ++++++++++++++ .../crypto_utils/resources/maicoin.yaml | 314 +++++++++++++ .../crypto_utils/resources/mandala.yaml | 329 +++++++++++++ .../crypto_utils/resources/mexc.yaml | 368 +++++++++++++++ .../crypto_utils/resources/mexo.yaml | 304 ++++++++++++ .../crypto_utils/resources/nicehash.yaml | 255 +++++++++++ .../crypto_utils/resources/nominex.yaml | 225 +++++++++ .../crypto_utils/resources/oceanex.yaml | 380 +++++++++++++++ .../crypto_utils/resources/okcoin.yaml | 338 ++++++++++++++ .../crypto_utils/resources/okex.yaml | 360 +++++++++++++++ .../crypto_utils/resources/omgfin.yaml | 359 +++++++++++++++ .../crypto_utils/resources/p2pb2b.yaml | 393 ++++++++++++++++ .../crypto_utils/resources/poloniex.yaml | 348 ++++++++++++++ .../resources/therocktrading.yaml | 340 ++++++++++++++ .../crypto_utils/resources/upbit.yaml | 320 +++++++++++++ .../crypto_utils/resources/vindax.yaml | 350 ++++++++++++++ .../crypto_utils/resources/xt.yaml | 328 +++++++++++++ .../crypto_utils/resources/xtheta_global.yaml | 303 ++++++++++++ .../crypto_utils/resources/zb.yaml | 322 +++++++++++++ .../crypto_utils/resources/zbg.yaml | 405 ++++++++++++++++ 77 files changed, 25990 insertions(+) create mode 100644 pandas_datareader/crypto_utils/resources/50x.yaml create mode 100644 pandas_datareader/crypto_utils/resources/alterdice.yaml create mode 100644 pandas_datareader/crypto_utils/resources/ascendex.yaml create mode 100644 pandas_datareader/crypto_utils/resources/b2bx.yaml create mode 100644 pandas_datareader/crypto_utils/resources/bankcex.yaml create mode 100644 pandas_datareader/crypto_utils/resources/bequant.yaml create mode 100644 pandas_datareader/crypto_utils/resources/bibox.yaml create mode 100644 pandas_datareader/crypto_utils/resources/bidesk.yaml create mode 100644 pandas_datareader/crypto_utils/resources/bigone.yaml create mode 100644 pandas_datareader/crypto_utils/resources/bitbay.yaml create mode 100644 pandas_datareader/crypto_utils/resources/bitfinex.yaml create mode 100644 pandas_datareader/crypto_utils/resources/bitforex.yaml create mode 100644 pandas_datareader/crypto_utils/resources/bithumb.yaml create mode 100644 pandas_datareader/crypto_utils/resources/bitmart.yaml create mode 100644 pandas_datareader/crypto_utils/resources/bitopro.yaml create mode 100644 pandas_datareader/crypto_utils/resources/bitstamp.yaml create mode 100644 pandas_datareader/crypto_utils/resources/bittrex.yaml create mode 100644 pandas_datareader/crypto_utils/resources/bitvavo.yaml create mode 100644 pandas_datareader/crypto_utils/resources/bitwell.yaml create mode 100644 pandas_datareader/crypto_utils/resources/bkex.yaml create mode 100644 pandas_datareader/crypto_utils/resources/bleutrade.yaml create mode 100644 pandas_datareader/crypto_utils/resources/btc-alpha.yaml create mode 100644 pandas_datareader/crypto_utils/resources/btc_turk.yaml create mode 100644 pandas_datareader/crypto_utils/resources/btse.yaml create mode 100644 pandas_datareader/crypto_utils/resources/bw.yaml create mode 100644 pandas_datareader/crypto_utils/resources/chiliz.yaml create mode 100644 pandas_datareader/crypto_utils/resources/coinbase.yaml create mode 100644 pandas_datareader/crypto_utils/resources/coinbene.yaml create mode 100644 pandas_datareader/crypto_utils/resources/coindcx.yaml create mode 100644 pandas_datareader/crypto_utils/resources/coinegg.yaml create mode 100644 pandas_datareader/crypto_utils/resources/coinex.yaml create mode 100644 pandas_datareader/crypto_utils/resources/coinfield.yaml create mode 100644 pandas_datareader/crypto_utils/resources/coingecko.yaml create mode 100644 pandas_datareader/crypto_utils/resources/coinhe.yaml create mode 100644 pandas_datareader/crypto_utils/resources/coinjar.yaml create mode 100644 pandas_datareader/crypto_utils/resources/coinlist.yaml create mode 100644 pandas_datareader/crypto_utils/resources/coinpaprika.yaml create mode 100644 pandas_datareader/crypto_utils/resources/coinsbit.yaml create mode 100644 pandas_datareader/crypto_utils/resources/crex24.yaml create mode 100644 pandas_datareader/crypto_utils/resources/crosstower.yaml create mode 100644 pandas_datareader/crypto_utils/resources/crypto.com.yaml create mode 100644 pandas_datareader/crypto_utils/resources/currency.com.yaml create mode 100644 pandas_datareader/crypto_utils/resources/deepcoin.yaml create mode 100644 pandas_datareader/crypto_utils/resources/dex-trade.yaml create mode 100644 pandas_datareader/crypto_utils/resources/digifinex.yaml create mode 100644 pandas_datareader/crypto_utils/resources/exrates.yaml create mode 100644 pandas_datareader/crypto_utils/resources/ftx.yaml create mode 100644 pandas_datareader/crypto_utils/resources/gateio.yaml create mode 100644 pandas_datareader/crypto_utils/resources/gemini.yaml create mode 100644 pandas_datareader/crypto_utils/resources/gopax.yaml create mode 100644 pandas_datareader/crypto_utils/resources/hbtc.yaml create mode 100644 pandas_datareader/crypto_utils/resources/hitbtc.yaml create mode 100644 pandas_datareader/crypto_utils/resources/hoo.yaml create mode 100644 pandas_datareader/crypto_utils/resources/huobi.yaml create mode 100644 pandas_datareader/crypto_utils/resources/huobi_korea.yaml create mode 100644 pandas_datareader/crypto_utils/resources/idex.yaml create mode 100644 pandas_datareader/crypto_utils/resources/kucoin.yaml create mode 100644 pandas_datareader/crypto_utils/resources/lbank.yaml create mode 100644 pandas_datareader/crypto_utils/resources/maicoin.yaml create mode 100644 pandas_datareader/crypto_utils/resources/mandala.yaml create mode 100644 pandas_datareader/crypto_utils/resources/mexc.yaml create mode 100644 pandas_datareader/crypto_utils/resources/mexo.yaml create mode 100644 pandas_datareader/crypto_utils/resources/nicehash.yaml create mode 100644 pandas_datareader/crypto_utils/resources/nominex.yaml create mode 100644 pandas_datareader/crypto_utils/resources/oceanex.yaml create mode 100644 pandas_datareader/crypto_utils/resources/okcoin.yaml create mode 100644 pandas_datareader/crypto_utils/resources/okex.yaml create mode 100644 pandas_datareader/crypto_utils/resources/omgfin.yaml create mode 100644 pandas_datareader/crypto_utils/resources/p2pb2b.yaml create mode 100644 pandas_datareader/crypto_utils/resources/poloniex.yaml create mode 100644 pandas_datareader/crypto_utils/resources/therocktrading.yaml create mode 100644 pandas_datareader/crypto_utils/resources/upbit.yaml create mode 100644 pandas_datareader/crypto_utils/resources/vindax.yaml create mode 100644 pandas_datareader/crypto_utils/resources/xt.yaml create mode 100644 pandas_datareader/crypto_utils/resources/xtheta_global.yaml create mode 100644 pandas_datareader/crypto_utils/resources/zb.yaml create mode 100644 pandas_datareader/crypto_utils/resources/zbg.yaml diff --git a/pandas_datareader/crypto_utils/resources/50x.yaml b/pandas_datareader/crypto_utils/resources/50x.yaml new file mode 100644 index 00000000..17ca9306 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/50x.yaml @@ -0,0 +1,312 @@ +# Tickers don't work as they only return the first currency. The second, with the type conversion (none, constant) +# does not work yet. + +name: 50x +exchange: true + +rate_limit: null # no rate limit +# max: null +# unit: null + +api_url: https://rates.50x.com/ + +requests: + currency_pairs: + request: + template: market + pair_template: null + params: + base: + default: USDT + + response: + type: dict + values: + currency_pair: + type: dict + values: + vol: + type: str + rate: + type: str + + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - key: currency_pair_second + path: [] + type: + - none + - constant + - "USDT" + +# tickers: +# request: +# template: market +# pair_template: null +# params: +# base: +# default: "USDT" +# response: +# type: dict +# values: +# currency_pair: +# type: dict +# values: +# vol: +# type: str +# rate: +# type: str +# +# mapping: +# - key: currency_pair_first +# path: +# - dict_key +# type: +# - str +# - key: currency_pair_second +# path: [] +# type: +# - none +# - constant +# - "USDT" +# - key: last_price +# path: +# - dict_values +# - rate +# type: +# - str +# - float +# - key: time +# path: [] +# type: +# - none +# - now +# - key: daily_volume +# path: +# - dict_values +# - vol +# type: +# - str +# - float + + historic_rates: + request: + template: chart + pair_template: + template: "{first}/{second}" + lower_case: false + alias: pair + params: + period: + allowed: + minutes: M1 + hours: H1 + days: D + weeks: W + default: D + end: + function: last_timestamp + type: + - datetime + - timestamp +# start: +# function: last_timestamp +# type: +# - datetime +# - timedelta +# - interval +# - 100 + response: + type: list + values: + type: dict + values: + vol: + type: float + high: + type: float + low: + type: float + open: + type: float + close: + type: float + date: + type: int + + mapping: + - key: time + path: + - date + type: + - float + - from_timestamp + - 0 + - key: open + path: + - open + type: + - float + - key: high + path: + - high + type: + - float + - key: low + path: + - low + type: + - float + - key: close + path: + - close + type: + - float + - key: volume + path: + - vol + type: + - float + + + trades: + request: + template: last_trades/ + pair_template: + template: "{first}/{second}" + lower_case: false + alias: pair + params: null + + response: + type: list + values: + type: dict + values: + a: + type: int + bs: + type: str + ts: + type: float + rate: + type: float + vol1: + type: float + vol2: + type: float + + mapping: + - key: time + path: + - ts + type: + - float + - from_timestamp + - 0 + - key: id + path: + - ts + type: + - float + - int + - key: direction + path: + - bs + type: + - value + - map + - b + - buy + - s + - sell + - key: price + path: + - rate + type: + - float + - key: amount + path: + - vol1 + type: + - float + + order_books: + request: + template: orderbook/ + pair_template: + template: "{first}/{second}" + lower_case: false + alias: pair + params: null + + response: + type: dict + values: + bid: + type: list + values: + type: list + values: + 0: + type: int + 1: + type: int + 2: + type: int + ask: + type: list + values: + type: list + values: + 0: + type: int + 1: + type: int + 2: + type: int + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bid + - 1 + type: + - float + - key: bids_price + path: + - bid + - 0 + type: + - float + - key: asks_amount + path: + - ask + - 1 + type: + - float + - key: asks_price + path: + - ask + - 0 + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/alterdice.yaml b/pandas_datareader/crypto_utils/resources/alterdice.yaml new file mode 100644 index 00000000..ad4ec9c2 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/alterdice.yaml @@ -0,0 +1,305 @@ +name: alterdice +exchange: true + +rate_limit: null + +api_url: "" + +requests: + currency_pairs: + request: + template: https://api.alterdice.com/v1/public/symbols + pair_template: null + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + id: + type: int + base: + type: str + quote: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - base + type: + - str + - key: currency_pair_second + path: + - data + - quote + type: + - str + + tickers: + request: + template: https://api.alterdice.com/v1/public/ticker + pair_template: + template: "{first}{second}" + lower_case: false + alias: pair + params: null + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + last: + type: str + volume_24H: + type: str + + mapping: + - key: last_price + path: + - data + - last + type: + - str + - float + - key: time + path: [] + type: + - none + - now + - key: daily_volume + path: + - data + - volume_24H + type: + - str + - float + + historic_rates: + request: + template: https://socket.alterdice.com/graph/hist + pair_template: + template: "{first}{second}" + lower_case: false + alias: t + params: + r: + allowed: + hours: 60 + days: D + weeks: W + default: D + end: + function: last_timestamp + type: + - datetime + - timestamp + limit: + default: 1000 + response: + type: list + values: + type: dict + values: + low: # + type: int + high: + type: int + volume: + type: int + time: + type: int + open: + type: int + close: + type: int + + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 0 + - key: open + path: + - open + type: + - int + - div + - 100000000 + - key: high + path: + - high + type: + - int + - div + - 100000000 + - key: low + path: + - low + type: + - int + - div + - 100000000 + - key: close + path: + - close + type: + - int + - div + - 100000000 + - key: volume + path: + - volume + type: + - int + - div + - 100000000 + + + trades: + request: + template: https://api.alterdice.com/v1/public/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: pair + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + volume: + type: float + price: + type: float + timestamp: + type: int + type: + type: str + mapping: + - key: time + path: + - data + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - data + - timestamp + type: + - int + - key: direction + path: + - data + - type + type: + - str + - key: price + path: + - data + - price + type: + - float + - key: amount + path: + - data + - volume + type: + - float + + order_books: + request: + template: https://api.alterdice.com/v1/public/book + pair_template: + template: "{first}{second}" + lower_case: false + alias: pair + params: null + + response: + type: dict + values: + data: + type: dict + buy: + type: list + values: + type: dict + values: + volume: + type: float + rate: + type: float + sell: + type: list + values: + type: dict + values: + volume: + type: float + rate: + type: float + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - data + - buy + - volume + type: + - float + - key: bids_price + path: + - data + - buy + - rate + type: + - float + - key: asks_amount + path: + - data + - sell + - volume + type: + - float + - key: asks_price + path: + - data + - sell + - rate + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/ascendex.yaml b/pandas_datareader/crypto_utils/resources/ascendex.yaml new file mode 100644 index 00000000..d85ed847 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/ascendex.yaml @@ -0,0 +1,401 @@ +name: ascendex +exchange: true + +rate_limit: null + +api_url: https://ascendex.com/api/pro/v1/ + +requests: + currency_pairs: + request: + template: products + pair_template: null + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - baseAsset + type: + - str + - key: currency_pair_second + path: + - data + - quoteAsset + type: + - str + + tickers: + request: + template: ticker + pair_template: null + params: null + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + symbol: + type: str + volume: + type: str + ask: + type: list + values: + 0: + type: str + bids: + type: list + values: + 0: + type: str + + + mapping: + - key: currency_pair_first + path: + - data + - symbol + type: + - str + - split + - "/" + - 0 + - key: currency_pair_second + path: + - data + - symbol + type: + - str + - split + - "/" + - 1 + - key: time + path: [] + type: + - none + - now + - key: best_bid + path: + - data + - bid + - 0 + type: + - str + - float + - key: best_ask + path: + - data + - ask + - 0 + type: + - str + - float + - key: daily_volume + path: + - data + - volume + type: + - str + - float + + historic_rates: + request: + template: barhist + pair_template: + template: "{first}/{second}" + lower_case: false + alias: symbol + params: + interval: + allowed: + minutes: 1 + hours: 60 + days: 1d + weeks: 1w + months: 1m + default: 1d + to: + function: last_timestamp + type: + - datetime + - timestampms +# from: +# function: last_timestamp +# type: +# - datatime +# - timedeltams +# - interval +# - 500 + n: + default: 20 + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + data: + type: dict + values: + c: + type: str + h: + type: str + i: + type: str + l: + type: str + o: + type: str + v: + type: str + ts: + type: int + + mapping: + - key: time + path: + - data + - data + - ts + type: + - float + - from_timestamp + - 1 + - key: open + path: + - data + - data + - o + type: + - str + - float + - key: high + path: + - data + - data + - h + type: + - str + - float + - key: low + path: + - data + - data + - l + type: + - str + - float + - key: close + path: + - data + - data + - c + type: + - str + - float + - key: volume + path: + - data + - data + - v + type: + - str + - float + + trades: + request: + template: trades + pair_template: + template: "{first}/{second}" + lower_case: false + alias: symbol + params: + n: + default: 100 + + response: + type: dict + values: + data: + type: dict + values: + data: + type: list + values: + type: dict + values: + seqnum: + type: int + p: + type: str + q: + type: str + ts: + type: int + bm: + type: bool + + mapping: + - key: time + path: + - data + - data + - ts + type: + - float + - from_timestamp + - 1 + - key: id + path: + - data + - data + - seqnum + type: + - int + - key: direction + path: + - data + - data + - bm + type: + - value + - map + - true + - sell + - false + - buy + - key: price + path: + - data + - data + - p + type: + - str + - float + - key: amount + path: + - data + - data + - q + type: + - str + - float + + order_books: + request: + template: depth + pair_template: + template: "{first}/{second}" + lower_case: false + alias: symbol + params: null + + response: + type: dict + values: + data: + type: dict + data: + type: dict + seqnum: + type: int + ts: + type: int + asks: + type: list + values: + type: list + values: + 0: # p + type: str + 1: #qty + type: str + bids: + type: list + values: + type: list + values: + 0: # p + type: str + 1: #qty + type: str + + mapping: + - key: time + path: + - data + - data + - ts + type: + - float + - from_timestamp + - 1 + - key: id + path: + - data + - data + - seqnum + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - data + - data + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - data + - data + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - data + - data + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - data + - data + - asks + - 0 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/b2bx.yaml b/pandas_datareader/crypto_utils/resources/b2bx.yaml new file mode 100644 index 00000000..e4b15805 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/b2bx.yaml @@ -0,0 +1,333 @@ +name: b2bx +exchange: true + +rate_limit: + max: 120 + unit: 60 + +api_url: "" + +requests: + currency_pairs: + request: + template: https://b2t-api-cmc-b2bx.flexprotect.org/marketdata/cmc/v1/ticker + pair_template: null + params: null + + response: + type: dict + values: + currency_pair: + type: dict + values: + base_name: + type: str + quote_name: + type: str + last_price: + type: str + base_volume: + type: str + quote_volume: + type: str + + + mapping: + - key: currency_pair_first + path: + - dict_values + - base_name + type: + - str + - key: currency_pair_second + path: + - dict_values + - quote_name + type: + - str + + + tickers: + request: + template: https://cmc-gate.b2bx.exchange/marketdata/cmc/v1/ticker + pair_template: null + params: null + response: + type: dict + values: + currency_pair: + type: dict + values: + last_price: + type: str + base_volume: + type: str + quote_volume: + type: str + + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - dict_values + - last_price + type: + - str + - float + - key: time + path: [] + type: + - none + - now + - key: daily_volume + path: + - dict_values + - base_volume + type: + - str + - float + + historic_rates: + request: + template: https://b2t-api-b2bx.flexprotect.org/marketdata/instruments/{currency_pair}/history + pair_template: + template: "{first}_{second}" + lower_case: true + params: + endDate: + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S" + startDate: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1000 + - from_timestamp + - 0 + - "%Y-%m-%dT%H:%M:%S" + count: + default: 1000 #max + type: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + months: 1M + default: 1d + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + start: + type: str + end: + type: str + open: + type: float + high: + type: float + low: + type: float + close: + type: float + volume: + type: float + quoteVolume: + type: float + + mapping: + - key: time + path: + - data + - start + type: + - str + - dateparser + - key: open + path: + - data + - open + type: + - float + - key: high + path: + - data + - high + type: + - float + - key: low + path: + - data + - low + type: + - float + - key: close + path: + - data + - close + type: + - float + - key: volume + path: + - data + - volume + type: + - float + + + trades: + request: + template: https://b2t-api-cmc-b2bx.flexprotect.org/marketdata/cmc/v1/trades/{currency_pair} + pair_template: + template: "{first}_{second}" + lower_case: true + params: null + + response: + type: list + values: + type: dict + values: + tradeID: + type: str + price: + type: str + base_volume: + type: str + quote_volume: + type: str + trade_timestamp: + type: str + type: + type: str + mapping: + - key: time + path: + - trade_timestamp + type: + - str + - float + - from_timestamp + - 0 + - key: id + path: + - tradeID + type: + - str + - int + - key: direction + path: + - type + type: + - str + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - base_volume + type: + - str + - float + + order_books: + request: + template: https://b2t-api-b2bx.flexprotect.org/marketdata/instruments/{currency_pair}/depth + pair_template: + template: "{first}_{second}" + lower_case: true + params: null + + response: + type: dict + values: + bids: + type: list + values: + type: dict + values: + amount: + type: float + price: + type: float + asks: + type: list + values: + type: dict + values: + amount: + type: float + price: + type: float + version: + type: int + + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: + - version + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - amount + type: + - float + - key: bids_price + path: + - bids + - price + type: + - float + - key: asks_amount + path: + - asks + - amount + type: + - float + - key: asks_price + path: + - asks + - price + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/bankcex.yaml b/pandas_datareader/crypto_utils/resources/bankcex.yaml new file mode 100644 index 00000000..da663b2d --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/bankcex.yaml @@ -0,0 +1,356 @@ +name: bankcex +exchange: true + +rate_limit: + max: 300 + unit: 60 + +api_url: https://api.bankcex.com/api/v1/ + +requests: + currency_pairs: + request: + template: exchangeInfo + pair_template: null + params: null + + response: + type: dict + values: + rate_limits: + type: list + symbols: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + + + mapping: + - key: currency_pair_first + path: + - symbols + - baseAsset + type: + - str + - key: currency_pair_second + path: + - symbols + - quoteAsset + type: + - str + + tickers: + request: + template: returnTicker + pair_template: null + params: null + response: + type: dict + values: + currency_pair: + type: dict + values: + symbol: + type: str + last: + type: float + highestBid: + type: float + lowestAsk: + type: float + quoteVolume: + type: float + baseVolume: + type: float + + + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - dict_values + - last + type: + - float + - key: time + path: [] + type: + - none + - now + - key: best_bid + path: + - dict_values + - highestBid + type: + - float + - key: best_ask + path: + - dict_values + - lowestAsk + type: + - float + - key: daily_volume + path: + - dict_values + - baseVolume + type: + - float + + historic_rates: + request: + template: klines + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + max: 100 + default: 100 + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + default: 1d +# startTime: # not necessary +# function: last_timestamp +# type: +# - datetime +# - timedeltams +# - interval +# - 1000 + endTime: + function: last_timestamp + type: + - datetime + - timestampms + response: + type: list + values: + type: list + values: + 0: # open time + type: int + 1: # open + type: str + 2: # high + type: str + 3: # low + type: str + 4: # close + type: str + 5: # volume + type: str + 6: # close time + type: int + 7: # quote volume + type: str + 8: # number of trades + type: str + + mapping: + - key: time + path: + - 6 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float + + + trades: + request: + template: trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + default: 500 + + response: + type: list + values: + type: dict + values: + id: + type: str + price: + type: str + qty: + type: str + time: + type: int + isBuyerMaker: + type: bool + isBestMatch: + type: bool + + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - id + type: + - str + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - true + - sell + - false + - buy + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + + order_books: + request: + template: depth + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + max: 1000 + default: 100 + response: + type: dict + values: + lastUpdateId: + type: str + bids: + type: list + values: + type: list + values: + 0: #price + type: str + 1: # qty + type: str + asks: + type: list + values: + type: list + values: + 0: #price + type: str + 1: # qty + type: str + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/bequant.yaml b/pandas_datareader/crypto_utils/resources/bequant.yaml new file mode 100644 index 00000000..996552ec --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/bequant.yaml @@ -0,0 +1,374 @@ +name: bequant +exchange: true + +rate_limit: + max: 6000 + unit: 60 + +api_url: https://api.bequant.io/api/2/public/ + +requests: + currency_pairs: + request: + template: symbol + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + baseCurrency: + type: str + quoteCurrency: + type: str + + mapping: + - key: currency_pair_first + path: + - baseCurrency + type: + - str + - key: currency_pair_second + path: + - quoteCurrency + type: + - str + + tickers: + request: + template: ticker + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbols + params: null + response: + type: list + values: + type: dict + values: + ask: + type: str + bid: + type: str + last: + type: str + volume: + type: str + volumeQuote: + type: str + timestamp: + type: str + + mapping: + - key: last_price + path: + - last + type: + - str + - float + - key: time + path: + - timestamp + type: + - str + - dateparser + - key: best_bid + path: + - bid + type: + - str + - float + - key: best_ask + path: + - ask + type: + - str + - float + - key: daily_volume + path: + - volume + type: + - str + - float + + historic_rates: + request: + template: candles + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbols + params: + period: + allowed: + minutes: M1 + hours: H1 + days: D1 + weeks: D7 + months: 1M + default: D1 + + till: + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S.%fZ" + from: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1000 + - from_timestamp + - 0 + - "%Y-%m-%dT%H:%M:%S.%fZ" + sort: + default: DESC + limit: + max: 1000 + default: 1000 + + response: + type: dict + values: + currency_pair: + type: list + values: + type: dict + values: + timestamp: + type: str + open: + type: str + close: + type: str + min: + type: str + max: + type: str + volumeQuote: + type: str + volume: + type: str + + mapping: + - key: time + path: + - list_values + - timestamp + type: + - str + - dateparser + - key: open + path: + - list_values + - open + type: + - str + - float + - key: high + path: + - list_values + - max + type: + - str + - float + - key: low + path: + - list_values + - min + type: + - str + - float + - key: close + path: + - list_values + - close + type: + - str + - float + - key: volume + path: + - list_values + - volume + type: + - str + - float + + trades: + request: + template: trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbols + params: +# from: +# function: last_timestamp +# type: +# - datetime +# - timestamp +# till: +# function: last_timestamp +# type: +# - datetime +# - timedelta +# - interval +# - 1000 +# sort: +# default: DESC + limit: + max: 1000 + default: 500 + response: + type: dict + values: + currency_pair: + type: list + values: + type: dict + values: + id: + type: int + price: + type: str + quantity: + type: str + side: + type: str + timestamp: + type: str + + mapping: + - key: time + path: + - list_values + - timestamp + type: + - str + - dateparser + - key: id + path: + - list_values + - id + type: + - int + - key: direction + path: + - list_values + - side + type: + - str + - key: price + path: + - list_values + - price + type: + - str + - float + - key: amount + path: + - list_values + - quantity + type: + - str + - float + + order_books: + request: + template: orderbook + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbols + params: + limit: + default: 100 + + response: + type: dict + values: + currency_pair: + type: dict + values: + timestamp: + type: str + batchingTime: + type: str + ask: + type: list + values: + type: dict + values: + price: + type: str + size: + type: str + bid: + type: list + values: + type: dict + values: + price: + type: str + size: + type: str + + mapping: + - key: time + path: + - dict_values + - timestamp + type: + - str + - dateparser + - key: id + path: + - dict_values + - timestamp + type: + - str + - dateparser + - totimestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - dict_values + - bid + - size + type: + - str + - float + - key: bids_price + path: + - dict_values + - bid + - price + type: + - str + - float + - key: asks_amount + path: + - dict_values + - ask + - size + type: + - str + - float + - key: asks_price + path: + - dict_values + - ask + - price + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/bibox.yaml b/pandas_datareader/crypto_utils/resources/bibox.yaml new file mode 100644 index 00000000..ce282e2f --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/bibox.yaml @@ -0,0 +1,416 @@ +name: bibox +exchange: true +api_url: https://api.bibox.com/v1/mdata +rate_limit: null +requests: + + tickers: + request: + template: "" + pair_template: null + params: + cmd: + type: str + default: marketAll + response: + type: dict + values: + + type: list + values: + result: + type: dict + values: + + buy: + type: int + high: + type: int + last: + type: float + low: + type: int + sell: + type: int + vol24H: + type: float + last_cny: + type: int + last_usd: + type: int + cmd: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: currency_pair_first + path: + - result + - coin_symbol + type: + - str + - key: currency_pair_second + path: + - result + - currency_symbol + type: + - str + - key: daily_volume + path: + - result + - vol24H + type: + - str + - float + - key: last_price + path: + - result + - last + type: + - str + - float + + currency_pairs: + request: + template: "" + pair_template: null + params: + cmd: + type: str + default: pairList + response: + type: dict + values: + result: + type: list + values: + type: dict + values: + id: + type: int + pair: # e.g. BIX_BTC + type: str + is_hide: + type: int + cmd: + type: str + ver: + type: str + mapping: + - key: currency_pair_first + path: + - result + - pair + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - result + - pair + type: + - str + - split + - "_" + - 1 + + historic_rates: + request: + template: "" + pair_template: # pairs, example: BIX_BTC + template: "{first}_{second}" + lower_case: false + alias: pair + params: + cmd: + type: str + default: kline + period: # k line period + allowed: + minutes: 1min + hours: 1hour + days: day + weeks: week + default: day + size: # how many, 1-1000, if not passed will return 1000 + type: int + default: 1000 + response: + type: dict + values: + result: + type: list + values: + type: dict + values: + time: + type: + - float + - from_timestamp + - 0 + open: + type: + - str + - float + high: + type: + - str + - float + low: + type: + - str + - float + close: + type: + - str + - float + vol: + type: + - str + - int + cmd: + type: str + ver: + type: str + mapping: + - key: time + path: + - result + - time + type: + - float + - from_timestamp + - 1 + - key: open + path: + - result + - open + type: + - str + - float + - key: high + path: + - result + - high + type: + - str + - float + - key: low + path: + - result + - low + type: + - str + - float + - key: close + path: + - result + - close + type: + - str + - float + - key: volume + path: + - result + - vol + type: + - str + - float + + order_books: + request: + template: "" + pair_template: # pairs, example: BIX_BTC + template: "{first}_{second}" + lower_case: false + alias: pair + params: + cmd: + type: str + default: depth + size: # how many, 1-200, if not passed will return 200 + type: int + default: 200 + response: + type: dict + values: + result: + type: dict + values: + update_time: + type: + - float + - from_timestamp + - 0 + asks: + type: list + values: + type: dict + values: + price: + type: + - str + - float + volume: + type: + - str + - float + bids: + type: list + values: + type: dict + values: + price: + type: + - str + - float + volume: + type: + - str + - float + pair: + type: str + cmd: + type: str + ver: + type: str + mapping: + - key: time + path: + - result + - update_time + type: + - float + - from_timestamp + - 1 + - key: asks_price + path: + - result + - asks + - price + type: + - str + - float + - key: asks_amount + path: + - result + - asks + - volume + type: + - str + - float + - key: bids_price + path: + - result + - bids + - price + type: + - str + - float + - key: bids_amount + path: + - result + - bids + - volume + type: + - str + - float + - key: id + path: + - result + - update_time + type: + - int + - key: position + path: [] + type: + - none + - range + + trades: + request: + template: "" + pair_template: # pairs, example: BIX_BTC + template: "{first}_{second}" + lower_case: false + alias: pair + params: + cmd: + type: str + default: deals + size: # how many, 1-200, if not passed will return 200 + type: int + default: 200 + response: + type: dict + values: + result: + type: list + values: + type: dict + values: + id: + type: int + pair: + type: str + price: + type: + - str + amount: + type: + - str + time: + type: + - str + side: # transaction side, 1-bid, 2-ask + type: int + cmd: + type: str + mapping: + - key: price + path: + - result + - price + type: + - str + - float + - key: amount + path: + - result + - amount + type: + - str + - float + - key: time + path: + - result + - time + type: + - str + - float + - from_timestamp + - 1 + - key: direction + path: + - result + - side + type: + - value + - map + - 1 + - buy + - 2 + - sell + - key: id + path: + - result + - time + type: + - str + - int + diff --git a/pandas_datareader/crypto_utils/resources/bidesk.yaml b/pandas_datareader/crypto_utils/resources/bidesk.yaml new file mode 100644 index 00000000..e722bc0a --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/bidesk.yaml @@ -0,0 +1,304 @@ +name: bidesk +is_exchange: true + +api_url: https://api.bidesk.com/ +rate_limit: + max: 1500 + unit: 60 + +requests: + currency_pairs: + request: + template: openapi/v1/brokerInfo + pair_template: null + params: null + + response: + type: dict + values: + symbols: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + + mapping: + - key: currency_pair_first + path: + - symbols + - baseAsset + type: + - str + - key: currency_pair_second + path: + - symbols + - quoteAsset + type: + - str + + tickers: + request: + template: openapi/quote/v1/ticker/price + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: null + + response: + type: dict + values: + symbol: + type: str + price: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - price + type: + - str + - float + + order_books: + request: + template: openapi/quote/v1/depth + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 1000 + default: 50 + response: + type: dict + values: + time: + type: int + bids: + type: list + values: + type: list + 0: #price + type: str + 1: #qty + type: str + asks: + type: list + values: + type: list + 0: + type: str + 1: + type: str + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - time + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + + trades: + request: + template: openapi/quote/v1/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 1000 + default: 500 + response: + type: list + value: + type: dict + values: + price: + type: str + qty: + typ: str + time: + type: int + isBuyerMaker: + type: bool + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - True + - sell + - False + - buy + - key: id + path: + - time + type: + - int + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + + historic_rates: + request: + template: openapi/quote/v1/klines + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + months: 1M + default: 1d + limit: + type: int + max: 1000 + default: 1000 + endTime: + function: last_timestamp + type: + - datetime + - timestampms + + response: + type: list + values: + type: list + values: + 0: #timestamp + type: int + 1: #open + type: str + 2: #high + type: str + 3: #low + type: str + 4: #close + type: str + 5: #volume + type: str + 6: #close time + type: int + 7: # quote Asset volume + type: str + 8: # number of trades + type: int + 9: # taker buy base asset volume + type: str + 10: # taker buy quote asset volume + type: str + + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/bigone.yaml b/pandas_datareader/crypto_utils/resources/bigone.yaml new file mode 100644 index 00000000..a621a096 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/bigone.yaml @@ -0,0 +1,341 @@ +name: bigone +exchange: true + +rate_limit: + max: 3000 + unit: 60 + +api_url: https://big.one/api/v3/ + +requests: + currency_pairs: + request: + template: asset_pairs + pair_template: null + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + name: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - name + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - data + - name + type: + - str + - split + - "-" + - 1 + + tickers: + request: + template: asset_pairs/{currency_pair}/ticker + pair_template: + template: "{first}-{second}" + lower_case: false + params: null + response: + type: dict + values: + data: + type: dict + values: + bid: + type: dict + values: + price: + type: str + ask: + type: dict + values: + price: + type: str + volume: + type: str + + mapping: + - key: time + path: [] + type: + - none + - now + - key: best_bid + path: + - data + - bid + - price + type: + - str + - float + - key: best_ask + path: + - data + - ask + - price + type: + - str + - float + - key: daily_volume + path: + - data + - volume + type: + - str + - float + + historic_rates: + request: + template: asset_pairs/{currency_pair}/candles + pair_template: + template: "{first}-{second}" + lower_case: false + params: + period: + allowed: + minutes: min1 + hours: hour1 + days: day1 + weeks: week1 + months: months1 + default: day1 + time: + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S.%fZ" + limit: + max: 500 + default: 500 + response: + type: dict + values: + type: list + values: + type: dict + values: + close: + type: str + high: + type: str + low: + type: str + open: + type: str + volume: + type: str + time: + type: str + + mapping: + - key: time + path: + - data + - time + type: + - str + - dateparser + - key: open + path: + - data + - open + type: + - str + - float + - key: high + path: + - data + - high + type: + - str + - float + - key: low + path: + - data + - low + type: + - str + - float + - key: close + path: + - data + - close + type: + - str + - float + - key: volume + path: + - data + - volume + type: + - str + - float + + + trades: + request: + template: asset_pairs/{currency_pair}/trades + pair_template: + template: "{first}-{second}" + lower_case: false + params: null + + response: + type: dict + values: + type: list + values: + type: dict + values: + id: + type: int + price: + type: str + amount: + type: str + taker_side: + type: str + created_at: + type: str + mapping: + - key: time + path: + - data + - created_at + type: + - str + - dateparser + - key: id + path: + - data + - id + type: + - int + - key: direction + path: + - data + - taker_side + type: + - value + - map + - ASK + - sell + - BID + - buy + - key: price + path: + - data + - price + type: + - str + - float + - key: amount + path: + - data + - amount + type: + - str + - float + + order_books: + request: + template: asset_pairs/{currency_pair}/depth + pair_template: + template: "{first}-{second}" + lower_case: false + params: + limit: + max: 200 + default: 50 + + response: + type: dict + values: + data: + type: dict + values: + bids: + type: list + values: + type: dict + values: + price: + type: str + quantity: + type: str + asks: + type: list + values: + type: dict + values: + price: + type: str + quantity: + type: str + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - data + - bids + - quantity + type: + - str + - float + - key: bids_price + path: + - data + - bids + - price + type: + - str + - float + - key: asks_amount + path: + - data + - asks + - quantity + type: + - str + - float + - key: asks_price + path: + - data + - asks + - price + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/bitbay.yaml b/pandas_datareader/crypto_utils/resources/bitbay.yaml new file mode 100644 index 00000000..6e725ee3 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/bitbay.yaml @@ -0,0 +1,384 @@ +name: bitbay +exchange: true + +api_url: https://api.bitbay.net/rest/trading/ +rate_limit: + max: 60 + unit: 60 + +requests: + currency_pairs: + request: + template: ticker + pair_template: null + params: null + response: + type: dict + values: + items: + type: dict + values: + currency_pair: + type: dict + + mapping: + - key: currency_pair_first + path: + - items + - dict_key + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - items + - dict_key + type: + - str + - split + - "-" + - 1 + + tickers: + request: + template: ticker + pair_template: null + params: null + response: + type: dict + values: + items: + type: dict + values: + currency_pair: + type: dict + values: + market: + type: dict + values: + time: + type: str + highestBid: + type: str + lowestAsk: + type: str + rate: + type: str + + mapping: + - key: currency_pair_first + path: + - items + - dict_key + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - items + - dict_key + type: + - str + - split + - "-" + - 1 + - key: time + path: + - items + - dict_values + - time + type: + - str + - float + - from_timestamp + - 1 + - key: last_price + path: + - items + - dict_values + - rate + type: + - str + - float + - key: best_bid + path: + - items + - dict_values + - highestBid + type: + - str + - float + - key: best_ask + path: + - items + - dict_values + - lowestAsk + type: + - str + - float + + + trades: + request: + template: transactions/{currency_pair} + pair_template: + template: "{first}-{second}" + lower_case: false + params: + limit: + type: int + max: 300 + default: 300 + response: + type: dict + values: + items: + type: list + values: + type: dict + values: + id: + type: str + t: + type: str + a: + type: str + r: + type: str + ty: + type: str + + mapping: + - key: time + path: + - items + - t + type: + - str + - float + - from_timestamp + - 1 + - key: id + path: + - items + - id + type: + - str + - key: price + path: + - items + - r + type: + - str + - float + - key: amount + path: + - items + - a + type: + - str + - float + - key: direction + path: + - items + - ty + type: + - str + + + order_books: + request: + template: orderbook-limited/{currency_pair}/50 #change limit 50 here + pair_template: + template: "{first}-{second}" + lower_case: false + params: null + response: + type: dict + values: + sell: + type: list + values: + type: dict + values: + ra: + type: str + ca: + type: str + sa: + type: str + pa: + type: str + co: + type: int + buy: + type: list + values: + type: dict + values: + ra: + type: str + ca: + type: str + sa: + type: str + pa: + type: str + co: + type: int + timestamp: + type: str + seqNo: + type: str + + mapping: + - key: time + path: + - timestamp + type: + - str + - float + - from_timestamp + - 1 + - key: id + path: + - seqNo + type: + - str + - int + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - buy + - ra + type: + - str + - float + - key: bids_amount + path: + - buy + - ca + type: + - str + - float + - key: asks_price + path: + - sell + - ra + type: + - str + - float + - key: asks_amount + path: + - sell + - ca + type: + - str + - float + + historic_rates: + request: + template: candle/history/{currency_pair}/{frequency} + pair_template: + template: "{first}-{second}" + lower_case: false + params: + to: + type: + - none + - now_timestampms + from: + function: last_timestamp + type: + - datetime + - timedeltams + - interval + - 2000 + + frequency: + allowed: + minutes: 60 + hours: 3600 + days: 86400 + weeks: 604800 + response: + type: dict + values: + items: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: dict + values: + o: + type: str + c: + type: str + h: + type: str + l: + type: str + v: + type: str + mapping: + - key: time + path: + - items + - 0 + type: + - str + - float + - from_timestamp + - 1 + - key: open + path: + - items + - 1 + - o + type: + - str + - float + - key: high + path: + - items + - 1 + - h + type: + - str + - float + - key: low + path: + - items + - 1 + - l + type: + - str + - float + - key: close + path: + - items + - 1 + - c + type: + - str + - float + - key: volume + path: + - items + - 1 + - v + type: + - str + - float diff --git a/pandas_datareader/crypto_utils/resources/bitfinex.yaml b/pandas_datareader/crypto_utils/resources/bitfinex.yaml new file mode 100644 index 00000000..8c3f78cb --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/bitfinex.yaml @@ -0,0 +1,365 @@ +name: bitfinex + # v1: +#api_url: https://api-pub.bitfinex.com/ +#api_url: https://api.bitfinex.com/ +api_url: '' + +rate_limit: + max: 90 + unit: 60 + +requests: + currency_pairs: + request: + template: https://api.bitfinex.com/v1/symbols_details + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + pair: + type: str + mapping: + - key: currency_pair_first + path: + - pair + type: + - str + - split_at_del_or_index + - ':' + - 3 + - 0 + + - key: currency_pair_second + path: + - pair + type: + - str + - split_at_del_or_index + - ':' + - 3 + - 1 + + + tickers: + request: + template: https://api.bitfinex.com/v1/pubticker/{currency_pair} + pair_template: # i.e. tBTCUSD + template: "{first}{second}" + lower_case: false + params: null + response: + type: dict + values: + mid: + type: str + bid: + type: str + ask: + type: str + last_price: + type: str + low: + type: str + high: + type: str + volume: + type: str + timestamp: + type: str + mapping: # for trading pairs (ex. tBTCUSD) + - key: time + path: + - timestamp + type: + - str + - float + - from_timestamp + - 0 + - key: best_bid + path: + - bid + type: + - str + - float + - key: best_ask + path: + - ask + type: + - str + - float + - key: last_price + path: + - last_price + type: + - str + - float + - key: daily_volume + path: + - volume + type: + - str + - float + + trades: + request: + template: https://api.bitfinex.com/v1/trades/{currency_pair} + pair_template: # i.e. tBTCUSD + template: "{first}{second}" + lower_case: false + params: + limit_trades: # Number of records + default: 999 # max: 10000 + start: # Millisecond start time + required: false + end: # Millisecond end time + required: false + sort: # if = 1 it sorts results returned with old > new + default: -1 + response: + type: list + values: + type: dict + values: + # template on trading pairs (ex. tBTCUSD) + timestamp: # ID + type: int + tid: # MTS: millisecond time stamp + type: + - int + price: # Price: How much was bought (positive) or sold (negative). + type: float + amount: # Amount: Price at which the trade was executed + type: float + exchange: # Exchange Name + type: str + type: # Direction (i.e. Sell/Buy) + type: str + # template on funding currencies (ex. fUSD) + + mapping: # for trading pairs (ex. tBTCUSD) + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - tid + type: + - int + - key: amount + path: + - amount + type: + - float + - key: price + path: + - price + type: + - float + - key: direction + path: + - type + type: + - str + + order_books: + request: + template: https://api.bitfinex.com/v1/book/{currency_pair} + pair_template: # i.e. tBTCUSD + template: "{first}{second}" + lower_case: false + params: + group: # Level of price aggregation (P0, P1, P2, P3, P4, R0) + type: str + default: 1 + limit_bids: # Number of price points ("25", "100") + type: int + default: 50 + limit_asks: # Number of price points ("25", "100") + type: int + default: 50 + response: + type: dict + values: + bids: + type: list + values: + type: dict + values: + price: + type: str + amount: + type: str + timestamp: + type: str + asks: + type: list + values: + type: dict + values: + price: + type: str + amount: + type: str + timestamp: + type: str + + mapping: # for trading pairs (ex. tBTCUSD), if AMOUNT > 0 then bid else ask. + - key: id + path: + - bids + - timestamp + type: + - str + - float + - int + - key: position + path: [] + type: + - none + - range + - key: time + path: + - bids + - timestamp + type: + - str + - float + - from_timestamp + - 0 + + - key: asks_price + path: + - asks + - price + type: + - str + - float + - key: asks_amount + path: + - asks + - amount + type: + - str + - float + + - key: bids_price + path: + - bids + - price + type: + - str + - float + - key: bids_amount + path: + - bids + - amount + type: + - str + - float + + + historic_rates: + request: + template: https://api-pub.bitfinex.com/v2/candles/trade:{frequency}:{currency_pair}/hist + pair_template: # i.e. tBTCUSD + template: "t{first}{second}" + lower_case: false + params: + limit: # Number of candles requested + default: 10000 # max + start: # Filter start (ms) + required: false + end: # Filter end (ms) + function: last_timestamp + type: + - datetime + - timestampms + sort: # if = 1 it sorts results returned with old > new + required: false + + frequency: + allowed: + minutes: 1m + hours: 1h + days: 1D + weeks: 7D + months: 1M + default: 1D + + response: + type: list + values: + # response with Section = "last" + - 0: # MTS: millisecond time stamp + type: + - float + - from_timestamp + - 1 + 1: # OPEN: First execution during the time frame + type: float + 2: # CLOSE: Last execution during the time frame + type: float + 3: # HIGH: Highest execution during the time frame + type: float + 4: # LOW: Lowest execution during the timeframe + type: float + 5: # VOLUME: Quantity of symbol traded within the timeframe + type: float + # response with Section = "hist" + - type: list + values: + 0: # MTS: millisecond time stamp + type: + - float + - from_timestamp + - 1 + 1: # OPEN: First execution during the time frame + type: float + 2: # CLOSE: Last execution during the time frame + type: float + 3: # HIGH: Highest execution during the time frame + type: float + 4: # LOW: Lowest execution during the timeframe + type: float + 5: # VOLUME: Quantity of symbol traded within the timeframe + type: float + mapping: # for trading pairs (ex. tBTCUSD) + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - 1 + type: + - float + - key: close + path: + - 2 + type: + - float + - key: high + path: + - 3 + type: + - float + - key: low + path: + - 4 + type: + - float + - key: volume + path: + - 5 + type: + - float diff --git a/pandas_datareader/crypto_utils/resources/bitforex.yaml b/pandas_datareader/crypto_utils/resources/bitforex.yaml new file mode 100644 index 00000000..4a66f2a2 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/bitforex.yaml @@ -0,0 +1,335 @@ +name: bitforex +exchange: true + +rate_limit: null + +api_url: https://api.bitforex.com/api/v1/market/ + +requests: + currency_pairs: + request: + template: symbols + pair_template: null + params: null + + response: + type: list + values: + data: + type: list + values: + type: dict + values: + symbol: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - symbol + type: + - str + - split + - "-" + - 2 + - key: currency_pair_second + path: + - data + - symbol + type: + - str + - split + - "-" + - 1 + + tickers: + request: + template: ticker + pair_template: + template: "coin-{second}-{first}" + alias: symbol + lower_case: true + params: null + response: + type: dict + values: + data: + type: dict + values: + buy: + type: float + date: + type: int + last: + type: float + sell: + type: float + vol: + type: float + mapping: + - key: last_price + path: + - data + - last + type: + - float + - key: time + path: + - data + - date + type: + - float + - from_timestamp + - 1 + - key: best_bid + path: + - data + - buy + type: + - float + - key: best_ask + path: + - data + - sell + type: + - float + - key: daily_volume + path: + - data + - vol + type: + - float + + historic_rates: + request: + template: kline + pair_template: + template: "coin-{second}-{first}" + lower_case: true + alias: symbol + params: + size: + max: 600 + default: 600 + ktype: + allowed: + minutes: 1min + hours: 1hour + days: 1day + weeks: 1week + months: 1month + default: 1day + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + close: + type: float + open: + type: float + high: + type: float + low: + type: float + time: + type: float + vol: + type: float + + mapping: + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 1 + - key: open + path: + - data + - open + type: + - float + - key: high + path: + - data + - high + type: + - float + - key: low + path: + - data + - low + type: + - float + - key: close + path: + - data + - close + type: + - float + - key: volume + path: + - data + - vol + type: + - float + + + trades: + request: + template: trades + pair_template: + template: "coin-{second}-{first}" + lower_case: true + alias: symbol + params: + size: + max: 600 + default: 200 + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + amount: + type: float + direction: + type: int + price: + type: float + tid: + type: int + time: + type: int + + mapping: + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - data + - tid + type: + - int + - key: direction + path: + - direction + type: + - value + - map + - 1 + - buy + - 2 + - sell + - key: price + path: + - data + - price + type: + - float + - key: amount + path: + - data + - amount + type: + - float + + order_books: + request: + template: depth + pair_template: + template: "coin-{second}-{first}" + lower_case: true + alias: symbol + params: + size: + max: 200 + default: 50 + + response: + type: dict + values: + data: + type: dict + values: + asks: + type: list + values: + type: dict + values: + amount: + type: float + price: + type: float + bids: + type: list + values: + type: dict + values: + amount: + type: float + price: + type: float + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - data + - bids + - amount + type: + - float + - key: bids_price + path: + - data + - bids + - price + type: + - float + - key: asks_amount + path: + - data + - asks + - amount + type: + - float + - key: asks_price + path: + - data + - asks + - price + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/bithumb.yaml b/pandas_datareader/crypto_utils/resources/bithumb.yaml new file mode 100644 index 00000000..592a98ec --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/bithumb.yaml @@ -0,0 +1,420 @@ +name: bithumb +exchange: true +api_url: https://global-openapi.bithumb.pro/openapi/v1/ +rate_limit: + max: 20 + unit: 1 +requests: + + currency_pairs: + request: + template: spot/ticker + pair_template: null + params: + symbol: + type: str + default: ALL + response: + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + p: # dict_key + type: dict + ver: + type: str + vol: + type: str + c: + type: str + s: + type: str + t: + type: str + v: + type: str + h: + type: str + l: + type: str + lev: + type: str + code: + type: str + msg: + type: str + timestamp: + type: int + startTime: + type: null + + mapping: + - key: currency_pair_first + path: + - data + - s + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - data + - s + type: + - str + - split + - "-" + - 1 + + tickers: + request: + template: spot/ticker + pair_template: null + params: + symbol: + type: str + default: ALL + response: + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + p: # dict_key + type: dict + ver: + type: str + vol: + type: str + c: + type: str + s: + type: str + t: + type: str + v: + type: str + h: + type: str + l: + type: str + lev: + type: str + code: + type: str + msg: + type: str + timestamp: + type: int + startTime: + type: null + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: currency_pair_first + path: + - data + - s + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - data + - s + type: + - str + - split + - "-" + - 1 + - key: last_price + path: + - data + - h + type: + - str + - float + - key: daily_volume + path: + - data + - v + type: + - str + - float + + order_books: + request: + template: spot/orderBook + pair_template: # e.g. BTC + template: "{first}-{second}" + alias: symbol + lower_case: false + params: null + response: + type: dict + values: + data: + type: dict + values: + symbol: + type: str + b: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + s: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + code: + type: str + msg: + type: str + timestamp: + type: int + startTime: + type: null + ver: + type: str + + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: bids_price + path: + - data + - b + - 0 + type: + - str + - float + - key: bids_amount + path: + - data + - b + - 1 + type: + - str + - float + - key: asks_amount + path: + - data + - s + - 1 + type: + - str + - float + - key: asks_price + path: + - data + - s + - 0 + type: + - str + - float + - key: id + path: + - data + - ver + type: + - str + - int + - key: position + path: [] + type: + - none + - range + + trades: + request: + template: spot/trades + pair_template: # e.g. BTC + template: "{first}-{second}" + alias: symbol + lower_case: false + params: null + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + p: + type: str + ver: + type: str + s: + type: str + t: + type: str + v: + type: str + mapping: + - key: time + path: + - data + - t + type: + - str + - float + - from_timestamp + - 0 + - key: id + path: + - data + - ver + type: + - str + - int + - key: amount + path: + - data + - v + type: + - str + - float + - key: price + path: + - data + - p + type: + - str + - float + - key: direction + path: + - data + - s + type: + - str + + historic_rates: + request: + template: spot/kline + pair_template: + template: "{first}-{second}" + alias: symbol + lower_case: false + params: + type: + allowed: + minutes: m1 + hours: h1 + days: d1 + weeks: w1 + months: M1 + default: m1 + start: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1000 + end: + function: last_timestamp + type: + - datetime + - timestamp + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + c: + type: str + s: + type: str + t: + type: str + v: + type: str + h: + type: str + time: + type: str + l: + type: str + o: + type: str + mapping: + - key: time + path: + - data + - time + type: + - str + - float + - from_timestamp + - 0 + - key: open + path: + - data + - o + type: + - str + - float + - key: high + path: + - data + - h + type: + - str + - float + - key: low + path: + - data + - l + type: + - str + - float + - key: close + path: + - data + - c + type: + - str + - float + - key: volume + path: + - data + - v + type: + - str + - float diff --git a/pandas_datareader/crypto_utils/resources/bitmart.yaml b/pandas_datareader/crypto_utils/resources/bitmart.yaml new file mode 100644 index 00000000..744bccac --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/bitmart.yaml @@ -0,0 +1,409 @@ +name: bitmart +exchange: true +api_url: https://api-cloud.bitmart.com/spot/v1/ +rate_limit: + max: 600 # 3-90 + unit: 60 +requests: + + currency_pairs: + request: + template: symbols + pair_template: null + params: null + response: + type: dict + values: + data: + type: dict + values: + symbols: + type: list + values: + type: str + mapping: + - key: currency_pair_first + path: + - data + - symbols + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - data + - symbols + type: + - str + - split + - "_" + - 1 + + + tickers: + request: + template: ticker + pair_template: null + params: null + response: + type: dict + values: + data: + type: dict + values: + tickers: + type: list + values: + type: dict + values: + symbol: + type: str + last_price: + type: str + quote_volume: + type: str + base_volume: + type: str + best_ask: + type: str + best_bid: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: currency_pair_first + path: + - data + - tickers + - symbol + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - data + - tickers + - symbol + type: + - str + - split + - "_" + - 1 + + - key: last_price + path: + - data + - tickers + - last_price + type: + - str + - float + - key: best_ask + path: + - data + - tickers + - best_ask + type: + - str + - float + - key: best_bid + path: + - data + - tickers + - best_bid + type: + - str + - float + - key: daily_volume + path: + - data + - tickers + - base_volume + type: + - str + - float + + + historic_rates: + request: + template: symbols/kline + pair_template: # e.g. BMX_ETH + template: "{first}_{second}" + lower_case: false + alias: symbol + params: + step: # in minutes + allowed: + minutes: 1 + hours: 60 + days: 1440 + weeks: 10080 + months: 43200 + default: 1440 # 1d + + from: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 500 + to: # in milliseconds + function: last_timestamp + type: + - datetime + - timestamp + + response: + type: dict + values: + data: + type: dict + values: + klines: + type: list + values: + type: dict + values: + last_price: + type: str + timestamp: + type: int + volume: + type: str + open: + type: str + close: + type: str + high: + type: str + low: + type: str + mapping: + - key: time + path: + - data + - klines + - timestamp + type: + - float + - from_timestamp + - 0 + - key: open + path: + - data + - klines + - open + type: + - str + - float + - key: high + path: + - data + - klines + - high + type: + - str + - float + - key: low + path: + - data + - klines + - low + type: + - str + - float + - key: close + path: + - data + - klines + - close + type: + - str + - float + - key: volume + path: + - data + - klines + - volume + type: + - str + - float + + order_books: + request: + template: symbols/book + pair_template: # e.g. BMX_ETH + template: "{first}_{second}" + lower_case: false + alias: symbol + params: + precision: # Price precision whose range is defined in symbol details + type: int + required: false + size: + type: int + max: 200 + default: 50 + + response: + type: dict + values: + trace: + type: str + data: + type: dict + values: + buya: + type: list + values: + type: dict + values: + amount: + type: str + total: + type: str + price: + type: str + count: + type: str + sells: + type: list + values: + type: dict + values: + amount: + type: str + total: + type: str + price: + type: str + count: + type: str + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - data + - buys + - amount + type: + - str + - float + - key: bids_price + path: + - data + - buys + - price + type: + - str + - float + - key: asks_amount + path: + - data + - sells + - amount + type: + - str + - float + - key: asks_price + path: + - data + - sells + - price + type: + - str + - float + + trades: + request: + template: symbols/trades + pair_template: # e.g. BMX_ETH + template: "{first}_{second}" + lower_case: false + alias: symbol + params: null + response: + type: dict + values: + data: + type: dict + values: + trades: + type: list + values: + type: dict + values: + amount: + type: str + order_time: + type: str + price: + type: str + count: + type: str + type: + type: str + mapping: + - key: amount + path: + - data + - trades + - amount + type: + - str + - float + - key: id + path: + - data + - trades + - order_time + type: + - str + - int + - key: time + path: + - data + - trades + - order_time + type: + - float + - from_timestamp + - 1 + - key: price + path: + - data + - trades + - price + type: + - str + - float + - key: direction + path: + - data + - trades + - type + type: + - str diff --git a/pandas_datareader/crypto_utils/resources/bitopro.yaml b/pandas_datareader/crypto_utils/resources/bitopro.yaml new file mode 100644 index 00000000..fbf9c46c --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/bitopro.yaml @@ -0,0 +1,345 @@ +name: bitopro +exchange: true + +rate_limit: + max: 600 + unit: 60 + +api_url: https://api.bitopro.com/v3/ + +requests: + currency_pairs: + request: + template: provisioning/trading-pairs + pair_template: null + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + base: + type: str + quote: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - base + type: + - str + - key: currency_pair_second + path: + - data + - quote + type: + - str + + tickers: + request: + template: tickers + pair_template: null + params: null + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + pair: + type: str + lastPrice: + type: str + volume24hr: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - pair + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - data + - pair + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - data + - lastPrice + type: + - str + - float + - key: time + path: [] + type: + - none + - now + - key: daily_volume + path: + - data + - volume24hr + type: + - str + - float + + historic_rates: + request: + template: trading-history/{currency_pair} + pair_template: + template: "{first}_{second}" + lower_case: true + params: + resolution: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + month: 1M + default: 1d + to: + function: last_timestamp + type: + - datetime + - timestamp + from: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 300 + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + timestamp: + type: int + open: + type: str + high: + type: str + low: + type: str + close: + type: str + volume: + type: str + + mapping: + - key: time + path: + - data + - timestamp + type: + - float + - from_timestamp + - 1 + - key: open + path: + - data + - open + type: + - str + - float + - key: high + path: + - data + - high + type: + - str + - float + - key: low + path: + - data + - low + type: + - str + - float + - key: close + path: + - data + - close + type: + - str + - float + - key: volume + path: + - data + - volume + type: + - str + - float + + + trades: + request: + template: trades/{currency_pair} + pair_template: + template: "{first}_{second}" + lower_case: true + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + timestamp: + type: int + isBuyer: + type: str + price: + type: str + amount: + type: str + mapping: + - key: time + path: + - data + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - data + - timestamp + type: + - int + - key: direction + path: + - data + - isBuyer + type: + - value + - map + - true + - sell + - false + - buy + - key: price + path: + - data + - price + type: + - str + - float + - key: amount + path: + - data + - amount + type: + - str + - float + + order_books: + request: + template: order-book/{currency_pair} + pair_template: + template: "{first}_{second}" + lower_case: true + params: + limit: + default: 20 + + response: + type: dict + values: + asks: + type: list + values: + type: dict + values: + amount: + type: str + count: + type: int + price: + type: str + total: + type: str + bids: + type: list + values: + type: dict + values: + amount: + type: str + count: + type: int + price: + type: str + total: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - amount + type: + - str + - float + - key: bids_price + path: + - bids + - price + type: + - str + - float + - key: asks_amount + path: + - asks + - amount + type: + - str + - float + - key: asks_price + path: + - asks + - price + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/bitstamp.yaml b/pandas_datareader/crypto_utils/resources/bitstamp.yaml new file mode 100644 index 00000000..5ee1f5b0 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/bitstamp.yaml @@ -0,0 +1,401 @@ +name: bitstamp +exchange: true +api_url: https://www.bitstamp.net/api/v2/ +rate_limit: + max: 60 + unit: 60 +requests: + currency_pairs: + request: + template: trading-pairs-info/ + values: null + params: null + response: + type: list + values: + type: dict + values: + base_decimals: + type: int + minimum_order: + type: str + name: # e.g. LTC/USD + type: str + counter_decimals: + type: int + trading: + type: str + url_symbol: # e.g. ltcusd + type: str + description: # e.g. Litecoin / U.S. dollar + type: str + mapping: + - key: currency_pair_first + path: + - name + - 0 + type: + - str + - split + - "/" + - 0 + - key: currency_pair_second + path: + - name + - 1 + type: + - str + - split + - "/" + - 1 + + tickers: + request: + template: ticker/{currency_pair}/ + pair_template: # e.g. btcusd + template: "{first}{second}" + lower_case: true + params: null + response: + type: dict + values: + last: + type: + - str + - float + high: + type: + - str + - float + low: + type: + - str + - float + vwap: + type: + - str + - float + volume: + type: + - str + - float + bid: + type: + - str + - float + ask: + type: + - str + - float + timestamp: + type: + - str + - float + - from_timestamp + - 0 + open: + type: + - str + - float + mapping: + - key: last_price + path: + - last + type: + - str + - float + - key: daily_volume + path: + - volume + type: + - str + - float + - key: best_bid + path: + - bid + type: + - str + - float + - key: best_ask + path: + - ask + type: + - str + - float + - key: time + path: + - timestamp + type: + - str + - float + - from_timestamp + - 0 + + historic_rates: + request: + template: ohlc/{currency_pair}/ + pair_template: + template: '{first}{second}' + lower_case: true + params: + step: + type: int + allowed: + minutes: 60 + hours: 3600 + days: 86400 + weeks: 259200 + default: 86400 + limit: + type: int + default: 1000 #limit between 1 and 1000 + end: + function: last_timestamp + type: + - datetime + - timestamp + response: + type: dict + values: + data: + type: dict + values: + pair: + - str + ohlc: + type: list + values: + high: + - str + - float + timestamp: + - str + - float + - from_timestamp + - 0 + volume: + - str + - float + low: + - str + - float + open: + - str + - float + close: + - str + - float + mapping: + - key: open + path: + - data + - ohlc + - open + type: + - str + - float + - key: close + path: + - data + - ohlc + - close + type: + - str + - float + - key: high + path: + - data + - ohlc + - high + type: + - str + - float + - key: low + path: + - data + - ohlc + - low + type: + - str + - float + - key: volume + path: + - data + - ohlc + - volume + type: + - str + - float + - key: time + path: + - data + - ohlc + - timestamp + type: + - str + - float + - from_timestamp + - 0 + + order_books: + request: + template: order_book/{currency_pair} + pair_template: # e.g. btcusd + template: "{first}{second}" + lower_case: true + params: + group: + type: int + default: 1 + response: + type: dict + values: + timestamp: + type: + - str + - float + - from_timestamp + - 0 + bids: + type: list + values: + type: list + values: + 0: # price + type: + - str + - float + 1: # amount + type: + - str + - float + asks: + type: list + values: + type: list + values: + 0: # price + type: + - str + - float + 1: # amount + type: + - str + - float + mapping: + - key: time + path: + - timestamp + type: + - str + - float + - from_timestamp + - 0 + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: id + path: + - timestamp + type: + - str + - int + - key: position + path: [] + type: + - none + - range + + trades: + request: + template: transactions/{currency_pair} + pair_template: # e.g. btcusd + template: "{first}{second}" + lower_case: true + params: + time: + type: str + default: hour + response: + type: list + values: + type: dict + values: + date: + type: + - str + tid: + type: + - str + price: + type: + - str + amount: + type: + - str + type: # 0 (buy) or 1 (sell). + type: + - int + mapping: + - key: time + path: + - date + type: + - str + - float + - from_timestamp + - 0 + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - amount + type: + - str + - float + - key: direction + path: + - type + type: + - value + - map + - "0" + - buy + - "1" + - sell + - key: id + path: + - tid + type: + - str + - int + diff --git a/pandas_datareader/crypto_utils/resources/bittrex.yaml b/pandas_datareader/crypto_utils/resources/bittrex.yaml new file mode 100644 index 00000000..411eecf7 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/bittrex.yaml @@ -0,0 +1,310 @@ +name: bittrex +exchange: true +api_docs: https://bittrex.github.io/api/v3 +api_url: https://api.bittrex.com/v3/ +rate_limit: null +requests: + currency_pairs: + request: + template: markets + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + symbol: + type: str + baseCurrencySymbol: + type: str + quoteCurrencySymbol: + type: str + mapping: + - key: currency_pair_first + path: + - baseCurrencySymbol + type: + - str + - key: currency_pair_second + path: + - quoteCurrencySymbol + type: + - str + + tickers: + request: + template: markets/tickers + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + symbol: + type: + - str + lastTradeRate: + type: + - str + - float + bidRate: + type: + - str + - float + askRate: + type: + - str + - float + mapping: + - key: currency_pair_first + path: + - symbol + type: + - str + - split + - '-' + - 0 + - key: currency_pair_second + path: + - symbol + type: + - str + - split + - '-' + - 1 + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - lastTradeRate + type: + - str + - float + - key: best_bid + path: + - bidRate + type: + - str + - float + - key: best_ask + path: + - askRate + type: + - str + - float + + order_books: + request: + template: markets/{currency_pair}/orderbook + pair_template: + template: "{first}-{second}" + lower_case: false + params: + depth: + type: int + max: 500 + default: 25 + response: + type: dict + values: + bid: + type: list + values: + type: dict + values: + quantity: + type: str + rate: + type: str + ask: + type: list + values: + type: dict + values: + quantity: + type: str + rate: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bid + - rate + type: + - str + - float + - key: bids_amount + path: + - bid + - quantity + type: + - str + - float + - key: asks_price + path: + - ask + - rate + type: + - str + - float + - key: asks_amount + path: + - ask + - quantity + type: + - str + - float + + trades: + request: + template: markets/{currency_pair}/trades + pair_template: + template: "{first}-{second}" + lower_case: true + params: null + response: + type: list + values: + type: dict + values: + id: + type: str + executedAt: + type: str + quantity: + type: str + rate: + type: str + takerSide: + type: str + + mapping: + - key: time + path: + - executedAt + type: + - str + - dateparser + - key: id + path: + - id + type: + - str + - key: price + path: + - rate + type: + - str + - float + - key: amount + path: + - quantity + type: + - str + - float + - key: direction + path: + - takerSide + type: + - str + + historic_rates: + request: + template: markets/{currency_pair}/candles/{frequency}/historical/{from} + pair_template: + template: "{first}-{second}" + lower_case: false + alias: null + params: + frequency: + allowed: + minutes: MINUTE_1 + default: MINUTE_1 + + from: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1440 + - from_timestamp + - 0 + - "%Y/%m/%d" + + response: + type: list + values: + type: dict + values: + startsAt: + type: str + open: + type: str + high: + type: str + low: + type: str + close: + type: str + volume: + type: str + quoteVolume: + type: str + mapping: + - key: time + path: + - startsAt + type: + - str + - dateparser + - key: open + path: + - open + type: + - str + - float + - key: high + path: + - high + type: + - str + - float + - key: low + path: + - low + type: + - str + - float + - key: close + path: + - close + type: + - str + - float + - key: volume + path: + - quoteVolume + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/bitvavo.yaml b/pandas_datareader/crypto_utils/resources/bitvavo.yaml new file mode 100644 index 00000000..af5d0e49 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/bitvavo.yaml @@ -0,0 +1,301 @@ +name: bitvavo +exchange: true +rate_limit: + max: 1000 + unit: 60 + +api_url: https://api.bitvavo.com/v2 + +requests: + currency_pairs: + request: + template: /markets + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + markets: + type: str + base: + type: str + quote: + type: str + mapping: + - key: currency_pair_first + path: + - base + type: + - str + - key: currency_pair_second + path: + - quote + type: + - str + + tickers: + request: + template: /ticker/price + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + market: + type: str + price: + type: str + mapping: + - key: currency_pair_first + path: + - market + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - market + type: + - str + - split + - "-" + - 1 + - key: last_price + path: + - price + type: + - str + - float + + + historic_rates: + request: + template: /{currency_pair}/candles + pair_template: + template: "{first}-{second}" + lower_case: false + params: + limit: + default: 1440 + start: + function: last_timestamp + type: + - datetime + - timedeltams + - interval + - 1400 + end: + function: last_timestamp + type: + - datetime + - timestampms + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + default: 1d + + response: + type: list + values: + type: list + values: + 0: #time + type: int + 1: # open + type: str + 2: # high + type: str + 3: # low + type: str + 4: # close + type: str + 5: # volume + type: str + + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float + + trades: + request: + template: /{currency_pair}/trades + pair_template: + template: "{first}-{second}" + lower_case: false + params: + limit: + type: int + default: 500 + + response: + type: list + values: + type: dict + values: + id: + type: str + timestamp: + type: int + amount: + type: str + price: + type: str + side: + type: str + + mapping: + - key: id + path: + - id + type: + - str + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: direction + path: + - side + type: + - str + - key: amount + path: + - amount + type: + - str + - float + - key: price + path: + - price + type: + - str + - float + + order_books: + request: + template: /{currency_pair}/book + pair_template: + template: "{first}-{second}" + lower_case: false + params: + depth: + type: int + default: 50 + + response: + type: dict + values: + market: + type: str + nonce: + type: int + bids: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + sells: + type: list + values: + type: list + values: + 0: # price + type: str + 1: # qty + type: str + + mapping: + - key: id + path: + - nonce + type: + - int + - key: position + path: [] + type: + - none + - range + - key: time + path: [] + type: + - none + - now + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/bitwell.yaml b/pandas_datareader/crypto_utils/resources/bitwell.yaml new file mode 100644 index 00000000..17444213 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/bitwell.yaml @@ -0,0 +1,338 @@ +name: bitwell +exchange: true +rate_limit: null + +api_url: https://openapi.bitwellex.com + +requests: + currency_pairs: + request: + template: /pub/openapi/v1/symbol/spot/all + pair_template: null + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + base_asset: + type: str + quote_asset: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - quote_asset + type: + - str + - key: currency_pair_second + path: + - data + - base_asset + type: + - str + + tickers: + request: + template: /pub/openapi/v1/hq/quote + pair_template: + template: "{first}_{second}" + lower_case: false + alias: symbol + params: null + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + time: + type: int + highest_bid: + type: float + lowest_ask: + type: float + trade: + type: float + volume_24: + type: float + mapping: + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 2 + - key: best_bid + path: + - data + - highest_bid + type: + - float + - key: best_ask + path: + - data + - lowest_ask + type: + - float + - key: last_price + path: + - data + - trade + type: + - float + - key: daily_volume + path: + - data + - volume_24 + type: + - float + + + + historic_rates: + request: + template: /pub/openapi/v1/hq/kline + pair_template: + template: "{first}_{second}" + lower_case: false + alias: symbol + params: + type: + allowed: + minutes: 3 + hours: 2 + days: 1 + default: 1 #day + num: + type: int + max: 2880 + default: 2000 + ts: + function: last_timestamp + type: + - datetime + - timestamp + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + time: + type: int + open: + type: float + high: + type: float + low: + type: float + close: + type: float + volume: + type: float + mapping: + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 0 + - key: open + path: + - data + - open + type: + - float + - key: high + path: + - data + - high + type: + - float + - key: low + path: + - data + - low + type: + - float + - key: close + path: + - data + - close + type: + - float + - key: volume + path: + - data + - volume + type: + - float + + + order_books: + request: + template: /pub/openapi/v1/hq/orderbook + pair_template: + template: "{first}_{second}" + lower_case: false + alias: symbol + params: null + + response: + type: dict + values: + data: + type: dict + values: + ask: + type: list + values: + type: list + values: + 0: + type: float + 1: + type: float + bid: + type: list + values: + type: list + values: + 0: + type: float + 1: + type: float + sn: + type: int + time: + type: int + + mapping: + - key: id + path: + - data + - sn + type: + - int + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 2 + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - data + - bid + - 1 + type: + - float + - key: asks_amount + path: + - data + - ask + - 1 + type: + - float + - key: bids_price + path: + - data + - bid + - 0 + type: + - float + - key: asks_price + path: + - data + - ask + - 0 + type: + - float + + trades: + request: + template: /pub/openapi/v1/hq/transaction + pair_template: + template: "{first}_{second}" + lower_case: false + alias: symbol + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + time_us: + type: int + price: + type: float + amount: + type: float + volume: + type: float + direction: + type: int + mapping: + - key: id + path: + - data + - sn + type: + - int + - key: time + path: + - data + - time_us + type: + - float + - from_timestamp + - 2 + - key: price + path: + - data + - price + type: + - float + - key: amount + path: + - data + - volume + type: + - float + - key: direction + path: + - data + - direction + type: + - value + - map + - 1 + - sell + - 2 + - buy \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/bkex.yaml b/pandas_datareader/crypto_utils/resources/bkex.yaml new file mode 100644 index 00000000..3c878d2b --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/bkex.yaml @@ -0,0 +1,356 @@ +name: bkex +exchange: true +api_url: https://api.bkex.cc + +requests: + currency_pairs: + request: + template: /v2/common/symbols + pair_template: null + params: null + response: + type: dict + values: + msg: + type: str + code: + type: str + data: + type: list + values: + type: dict + values: + coinTypes: + type: list + values: + type: dict + values: + symbol: + type: str + mapping: + - key: currency_pair_first + path: + - data + - symbol + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - data + - symbol + type: + - str + - split + - "_" + - 1 + + tickers: + request: + template: /v2/q/ticker/price + pair_template: + template: "{first}_{second}" + lower_case: false + alias: pair + params: null + response: + type: dict + values: + code: + type: int + data: + type: list + values: + type: dict + values: + price: + type: float + symbol: + type: str + mapping: + - key: currency_pair_first + path: + - data + - symbol + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - data + - symbol + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - data + - price + type: + - float + - key: time + path: [] + type: + - none + - now + + historic_rates: + request: + template: /v2/q/kline + pair_template: + template: "{first}_{second}" + lower_case: false + alias: symbol + params: + period: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + default: 1d + size: + default: 1000 + to: + function: last_timestamp + type: + - datetime + - timestampms + from: + function: last_timestamp + type: + - datetime + - timedeltams + - interval + - 1000 + + + response: + type: dict + values: + msg: + type: str + code: + type: str + data: + type: list + values: + type: dict + values: + ts: # timestamp ms + type: int + close: # closing price + type: float + open: # opening price + type: float + hhigh: # highest price + type: float + low: # lowest price + type: float + volume: #base amount + type: float + mapping: + - key: time + path: + - data + - ts + type: + - float + - from_timestamp + - 1 + - key: low + path: + - data + - low + type: + - float + - key: high + path: + - data + - high + type: + - float + - key: open + path: + - data + - open + type: + - float + - key: close + path: + - data + - close + type: + - float + - key: volume + path: + - data + - volume + type: + - float + + order_books: + request: + template: /v2/q/depth + pair_template: + template: "{first}_{second}" + lower_case: false + alias: symbol + params: + depth: + type: + - int + default: 50 + preicion: + type: int + default: 4 + response: + type: dict + values: + msg: + type: str + code: + type: str + data: + type: dict + values: + bid: + type: list + values: + type: list + values: + 0: # price + type: float + 1: # quantity + type: float + ask: + type: list + values: + type: list + values: + 0: # price + type: float + 1: # quantity + type: float + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - data + - bid + - 0 + type: + - float + - key: bids_amount + path: + - data + - bid + - 1 + type: + - float + - key: asks_price + path: + - data + - ask + - 0 + type: + - float + - key: asks_amount + path: + - data + - ask + - 1 + type: + - float + + trades: + request: + template: /v2/q/deals + pair_template: + template: "{first}_{second}" + lower_case: false + alias: symbol + params: + size: + type: + - int + default: 50 + response: + type: dict + values: + msg: + type: str + code: + type: str + data: + type: list + values: + type: dict + values: + ts: + type: int + price: + type: float + volume: + type: float + direction: + type: str + mapping: + - key: time + path: + - data + - ts + type: + - float + - from_timestamp + - 1 + - key: id + path: + - data + - ts + type: + - int + - key: direction + path: + - data + - direction + type: + - value + - map + - B + - buy + - S + - sell + - key: price + path: + - data + - price + type: + - float + - key: amount + path: + - data + - volume + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/bleutrade.yaml b/pandas_datareader/crypto_utils/resources/bleutrade.yaml new file mode 100644 index 00000000..6906c553 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/bleutrade.yaml @@ -0,0 +1,369 @@ +#ToDo: API Dokumentation nicht auffindbar. Historic Rates flexibeler Timestamp nicht implementiert. +name: bleutrade +exchange: true +api_url: https://bleutrade.com/api/v3/ +rate_limit: null + +requests: + currency_pairs: + request: + template: public/getmarkets + pair_template: null + params: null + response: + type: dict + values: + success: + type: bool + message: + type: str + result: + type: list + values: + type: dict + values: + MarketName: + type: str # e.g. ETH_BTC + MarketAsset: # e.g. ETH + type: str + BaseAsset: # e.g. BTC + type: str + MarketAssetLong: # e.g. Ethereum + type: str + BaseAssetLong: # e.g. Bitcoin + type: str + IsActive: + type: bool + MinTradeSize: + type: float + InfoMassage: + type: str + mapping: + - key: currency_pair_first + path: + - result + - MarketAsset + type: + - str + - key: currency_pair_second + path: + - result + - BaseAsset + type: + - str + + + tickers: + request: + template: public/getticker + pair_template: + template: "{first}_{second}" + lower_case: false + alias: market + params: null + response: + type: dict + values: + success: + type: bool + message: + type: str + result: + type: list + values: + type: dict + values: + Market: + type: str + Bid: + type: float + Ask: + type: float + Last: + type: float + mapping: + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - result + - Last + type: + - float + - key: best_bid + path: + - result + - Bid + type: + - float + - key: best_ask + path: + - result + - Ask + type: + - float + + order_books: + request: + template: public/getorderbook + pair_template: # e.g. ETH_BTC + template: "{first}_{second}" + lower_case: false + alias: market + params: + type: + type: str + default: ALL + depth: + type: int + default: 20 + response: + type: dict + values: + success: + type: bool + message: + type: str + result: + type: dict + values: + buy: + type: list + values: + type: dict + values: + Quantity: + type: float + Rate: + type: float + sell: + type: list + values: + type: dict + values: + Quantity: + type: float + Rate: + type: float + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - result + - buy + - Rate + type: + - float + - key: bids_amount + path: + - result + - buy + - Quantity + type: + - float + - key: asks_price + path: + - result + - sell + - Rate + type: + - float + - key: asks_amount + path: + - result + - sell + - Quantity + type: + - float + + trades: + request: + template: public/getmarkethistory + pair_template: # e.g. ETH_BTC + template: "{first}_{second}" + lower_case: false + alias: market + params: + count: + type: int + max: 200 + default: 20 + response: + type: dict + values: + success: + type: bool + message: + type: str + result: + type: list + values: + type: dict + values: + TradeID: + type: int + TimeStamp: + type: + - str + Quantity: + type: float + Price: + type: float + BaseVolumne: + type: float + OrderType: + type: str + Total: + type: float + + mapping: + - key: time + path: + - result + - TimeStamp + type: + - str + - dateparser + - key: id + path: + - result + - TradeID + type: + - int + - key: amount + path: + - result + - Quantity + type: + - float + - key: price + path: + - result + - Price + type: + - float + - key: direction + path: + - result + - OrderType + type: + - str + + historic_rates: + request: + template: public/getcandles + pair_template: # e.g. ETH_BTC + template: "{first}_{second}" + lower_case: false + alias: market + params: + period: + type: str + allowed: +# minutes: 1m #raises an error + hours: 1h + days: 1d + weeks: 1w + default: 1d + response: + type: dict + values: + success: + type: bool + message: + type: str + result: + type: list + values: + type: dict + values: + TimeStamp: + type: + - str + - strptime + - "%Y-%m-%d %H:%M:%S" + Open: + type: + - str + - float + High: + type: + - str + - float + Low: + type: + - str + - float + Close: + type: + - str + - float + Volume: + type: + - str + - float + BaseVolume: + type: + - str + - float + mapping: + - key: time + path: + - result + - TimeStamp + type: + - str + - strptime + - "%Y-%m-%d %H:%M:%S" + - key: open + path: + - result + - Open + type: + - str + - float + - key: high + path: + - result + - High + type: + - str + - float + - key: low + path: + - result + - Low + type: + - str + - float + - key: close + path: + - result + - Close + type: + - str + - float + - key: volume + path: + - result + - Volume + type: + - str + - float diff --git a/pandas_datareader/crypto_utils/resources/btc-alpha.yaml b/pandas_datareader/crypto_utils/resources/btc-alpha.yaml new file mode 100644 index 00000000..6ff788c2 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/btc-alpha.yaml @@ -0,0 +1,253 @@ +name: btc-alpha +api_docs: https://btc-alpha.github.io/api-docs/ +rate_limit: null + +api_url: https://btc-alpha.com/api/ + +requests: + currency_pairs: + request: + template: v1/pairs/ + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + currency1: + type: str + currency2: + type: str + mapping: + - key: currency_pair_first + path: + - currency1 + type: + - str + - key: currency_pair_second + path: + - currency2 + type: + - str + + historic_rates: + request: + template: charts/{currency_pair}/{frequency}/chart + pair_template: + template: "{first}_{second}" + lower_case: false + params: + limit: + max: 720 + default: 720 + until: + function: last_timestamp + type: + - datetime + - timestamp + frequency: + allowed: + minutes: 5 + hours: 60 + days: D + default: D + + response: + type: list + values: + type: dict + values: + time: + type: int + open: + type: float + high: + type: float + low: + type: float + close: + type: float + volume: + type: float + + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 0 + - key: open + path: + - open + type: + - float + - key: high + path: + - high + type: + - float + - key: low + path: + - low + type: + - float + - key: close + path: + - close + type: + - float + - key: volume + path: + - volume + type: + - float + + + trades: + request: + template: v1/exchanges + pair_template: + template: "{first}_{second}" + lower_case: false + alias: pair + params: + limit: + type: int + default: 100 + + response: + type: list + values: + type: dict + values: + id: + type: int + timestamp: + type: float + price: + type: str + amount: + type: str + type: + type: str + + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - id + type: + - int + - key: direction + path: + - type + type: + - str + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - amount + type: + - str + - float + + order_books: + request: + template: v1/orderbook/{currency_pair} + pair_template: + template: "{first}_{second}" + lower_case: false + params: + group: + type: int + default: 1 # group by price + limit_asks: + type: int + default: 50 + limit_bids: + type: int + default: 50 + response: + type: dict + values: + sell: + type: list + values: + type: dict + values: + price: + type: float + id: # id and timestamp only if group=1 + type: int + amount: + type: float + timestamp: + type: float + buy: + type: list + values: + type: dict + values: + price: + type: float + id: + type: int + amount: + type: float + timestamp: + type: float + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - buy + - amount + type: + - float + - key: bids_price + path: + - buy + - price + type: + - float + - key: asks_amount + path: + - sell + - amount + type: + - float + - key: asks_price + path: + - sell + - price + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/btc_turk.yaml b/pandas_datareader/crypto_utils/resources/btc_turk.yaml new file mode 100644 index 00000000..112ab64f --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/btc_turk.yaml @@ -0,0 +1,389 @@ +name: btc_turk +is_exchange: true + +api_url: "" #Base Api url changes. Complete URL therefore in templates +rate_limit: + max: 60 + unit: 60 + +requests: + currency_pairs: + request: + template: https://api.btcturk.com/api/v2/ticker + pair_template: null + params: null + response: + type: dict + values: + data: + type: dict + values: + type: list + values: + pair: + type: str + pairNormalized: + type: str + timestamp: + type: int + last: + type: float + high: + type: float + low: + type: float + bid: + type: float + ask: + type: float + open: + type: float + volume: + type: float + + mapping: + - key: currency_pair_first + path: + - data + - pairNormalized + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - data + - pairNormalized + type: + - str + - split + - "_" + - 1 + + tickers: + request: + template: https://api.btcturk.com/api/v2/ticker + pair_template: null + params: null + response: + type: dict + values: + data: + type: dict + values: + type: list + values: + pair: + type: str + pairNormalized: + type: str + timestamp: + type: int + last: + type: float + high: + type: float + low: + type: float + bid: + type: float + ask: + type: float + open: + type: float + volume: + type: float + mapping: + - key: currency_pair_first + path: + - data + - pairNormalized + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - data + - pairNormalized + type: + - str + - split + - "_" + - 1 + - key: time + path: + - data + - timestamp + type: + - float + - from_timestamp + - 1 + - key: best_bid + path: + - data + - bid + type: + - float + - key: daily_volume + path: + - data + - volume + type: + - float + - key: best_ask + path: + - data + - ask + type: + - float + - key: last_price + path: + - data + - last + type: + - float + + order_books: + request: + template: https://api.btcturk.com/api/v2/orderbook + pair_template: # e.g. BTCTRY + template: "{first}{second}" + lower_case: false + alias: pairSymbol + params: + limit: + type: int + default: 100 #max 1000 + response: + type: dict + values: + data: + type: dict + values: + timestamp: + type: int + bids: + type: list + values: + type: list + values: + 0: #price + type: str + 1: # qty + type: str + asks: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + + mapping: + - key: time + path: + - data + - timestamp + type: + - float + - from_timestamp + - 1 + - key: id + path: + - data + - timestamp + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - data + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - data + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - data + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - data + - asks + - 1 + type: + - str + - float + + trades: + request: + template: https://api.btcturk.com/api/v2/trades + pair_template: # e.g. BTCTRY + template: "{first}{second}" + lower_case: false + alias: pairSymbol + params: + last: + type: int + max: 50 + default: 50 + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + pair: + type: str + pairNormalized: + type: str + date: + type: int + tid: + type: str + price: + type: float + amount: + type: float + side: + type: str + + + mapping: + - key: time + path: + - data + - date + type: + - float + - from_timestamp + - 1 + - key: id + path: + - data + - tid + type: + - str + - int + - key: direction + path: + - data + - side + type: + - str + - key: price + path: + - data + - price + type: + - str + - float + - key: amount + path: + - data + - amount + type: + - str + - float + + historic_rates: # no hint which currency pair is meant + request: + template: https://graph-api.btcturk.com/v1/ohlcs + pair_template: + template: "{first}_{second}" + lower_case: false + alias: pair + params: + to: # from and to params are available. But API returns every data point by default. + function: last_timestamp + type: + - datetime + - timestamp + from: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1000 + + response: + type: list + values: + type: dict + values: + time: + type: int + open: + type: float + high: + type: float + low: + type: float + close: + type: float + volume: + type: float + average: + type: float + dailyChangeAmount: + type: float + dailyChangePercentage: + type: float + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 0 + - key: open + path: + - open + type: + - float + - key: high + path: + - high + type: + - float + - key: low + path: + - low + type: + - float + - key: close + path: + - close + type: + - float + - key: volume + path: + - volume + type: + - float diff --git a/pandas_datareader/crypto_utils/resources/btse.yaml b/pandas_datareader/crypto_utils/resources/btse.yaml new file mode 100644 index 00000000..094e1af6 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/btse.yaml @@ -0,0 +1,331 @@ +name: btse +exchange: true + +rate_limit: + max: 900 + unit: 60 + +api_url: https://api.btse.com/spot/ + +requests: + currency_pairs: + request: + template: api/v3.2/market_summary + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + symbol: + type: str + base: + type: str + quote: + type: str + mapping: + - key: currency_pair_first + path: + - base + type: + - str + - key: currency_pair_second + path: + - quote + type: + - str + + tickers: + request: + template: api/v3.2/market_summary + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + symbol: + type: str + base: + type: str + quote: + type: str + last: + type: float + lowestAsk: + type: float + highestBid: + type: float + volume: + type: float + + mapping: + - key: currency_pair_first + path: + - base + type: + - str + - key: currency_pair_second + path: + - quote + type: + - str + - key: last_price + path: + - last + type: + - float + - key: time + path: [] + type: + - none + - now + - key: best_bid + path: + - highestBid + type: + - float + - key: best_ask + path: + - lowestAsk + type: + - float + - key: daily_volume + path: + - volume + type: + - float + + historic_rates: + request: + template: api/v3.2/ohlcv + pair_template: + template: "{first}-{second}" + lower_case: false + alias: symbol + params: + resolution: + allowed: + minutes: 1 + hours: 60 + days: 1440 + weeks: 10080 + months: 43200 + default: 1440 + start: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 200 + end: + function: last_timestamp + type: + - datetime + - timestamp + response: + type: list + values: + type: list + values: + 0: #time + type: int + 1: #open + type: float + 2: #high + type: float + 3: #low + type: float + 4: #close + type: float + 5: #volume + type: float + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 0 + - key: open + path: + - 1 + type: + - float + - key: high + path: + - 2 + type: + - float + - key: low + path: + - 3 + type: + - float + - key: close + path: + - 4 + type: + - float + - key: volume + path: + - 5 + type: + - float + + + trades: + request: + template: api/v3.2/trades + pair_template: + template: "{first}-{second}" + lower_case: false + alias: symbol + params: +# startTime: +# function: last_timestamp +# type: +# - timestamp +# - timedelta +# - interval +# - 200 +# - datetime +# endTime: +# function: last_timestamp +# type: +# - timestmap +# - datetime + count: + default: 300 + + response: + type: list + values: + type: dict + values: + price: + type: float + size: + type: float + side: + type: str + serialId: + type: int + timestamp: + type: int + + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: id + path: + - serialId + type: + - int + - key: direction + path: + - side + type: + - str + - key: price + path: + - price + type: + - float + - key: amount + path: + - size + type: + - float + + order_books: + request: + template: api/v3.2/orderbook/L2 + pair_template: + template: "{first}-{second}" + lower_case: false + alias: symbol + params: + depth: + default: 50 + + response: + type: dict + values: + timestamp: + type: int + buyQuote: + type: list + values: + type: dict + values: + price: + type: str + size: + type: str + sellQuote: + type: list + values: + type: dict + values: + price: + type: str + size: + type: str + + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: id + path: + - timestamp + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - buyQuote + - size + type: + - str + - float + - key: bids_price + path: + - buyQuote + - price + type: + - str + - float + - key: asks_amount + path: + - sellQuote + - size + type: + - str + - float + - key: asks_price + path: + - sellQuote + - price + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/bw.yaml b/pandas_datareader/crypto_utils/resources/bw.yaml new file mode 100644 index 00000000..863744b5 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/bw.yaml @@ -0,0 +1,420 @@ +name: bw +exchange: true +rate_limit: null +api_url: https://www.bw.com/api/ + +requests: + currency_pairs: + request: + template: data/v1/tickers + pair_template: null + params: + isUseMarketName: + type: bool + default: "True" + response: + type: dict + values: + datas: + type: dict + values: + currency_pair: + type: list + + mapping: + - key: currency_pair_first + path: + - datas + - list_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - datas + - list_key + type: + - str + - split + - "_" + - 1 + + tickers: + request: + template: data/v1/tickers + pair_template: null + params: + isUseMarketName: + type: bool + default: "True" + response: + type: dict + values: + datas: + type: dict + values: + currency_pair: + type: list + values: + 0: #MarketID + type: int + 1: #last + type: str + 2: #high + type: str + 3: #low + type: str + 4: #24h Volumne + type: str + 5: #24h price increase + type: str + 6: #recent 6h closing price list + type: str + 7: #buy one price + type: str + 8: #sell one price + type: str + 9: #24h turnover + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: currency_pair_first + path: + - datas + - list_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - datas + - list_key + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - datas + - list_values + - 1 + type: + - str + - float + - key: daily_volume + path: + - datas + - list_values + - 4 + type: + - str + - float + - key: best_bid + path: + - datas + - list_values + - 7 + type: + - str + - float + - key: best_ask + path: + - datas + - list_values + - 8 + type: + - str + - float + + historic_rates: + request: + template: data/v1/klines + pair_template: + template: "{first}_{second}" + lower_case: false + alias: marketName + params: + dataSize: + type: int + default: 500 + type: + allowed: + minutes: 1M + hours: 1H + days: 1D + weeks: 1W + default: 1D + + response: + type: dict + values: + datas: + type: list + values: + type: list + values: + 0: #data Typ + type: str + 1: #market ID + type: int + 2: #market_name + type: str + 3: #timestamp + type: int + 4: #opening Price + type: str + 5: #highest price + type: str + 6: #lowest Price + type: str + 7: #closing Price + type: #str + 8: #volume + type: str + 9: #price_range + type: str + 10: #US Dollar Exchange Rate + type: # str + 11: # K-line Period + type: str + 12: #converted + type: bool + 13: #? + type: str + resMsg: + type: dict + values: + message: + type: str + method: + type: str + code: + type: str + + mapping: + - key: time + path: + - datas + - 3 + type: + - str + - float + - from_timestamp + - 0 + - key: open + path: + - datas + - 4 + type: + - str + - float + - key: close + path: + - datas + - 7 + type: + - str + - float + - key: low + path: + - datas + - 6 + type: + - str + - float + - key: high + path: + - datas + - 5 + type: + - str + - float + - key: volume + path: + - datas + - 8 + type: + - str + - float + + + trades: + request: + template: data/v1/trades + pair_template: + template: "{first}_{second}" + lower_case: false + alias: marketName + params: + dataSize: + type: int + max: 20 + default: 20 + response: + type: dict + values: + datas: + type: list + values: + type: list + values: + 0: #trade data + type: str + 1: # market ID + type: str + 2: # timestamp + type: str + 3: # symbol + type: str + 4: # direction + type: str + 5: # price + type: str + 6: # amount + type: str + mapping: + - key: time + path: + - datas + - 2 + type: + - str + - float + - from_timestamp + - 0 + - key: id + path: + - datas + - 2 + type: + - str + - int + - key: direction + path: + - datas + - 4 + type: + - value + - map + - bid + - sell + - ask + - buy + - key: price + path: + - datas + - 5 + type: + - str + - float + - key: amount + path: + - datas + - 6 + type: + - str + - float + + order_books: + request: + template: data/v1/entrusts + pair_template: + template: "{first}_{second}" + lower_case: false + alias: marketName + params: + dataSize: + type: int + max: 50 + default: 50 + + response: + type: dict + values: + datas: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + bids: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + timestamp: + type: str + mapping: + - key: time + path: + - datas + - timestamp + type: + - str + - float + - from_timestamp + - 0 + - key: id + path: + - datas + - timestamp + type: + - str + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - datas + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - datas + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - datas + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - datas + - asks + - 0 + type: + - str + - float + diff --git a/pandas_datareader/crypto_utils/resources/chiliz.yaml b/pandas_datareader/crypto_utils/resources/chiliz.yaml new file mode 100644 index 00000000..bd4f34a7 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/chiliz.yaml @@ -0,0 +1,304 @@ +name: chiliz +is_exchange: true + +api_url: https://api.chiliz.net/ +rate_limit: + max: 3000 + unit: 60 + +requests: + currency_pairs: + request: + template: openapi/v1/brokerInfo + pair_template: null + params: null + + response: + type: dict + values: + symbols: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + + mapping: + - key: currency_pair_first + path: + - symbols + - baseAsset + type: + - str + - key: currency_pair_second + path: + - symbols + - quoteAsset + type: + - str + + tickers: + request: + template: openapi/quote/v1/ticker/price + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: null + + response: + type: dict + values: + symbol: + type: str + price: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - price + type: + - str + - float + + order_books: + request: + template: openapi/quote/v1/depth + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 100 + default: 100 + response: + type: dict + values: + time: + type: int + bids: + type: list + values: + type: list + 0: #price + type: str + 1: #qty + type: str + asks: + type: list + values: + type: list + 0: + type: str + 1: + type: str + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - time + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + + trades: + request: + template: openapi/quote/v1/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 1000 + default: 500 + response: + type: list + value: + type: dict + values: + price: + type: str + qty: + typ: str + time: + type: int + isBuyerMaker: + type: bool + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - True + - sell + - False + - buy + - key: id + path: + - time + type: + - int + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + + historic_rates: + request: + template: openapi/quote/v1/klines + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + months: 1M + default: 1d + limit: + type: int + max: 1000 + default: 1000 + endTime: + function: last_timestamp + type: + - datetime + - timestampms + + response: + type: list + values: + type: list + values: + 0: #timestamp + type: int + 1: #open + type: str + 2: #high + type: str + 3: #low + type: str + 4: #close + type: str + 5: #volume + type: str + 6: #close time + type: int + 7: # quote Asset volume + type: str + 8: # number of trades + type: int + 9: # taker buy base asset volume + type: str + 10: # taker buy quote asset volume + type: str + + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/coinbase.yaml b/pandas_datareader/crypto_utils/resources/coinbase.yaml new file mode 100644 index 00000000..c86b01ce --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/coinbase.yaml @@ -0,0 +1,338 @@ +name: coinbase +exchange: true +api_url: https://api.pro.coinbase.com/ +rate_limit: + max: 180 + unit: 60 +requests: + currency_pairs: + request: + template: products/ + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + id: # i.e. "BTC-USD" + type: str + base_currency: # i.e. "BTC" + type: str + quote_currency: # i.e. "USD" + type: str + base_min_size: + type: + - str + base_max_size: + type: + - str + quote_increment: + type: + - str + mapping: + - key: currency_pair_first + path: + - base_currency + type: + - str + - key: currency_pair_second + path: + - quote_currency + type: + - str + + tickers: + request: + template: products/{currency_pair}/ticker + pair_template: # e.g. BTC-USD + template: "{first}-{second}" + lower_case: false + params: null + response: + type: dict + values: + trade_id: + type: int + price: + type: + - str + size: + type: + - str + bid: + type: + - str + ask: + type: + - str + volume: + type: + - str + time: + type: + - str + mapping: + + - key: last_price + path: + - price + type: + - str + - float + - key: best_bid + path: + - bid + type: + - str + - float + - key: best_ask + path: + - ask + type: + - str + - float + - key: daily_volume + path: + - volume + type: + - str + - float + - key: time + path: + - time + type: + - str + - dateparser + + + order_books: + request: + template: products/{currency_pair}/book + pair_template: # e.g. BTC-USD + template: "{first}-{second}" + lower_case: false + params: + level: + type: int + possible: + - 1 # Only the best bid and ask + - 2 # Top 50 bids and asks (aggregated) + - 3 # Full order book (non aggregated), Abuse of Level 3 via polling will cause your access to be limited or blocked. + default: 2 + response: + type: dict + values: + sequence: + type: + - int + bids: + type: list + values: + type: list + values: + 0: # price + type: + - str + 1: # size + type: + - str + 2: # num-orders + type: int + asks: + type: list + values: + type: list + values: + 0: # price + type: + - str + 1: # size + type: + - str + 2: # num-orders + type: int + mapping: + - key: time + path: [] + type: + - none + - now + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: position + path: [] + type: + - none + - range + - key: id + path: + - sequence + type: + - int + + + trades: + request: + template: products/{currency_pair}/trades + pair_template: # e.g. BTC-USD + template: "{first}-{second}" + lower_case: false + params: null + response: + type: list + values: + type: dict + values: + time: + type: + - str + trade_id: + type: int + price: + type: + - str + size: + type: + - str + side: + type: str + mapping: + - key: time + path: + - time + type: + - str + - dateparser + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - size + type: + - str + - float + - key: direction + path: + - side + type: + - str + - key: id + path: + - trade_id + type: + - int + + historic_rates: # Historical rates should not be polled frequently. If you need real-time information, use the trade and book endpoints along with the websocket feed. + request: + template: products/{currency_pair}/candles + pair_template: # e.g. BTC-USD + template: "{first}-{second}" + lower_case: false + params: + start: # Start time in ISO 8601 "%Y-%m-%dT%H:%M:%S.%fZ" + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 300 + - from_timestamp + - 0 + - "%Y-%m-%dT%H:%M:%S.%fZ" + end: # End time in ISO 8601 + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S.%fZ" + granularity: # Desired timeslice in seconds + type: int + allowed: + minutes: 60 + hours: 3600 + days: 86400 + default: 86400 + response: + type: list # TODO: Header Entry? + values: + type: list + values: + 0: # start time + type: int + 1: # low + type: float + 2: # high + type: float + 3: # open + type: float + 4: # close + type: float + 5: # volume + type: float + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 0 + - to_end + - interval + + - key: low + path: + - 1 + type: + - float + - key: high + path: + - 2 + type: + - float + - key: open + path: + - 3 + type: + - float + - key: close + path: + - 4 + type: + - float + - key: volume + path: + - 5 + type: + - float diff --git a/pandas_datareader/crypto_utils/resources/coinbene.yaml b/pandas_datareader/crypto_utils/resources/coinbene.yaml new file mode 100644 index 00000000..70621f7b --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/coinbene.yaml @@ -0,0 +1,378 @@ +name: coinbene +exchange: true +api_url: https://openapi-exchange.coinbene.com/api/exchange/v2/market/ +rate_limit: + max: 15 + unit: 1 +requests: + currency_pairs: + request: + template: tradePair/list + pair_template: null + params: null + response: + type: dict + values: + code: + type: int + data: + type: list + values: + type: dict + values: + symbol: + type: str + baseAsset: + type: str + quoteAsset: + type: str + mapping: + - key: currency_pair_first + path: + - data + - baseAsset + type: + - str + - key: currency_pair_second + path: + - data + - quoteAsset + type: + - str + + tickers: + request: + template: ticker/one + pair_template: + template: "{first}/{second}" + lower_case: false + alias: symbol + params: null + response: + type: dict + values: + code: + type: int + message: + type: str + data: + type: dict + values: + symbol: + type: str + latestPrice: + type: str + bestBid: + type: str + bestAsk: + type: str + high24h: + type: str + low24h: + type: str + volume24h: + type: str + chg24h: + type: str + chg0h: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - data + - latestPrice + type: + - str + - float + - key: best_bid + path: + - data + - bestBid + type: + - str + - float + - key: best_ask + path: + - data + - bestAsk + type: + - str + - float + + trades: + request: + template: trades + pair_template: + template: "{first}/{second}" + lower_case: false + alias: symbol + params: null + response: + type: dict + values: + code: + type: int + data: + type: list + values: + type: list + 0: + type: str + 1: + type: str + 2: + type: str + 3: + type: str + 4: + type: str + mapping: + - key: time + path: + - data + - 4 + type: + - str + - strptime + - "%Y-%m-%dT%H:%M:%S.%fZ" + - key: id + path: + - data + - 4 + type: + - strptime + - totimestamp + - "%Y-%m-%dT%H:%M:%S.%fZ" + - key: amount + path: + - data + - 2 + type: + - str + - float + - key: price + path: + - data + - 1 + type: + - str + - float + - key: direction + path: + - data + - 3 + type: + - str + + historic_rates: + request: + template: instruments/candles + pair_template: + template: "{first}/{second}" + lower_case: false + alias: symbol + params: + period: + allowed: + minutes: 1 + hours: 60 + days: D + weeks: W + months: M + default: D + end: + function: last_timestamp + type: + - datetime + - timestamp + response: + type: dict + values: + code: + type: int + data: + type: list + values: + type: list + values: + 0: #timestamp + type: str + 1: # open + type: str + 2: # high + type: str + 3: # low + type: str + 4: # close + type: str + 5: #volume + type: str + mapping: + - key: time + path: + - data + - 0 + type: + - str + - strptime + - "%Y-%m-%dT%H:%M:%S.%fZ" + - key: open + path: + - data + - 1 + type: + - str + - float + - key: high + path: + - data + - 2 + type: + - str + - float + - key: low + path: + - data + - 3 + type: + - str + - float + - key: close + path: + - data + - 4 + type: + - str + - float + - key: volume + path: + - data + - 5 + type: + - str + - float + + order_books: + request: + template: orderBook + pair_template: + template: "{first}/{second}" + lower_case: false + alias: symbol + params: + depth: + type: int + default: 100 + response: + type: dict + values: + code: + type: int + data: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: # Price + type: str + 1: # Size + type: str + bids: + type: list + values: + type: list + values: + 0: # Price + type: str + 1: # Size + type: str + mapping: + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: time + path: [] + type: + - none + - now + - key: bids_price + path: + - data + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - data + - bids + - 1 + type: + - str + - float + - key: asks_amount + path: + - data + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - data + - asks + - 0 + type: + - str + - float + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pandas_datareader/crypto_utils/resources/coindcx.yaml b/pandas_datareader/crypto_utils/resources/coindcx.yaml new file mode 100644 index 00000000..8cdcbe62 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/coindcx.yaml @@ -0,0 +1,221 @@ +# Structure of Order-Books not applicable to our program. Tickers not with single request, while CP are not separated. + +name: coindcx +exchange: true + +rate_limit: null + +api_url: "" #Base URL differs + +requests: + currency_pairs: + request: + template: https://api.coindcx.com/exchange/v1/markets_details + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + base_currency_short_name: + type: str + target_currency_short_name: + type: str + + mapping: + - key: currency_pair_first + path: + - target_currency_short_name + type: + - str + - key: currency_pair_second + path: + - base_currency_short_name + type: + - str + + historic_rates: + request: + template: https://public.coindcx.com/market_data/candles + pair_template: + template: "B-{first}_{second}" + lower_case: false + alias: pair + params: + limit: + dafault: 1000 + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w +# months: 1M + default: 1d + endTime: + function: last_timestamp + type: + - datetime + - timestampms + startTime: + function: last_timestamp + type: + - datetime + - timedeltams + - interval + - 1000 + response: + type: list + values: + type: dict + values: + open: + type: float + high: + type: float + low: + type: float + close: + type: float + volume: + type: float + time: + type: int + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: open + path: + - open + type: + - float + - key: high + path: + - high + type: + - float + - key: low + path: + - low + type: + - float + - key: close + path: + - close + type: + - float + - key: volume + path: + - volume + type: + - float + + trades: + request: + template: https://public.coindcx.com/market_data/trade_history + pair_template: + template: "B-{first}_{second}" + lower_case: false + alias: pair + params: + limit: + default: 100 + max: 500 + response: + type: list + values: + type: dict + values: + p: + type: float + q: + type: float + s: + type: str + T: + type: int + m: + type: str + + mapping: + - key: direction + path: + - m + type: + - value + - map + - True + - sell + - False + - buy + - key: time + path: + - T + type: + - float + - from_timestamp + - 1 + - key: id + path: + - T + type: + - int + + - key: price + path: + - p + type: + - float + - key: amount + path: + - q + type: + - float +# +# order_books: +# request: +# template: /market_data/orderbook +# pair_template: +# template: "B{first}_{second}" +# lower_case: false +# alias: pair +# params: null +# +# response: +# type: dict +# values: +# bids: +# type: dict +# values: +# +# +# mapping: +# - key: time +# path: +# type: +# - key: id +# path: +# type: +# - key: position +# path: [] +# type: +# - none +# - range +# - key: bids_amount +# path: +# type: +# - key: bids_price +# path: +# type: +# - key: asks_amount +# path: +# type: +# - key: asks_price +# path: +# type: \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/coinegg.yaml b/pandas_datareader/crypto_utils/resources/coinegg.yaml new file mode 100644 index 00000000..ef9d0b34 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/coinegg.yaml @@ -0,0 +1,310 @@ +name: coinegg +exchange: true + +rate_limit: + max: 3000 + unit: 60 + +api_url: https://api.coinegg.fun/ + +requests: + currency_pairs: + request: + template: openapi/v1/brokerInfo + pair_template: null + params: null + + response: + type: dict + values: + symbols: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + + mapping: + - key: currency_pair_first + path: + - symbols + - baseAsset + type: + - str + - key: currency_pair_second + path: + - symbols + - quoteAsset + type: + - str + + tickers: + request: + template: openapi/quote/v1/ticker/price + pair_template: + template: "{first}{second}" + lower_case: false + alias: sybmol + params: null + response: + type: dict + values: + symbol: + type: str + price: + type: str + + mapping: + - key: last_price + path: + - price + type: + - str + - float + - key: time + path: [] + type: + - none + - now + + historic_rates: + request: + template: openapi/quote/v1/klines + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + interval: + allowed: + minutes: 1m +# hours: 1h + days: 1d + weeks: 1w + months: 1M + default: 1d + endTime: + function: last_timestamp + type: + - datetime + - timestampms +# startTime: #not required with endTime and limit parameter +# function: last_timestamp +# type: +# - datetime +# - timedeltams +# - interval +# - 100 + limit: + type: + - int + default: 1000 + + response: + type: list + values: + type: list + values: + 0: #open time + type: int + 1: #open + type: str + 2: # high + type: str + 3: # low + type: str + 4: # close + type: str + 5: # vol + type: str + 6: # close time + type: int + 7: # quote_vol + type: str + + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 1 + - to_end + - interval + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float + + + trades: + request: + template: openapi/quote/v1/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + default: 500 #max: 1000 + + response: + type: list + values: + type: dict + values: + price: + type: str + time: + type: int + qty: + type: str + isBuyerMaker: + type: bool + + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - time + type: + - int + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - true + - sell + - false + - buy + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + + order_books: + request: + template: openapi/quote/v1/depth + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + default: 50 + + response: + type: dict + values: + time: + type: int + bids: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + asks: + type: list + values: + type: list + values: + 0: #price + type: str + 1: #qty + type: str + + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - time + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/coinex.yaml b/pandas_datareader/crypto_utils/resources/coinex.yaml new file mode 100644 index 00000000..98ada1fe --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/coinex.yaml @@ -0,0 +1,411 @@ +name: coinex +terms: + terms_url: https://www.coinex.com/service + permission: false + search_targets: + - tag: div + class: article-body-inner +api_url: https://api.coinex.com/v1/ + +rate_limit: null # 20 times per second per IP (for Trading and Account API); no limit on Market API +requests: + currency_pairs: + request: + template: market/info + pair_template: null + params: null + response: + type: dict + values: + code: + type: int + data: + type: dict + values: + currency_pair: + type: dict + values: + name: + type: str + pricing_name: + type: str + trading_name: + type: str + mapping: + - key: currency_pair_first + path: + - data + - dict_values + - trading_name + type: + - str + - key: currency_pair_second + path: + - data + - dict_values + - pricing_name + type: + - str + + tickers: + request: + template: market/ticker + pair_template: + template: "{first}{second}" + lower_case: false + alias: market + params: null + response: + type: dict + values: + code: + type: int + data: + type: dict + values: + date: + type: int + ticker: + type: dict + values: + vol: + type: str + low: + type: str + open: + type: str + high: + type: str + last: + type: str + buy: + type: str + buy_amount: + type: str + sell: + type: str + sell_amount: + type: str + message: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: best_bid + path: + - data + - ticker + - buy + type: + - str + - float + - key: last_price + path: + - data + - ticker + - last + type: + - str + - float + - key: best_ask + path: + - data + - ticker + - sell + type: + - str + - float + - key: daily_volume + path: + - data + - ticker + - vol + type: + - str + - float +# + order_books: + request: + template: market/depth + pair_template: # e.g. BTCBCH + template: "{first}{second}" + lower_case: false + alias: market + params: + merge: + type: float + required: true + default: "0" + limit: + type: int + default: 50 + response: + type: dict + values: + code: + type: int + data: + type: dict + values: + last: + type: + - str + asks: + type: list + values: + type: list + values: + 0: # Order price + type: + - str + 1: # Order amount + type: + - str + bids: + type: list + values: + type: list + values: + 0: # Order price + type: + - str + 1: # Order amount + type: + - str + message: + type: str + mapping: + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - data + - time + type: + - int + - key: position + path: [] + type: + - none + - range + - key: asks_price + path: + - data + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - data + - asks + - 1 + type: + - str + - float + - key: bids_price + path: + - data + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - data + - bids + - 1 + type: + - str + - float + + trades: + request: + template: market/deals + pair_template: # e.g. BTCBCH + template: "{first}{second}" + lower_case: false + alias: market + params: + last_id: # Transaction history id, send 0 to draw from the latest record. + type: int + default: "0" + limit: + type: int + default: 100 # less than 1,000 + response: + type: dict + values: + code: + type: int + data: + type: list + values: + type: dict + values: + amount: + type: + - str + - float + date: + type: + - int + date_ms: + type: + - int + id: + type: int + price: + type: + - str + - float + type: + type: str + message: + type: str + mapping: + - key: id + path: + - data + - id + type: + - int + - key: amount + path: + - data + - amount + type: + - str + - float + - key: time + path: + - data + - date + type: + - float + - from_timestamp + - 0 + - key: price + path: + - data + - price + type: + - str + - float + - key: direction + path: + - data + - type + type: + - str + + historic_rates: + request: + template: market/kline + pair_template: # e.g. BTCBCH + template: "{first}{second}" + lower_case: false + alias: market + params: + type: + type: str + allowed: + minutes: 1min + hours: 1hour + days: 1day + weeks: 1week + default: 1day + limit: # Less than or equal to 1000 + type: int + max: 1000 + default: 1000 + response: + type: dict + values: + code: + type: int + data: + type: list + values: + type: list + values: + 0: # Time + type: + - int + 1: # open + type: + - str + 2: # close + type: + - str + 3: # highest + type: + - str + 4: # lowest + type: + - str + 5: # volume + type: + - str + 6: # amount + type: + - str + 7: # market + type: str + message: + type: str + mapping: + - key: time + path: + - data + - 0 + type: + - float + - from_timestamp + - 0 + - key: open + path: + - data + - 1 + type: + - str + - float + - key: close + path: + - data + - 2 + type: + - str + - float + - key: high + path: + - data + - 3 + type: + - str + - float + - key: low + path: + - data + - 4 + type: + - str + - float + - key: volume + path: + - data + - 5 + type: + - str + - float diff --git a/pandas_datareader/crypto_utils/resources/coinfield.yaml b/pandas_datareader/crypto_utils/resources/coinfield.yaml new file mode 100644 index 00000000..546f3fc1 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/coinfield.yaml @@ -0,0 +1,348 @@ +name: coinfield +exchange: true + +rate_limit: null + +api_url: https://api.coinfield.com/v1/ + +requests: + currency_pairs: + request: + template: markets + pair_template: null + params: null + + response: + type: dict + values: + markets: + type: list + values: + type: dict + values: + id: + type: str + name: + type: str + + mapping: + - key: currency_pair_first + path: + - markets + - name + type: + - str + - split + - "/" + - 0 + - key: currency_pair_second + path: + - markets + - name + type: + - str + - split + - "/" + - 1 + + tickers: + request: + template: tickers/{currency_pair} + pair_template: + template: "{first}{second}" + lower_case: true + params: null + response: + type: dict + values: + markets: + type: list + values: + type: dict + values: + timestamp: + type: str + bid: + type: float + ask: + type: float + vol: + type: float + last: + type: float + + mapping: + - key: last_price + path: + - markets + - last + type: + - float + - key: time + path: [] + type: + - none + - now + - key: best_bid + path: + - markets + - bid + type: + - float + - key: best_ask + path: + - markets + - ask + type: + - float + - key: daily_volume + path: + - markets + - vol + type: + - float + + historic_rates: + request: + template: ohlc/{currency_pair} + pair_template: + template: "{first}{second}" + lower_case: true + params: + limit: + default: 400 + period: + allowed: + minutes: 1 + hours: 60 + days: 1440 + weeks: 10080 + default: 1440 + to: + function: last_timestamp + type: + - datetime + - timestamp + from: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 400 + response: + type: dict + values: + ohlc: + type: list + values: + type: dict + values: + ts: + type: str + o: + type: str + h: + type: str + l: + type: str + c: + type: str + v: + type: str + + mapping: + - key: time + path: + - ohlc + - ts + type: + - str + - dateparser + - key: open + path: + - ohlc + - o + type: + - str + - float + - key: high + path: + - ohlc + - h + type: + - str + - float + - key: low + path: + - ohlc + - l + type: + - str + - float + - key: close + path: + - ohlc + - c + type: + - str + - float + - key: volume + path: + - ohlc + - v + type: + - str + - float + + + trades: + request: + template: trades/{currency_pair} + pair_template: + template: "{first}{second}" + lower_case: true + params: + limit: + default: 200 + + response: + type: dict + values: + trades_hash: + type: str + trades: + type: list + values: + type: dict + values: + id: + type: int + price: + type: str + volume: + type: str + total_value: + type: str + timestamp: + type: str + + + mapping: + - key: time + path: + - trades + - timestamp + type: + - str + - dateparser + - key: id + path: + - trades + - id + type: + - int +# - key: direction +# path: +# type: + - key: price + path: + - trades + - price + type: + - str + - float + - key: amount + path: + - trades + - volume + type: + - str + - float + + order_books: + request: + template: orderbook/{currency_pair} + pair_template: + template: "{first}{second}" + lower_case: true + params: + limit: + default: 50 + + response: + type: dict + values: + asks_hash: + type: str + bids: + type: list + values: + type: dict + values: + id: + type: int + price: + type: str + volume: + type: str + timestamp: + type: str + asks: + type: list + values: + type: dict + values: + id: + type: int + price: + type: str + volume: + type: str + timestamp: + type: str + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - volume + type: + - str + - float + - key: bids_price + path: + - bids + - price + type: + - str + - float + - key: asks_amount + path: + - asks + - volume + type: + - str + - float + - key: asks_price + path: + - asks + - price + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/coingecko.yaml b/pandas_datareader/crypto_utils/resources/coingecko.yaml new file mode 100644 index 00000000..3bcdbd32 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/coingecko.yaml @@ -0,0 +1,116 @@ +name: coingecko +exchange: false +api_url: https://api.coingecko.com/api/v3/ +#api_url: https://api.coingecko.com/api/v2/ +rate_limit: + max: 50 + unit: 60 + +requests: + currency_pairs: + request: + template: coins/list + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + id: + type: str + symbol: + type: str + name: + type: str + + mapping: + - key: currency_pair_first + path: + - id + type: + - str + - key: currency_pair_second + path: [] + type: + - none + - constant + - USD + + historic_rates: + request: + template: coins/{currency_pair}/market_chart + pair_template: + template: "{first}" + lower_case: true + params: + vs_currency: + type: str + default: USD + days: + type: int + default: max + + response: + type: dict + values: + prices: + type: list + values: + type: list + values: + 0: + type: int + 1: + type: float + market_caps: + type: list + values: + type: list + values: + 0: + type: int + 1: + type: float + total_volumes: + type: list + values: + type: list + values: + 0: + type: int + 1: + type: float + + mapping: + - key: time + path: + - prices + - 0 + type: + - float + - from_timestamp + - 1 + - to_end + - interval + - key: close + path: + - prices + - 1 + type: + - float + - key: volume + path: + - total_volumes + - 1 + type: + - float + - key: market_cap + path: + - market_caps + - 1 + type: + - float + + diff --git a/pandas_datareader/crypto_utils/resources/coinhe.yaml b/pandas_datareader/crypto_utils/resources/coinhe.yaml new file mode 100644 index 00000000..8a06582e --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/coinhe.yaml @@ -0,0 +1,333 @@ +name: coinhe +exchange: true + +rate_limit: null + +api_url: https://api.coinhe.io/v1/ + +requests: + currency_pairs: + request: + template: market-summary/ + pair_template: null + params: null + + response: + type: list + values: + tyoe: dict + values: + currency_pair: + type: dict + + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 1 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 0 + + tickers: + request: + template: market-summary/ + pair_template: null + params: null + response: + type: list + values: + tyoe: dict + values: + currency_pair: + type: dict + values: + lastUpdateTimestamp: + type: int + LastPrice: + type: float + highestBid: + type: float + lowestAsk: + type: float + baseVolume24g: + type: float + quoteVolume24h: + type: float + + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 1 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: last_price + path: + - dict_values + - LastPrice + type: + - float + - key: time + path: + - dict_values + - lastUpdateTimestamp + type: + - float + - from_timestamp + - 0 + - key: best_bid + path: + - dict_values + - highestBid + type: + - float + - key: best_ask + path: + - dict_values + - lowestAsk + type: + - float + - key: daily_volume + path: + - dict_values + - baseVolume24h + type: + - float + - key: daily_base_volume + path: + - dict_values + - quoteVolume24h + type: + - float + + historic_rates: + request: + template: candlestick-v2 + pair_template: + template: "{second}_{first}" + lower_case: false + alias: pair + params: + interval: + allowed: + minutes: 5m + days: 1d + default: 5m + timestamp: + function: last_timestamp + type: + - datetime + - timestamp + response: + type: list + values: + type: dict + values: + close: + type: str + high: + type: str + open: + type: str + low: + type: str + volume: + type: str + timestamp: + type: int + + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 0 + - key: open + path: + - open + type: + - str + - float + - key: high + path: + - high + type: + - str + - float + - key: low + path: + - low + type: + - str + - float + - key: close + path: + - close + type: + - str + - float + - key: volume + path: + - volume + type: + - str + - float + + + trades: + request: + template: trades/{currency_pair} + pair_template: + template: "{second}_{first}" + lower_case: false +# alias: + params: null + + response: + type: list + values: + type: dict + values: + tradeID: + type: int + price: + type: float + base_volume: + type: float + quote_volume: + type: float + trade_timestamp: + type: int + type: + type: str + + mapping: + - key: time + path: + - trade_timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - tradeID + type: + - int + - key: direction + path: + - type + type: + - str + - key: price + path: + - price + type: + - float + - key: amount + path: + - quote_volume # pair is quoted indirectly + type: + - float + + order_books: + request: + template: orderbook/{currency_pair} + pair_template: + template: "{second}_{first}" + lower_case: false +# alias: + params: null + + response: + type: dict + values: + timestamp: + type: int + bids: + type: list + values: + type: list + values: + 0: #price + type: str + 1: #qty + type: str + asks: + type: list + values: + type: list + values: + 0: #price + type: str + 1: #qty + type: str + + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - timestamp + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/coinjar.yaml b/pandas_datareader/crypto_utils/resources/coinjar.yaml new file mode 100644 index 00000000..380202ea --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/coinjar.yaml @@ -0,0 +1,310 @@ +name: coinjar +exchange: true + +rate_limit: null + +api_url: "" + +requests: + currency_pairs: + request: + template: https://api.exchange.coinjar.com/products + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + name: + type: str + + mapping: + - key: currency_pair_first + path: + - name + type: + - str + - split + - "/" + - 0 + - key: currency_pair_second + path: + - name + type: + - str + - split + - "/" + - 1 + + tickers: + request: + template: https://data.exchange.coinjar.com/products/{currency_pair}/ticker + pair_template: + template: "{first}{second}" + lower_case: false + params: null + response: + type: dict + values: + volume_24h: + type: str + last: + type: str + current_time: + type: str + bid: + type: str + ask: + type: str + + mapping: + - key: last_price + path: + - last + type: + - str + - float + - key: time + path: + - current_time + type: + - str + - dateparser + - key: best_bid + path: + - bid + type: + - str + - float + - key: best_ask + path: + - ask + type: + - str + - float + - key: daily_volume + path: + - volume_24h + type: + - str + - float + + historic_rates: + request: + template: https://data.exchange.coinjar.com/products/{currency_pair}/candles + pair_template: + template: "{first}{second}" + lower_case: false + params: + before: + function: last_timestamp + type: + - datetime + - timestamp + after: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 300 + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + months: 1M + default: 1d + + response: + type: list + values: + type: list + values: + 0: #time + type: str + 1: #open + type: str + 2: #high + type: str + 3: #low + type: str + 4: #close + type: str + 5: #vol + type: str + + mapping: + - key: time + path: + - 0 + type: + - str + - dateparser + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float + + + trades: + request: + template: https://data.exchange.coinjar.com/products/{currency_pair}/trades + pair_template: + template: "{first}{second}" + lower_case: false + params: + limit: + default: 200 + + response: + type: list + values: + type: dict + values: + value: + type: str + timestamp: + type: str + tid: + type: int + taker_side: + type: str + size: + type: str + price: + type: str + + mapping: + - key: time + path: + - timestamp + type: + - str + - dateparser + - key: id + path: + - tid + type: + - int + - key: direction + path: + - taker_side + type: + - str + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - size + type: + - str + - float + + order_books: + request: + template: https://data.exchange.coinjar.com/products/{currency_pair}/book + pair_template: + template: "{first}{second}" + lower_case: false + params: + level: + default: 2 + response: + type: dict + values: + bids: + type: list + values: + type: list + values: + 0: # price + type: str + 1: # qty + type: str + asks: + type: list + values: + type: list + values: + 0: # price + type: str + 1: # qty + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/coinlist.yaml b/pandas_datareader/crypto_utils/resources/coinlist.yaml new file mode 100644 index 00000000..1da79c76 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/coinlist.yaml @@ -0,0 +1,288 @@ +name: coinlist +exchange: true + +rate_limit: + max: 200 + unit: 60 + +api_url: http://trade-api.coinlist.co/v1/ + +requests: + currency_pairs: + request: + template: symbols + pair_template: null + params: null + + response: + type: list + values: + symbols: + type: list + values: + type: dict + values: + symbol: + type: str + base_currency: + type: str + quote_currency: + type: str + + mapping: + - key: currency_pair_first + path: + - symbols + - base_currency + type: + - str + - key: currency_pair_second + path: + - symbols + - quote_currency + type: + - str + + tickers: + request: + template: symbols/summary + pair_template: null + params: null + response: + type: dict + values: + currency_pair: + type: dict + values: + last_price: + type: str + lowest_ask: + type: str + highest_bid: + type: str + volume_base_24h: + type: str + volume_quote_24h: + type: str + + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "-" + - 1 + - key: last_price + path: + - dict_values + - last_price + type: + - str + - float + - key: time + path: [] + type: + - none + - now + - key: best_bid + path: + - dict_values + - highest_bid + type: + - str + - float + - key: best_ask + path: + - dict_values + - lowest_ask + type: + - str + - float + - key: daily_volume + path: + - dict_values + - volume_base_24h + type: + - str + - float + + historic_rates: + request: + template: symbols/{currency_pair}/candles + pair_template: + template: "{first}-{second}" + lower_case: false + params: + granularity: + allowed: + minutes: 1m + hours: 30m + default: 30m +# start_time: +# function: last_timestamp +# type: +# - datetime +# - timedelta +# - interval +# - 300 +# - format +# - "%Y-%m%dT%H:%M:%S.%fZ" + end_time: + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S.%fZ" + response: + type: dict + values: + candles: + type: list + values: + type: list + values: + 0: #time + type: str + 1: #open + type: str + 2: #high + type: str + 3: # low + type: str + 4: #close + type: str + 5: #volume + type: str + mapping: + - key: time + path: + - candles + - 0 + type: + - str + - dateparser + - key: open + path: + - candles + - 1 + type: + - str + - float + - key: high + path: + - candles + - 2 + type: + - str + - float + - key: low + path: + - candles + - 3 + type: + - str + - float + - key: close + path: + - candles + - 4 + type: + - str + - float + - key: volume + path: + - candles + - 5 + type: + - str + - float + + order_books: + request: + template: symbols/{currency_pair}/book + pair_template: + template: "{first}-{second}" + lower_case: false + params: null + + response: + type: dict + values: + call_time: + type: str + after_auction_code: + type: str + bids: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + asks: + type: list + values: + type: list + values: + 0: #price + type: str + 1: #qty + type: str + + mapping: + - key: time + path: + - call_time + type: + - str + - dateparser + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/coinpaprika.yaml b/pandas_datareader/crypto_utils/resources/coinpaprika.yaml new file mode 100644 index 00000000..654a2722 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/coinpaprika.yaml @@ -0,0 +1,226 @@ +# ToDo: Tickers fehlerhaft +name: coinpaprika +exchange: false + +rate_limit: + max: 600 + unit: 60 + +api_url: https://api.coinpaprika.com/v1/ + +requests: + currency_pairs: + request: + template: coins + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + id: + type: str + name: + type: str + symbol: + type: str + + + mapping: + - key: currency_pair_first + path: + - id + type: + - str + - key: currency_pair_second + path: [] + type: + - none + - constant + - 'USD' + +# pair_infos: +# request: +# template: coins/{currency_pair} +# pair_template: +# template: "{first}" +# lower_case: true +# params: null +# response: +# type: dict +# values: +# first_data_at: +# type: str +# last_data_at: +# type: str +# mapping: +# - key: start +# path: +# - first_data_at +# type: +# - str +# - dateparser +# - key: end +# path: +# - last_data_at +# type: +# - str +# - dateparser +## + historic_rates: + request: + template: tickers/{currency_pair}/historical + pair_template: + template: "{first}" + lower_case: true + params: + start: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 5000 + end: + function: last_timestamp + type: + - datetime + - timestamp + limit: + default: 5000 # max! + interval: + allowed: + minutes: 5m + hours: 1h + days: 1d + weeks: 7d + months: 30d + default: 1d + + response: + type: list + values: + type: dict + values: + timestamp: + type: str + price: + type: float + volume_24h: + type: float + market_cap: + type: float + + mapping: + - key: time + path: + - timestamp + type: + - str + - dateparser + - key: close + path: + - price + type: + - float + - key: volume + path: + - volume_24h + type: + - float + - key: market_cap + path: + - market_cap + type: + - float + + +# sentiments: +# request: +# template: tickers/{currency_pair}/historical +# pair_template: +# template: "{first}" +# lower_case: true +# params: +# +# historic_rates: +# request: +# template: coins/{currency_pair}/ohlcv/historical +# pair_template: +# template: "{first}" +# lower_case: true +# params: +# start: +# function: last_timestamp +# type: +# - datetime +# - timedelta +# - interval +# - 366 +# limit: +# default: 366 # max value +# quote: +# default: usd # or 'btc' +# +# response: +# type: list +# values: +# type: dict +# values: +# time_open: +# type: str +# time_close: +# type: str +# open: +# type: float +# high: +# type: float +# low: +# type: float +# close: +# type: float +# volume: +# type: float +# market_cap: +# type: float +# +# +# mapping: +# - key: time +# path: +# - time_close +# type: +# - str +# - dateparser +# - key: open +# path: +# - open +# type: +# - float +# - key: high +# path: +# - high +# type: +# - float +# - key: low +# path: +# - low +# type: +# - float +# - key: close +# path: +# - close +# type: +# - float +# - key: volume +# path: +# - volume +# type: +# - float +# - key: market_cap +# path: +# - market_cap +# type: +# - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/coinsbit.yaml b/pandas_datareader/crypto_utils/resources/coinsbit.yaml new file mode 100644 index 00000000..41928331 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/coinsbit.yaml @@ -0,0 +1,325 @@ +name: coinsbit +exchange: true + +rate_limit: null +api_url: https://coinsbit.io/api/v1/public/ + +requests: + currency_pairs: + request: + template: markets + pair_template: null + params: null + + response: + type: dict + values: + result: + type: list + values: + type: dict + values: + name: + type: str + stock: + type: str + money: + type: str + mapping: + - key: currency_pair_first + path: + - result + - stock + type: + - str + - key: currency_pair_second + path: + - result + - money + type: + - str + + tickers: + request: + template: tickers + pair_template: null + params: null + response: + type: dict + values: + result: + type: dict + values: + currency_pair: + type: dict + values: + at: + type: int + ticker: + type: dict + values: + bid: + type: str + ask: + type: str + last: + type: str + vol: + type: str + + mapping: + - key: currency_pair_first + path: + - result + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - result + - dict_key + type: + - str + - split + - "_" + - 1 + - key: time + path: + - result + - dict_values + - at + type: + - float + - from_timestamp + - 0 + - key: last + path: + - result + - dict_values + - ticker + - last + type: + - str + - float + - key: best_bid + path: + - result + - dict_values + - ticker + - bid + type: + - str + - float + - key: best_ask + path: + - result + - dict_values + - ticker + - ask + type: + - str + - float + - key: daily_volume + path: + - result + - dict_values + - ticker + - vol + type: + - str + - float + + order_books: + request: + template: depth/result + pair_template: + template: "{first}_{second}" + lower_case: false + alias: market + params: + limit: + default: 50 #max=100 + response: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: #price + type: str + 1: #qty + type: str + bids: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + + historic_rates: + request: + template: kline + pair_template: + template: "{first}_{second}" + lower_case: false + alias: market + params: + start: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1000 + end: + function: last_timestamp + type: + - datetime + - timestamp + interval: + allowed: #minimum is 86400 +# minutes: 60 +# hours: 3600 + days: 86400 + weeks: 604800 + months: 18144000 + + default: 86400 # 1day + response: + type: dict + values: + result: + type: dict + values: + market: + type: str + start: + type: int + end: + type: int + interval: + type: int + kline: + type: list + values: + type: dict + values: + time: + type: int + open: + type: str + highest: + type: str + lowest: + type: str + close: + type: str + volume: + type: str + amount: + type: str + mapping: + - key: time + path: + - result + - kline + - time + type: + - float + - from_timestamp + - 0 + - key: open + path: + - result + - kline + - open + type: + - str + - float + - key: high + path: + - result + - kline + - highest + type: + - str + - float + - key: low + path: + - result + - kline + - lowest + type: + - str + - float + - key: close + path: + - result + - kline + - close + type: + - str + - key: volume + path: + - result + - kline + - volume + type: + - str + - float + + + + diff --git a/pandas_datareader/crypto_utils/resources/crex24.yaml b/pandas_datareader/crypto_utils/resources/crex24.yaml new file mode 100644 index 00000000..03fa17ff --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/crex24.yaml @@ -0,0 +1,313 @@ +name: crex24 +exchange: true +api_url: https://api.crex24.com/v2/public/ +rate_limit: null + +requests: + + currency_pairs: + request: + template: instruments + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + symbol: + type: str + baseCurrency: + type: str + quoteCurrency: + type: str + + + mapping: + - key: currency_pair_first + path: + - baseCurrency + type: + - str + - key: currency_pair_second + path: + - quoteCurrency + type: + - str + + tickers: + request: + template: tickers + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + instrument: + type: str + last: + type: float + percentChange: + type: float + low: + type: float + high: + type: float + baseVolume: + type: float + quoteVolume: + type: float + volumeInBtc: + type: float + volumeInUsd: + type: float + ask: + type: float + bid: + type: float + timestamp: + type: str + + mapping: + - key: time + path: + - timestamp + type: + - str + - dateparser + - key: currency_pair_first + path: + - instrument + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - instrument + type: + - str + - split + - "-" + - 1 + - key: last_price + path: + - last + type: + - float + - key: best_ask + path: + - ask + type: + - float + - key: best_bid + path: + - bid + type: + - float + - key: daily_volume + path: + - baseVolume + type: + - float + + historic_rates: + request: + template: ohlcv + pair_template: + template: "{first}-{second}" + lower_case: false + alias: instrument + params: + granularity: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + default: 1d + limit: + type: int + default: 1000 #between 1-1000, if not specified, default is 100. + response: + type: list + values: + type: dict + values: + timestamp: + type: str + open: + type: float + high: + type: float + low: + type: float + close: + type: float + volume: + type: float + mapping: + - key: time + path: + - timestamp + type: + - str + - dateparser + - key: open + path: + - open + type: + - float + - key: high + path: + - high + type: + - float + - key: low + path: + - low + type: + - float + - key: close + path: + - close + type: + - float + - key: volume + path: + - volume + type: + - float + + trades: + request: + template: recentTrades + pair_template: + template: "{first}-{second}" + lower_case: false + alias: instrument + params: + limit: + type: int + default: 1000 + + response: + type: list + values: + type: dict + values: + timestamp: + type: str + price: + type: float + volume: + type: float + side: + type: float + mapping: + - key: id + path: + - timestamp + type: + - str + - dateparser + - totimestamp + - key: time + path: + - timestamp + type: + - str + - dateparser + - key: direction + path: + - side + type: + - str + - key: price + path: + - price + type: + - float + - key: amount + path: + - volume + type: + - float + + + order_books: + request: + template: orderBook + pair_template: + template: "{first}-{second}" + lower_case: false + alias: instrument + params: + limit: + type: int + default: 50 + response: + type: dict + values: + buyLevels: + type: list + values: + type: dict + values: + price: + type: float + volume: + type: float + sellLevels: + type: list + values: + type: dict + values: + price: + type: float + volume: + type: float + mapping: + - key: id + path: [] + type: + - none + - now_timestamp + - key: time + path: [] + type: + - none + - now + - key: position + path: [] + type: + - none + - now + - key: bids_amount + path: + - buyLevels + - volume + type: + - float + - key: bids_price + path: + - buyLevels + - price + type: + - float + - key: asks_amount + path: + - sellLevels + - volume + type: + - float + - key: asks_price + path: + - sellLevels + - price + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/crosstower.yaml b/pandas_datareader/crypto_utils/resources/crosstower.yaml new file mode 100644 index 00000000..9e48e226 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/crosstower.yaml @@ -0,0 +1,364 @@ +name: crosstower +exchange: true + +rate_limit: + max: 6000 + unit: 60 + +api_url: https://api.crosstower.com/api/2/ + +requests: + currency_pairs: + request: + template: public/symbol + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + baseCurrency: + type: str + quoteCurrency: + type: str + + mapping: + - key: currency_pair_first + path: + - baseCurrency + type: + - str + - key: currency_pair_second + path: + - quoteCurrency + type: + - str + + tickers: + request: + template: public/ticker + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbols + params: null + response: + type: list + values: + type: dict + values: + ask: + type: str + bid: + type: str + last: + type: str + volume: + type: str + timestamp: + type: str + volumeQuote: + type: str + + mapping: + - key: last_price + path: + - last + type: + - str + - float + - key: time + path: + - timestamp + type: + - str + - dateparser + - key: best_bid + path: + - bid + type: + - str + - float + - key: best_ask + path: + - ask + type: + - str + - float + - key: daily_volume + path: + - volumeQuote + type: + - str + - float + + historic_rates: + request: + template: public/candles + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbols + params: + period: + allowed: + minutes: M1 + hours: H1 + days: D1 + weeks: W1 + months: 1M + sort: + default: DESC +# from: +# function: last_timestamp +# type: +# - datetime +# - timedelta +# - interval +# - 1000 +# - fromtimestamp +# - "%Y-%m-%dT%H:%M:%S.%fZ" + till: + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S.%fZ" + limit: + default: 1000 + response: + type: dict + values: + currency_pair: + type: list + values: + type: dict + values: + timestamp: + type: str + open: + type: str + max: + type: str + min: + type: str + close: + type: str + volume: + type: str + volumeQuote: + type: str + + mapping: + - key: time + path: + - dict_values + - timestamp + type: + - str + - dateparser + - key: open + path: + - dict_values + - open + type: + - str + - float + - key: high + path: + - dict_values + - max + type: + - str + - float + - key: low + path: + - dict_values + - min + type: + - str + - float + - key: close + path: + - dict_values + - close + type: + - str + - float + - key: volume + path: + - dict_values + - volume + type: + - str + - float + + trades: + request: + template: public/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbols + params: +# from: +# function: last_timestamp +# type: +# - datetime +# - timedelta +# - interval +# - 1000 +# - fromtimestamp +# - "%Y-%m-%dT%H:%M:%S.%fZ" +# till: +# function: last_timestamp +# type: +# - datetime +# - format +# - "%Y-%m-%dT%H:%M:%S.%fZ" + limit: + default: 1000 + max: 1000 + + response: + type: dict + values: + currency_pair: + type: list + values: + type: dict + values: + timestamp: + type: str + id: + type: int + price: + type: str + quantity: + type: str + side: + type: str + + mapping: + - key: time + path: + - dict_values + - timestamp + type: + - str + - dateparser + - key: id + path: + - dict_values + - id + type: + - int + - key: direction + path: + - dict_values + - side + type: + - str + - key: price + path: + - dict_values + - price + type: + - str + - float + - key: amount + path: + - dict_values + - quantity + type: + - str + - float + + order_books: + request: + template: public/orderbook + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbols + params: + limit: + default: 50 + max: 0 # to see complete order-book + + response: + type: dict + values: + currency_pair: + type: dict + values: + ask: + type: list + values: + type: dict + price: + type: str + size: + type: str + sell: + type: list + values: + type: dict + price: + type: str + size: + type: str + timestamp: + type: str + mapping: + - key: time + path: + - dict_values + - timestamp + type: + - str + - dateparser + - key: id + path: [] + type: + - none + - now_timestampms + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - dict_values + - bid + - size + type: + - str + - float + - key: bids_price + path: + - dict_values + - bid + - price + type: + - str + - float + - key: asks_amount + path: + - dict_values + - ask + - size + type: + - str + - float + - key: asks_price + path: + - dict_values + - ask + - price + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/crypto.com.yaml b/pandas_datareader/crypto_utils/resources/crypto.com.yaml new file mode 100644 index 00000000..701cfb34 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/crypto.com.yaml @@ -0,0 +1,392 @@ +name: crypto.com +exchange: true +rate_limit: + max: 6000 + unit: 60 + +api_url: https://uat-api.3ona.co/v2/ + +requests: + currency_pairs: + request: + template: public/get-instruments + pair_template: null + params: null + + response: + type: dict + values: + result: + type: dict + values: + instruments: + type: list + values: + type: dict + values: + instrument_name: + type: str + quote_currency: + type: str + base_currency: + type: str + mapping: + - key: currency_pair_first + path: + - result + - instruments + - base_currency + type: + - str + - key: currency_pair_second + path: + - result + - instruments + - quote_currency + type: + - str + + tickers: + request: + template: public/get-ticker + pair_template: null + params: null + response: + type: dict + values: + result: + type: dict + values: + data: + type: list + values: + i: + type: str + b: + type: float + k: + type: float + a: + type: float + t: + type: int + v: + type: float + mapping: + - key: currency_pair_first + path: + - result + - data + - i + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - result + - data + - i + type: + - str + - split + - "_" + - 1 + - key: time + path: + - result + - data + - t + type: + - float + - from_timestamp + - 1 + - key: last_price + path: + - result + - data + - a + type: + - float + - key: best_bid + path: + - result + - data + - b + type: + - float + - key: best_ask + path: + - result + - data + - k + type: + - float + - key: daily_volume + path: + - result + - data + - v + type: + - float + + trades: + request: + template: public/get-trades + pair_template: + template: "{first}_{second}" + lower_case: false + alias: instrument_name + params: null + + response: + type: dict + values: + result: + type: dict + values: + instrument_name: + type: str + data: + type: list + values: + type: dict + values: + dataTime: + type: int + d: #trade id + type: int + s: #side + type: str + p: #price + type: float + q: #quantity + type: float + t: #time + type: int + i: + type: str + mapping: + - key: time + path: + - result + - data + - t + type: + - float + - from_timestamp + - 1 + - key: id + path: + - result + - data + - d + type: + - int + - key: direction + path: + - result + - data + - s + type: + - str + - key: price + path: + - result + - data + - p + type: + - float + - key: amount + path: + - result + - data + - q + type: + - float + + order_books: + request: + template: public/get-book + pair_template: + template: "{first}_{second}" + lower_case: false + alias: instrument_name + params: + depth: + type: int + max: 150 + default: 50 + response: + type: dict + values: + result: + type: dict + values: + data: + type: list + values: + type: dict + values: + bids: + type: list + values: + type: list + values: + 0: #price + type: float + 1: #qty + type: float + asks: + type: list + values: + type: list + values: + 0: #price + type: float + 1: #qty + type: float + t: #timestamp + type: int + mapping: + - key: time + path: + - result + - data + - t + type: + - float + - from_timestamp + - 1 + - key: id + path: + - result + - data + - t + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - result + - data + - bids + - 0 + type: + - float + - key: bids_amount + path: + - result + - data + - bids + - 1 + type: + - float + - key: asks_price + path: + - result + - data + - asks + - 0 + type: + - float + - key: asks_amount + path: + - result + - data + - asks + - 1 + type: + - float + + historic_rates: + request: + template: public/get-candlestick + pair_template: + template: "{first}_{second}" + lower_case: false + alias: instrument_name + params: + timeframe: + allowed: +# minutes: 1M +# hours: 1H + days: 1D + weeks: 1W +# months: 1M + default: 1D + limit: + default: 100 + + response: + type: dict + values: + result: + type: data + values: + type: list + values: + type: dict + values: + t: + type: int + o: + type: float + h: + type: float + l: + type: float + c: + type: float + v: + type: float + mapping: + - key: time + path: + - result + - data + - t + type: + - float + - from_timestamp + - 1 + - key: open + path: + - result + - data + - o + type: + - float + - key: high + path: + - result + - data + - h + type: + - float + - key: low + path: + - result + - data + - l + type: + - float + - key: close + path: + - result + - data + - c + type: + - float + - key: volume + path: + - result + - data + - v + type: + - float diff --git a/pandas_datareader/crypto_utils/resources/currency.com.yaml b/pandas_datareader/crypto_utils/resources/currency.com.yaml new file mode 100644 index 00000000..b1f26370 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/currency.com.yaml @@ -0,0 +1,320 @@ +name: currency.com +exchange: true +api_url: https://marketcap.backend.currency.com/api/v1/ + +rate_limit: null + +requests: + currency_pairs: + request: + template: ticker + pair_template: null + params: null + + response: + type: dict + values: + currency_pair: + type: dict + values: + base_currency: + type: str + quote_currency: + type: str + mapping: + - key: currency_pair_first + path: + - dict_values + - base_currency + type: + - str + - key: currency_pair_second + path: + - dict_values + - quote_currency + type: + - str + + tickers: + request: + template: ticker + pair_template: null + params: null + + response: + type: dict + values: + currency_pair: + type: dict + values: + base_currency: + type: str + quote_currency: + type: str + last_price: + type: float + base_volume: + type: float + lowest_ask_price: + type: float + highest_bid_price: + type: float + mapping: + - key: currency_pair_first + path: + - dict_values + - base_currency + type: + - str + - key: currency_pair_second + path: + - dict_values + - quote_currency + type: + - str + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - dict_values + - last_price + type: + - float + - key: best_bid + path: + - dict_values + - highest_bid + type: + - float + - key: best_ask + path: + - dict_values + - lowest_ask + type: + - float + - key: daily_volume + path: + - dict_values + - base_volume + type: + - float + + order_books: + request: + template: orderbook + pair_template: + template: "{first}/{second}" + lower_case: false + alias: symbol + params: + depth: + default: 50 + + response: + type: dict + values: + timestamp: + type: int + asks: + type: list + values: + type: list + values: + 0: # price + type: float + 1: # qty + type: float + bids: + type: list + values: + type: list + values: + 0: # price + type: float + 1: # qty + type: float + + mapping: + - key: id + path: + - timestamp + type: + - int + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bids + - 0 + type: + - float + - key: bids_amount + path: + - bids + - 1 + type: + - float + - key: asks_price + path: + - asks + - 0 + type: + - float + - key: asks_amount + path: + - asks + - 1 + type: + - float + + historic_rates: + request: + template: candles + pair_template: + template: "{first}/{second}" + lower_case: false + alias: symbol + params: + interval: + allowed: + minutes: M1 + hours: H1 + days: D1 + weeks: W1 + default: D1 + limit: + default: 1000 + endTime: + function: last_timestamp + type: + - datetime + - timestampms + startTime: + function: last_timestamp + type: + - datetime + - timedeltams + - interval + - 1000 + + response: + type: list + values: + type: list + values: + 0: + type: int + 1: + type: str + 2: + type: str + 3: + type: str + 4: + type: str + mapping: + - key: time + path: + - [] + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - [] + - 1 + type: + - str + - float + - key: high + path: + - [] + - 2 + type: + - str + - float + - key: low + path: + - [] + - 3 + type: + - str + - float + - key: close + path: + - [] + - 4 + type: + - str + - float + + trades: + request: + template: trades + pair_template: + template: "{first}/{second}" + lower_case: false + alias: symbol + params: null + + response: + type: list + values: + type: dict + values: + tradeID: + type: int + price: + type: float + base_volume: + type: float + quote_volume: + type: float + trade_timestamp: + type: float + type: + type: str + + mapping: + - key: id + path: + - tradeID + type: + - int + - key: time + path: + - trade_timestamp + type: + - float + - from_timestamp + - 0 + - key: direction + path: + - type + type: + - str + - key: price + path: + - price + type: + - float + - key: amount + path: + - base_volume + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/deepcoin.yaml b/pandas_datareader/crypto_utils/resources/deepcoin.yaml new file mode 100644 index 00000000..82e5270f --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/deepcoin.yaml @@ -0,0 +1,211 @@ +name: deepcoin +exchange: true + +rate_limit: null + +api_url: https://api-w.deepcoin.pro + +requests: + currency_pairs: + request: + template: /query/v1.0/Instrument + pair_template: null + params: + ProductGroup: + default: Spot + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + InsturmentID: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - InstrumentID + type: + - str + - split + - "/" + - 0 + - key: currency_pair_second + path: + - data + - InstrumentID + type: + - str + - split + - "/" + - 1 + + tickers: + request: + template: /query/v1.0/MarketData + pair_template: null + params: + ProductGroup: + default: Spot + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + InstrumentID: + type: str + UpdateTime: + type: int + LastPrice: + type: float + BidPrice1: + type: float + AskPrice1: + type: float + Turnover: + type: float + Volume: + type: float + + mapping: + - key: currency_pair_first + path: + - data + - InstrumentID + type: + - str + - split + - "/" + - 0 + - key: currency_pair_second + path: + - data + - InstrumentID + type: + - str + - split + - "/" + - 1 + - key: last_price + path: + - data + - LastPrice + type: + - float + - key: time + path: + - data + - UpdateTime + type: + - float + - from_timestamp + - 0 + - key: best_bid + path: + - data + - BidPrice1 + type: + - float + - key: best_ask + path: + - data + - AskPrice1 + type: + - float + - key: daily_volume + path: + - data + - Turnover + type: + - float + + historic_rates: + request: + template: /query/v1.0/KLine + pair_template: + template: "{first}{second}" + lower_case: false + alias: InstrumentID + params: + Type: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + months: 1o + default: 1d + Count: + max: 2000 + default: 200 + StartDatetime: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 200 + response: + type: list + values: + type: dict + values: + BeginTime: + type: int + UpdateTime: + type: int + OpenPrice: + type: float + ClosePrice: + type: float + HighestPrice: + type: float + LowestPrice: + type: float + Volume: + type: float + Turnover: + type: float + + mapping: + - key: time + path: + - UpdateTime + type: + - float + - from_timestamp + - 0 + - key: open + path: + - ClosePrice + type: + - float + - key: high + path: + - HighestPrice + type: + - float + - key: low + path: + - LowestPrice + type: + - float + - key: close + path: + - ClosePrice + type: + - float + - key: volume + path: + - Turnover + type: + - float diff --git a/pandas_datareader/crypto_utils/resources/dex-trade.yaml b/pandas_datareader/crypto_utils/resources/dex-trade.yaml new file mode 100644 index 00000000..a28b224d --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/dex-trade.yaml @@ -0,0 +1,310 @@ +name: dex-trade +exchange: true + +rate_limit: null + +api_url: "" + +requests: + currency_pairs: + request: + template: https://api.dex-trade.com/v1/public/symbols + pair_template: null + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + base: + type: str + quote: + type: str + id: + type: int + + mapping: + - key: currency_pair_first + path: + - data + - base + type: + - str + - key: currency_pair_second + path: + - data + - quote + type: + - str + + tickers: + request: + template: https://api.dex-trade.com/v1/public/ticker + pair_template: + template: "{first}{second}" + lower_case: false + alias: pair + params: null + response: + type: dict + values: + data: + type: dict + values: + last: + type: str + volume_24H: + type: str + + mapping: + - key: last_price + path: + - data + - last + type: + - str + - float + - key: time + path: [] + type: + - none + - now + - key: daily_volume + path: + - data + - volume_24H + type: + - str + - float + + historic_rates: + request: + template: https://socket.dex-trade.com/graph/hist + pair_template: + template: "{first}{second}" + lower_case: false + alias: t + params: + r: + allowed: + minutes: 1 + hours: 60 + days: D + weeks: W + default: D + end: + function: last_timestamp + type: + - datetime + - timestamp + limit: + default: 1000 + + response: + type: list + values: + type: dict + values: + low: + type: float + high: + type: float + volume: + type: float + time: + type: float + open: + type: float + close: + type: float + + + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 0 + - key: open + path: + - open + type: + - int + - div + - 100000000 + - key: high + path: + - high + type: + - int + - div + - 100000000 + - key: low + path: + - low + type: + - int + - div + - 100000000 + - key: close + path: + - close + type: + - int + - div + - 100000000 + - key: volume + path: + - volume + type: + - int + - div + - 100000000 + + trades: + request: + template: https://api.dex-trade.com/v1/public/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: pair + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + volume: + type: float + rate: + type: float + price: + type: float + timestamp: + type: int + type: + type: str + + mapping: + - key: time + path: + - data + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - data + - timestamp + type: + - int + - key: direction + path: + - data + - type + type: + - str + - key: price + path: + - data + - rate + type: + - float + - key: amount + path: + - data + - volume + type: + - float + + order_books: + request: + template: https://api.dex-trade.com/v1/public/book + pair_template: + template: "{first}{second}" + lower_case: false + alias: pair + params: null + + response: + type: dict + values: + buy: + type: list + values: + type: dict + values: + volume: + type: float + count: + type: float + rate: + type: float + sell: + type: list + values: + type: dict + values: + volume: + type: float + count: + type: float + rate: + type: float + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - data + - buy + - volume + type: + - float + - key: bids_price + path: + - data + - buy + - rate + type: + - flot + - key: asks_amount + path: + - data + - sell + - volume + type: + - float + - key: asks_price + path: + - data + - sell + - rate + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/digifinex.yaml b/pandas_datareader/crypto_utils/resources/digifinex.yaml new file mode 100644 index 00000000..1f80bf12 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/digifinex.yaml @@ -0,0 +1,291 @@ +name: digifinex +exchange: true +api_doc: https://docs.digifinex.com/en-ww/v3/#market-data +rate_limit: null +api_url: https://openapi.digifinex.vip/v3/ + +requests: + currency_pairs: + request: + template: markets + pair_template: null + params: null + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + volume_precision: + type: int + price_precision: + type: int + market: + type: str + min_amount: + type: int + min_volume: + type: float + mapping: + - key: currency_pair_first + path: + - data + - market + type: + - str + - splitupper + - "_" + - 0 + - key: currency_pair_second + path: + - data + - market + type: + - str + - splitupper + - "_" + - 1 + + tickers: + request: + template: ticker + pair_template: null + params: null + response: + type: dict + values: + ticker: + type: list + values: + type: dict + values: + vol: + type: float + change: + type: float + base_vol: + type: float + sell: + type: float + last: + type: float + symbol: + type: str + low: + type: float + buy: + type: float + high: + type: float + date: + type: int + code: + type: bool + + mapping: + - key: time + path: [] + type: + - none + - now + - key: currency_pair_first + path: + - ticker + - symbol + type: + - str + - splitupper + - "_" + - 0 + - key: currency_pair_second + path: + - ticker + - symbol + type: + - str + - splitupper + - "_" + - 1 + - key: last_price + path: + - ticker + - last + type: + - float + - key: best_bid + path: + - ticker + - buy + type: + - float + - key: best_ask + path: + - ticker + - sell + type: + - float + - key: daily_volume + path: + - ticker + - vol + type: + - float + + historic_rates: + request: + template: kline + pair_template: + template: "{first}_{second}" + lower_case: true + alias: symbol + params: + period: + allowed: + minutes: 1 + hours: 60 + days: 1D + weeks: 1W + default: 1D + start_time: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1000 + end_time: + function: last_timestamp + type: + - datetime + - timestamp + + response: + type: dict + values: + code: + type: dict + data: + type: list + values: + type: list + values: + 0: # timestamp + type: int + 1: # volume + type: float + 2: # close + type: float + 3: # high + type: float + 4: # low + type: float + 5: # open + type: float + mapping: + - key: time + path: + - data + - [] + - 0 + type: + - float + - from_timestamp + - 0 + - key: volume + path: + - data + - [] + - 1 + type: + - float + - key: close + path: + - data + - [] + - 2 + type: + - float + - key: high + path: + - data + - [] + - 3 + type: + - float + - key: low + path: + - data + - [] + - 4 + type: + - float + - key: open + path: + - data + - [] + - 4 + type: + - float + +# trades: +# request: +# template: trades +# pair_template: +# template: "{first}_{second}" +# lower_case: true +# alias: symbol +# params: +# limit: #between 100-500 +# type: int +# default: 100 +# response: +# type: dict +# values: +# data: +# type: list +# values: +# type: dict +# values: +# date: +# type: int +# id: +# type: int +# amount: +# type: float +# type: +# type: str +# price: +# type: float +# mapping: +# - key: trade_time +# path: +# - data +# - date +# type: +# - int +# - fromtimestamp +# - key: trade_amount +# path: +# - data +# - amount +# type: +# - float +# - key: trade_last_price +# path: +# - data +# - price +# type: +# - int +# - key: trade_side +# path: +# - data +# - type +# type: +# - str +# +# order_book: +# request: +# response: +# mapping: \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/exrates.yaml b/pandas_datareader/crypto_utils/resources/exrates.yaml new file mode 100644 index 00000000..af1c2475 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/exrates.yaml @@ -0,0 +1,318 @@ +name: exrates +exchange: true +api_url: '' +api_docs: https://docs.exrates.me/ +rate_limit: + max: 10 + unit: 60 + +requests: + currency_pairs: + request: + template: https://api.exrates.me/v1/public/symbols + pair_template: null + params: null + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + id: + type: int + base: + type: str + quote: + type: str + mapping: + - key: currency_pair_first + path: + - data + - base + type: + - str + - key: currency_pair_second + path: + - data + - quote + type: + - str + + tickers: + request: + template: https://api.exrates.me/v1/public/ticker + pair_template: + template: "{first}{second}" + lower_case: false + alias: pair + params: null + response: + type: dict + values: + status: + type: boolean + data: + type: dict + values: + id: + type: int + pair: + type: str + last: + type: str + open: + type: str + close: + type: str + high: + type: str + low: + type: str + volume_24H: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: price + path: + - data + - last + type: + - str + - float + - key: daily_volume + path: + - data + - volume_24H + type: + - str + - float + + trades: + request: + template: https://api.exrates.me/v1/public/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: pair + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + volume: + type: float + rate: + type: float + price: + type: float + timestamp: + type: int + type: + type: str + + mapping: + - key: id + path: + - data + - timestamp + type: + - int + - key: time + path: + - data + - timestamp + type: + - float + - from_timestamp + - 0 + - key: direction + path: + - data + - type + type: + - str + - key: price + path: + - data + - rate + type: + - float + - key: amount + path: + - data + - volume + type: + - float + + order_books: + request: + template: https://api.exrates.me/v1/public/book + pair_template: + template: "{first}{second}" + lower_case: false + alias: pair + params: null + + response: + type: dict + values: + data: + type: dict + values: + buy: + type: list + values: + type: dict + values: + volume: + type: float + count: + type: int + rate: + type: float + sell: + type: list + values: + type: dict + values: + volume: + type: float + count: + type: int + rate: + type: float + mapping: + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - data + - buy + - rate + type: + - float + - key: bids_amount + path: + - data + - buy + - volume + type: + - float + - key: asks_price + path: + - data + - sell + - rate + type: + - float + - key: asks_amount + path: + - data + - sell + - volume + type: + - float + + historic_rates: + request: + template: https://socket.exrates.me/graph/hist + pair_template: + template: "{first}{second}" + lower_case: false + alias: t + params: + end: + function: last_timestamp + type: + - datetime + - timestamp + r: + allowed: + minutes: 1 + hours: 60 + days: D + weeks: W + default: D + limit: + type: int + default: 500 + + response: + type: list + values: + type: dict + values: + low: + type: int + high: + type: int + volume: + type: int + time: + type: int + close: + type: int + open: + type: int + mapping: + - key: open + path: + - open + type: + - int + - div + - 100000000 + - key: high + path: + - high + type: + - int + - div + - 100000000 + - key: low + path: + - low + type: + - int + - div + - 100000000 + - key: close + path: + - close + type: + - int + - div + - 100000000 + - key: volume + path: + - volume + type: + - int + - div + - 100000000 + - key: time + path: + - time + type: + - float + - from_timestamp + - 0 diff --git a/pandas_datareader/crypto_utils/resources/ftx.yaml b/pandas_datareader/crypto_utils/resources/ftx.yaml new file mode 100644 index 00000000..dd98c2aa --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/ftx.yaml @@ -0,0 +1,384 @@ +name: ftx +is_exchange: true +api_docs: https://docs.ftx.com/#rest-api +api_url: https://ftx.com/api/ +# +rate_limit: + max: 1800 + unit: 60 + +requests: + currency_pairs: + request: + template: markets + pair_template: null + params: null + + response: + type: dict + values: + success: + type: boolean + result: + type: list + values: + type: dict + values: + name: + type: str + baseCurrency: + type: str + quoteCurrency: + type: str + type: + type: str + underlying: + type: str + enabled: + type: boolean + ask: + type: float + bid: + type: float + last: + type: float + postOnly: + type: boolean + priceIncrement: + type: float + sizeIncrement: + type: float + restricted: + type: boolean + + mapping: + - key: currency_pair_first + path: + - result + - baseCurrency + type: + - str + - key: currency_pair_second + path: + - result + - quoteCurrency + type: + - str + + tickers: + request: + template: markets + pair_template: null + params: null + + response: + type: dict + values: + success: + type: boolean + result: + type: list + values: + type: dict + values: + name: + type: str + baseCurrency: + type: str + quoteCurrency: + type: str + type: + type: str + underlying: + type: str + enabled: + type: boolean + ask: + type: float + bid: + type: float + last: + type: float + postOnly: + type: boolean + priceIncrement: + type: float + sizeIncrement: + type: float + restricted: + type: boolean + + mapping: + - key: currency_pair_first + path: + - result + - baseCurrency + type: + - str + - key: currency_pair_second + path: + - result + - quoteCurrency + type: + - str + - key: time + path: [] + type: + - none + - now + - key: last + path: + - result + - last + type: + - float + - key: best_ask + path: + - result + - ask + type: + - float + - key: best_bid + path: + - result + - bid + type: + - float + + historic_rates: + request: + template: markets/{currency_pair}/candles + pair_template: + template: "{first}_{second}" + alias: null + lower_case: false + params: + resolution: + allowed: + seconds: 15 + minutes: 60 + hours: 3600 + days: 86400 + default: 86400 #daily + limit: + type: int + default: 5000 + end_time: + function: last_timestamp + type: + - datetime + - timestamp + + response: + type: dict + values: + success: + type: boolean + result: + type: list + values: + type: dict + values: + close: + type: float + high: + type: float + low: + type: float + open: + type: float + startTime: + type: str + time: + type: int + volume: + type: float + mapping: + - key: time + path: + - result + - time + type: + - float + - from_timestamp + - 1 + - key: open + path: + - result + - open + type: + - float + - key: high + path: + - result + - high + type: + - float + - key: low + path: + - result + - low + type: + - float + - key: close + path: + - result + - close + type: + - float + - key: volume + path: + - result + - volume + type: + - float + + trades: + request: + template: markets/{currency_pair}/trades + pair_template: + template: "{first}_{second}" + alias: null + lower_case: false + params: + limit: + type: int + default: 100 + + response: + type: dict + values: + success: + type: boolean + result: + type: list + values: + type: dict + values: + id: + type: int + liquidation: + type: boolean + price: + type: float + side: + type: str + size: + type: float + time: + type: str + mapping: + - key: time + path: + - result + - time + type: + - str + - strptime + - "%Y-%m-%dT%H:%M:%S.%f+00:00" + - key: id + path: + - result + - id + type: + - int + - key: direction + path: + - result + - side + type: + - str + - key: price + path: + - result + - price + type: + - float + - key: amount + path: + - result + - size + type: + - float + + order_books: + request: + template: markets/{currency_pair}/orderbook + pair_template: + template: "{first}_{second}" + alias: null + lower_case: false + params: + depth: + type: int + default: 200 + + response: + type: dict + values: + success: + type: bool + result: + type: dict + values: + asks: + type: list + values: + type: list + 0: + type: float + 1: + type: float + bids: + type: list + values: + type: list + 0: + type: float + 1: + type: float + + mapping: + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: time + path: [] + type: + - none + - now + - key: bids_price + path: + - result + - bids + - 0 + type: + - float + - key: bids_amount + path: + - result + - bids + - 1 + type: + - float + - key: asks_price + path: + - result + - asks + - 0 + type: + - float + - key: asks_amount + path: + - result + - asks + - 1 + type: + - float diff --git a/pandas_datareader/crypto_utils/resources/gateio.yaml b/pandas_datareader/crypto_utils/resources/gateio.yaml new file mode 100644 index 00000000..1c6956e2 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/gateio.yaml @@ -0,0 +1,362 @@ +name: gateio +exchange: true +api_url: https://api.gateio.ws/api/v4/spot/ +rate_limit: null + +requests: + currency_pairs: + request: + template: currency_pairs + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + id: + type: str + base: + type: str + quote: + type: str + fee: + type: str + min_base_amount: + type: str + min_quote_amount: + type: str + amount_precision: + type: str + precision: + type: int + trade_status: + type: str + mapping: + - key: currency_pair_first + path: + - base + type: + - str + - key: currency_pair_second + path: + - quote + type: + - str + + tickers: + request: + template: tickers + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + currency_pair: + type: str + last: + type: str + lowest_ask: + type: str + highest_bid: + type: str + change_percentage: + type: str + base_volume: + type: str + quote_volume: + type: str + high_24h: + type: str + low_24h: + type: str + mapping: + - key: currency_pair_first + path: + - currency_pair + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - currency_pair + type: + - str + - split + - "_" + - 1 + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - last + type: + - str + - float + - key: best_bid + path: + - highest_bid + type: + - str + - float + - key: best_ask + path: + - lowest_ask + type: + - str + - float + - key: daily_volume + path: + - quote_volume + type: + - str + - float +# + order_books: + request: + template: order_book + pair_template: + template: "{first}_{second}" + alias: currency_pair + lower_case: true + params: + interval: + type: int + default: "0" + limit: + type: int + default: 30 + + response: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: # price + type: + - str + 1: # size + type: + - str + bids: + type: list + values: + type: list + values: + 0: + type: + - str + 1: + type: + - str + mapping: + - key: time + path: [] + type: + - none + - now + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + + trades: + request: + template: trades + pair_template: + template: "{first}_{second}" + alias: currency_pair + lower_case: true + params: + limit: + type: int + default: 200 + last_id: + type: int + required: false + response: + type: list + values: + type: dict + values: + id: + type: str + create_time: + type: str + side: + type: str + role: + type: str + amount: + type: str + price: + type: str + order_id: + type: str + fee: + type: str + fee_currency: + type: str + point_fee: + type: str + gt_fee: + type: str + + mapping: + - key: time + path: + - create_time + type: + - str + - float + - from_timestamp + - 0 + - key: amount + path: + - amount + type: + - str + - float + - key: direction + path: + - side + type: + - str + - key: price + path: + - price + type: + - str + - float + - key: id + path: + - id + type: + - str + - int + + + historic_rates: + request: + template: candlesticks + pair_template: + template: "{first}_{second}" + alias: currency_pair + lower_case: true + params: + limit: + type: int + default: 1000 + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + default: 1d + to: + function: last_timestamp + type: + - datetime + - timestamp + response: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + 2: + type: str + 3: + type: str + 4: + type: str + 5: + type: str + 6: + type: str + mapping: + - key: time + path: + - 0 + type: + - str + - float + - from_timestamp + - 0 + - key: volume + path: + - 1 + type: + - str + - float + - key: close + path: + - 2 + type: + - str + - float + - key: high + path: + - 3 + type: + - str + - float + - key: low + path: + - 4 + type: + - str + - float + - key: open + path: + - 5 + type: + - str \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/gemini.yaml b/pandas_datareader/crypto_utils/resources/gemini.yaml new file mode 100644 index 00000000..6cecc2f6 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/gemini.yaml @@ -0,0 +1,320 @@ +# The extraction of the currency_pairs relies on the fact, that every quote_currency is only 3 digits long. +# However this may change in future. + +name: gemini +exchange: true +api_docs: https://docs.gemini.com/rest-api/ +api_url: https://api.gemini.com/ +rate_limit: # For public API entry points, we limit requests to 120 requests per minute, and recommend that you do not exceed 1 request per second. + max: 120 # recommended: 60 + unit: 60 + +requests: + currency_pairs: + request: + template: v1/symbols + pair_template: null + params: null + response: + type: list + values: # each available currency pair, i.e. "btcusd" + type: str + mapping: # TODO split Methode + - key: currency_pair_first + path: + - [] + type: + - str + - slice + - 0 + - -3 + - key: currency_pair_second + path: + - [] + type: + - str + - slice + - -3 + - + + tickers: + request: + template: v1/pricefeed + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + pair: + type: str + price: + type: str + percentageChange24h: + type: str + + mapping: + - key: currency_pair_first + path: + - pair + type: + - str + - slice + - 0 + - -3 + - key: currency_pair_second + path: + - pair + type: + - str + - slice + - -3 + - + - key: last_price + path: + - price + type: + - str + - float + - key: time + path: [] + type: + - none + - now + + order_books: + request: + template: v1/book/{currency_pair} + pair_template: # e.g. btcusd + template: "{first}{second}" + lower_case: true + params: + limit_bids: # Optional. Limit the number of bids (offers to buy) returned. Default is 50. May be 0 to return the full order book on this side. + type: int + default: 50 + limit_asks: # Optional. Limit the number of asks (offers to sell) returned. Default is 50. May be 0 to return the full order book on this side. + type: int + default: 50 + response: + type: dict + values: + bids: # The bids currently on the book. These are offers to buy at a given price + type: list + values: + type: dict + values: + amount: # The total quantity remaining at the price + type: + - str + price: # The price + type: + - str + timestamp: # DO NOT USE - this field is included for compatibility reasons only and is just populated with a dummy value. + type: + - str + asks: # The asks currently on the book. These are offers to sell at a given price + type: list + values: + type: dict + values: + amount: # The total quantity remaining at the price + type: + - str + price: # The price + type: + - str + timestamp: # DO NOT USE - this field is included for compatibility reasons only and is just populated with a dummy value. + type: + - str + mapping: + - key: time + path: + - bids + - timestamp + type: + - str + - float + - from_timestamp + - 0 + - key: id + path: + - bids + - timestamp + type: + - str + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - amount + type: + - str + - float + - key: bids_price + path: + - bids + - price + type: + - str + - float + - key: asks_amount + path: + - asks + - amount + type: + - str + - float + - key: asks_price + path: + - asks + - price + type: + - str + - float + + trades: # This public API endpoint is limited to retrieving seven calendar days of data. + request: + template: v1/trades/{currency_pair} + pair_template: # e.g. btcusd + template: "{first}{second}" + lower_case: true + params: + since: # Optional. Only return trades after this timestamp. If not present, will show the most recent trades. + required: false + limit_trades: # Optional. The maximum number of trades to return. The default is 50. + type: int + default: 50 + include_breaks: # Optional. Whether to display broken trades. False by default. Can be '1' or 'true' to activate + type: bool + required: false + response: + type: list + values: + type: dict + values: + timestamp: # The time that the trade was executed + type: + - int + timestampms: # The time that the trade was executed in milliseconds + type: + - int + tid: # The trade ID number + type: + - int + price: # The price the trade was executed at + type: + - str + amount: # The amount that was traded + type: + - str + exchange: # Will always be "gemini" + type: str + type: + type: str + allowed: + - buy # buy means that an ask was removed from the book by an incoming buy order + - sell # sell means that a bid was removed from the book by an incoming sell order + - auction # auction indicates a bulk trade from an auction + - block # block indicates a block trade + broken: + type: bool # Whether the trade was broken or not. Broken trades will not be displayed by default; use the include_breaks to display them. + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - tid + type: + - int + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - amount + type: + - str + - float + - key: direction + path: + - type + type: + - str + + historic_rates: + request: + template: v2/candles/{currency_pair}/{frequency} + pair_template: + template: "{first}{second}" + lower_case: true + params: + frequency: + allowed: + minutes: 1m + hours: 1hr + days: 1day + default: 1day + response: + type: list + values: + type: list + values: + 0: # timestamp + type: int + 1: # open + type: float + 2: # high + type: float + 3: # low + type: float + 4: # close + type: float + 5: # volume + type: float + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - 1 + type: + - float + - key: high + path: + - 2 + type: + - float + - key: low + path: + - 3 + type: + - float + - key: close + path: + - 4 + type: + - float + - key: volume + path: + - 5 + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/gopax.yaml b/pandas_datareader/crypto_utils/resources/gopax.yaml new file mode 100644 index 00000000..fa835fff --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/gopax.yaml @@ -0,0 +1,301 @@ +name: gopax +exchange: true + +rate_limit: + max: 1200 + unit: 60 + +api_url: https://api.gopax.co.kr + +requests: + currency_pairs: + request: + template: /trading-pairs + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + + mapping: + - key: currency_pair_first + path: + - baseAsset + type: + - str + - key: currency_pair_second + path: + - quoteAsset + type: + - str + + tickers: + request: + template: /trading-pairs/{currency_pair}/ticker + pair_template: + template: "{first}-{second}" + lower_case: false + params: null + response: + type: dict + values: + price: + type: float + ask: + type: float + bid: + type: float + volume: + type: float + time: + type: str + + mapping: + - key: last_price + path: + - price + type: + - float + - key: time + path: + - time + type: + - str + - dateparser + - key: best_bid + path: + - bid + type: + - float + - key: best_ask + path: + - ask + type: + - float + - key: daily_volume + path: + - volume + type: + - float + + historic_rates: + request: + template: /trading-pairs/{currency_pair}/candles + pair_template: + template: "{first}-{second}" + lower_case: false + params: + interval: + allowed: + minutes: 1 + hours: 60 + days: 1440 + default: 1440 # e.g. 1 day + start: + default: 1 # better as intervals up to 5000 can lead to zero new prices and the program exits. +# function: last_timestamp +# type: +# - datetime +# - timedeltams +# - interval +# - 5000 + end: + function: last_timestamp + type: + - datetime + - timestampms + + response: + type: list + values: + type: list + values: + 0: #time + type: int + 1: #open + type: float + 2: #high + type: float + 3: #low + type: float + 4: #close + type: float + 5: #volume + type: float + + mapping: + - key: time + path: + - [] + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - [] + - 1 + type: + - float + - key: high + path: + - [] + - 2 + type: + - float + - key: low + path: + - [] + - 3 + type: + - float + - key: close + path: + - [] + - 4 + type: + - float + - key: volume + path: + - [] + - 5 + type: + - float + + + trades: + request: + template: /trading-pairs/{currency_pair}/trades + pair_template: + template: "{first}-{second}" + lower_case: false + params: null + + response: + type: list + values: + type: dict + values: + date: + type: int + id: + type: int + price: + type: float + amount: + type: float + side: + type: str + + mapping: + - key: time + path: + - date + type: + - float + - from_timestamp + - 0 + - key: id + path: + - id + type: + - int + - key: direction + path: + - side + type: + - str + - key: price + path: + - price + type: + - float + - key: amount + path: + - amount + type: + - float + + order_books: + request: + template: /trading-pairs/{currency_pair}/book + pair_template: + template: "{first}-{second}" + lower_case: false + params: + level: + type: int + default: 2 + + response: + type: dict + values: + sequence: + type: int + bid: + type: list + values: + type: list + values: + 1: #price + type: float + 2: #quantity + type: float + ask: + type: list + values: + type: list + values: + 1: #price + type: float + 2: #quantity + type: float + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: + - sequence + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bid + - 2 + type: + - float + - key: bids_price + path: + - bid + - 1 + type: + - float + - key: asks_amount + path: + - ask + - 2 + type: + - float + - key: asks_price + path: + - ask + - 1 + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/hbtc.yaml b/pandas_datareader/crypto_utils/resources/hbtc.yaml new file mode 100644 index 00000000..88ba65b5 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/hbtc.yaml @@ -0,0 +1,305 @@ +name: hbtc +is_exchange: true + +rate_limit: null +api_url: https://api.bhex.com/ + +requests: + currency_pairs: + request: + template: openapi/v1/pairs + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + symbol: + type: str + quoteToke: + type: str + baseToken: + type: str + mapping: + - key: currency_pair_first + path: + - baseToken + type: + - str + - key: currency_pair_second + path: + - quoteToken + type: + - str + + tickers: + request: + template: openapi/quote/v1/ticker/price + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: null + response: + type: dict + values: + price: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - price + type: + - str + - float + + + order_books: + request: + template: openapi/quote/v1/depth/merged + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + default: 40 + response: + type: dict + values: + time: + type: int + bids: + type: list + values: + type: list + values: + 0: #price + type: str + 1: #quantity + type: str + asks: + type: list + values: + type: list + values: + 0: #price + type: str + 1: #quantity + type: str + + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - time + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + + trades: + request: + template: openapi/quote/v1/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 1000 + default: 500 + response: + type: list + values: + type: dict + values: + price: + type: str + time: + type: int + qty: + type: str + isBuyerMaker: + type: bool + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - time + type: + - int + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - true + - sell + - false + - buy + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + + historic_rates: + request: + template: openapi/quote/v1/klines + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + startTime: + type: int + required: false + endTime: + function: last_timestamp + type: + - datetime + - timestampms + limit: + type: int + max: 1000 + default: 1000 + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + months: 1M + default: 1d + response: + type: list + values: + type: list + values: + 0: #open time + type: int + 1: # open + type: str + 2: #high + type: str + 3: #low + type: str + 4: #close + type: str + 5: #volume + type: str + 6: # close time + type: str + 7: # quote asset volume + type: str + 8: # numb. trades + type: str + 9: # taker buy base asset volume + type: str + 10: # taker buy quote asset volume + type: str + 11: + type: str + + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float + + + diff --git a/pandas_datareader/crypto_utils/resources/hitbtc.yaml b/pandas_datareader/crypto_utils/resources/hitbtc.yaml new file mode 100644 index 00000000..a6905592 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/hitbtc.yaml @@ -0,0 +1,393 @@ +name: hitbtc +exchange: true +api_docs: https://api.hitbtc.com/#market-data +api_url: https://api.hitbtc.com/api/2/ +rate_limit: + max: 100 + unit: 1 +requests: + currency_pairs: + request: + template: public/symbol/ + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + id: # Symbol identifier. In the future, the description will simply use the symbol, i.e. "ETHBTC" + type: str + baseCurrency: # i.e. "ETH" + type: str + quoteCurrency: # i.e. "BTC" + type: str + quantityIncrement: + type: + - str + - float + tickSize: + type: + - str + - float + takeLiquidityRate: # Default fee rate + type: + - str + - float + provideLiquidityRate: # Default fee rate for market making trades + type: + - str + - float + feeCurrency: # i.e. "BTC" + type: str + mapping: + - key: currency_pair_first + path: + - baseCurrency + type: + - str + - key: currency_pair_second + path: + - quoteCurrency + type: + - str + + tickers: + request: + template: public/ticker/{currency_pair} + pair_template: # i.e. ETHBTC + template: "{first}{second}" + lower_case: false + params: null + response: + type: list + values: + type: dict + values: + ask: # Best ask price + type: + - str + - float + bid: # Best bid price + type: + - str + - float + last: # Last trade price + type: + - str + - float + open: # Last trade price 24 hours ago + type: + - str + - float + low: # Lowest trade price within 24 hours + type: + - str + - float + high: # Highest trade price within 24 hours + type: + - str + - float + volume: # Total trading amount within 24 hours in base currency + type: + - str + - float + volumeQuote: # Total trading amount within 24 hours in quote currency + type: + - str + - float + timestamp: # Last update or refresh ticker timestamp + type: + - str + symbol: + type: str + mapping: + - key: best_ask + path: + - ask + type: + - str + - float + - key: best_bid + path: + - bid + type: + - str + - float + - key: last_price + path: + - last + type: + - str + - float + - key: daily_volume + path: + - volume + type: + - str + - float + - key: time + path: + - timestamp + type: + - str + - dateparser + + trades: + request: + template: public/trades/{currency_pair} + pair_template: # i.e. ETHBTC + template: "{first}{second}" + lower_case: false + params: + sort: + type: str + default: DESC + by: # Filtration definition. Accepted values: id, timestamp. Default timestamp + type: str + default: timestamp + required: false + from: # Number or Datetime + required: false + till: # Number or Datetime + required: false + limit: + type: int + required: false + offset: + type: int + required: false + response: + type: list + values: + type: dict + values: + id: + type: int + price: + type: + - str + - float + quantity: + type: + - str + - float + side: # Trade side "sell" or "buy" + type: str + timestamp: + type: + - str + mapping: + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - quantity + type: + - str + - float + - key: direction + path: + - side + type: + - str + - key: ime + path: + - timestamp + type: + - str + - dateparser + - key: id + path: + - id + type: + - int + + order_books: + request: + template: public/orderbook/{currency_pair} + pair_template: # i.e. ETHBTC + template: "{first}{second}" + lower_case: false + params: + limit: # Limit of orderbook levels. Set 0 to view full orderbook levels + type: int + default: 100 + response: + type: dict + values: + ask: + type: list + values: + type: dict + values: + price: # Price level + type: + - str + size: # Total volume of orders with the specified price + type: + - str + bid: + type: list + values: + type: dict + values: + price: # Price level + type: + - str + size: # Total volume of orders with the specified price + type: + - str + mapping: + - key: book_time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: asks_price + path: + - ask + - price + type: + - str + - float + - key: asks_amount + path: + - ask + - size + type: + - str + - float + - key: bids_price + path: + - bid + - price + type: + - str + - float + - key: bids_amount + path: + - bid + - size + type: + - str + - float + + historic_rates: + request: + template: public/candles/{currency_pair} + pair_template: # i.e. ETHBTC + template: "{first}{second}" + lower_case: false + params: + period: + type: str + allowed: + minutes: M1 +# hours: H1 + days: D1 + weeks: D7 + months: 1M + default: D1 + sort: + type: str + default: ASC + from: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1000 + - from_timestamp + - 0 + - "%Y-%m-%dT%H:%M:%S.%fZ" + till: + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S.%fZ" + limit: # Limit of candles, default 100. + type: int + default: 1000 + offset: + type: int + required: false + response: # Result contain candles only with non zero volume. (No trades - no candles) + type: list + values: + type: dict + values: + timestamp: + type: + - str + open: # Open price + type: + - str + close: # Close price + type: + - str + min: # Min price + type: + - str + max: # Max price + type: + - str + volume: # Volume in base currency + type: + - str + volumeQuote: # Volume in quote currency + type: + - str + mapping: + - key: time + path: + - timestamp + type: + - str + - dateparser + - key: open + path: + - open + type: + - str + - float + - key: close + path: + - close + type: + - str + - float + - key: low + path: + - min + type: + - str + - float + - key: high + path: + - max + type: + - str + - float + - key: volume + path: + - volume + type: + - str + - float diff --git a/pandas_datareader/crypto_utils/resources/hoo.yaml b/pandas_datareader/crypto_utils/resources/hoo.yaml new file mode 100644 index 00000000..d9723730 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/hoo.yaml @@ -0,0 +1,341 @@ +name: hoo +exchange: true +api_docs: https://hoo.com/docs-en +rate_limit: + max: 300 + unit: 60 + +api_url: https://api.hoolgd.com/open/v1/ + +requests: + currency_pairs: + request: + template: tickers/market + pair_template: null + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + price: + type: str + symbol: + type: str + volume: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - symbol + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - data + - symbol + type: + - str + - split + - "-" + - 1 + + tickers: + request: + template: tickers/market + pair_template: null + params: null + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + price: + type: str + symbol: + type: str + volume: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - symbol + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - data + - symbol + type: + - str + - split + - "-" + - 1 + - key: time + path: [] + type: + - none + - now + - key: daily_volume + path: + - data + - volume + type: + - str + - float + - key: last_price + path: + - data + - price + type: + - str + - float + + historic_rates: + request: + template: kline/market + pair_template: + template: "{first}-{second}" + lower_case: false + alias: symbol + params: + type: + allowed: + minutes: 1Min + hours: 1Hour + days: 1Day + weeks: 1Week + default: 1Day + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + open: + type: str + high: + type: str + low: + type: str + close: + type: str + time: + type: int + volume: + type: str + mapping: + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 0 + - key: open + path: + - data + - open + type: + - str + - float + - key: high + path: + - data + - high + type: + - str + - float + - key: low + path: + - data + - low + type: + - str + - float + - key: close + path: + - data + - close + type: + - str + - float + - key: volume + path: + - data + - volume + type: + - str + - float + + trades: + request: + template: trade/market + pair_template: + template: "{first}-{second}" + lower_case: false + alias: symbol + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + amount: + type: str + price: + type: str + time: + type: int + side: + type: str + volume: + type: str + + mapping: + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - data + - time + type: + - int + - key: direction + path: + - data + - side + type: + - value + - map + - -1 + - buy + - 1 + - sell + - key: price + path: + - data + - price + type: + - str + - float + - key: amount + path: + - data + - volume + type: + - str + - float + + order_books: + request: + template: depth/market + pair_template: + template: "{first}-{second}" + lower_case: false + alias: symbol + params: null + + response: + type: dict + values: + data: + type: dict + values: + bids: + type: list + values: + type: dict + values: + price: + type: str + quantity: + type: str + asks: + type: list + values: + type: dict + values: + price: + type: str + quantity: + type: str + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - data + - bids + - quantity + type: + - str + - float + - key: bids_price + path: + - data + - bids + - price + type: + - str + - float + - key: asks_amount + path: + - data + - asks + - quantity + type: + - str + - float + - key: asks_price + path: + - data + - asks + - price + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/huobi.yaml b/pandas_datareader/crypto_utils/resources/huobi.yaml new file mode 100644 index 00000000..274acc47 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/huobi.yaml @@ -0,0 +1,423 @@ +name: huobi +exchange: true +api_docs: https://huobiapi.github.io/docs/spot/v1/en/ +api_url: https://api.huobi.pro/ +rate_limit: + max: 100 + unit: 10 +requests: + currency_pairs: + request: + template: v1/common/symbols + pair_template: null + params: null + response: + type: dict + values: + status: + type: str + data: + type: list + values: + type: dict + values: + base-currency: + type: str + quote-currency: + type: str + price-precision: + type: int + amoint_precision: + type: int + symbol-partition: + type: str + symbol: + type: str + state: + type: str + value-precision: + type: int + min-order-amt: + type: float + max-oder-amt: + type: float + min-order-value: + type: float + laverage-ratio: + type: int + mapping: + - key: currency_pair_first + path: + - data + - base-currency + type: + - str + - upper + - key: currency_pair_second + path: + - data + - quote-currency + type: + - str + - upper + + historic_rates: + request: + template: market/history/kline + pair_template: # i.e. BTC_CQ + template: "{first}{second}" + lower_case: true + alias: symbol + params: + period: + type: str + allowed: + minutes: 1min + hours: 60min + days: 1day + weeks: 1week + months: 1mon + default: 1day + size: + type: int + min: 1 + max: 2000 + default: 2000 + response: + type: dict + values: + status: + type: str + allowed: + - ok + - error + ch: # channel format, i.e. "market.btcusdt.kline.1day" + type: str + ts: # timestamp in millisecond + type: + - int + data: + type: list + values: + type: dict + values: + id: + type: int + amount: + type: float + count: + type: int + open: + type: float + close: + type: float + low: + type: float + high: + type: float + vol: + type: float + mapping: + - key: time + path: + - data + - id + type: + - float + - from_timestamp + - 0 + - key: open + path: + - data + - open + type: + - float + - key: close + path: + - data + - close + type: + - float + - key: low + path: + - data + - low + type: + - float + - key: high + path: + - data + - high + type: + - float + - key: volume + path: + - data + - vol + type: + - float + + tickers: + request: + template: market/detail/merged + pair_template: # i.e. BTC_CQ + template: "{first}{second}" + lower_case: true + alias: symbol + params: null + response: + type: dict + values: + status: + type: str + ch: # channel format, i.e. "market.btcusdt.kline.1day" + type: str + ts: # timestamp in millisecond + type: + - int + tick: + type: dict + values: + amount: + type: float + open: # daily Kline, opening price + type: float + close: # daily Kline, closing price + type: float + high: # daily Kline,the maxmum price + type: float + id: + type: int + count: + type: int + low: # daily Kline, the minimum price + type: float + version: + type: int + ask: + type: list + values: + 0: + type: float + 1: + type: float + bid: + type: list + values: + 0: # price + type: float + 1: # size + type: float + vol: + type: float + mapping: + - key: time + path: + - ts + type: + - float + - from_timestamp + - 1 + - key: daily_volume + path: + - tick + - vol + type: + - float + - key: best_ask + path: + - tick + - ask + - 0 + type: + - float + - key: best_bid + path: + - tick + - bid + - 0 + type: + - float + + order_books: + request: + template: market/depth + pair_template: # i.e. BTC_CQ + template: "{first}{second}" + lower_case: true + alias: symbol + params: + type: + type: str + default: step0 #aggregation level (step5 -->max. aggregation) + response: + type: dict + values: + status: + type: str + ch: + type: str + ts: # timestamp in millisecond + type: + - int + tick: # Depth + type: dict + values: + id: + type: int + ts: + type: + - int + bids: + type: list + values: + type: list + values: + 0: # price + type: int + 1: # amount + type: float + asks: + type: list + values: + type: list + values: + 0: # price + type: int + 1: # amount + type: float + mapping: + - key: time + path: + - tick + - ts + type: + - float + - from_timestamp + - 1 + - key: bids_price + path: + - tick + - bids + - 0 + type: + - int + - key: bids_amount + path: + - tick + - bids + - 1 + type: + - float + - key: asks_price + path: + - tick + - asks + - 0 + type: + - int + - key: asks_amount + path: + - tick + - asks + - 1 + type: + - float + - key: id + path: + - tick + - version + type: + - int + - key: position + path: [] + type: + - none + - range + +# Probleme mit der resoponse. Die können wir nicht mappen, da manchmal zu einem Zeitpunkt mehrere Trades zurückkommen. +# trades: +# request: +# template: market/history/trade +# pair_template: # i.e. BTC_CQ +# template: "{first}{second}" +# alias: symbol +# lower_case: true +# params: +# size: +# type: int +# default: 5 +# response: +# type: dict +# values: +# status: +# type: str +# ch: +# type: str +# ts: +# type: int +# data: +# type: list +# values: +# type: dict +# values: +# id: +# type: int +# ts: # timestamp +# type: int +# data: +# type: list +# values: +# type: dict +# values: +# id: +# type: int +# ts: +# type: int +# trade-id: +# type: int +# amount: +# type: float +# price: +# type: +# - int +# direction: +# type: str +# +# mapping: +# - key: price +# path: +# - data +# - data +# - price +# type: +# - float +# - key: amount +# path: +# - data +# - data +# - amount +# type: +# - float +# - key: direction +# path: +# - data +# - data +# - direction +# type: +# - str +# - key: time +# path: +# - data +# - data +# - ts +# type: +# - int +# - Afrom_timestamp +# - key: id +# path: +# - data +# - data +# - trade-id +# type: +# - int \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/huobi_korea.yaml b/pandas_datareader/crypto_utils/resources/huobi_korea.yaml new file mode 100644 index 00000000..48c89493 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/huobi_korea.yaml @@ -0,0 +1,424 @@ +name: huobi_korea +exchange: true +api_url: https://api-cloud.huobi.co.kr/ +rate_limit: + max: 100 + unit: 10 +requests: + currency_pairs: + request: + template: v1/common/symbols + pair_template: null + params: null + response: + type: dict + values: + status: + type: str + data: + type: list + values: + type: dict + values: + base-currency: + type: str + quote-currency: + type: str + price-precision: + type: int + amoint_precision: + type: int + symbol-partition: + type: str + symbol: + type: str + state: + type: str + value-precision: + type: int + min-order-amt: + type: float + max-oder-amt: + type: float + min-order-value: + type: float + laverage-ratio: + type: int + mapping: + - key: currency_pair_first + path: + - data + - base-currency + type: + - str + - upper + - key: currency_pair_second + path: + - data + - quote-currency + type: + - str + - upper + + + + historic_rates: + request: + template: market/history/kline + pair_template: # i.e. BTC_CQ + template: "{first}{second}" + lower_case: true + alias: symbol + params: + period: + type: str + allowed: + minutes: 1min + hours: 60min + days: 1day + weeks: 1week + months: 1mon + default: 1day + size: + type: int + min: 1 + max: 2000 + default: 2000 + response: + type: dict + values: + status: + type: str + allowed: + - ok + - error + ch: # channel format, i.e. "market.btcusdt.kline.1day" + type: str + ts: # timestamp in millisecond + type: + - int + data: + type: list + values: + type: dict + values: + id: + type: int + amount: + type: float + count: + type: int + open: + type: float + close: + type: float + low: + type: float + high: + type: float + vol: + type: float + mapping: + - key: time + path: + - data + - id + type: + - float + - from_timestamp + - 0 + - key: open + path: + - data + - open + type: + - float + - key: close + path: + - data + - close + type: + - float + - key: low + path: + - data + - low + type: + - float + - key: high + path: + - data + - high + type: + - float + - key: volume + path: + - data + - vol + type: + - float + + tickers: + request: + template: market/detail/merged + pair_template: # i.e. BTC_CQ + template: "{first}{second}" + lower_case: true + alias: symbol + params: null + response: + type: dict + values: + status: + type: str + ch: # channel format, i.e. "market.btcusdt.kline.1day" + type: str + ts: # timestamp in millisecond + type: + - int + tick: + type: dict + values: + amount: + type: float + open: # daily Kline, opening price + type: float + close: # daily Kline, closing price + type: float + high: # daily Kline,the maxmum price + type: float + id: + type: int + count: + type: int + low: # daily Kline, the minimum price + type: float + version: + type: int + ask: + type: list + values: + 0: + type: float + 1: + type: float + bid: + type: list + values: + 0: # price + type: float + 1: # size + type: float + vol: + type: float + mapping: + - key: time + path: + - ts + type: + - float + - from_timestamp + - 1 + - key: daily_volume + path: + - tick + - vol + type: + - float + - key: best_ask + path: + - tick + - ask + - 0 + type: + - float + - key: best_bid + path: + - tick + - bid + - 0 + type: + - float + + order_books: + request: + template: market/depth + pair_template: # i.e. BTC_CQ + template: "{first}{second}" + lower_case: true + alias: symbol + params: + type: + type: str + default: step0 #aggregation level (step5 -->max. aggregation) + response: + type: dict + values: + status: + type: str + ch: + type: str + ts: # timestamp in millisecond + type: + - int + tick: # Depth + type: dict + values: + id: + type: int + ts: + type: + - int + bids: + type: list + values: + type: list + values: + 0: # price + type: int + 1: # amount + type: float + asks: + type: list + values: + type: list + values: + 0: # price + type: int + 1: # amount + type: float + mapping: + - key: time + path: + - tick + - ts + type: + - float + - from_timestamp + - 1 + - key: bids_price + path: + - tick + - bids + - 0 + type: + - int + - key: bids_amount + path: + - tick + - bids + - 1 + type: + - float + - key: asks_price + path: + - tick + - asks + - 0 + type: + - int + - key: asks_amount + path: + - tick + - asks + - 1 + type: + - float + - key: id + path: + - tick + - version + type: + - int + - key: position + path: [] + type: + - none + - range + +# Probleme mit der resoponse. Die können wir nicht mappen, da manchmal zu einem Zeitpunkt mehrere Trades zurückkommen. +# trades: +# request: +# template: market/history/trade +# pair_template: # i.e. BTC_CQ +# template: "{first}{second}" +# alias: symbol +# lower_case: true +# params: +# size: +# type: int +# default: 5 +# response: +# type: dict +# values: +# status: +# type: str +# ch: +# type: str +# ts: +# type: int +# data: +# type: list +# values: +# type: dict +# values: +# id: +# type: int +# ts: # timestamp +# type: int +# data: +# type: list +# values: +# type: dict +# values: +# id: +# type: int +# ts: +# type: int +# trade-id: +# type: int +# amount: +# type: float +# price: +# type: +# - int +# direction: +# type: str +# +# mapping: +# - key: price +# path: +# - data +# - data +# - price +# type: +# - float +# - key: amount +# path: +# - data +# - data +# - amount +# type: +# - float +# - key: direction +# path: +# - data +# - data +# - direction +# type: +# - str +# - key: time +# path: +# - data +# - data +# - ts +# type: +# - int +# - Afrom_timestamp +# - key: id +# path: +# - data +# - data +# - trade-id +# type: +# - int \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/idex.yaml b/pandas_datareader/crypto_utils/resources/idex.yaml new file mode 100644 index 00000000..741a0e3a --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/idex.yaml @@ -0,0 +1,336 @@ +name: idex +exchange: true +api_docs: https://docs.idex.io/#introduction +api_url: https://api.idex.io/ +rate_limit: + max: 300 + unit: 60 +requests: + currency_pairs: + request: + template: v1/markets + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + mapping: + - key: currency_pair_first + path: + - baseAsset + type: + - str + - key: currency_pair_second + path: + - quoteAsset + type: + - str + + + tickers: + request: + template: v1/tickers + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + baseVolume: + type: str + quoteVolume: + type: str + ask: + type: str + bid: + type: str + time: + type: int + + mapping: + - key: currency_pair_first + path: + - market + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - market + type: + - str + - split + - "-" + - 1 + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: best_ask + path: + - bid + type: + - str + - float + - key: best_bid + path: + - bid + type: + - str + - float + + order_books: + request: + template: v1/orderbook + pair_template: # e.g. ETH_SAN + template: "{first}-{second}" + lower_case: false + alias: market + params: + level: + type: int + default: 2 + limit: + type: int + default: 50 + + response: + type: dict + values: + sequence: + type: int + asks: + type: list + values: + type: list + values: + 0: #price + type: + - str + 1: #quantity + type: + - str + bids: + type: list + values: + type: list + values: + 0: #price + type: + - str + 1: #quantity + type: + - str + mapping: + - key: position + path: [] + type: + - none + - range + - key: id + path: + - sequence + type: + - int + - key: time + path: [] + type: + - none + - now + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + + trades: + request: + template: v1/trades + pair_template: # e.g. ETH_SAN + template: "{first}-{second}" + lower_case: false + alias: market + params: + limit: + type: int + max: 1000 + default: 200 + response: + type: list + values: + type: dict + values: + fillId: + type: str + quantity: + type: str + price: + type: str + time: + type: int + makerSide: + type: str + sequence: + type: int + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - sequence + type: + - int + - key: amount + path: + - quantity + type: + - str + - float + - key: direction + path: + - makerSide + type: + - value + - map + - sell + - buy + - buy + - sell + - key: price + path: + - price + type: + - str + - float + + historic_rates: + request: + template: v1/candles + pair_template: # e.g. ETH_SAN + template: "{first}-{second}" + lower_case: false + alias: market + params: + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + default: 1d + limit: + max: 1000 + default: 1000 + end: + function: last_timestamp + type: + - datetime + - timestampms +# start: +# function: last_timestamp +# type: +# - datetime +# - timedeltams +# - interval +# - 1000 + + response: + type: list + values: + type: dict + values: + market: + type: str + start: + type: int + open: + type: str + high: + type: str + low: + type: str + close: + type: str + volume: + type: str + mapping: + - key: time + path: + - start + type: + - float + - from_timestamp + - 1 + - key: open + path: + - open + type: + - str + - float + - key: high + path: + - high + type: + - str + - float + - key: low + path: + - low + type: + - str + - float + - key: close + path: + - close + type: + - str + - float + - key: volume + path: + - volume + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/kucoin.yaml b/pandas_datareader/crypto_utils/resources/kucoin.yaml new file mode 100644 index 00000000..2a51a4bd --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/kucoin.yaml @@ -0,0 +1,432 @@ +name: kucoin +exchange: true +api_url: https://api.kucoin.com/api/v1/ +rate_limit: + max: 30 + unit: 60 +requests: + currency_pairs: + request: + template: symbols + pair_template: null + params: null + response: + type: dict + values: + code: + type: + - str + - int + data: + type: list + values: + symbol: + type: str + name: + type: str + baseCurrency: + type: str + quoteCurrency: + type: str + baseMinSize: + type: float + quoteMinSize: + type: int + baseMaxSize: + type: int + quoteMaxSize: + type: float + baseIncrement: + type: float + quoteIncrement: + type: float + priceIncrement: + type: float + feeCurrency: + type: str + enableTrading: + type: bool + mapping: + - key: currency_pair_first + path: + - data + - symbol + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - data + - symbol + type: + - str + - split + - "-" + - 1 + + tickers: + request: + template: market/allTickers + pair_template: null + params: null + response: + type: dict + values: + code: + type: int + data: + type: dict + values: + ticker: + type: list + values: + type: dict + values: + symbol: # e.g. KCS + type: str + high: + type: float + vol: + type: float + last: + type: float + low: + type: float + buy: + type: float + sell: + type: float + changePrice: + type: float + averagePrice: + type: float + changeRate: + type: float + volValue: + type: float + time: + type: int + mapping: + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 1 + - key: currency_pair_first + path: + - data + - ticker + - symbol + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - data + - ticker + - symbol + type: + - str + - split + - "-" + - 1 + - key: last_price + path: + - data + - ticker + - last + type: + - float + - key: best_bid + path: + - data + - ticker + - buy + type: + - float + - key: best_ask + path: + - data + - ticker + - sell + type: + - float + - key: daily_volume + path: + - data + - ticker + - volValue + type: + - float + + historic_rates: + request: + template: market/candles + pair_template: # e.g. KCS-BTC + template: "{first}-{second}" + lower_case: false + alias: symbol + params: + startAt: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1000 + endAt: + function: last_timestamp + type: + - datetime + - timestamp + type: + allowed: + minutes: 1min + hours: 1hour + days: 1day + weeks: 1week + default: 1day + + response: + type: dict + values: + code: + type: str + data: + type: list + values: + type: list + values: + 0: # timestamp + type: + - str + 1: # open + type: + - str + 2: # close + type: + - str + 3: # high + type: + - str + 4: # low + type: + - str + 5: # volume + type: + - str + 6: # amount + type: + - str + mapping: + - key: time + path: + - data + - 0 + type: + - str + - float + - from_timestamp + - 0 + - key: open + path: + - data + - 1 + type: + - str + - float + - key: close + path: + - data + - 2 + type: + - str + - float + - key: high + path: + - data + - 3 + type: + - str + - float + - key: low + path: + - data + - 4 + type: + - str + - float + - key: volume + path: + - data + - 5 + type: + - str + - float + + + order_books: + request: + template: market/orderbook/level2_20 + pair_template: # e.g. KCS-BTC + template: "{first}-{second}" + lower_case: false + alias: symbol + params: null + response: + type: dict + values: + code: + type: str + data: + type: dict + values: + time: + type: int + sequence: + type: str + bids: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + asks: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + mapping: + - key: asks_price + path: + - data + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - data + - asks + - 1 + type: + - str + - float + - key: bids_price + path: + - data + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - data + - bids + - 1 + type: + - str + - float + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - data + - sequence + type: + - str + - int + - key: position + path: [] + type: + - none + - range + + trades: + request: + template: market/histories + pair_template: + template: "{first}-{second}" + alias: symbol + lower_case: false + params: null + + response: + type: dict + values: + code: + type: str + data: + type: list + values: + type: dict + values: + sequence: + type: str + price: + type: str + size: + type: str + side: + type: str + time: + type: int + mapping: + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 3 + - key: price + path: + - data + - price + type: + - str + - float + - key: amount + path: + - data + - size + type: + - str + - float + - key: direction + path: + - data + - side + type: + - str + - key: id + path: + - data + - sequence + type: + - str + - int + diff --git a/pandas_datareader/crypto_utils/resources/lbank.yaml b/pandas_datareader/crypto_utils/resources/lbank.yaml new file mode 100644 index 00000000..6b109afd --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/lbank.yaml @@ -0,0 +1,333 @@ +name: lbank +exchange: true +api_docs: https://github.com/LBank-exchange/lbank-official-api-docs/tree/master/API-For-Spot-EN +api_url: https://api.lbkex.com/v1/ +rate_limit: null + +requests: + tickers: + request: + template: ticker.do + pair_template: null + params: + symbol: + type: str + default: all + response: + type: list + values: + type: dict + values: + symbol: + type: str + ticker: + type: dict + values: + change: + type: float + high: + type: float + latest: + type: float + low: + type: float + turnover: + type: float + vol: + type: float + timestamp: + type: + - int + mapping: + - key: time + path: [] + type: + - none + - now + - key: currency_pair_first + path: + - symbol + type: + - str + - splitupper + - "_" + - 0 + - key: currency_pair_second + path: + - symbol + type: + - str + - splitupper + - "_" + - 1 + - key: last_price + path: + - ticker + - latest + type: + - float + - key: last_price + path: + - ticker + - latest + type: + - float + - key: daily_volume + path: + - ticker + - vol + type: + - float + + currency_pairs: + request: + template: currencyPairs.do + pair_template: null + params: null + response: + type: list + values: # each available currency pair e.g. "bcc_eth","etc_btc"... + type: str + mapping: + - key: currency_pair_first + path: + - [] + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - [] + type: + - str + - split + - "_" + - 1 + + order_books: + request: + template: depth.do + pair_template: # e.g. eth_btc + template: "{first}_{second}" + lower_case: true + alias: symbol + params: + size: + type: int + min: 1 + max: 60 + default: 60 + merge: + type: int + default: "0" + response: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: # price + type: float + 1: # size + type: float + bids: + type: list + values: + type: list + values: + 0: # price + type: float + 1: # size + type: float + mapping: + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: time + path: [] + type: + - none + - now + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + + trades: + request: + template: trades.do + pair_template: # e.g. eth_btc + template: "{first}_{second}" + lower_case: true + alias: symbol + params: + size: + type: int + min: 1 + max: 600 + default: 200 + time: + required: false + response: + type: list + values: + type: dict + values: + date_ms: + type: + - float + - from_timestamp + - 0 + amount: + type: float + price: + type: float + type: + type: str + tid: + type: str + mapping: + - key: id + path: + - tid + type: + - str + - key: time + path: + - date_ms + type: + - float + - from_timestamp + - 1 + - key: amount + path: + - amount + type: + - float + - key: price + path: + - price + type: + - float + - key: direction + path: + - type + type: + - str + + historic_rates: + request: + template: kline.do + pair_template: # e.g. eth_btc + template: "{first}_{second}" + lower_case: true + alias: symbol + params: + size: + type: int + min: 1 + max: 2880 + default: 2000 + type: + allowed: + minutes: minute1 + hours: hour1 + days: day1 + weeks: week1 + months: month1 + default: day1 + time: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 2000 +# type: int +# default: 1325432318 #01.01.2012 + response: + type: list + values: + type: list + values: + 0: # timestamp + type: + - int + 1: # open + type: float + 2: # high + type: float + 3: # low + type: float + 4: # close + type: float + 5: # volume + type: float + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 0 + - key: open + path: + - 1 + type: + - float + - key: high + path: + - 2 + type: + - float + - key: low + path: + - 3 + type: + - float + - key: close + path: + - 4 + type: + - float + - key: volume + path: + - 5 + type: + - float diff --git a/pandas_datareader/crypto_utils/resources/maicoin.yaml b/pandas_datareader/crypto_utils/resources/maicoin.yaml new file mode 100644 index 00000000..346d5b98 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/maicoin.yaml @@ -0,0 +1,314 @@ +name: maicoin +exchange: true +api_docs: https://max.maicoin.com/documents/api_list#!/public/getApiV2K +rate_limit: + max: 1200 + unit: 60 + +api_url: https://max-api.maicoin.com/api/v2/ + +requests: + currency_pairs: + request: + template: markets + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + base_unit: + type: str + quote_unit: + type: str + + mapping: + - key: currency_pair_first + path: + - base_unit + type: + - str + - key: currency_pair_second + path: + - quote_unit + type: + - str + + tickers: + request: + template: tickers/{currency_pair} + pair_template: + template: "{first}{second}" + lower_case: true + params: null + response: + type: dict + values: + at: + type: int + buy: + type: str + sell: + type: str + last: + type: str + vol: + type: str + + + mapping: + - key: last_price + path: + - last + type: + - str + - float + - key: time + path: + - at + type: + - float + - from_timestamp + - 0 + - key: best_bid + path: + - buy + type: + - str + - float + - key: best_ask + path: + - sell + type: + - str + - float + - key: daily_volume + path: + - vol + type: + - str + - float + + historic_rates: + request: + template: k + pair_template: + template: "{first}{second}" + lower_case: true + alias: market + params: + limit: + default: 2000 + timestamp: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 2000 + period: + allowed: + minutes: 1 + hours: 60 + days: 1440 + weeks: 10080 + default: 1440 + response: + type: list + values: + type: list + values: + 0: #time + type: int + 1: #open + type: float + 2: #high + type: float + 3: #low + type: float + 4: #close + type: float + 5: #vol + type: float + + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 0 + - key: open + path: + - 1 + type: + - float + - key: high + path: + - 2 + type: + - float + - key: low + path: + - 3 + type: + - float + - key: close + path: + - 4 + type: + - float + - key: volume + path: + - 5 + type: + - float + + + trades: + request: + template: trades + pair_template: + template: "{first}{second}" + lower_case: true + alias: market + params: + limit: + default: 200 + + response: + type: list + values: + type: dict + values: + id: + type: int + price: + type: str + volume: + type: str + created_at: + type: int + side: + type: str + + mapping: + - key: time + path: + - created_at + type: + - float + - from_timestamp + - 0 + - key: id + path: + - id + type: + - int + - key: direction + path: + - side + type: + - value + - map + - ask + - sell + - bid + - buy + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - volume + type: + - str + - float + + order_books: + request: + template: depth + pair_template: + template: "{first}{second}" + lower_case: true + alias: market + params: + limit: + default: 50 + + response: + type: dict + values: + timestamp: + type: int + asks: + type: list + values: + type: list + values: + 0: #Price + type: str + 1: # Qty + type: str + bids: + type: list + values: + type: list + values: + 0: #Price + type: str + 1: # Qty + type: str + + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - timestamp + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/mandala.yaml b/pandas_datareader/crypto_utils/resources/mandala.yaml new file mode 100644 index 00000000..3bb77dbd --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/mandala.yaml @@ -0,0 +1,329 @@ +name: mandala +exchange: true + +rate_limit: + max: 1200 + unit: 60 + +api_url: "" + +requests: + currency_pairs: + request: + template: https://trade.mandala.exchange/open/v1/common/symbols + pair_template: null + params: null + + response: + type: dict + values: + data: + type: dict + values: + list: + type: list + values: + type: dict + values: + symbol: + type: str + baseAsset: + type: str + quoteAsset: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - list + - baseAsset + type: + - str + - key: currency_pair_second + path: + - data + - list + - quoteAsset + type: + - str + + order_books: + request: + template: https://api.binance.com/api/v3/depth + pair_template: # e.g. BNBBTC + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + max: 100 + default: 50 + + response: + type: dict + values: + lastUpdateId: + type: int + bids: + type: list + values: + type: list + values: + 0: # price + type: + - str + - float + 1: # quantity + type: + - str + - float + asks: + type: list + values: + type: list + values: + 0: # price + type: + - str + - float + 1: # quantity + type: + - str + - float + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: + - lastUpdateId + type: + - int + + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + + trades: + request: + template: https://api.binance.com/api/v1/trades + pair_template: # e.g. BNBBTC + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + max: 1000 + default: 500 + weight: 1 + response: + type: list + values: + type: dict + values: + id: + type: int + price: + type: + - str + - float + qty: + type: + - str + - float + time: + type: + - float + - from_timestamp + - 1 + isBuyerMaker: + type: bool + isBestMatch: + type: bool + mapping: + - key: id + path: + - id + type: + - int + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - True + - sell + - False + - buy + + historic_rates: + request: + template: https://api.binance.com/api/v1/klines + pair_template: # e.g. BNBBTC + template: "{first}{second}" + lower_case: false + alias: symbol + params: + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + months: 1M + default: 1d + startTime: + required: false + endTime: + function: last_timestamp + type: + - datetime + - timestampms +# - timedeltams +# - interval +# - 1000 + limit: + max: 1000 + default: 1000 + response: + type: list + values: + type: list + values: + 0: # Open time + type: + - float + - from_timestamp + - 1 + 1: # open + type: + - str + - float + 2: # high + type: + - str + - float + 3: # low + type: + - str + - float + 4: # close + type: + - str + - float + 5: # volume + type: + - str + - float + 6: # close time + type: + - float + - from_timestamp + - 1 + 7: # Quote asset volume + type: + - str + - float + 8: # Number of trades + type: int + 9: # Taker buy base asset volume + type: + - str + - float + 10: # Taker buy quote asset volume + type: + - str + - float + 11: # ignore + type: ignore + mapping: + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float + - key: time + path: + - 6 + type: + - float + - from_timestamp + - 1 diff --git a/pandas_datareader/crypto_utils/resources/mexc.yaml b/pandas_datareader/crypto_utils/resources/mexc.yaml new file mode 100644 index 00000000..e841297e --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/mexc.yaml @@ -0,0 +1,368 @@ +name: mexc +exchange: true + +rate_limit: + max: 1200 + unit: 60 + +api_url: https://www.mexc.com + +requests: + currency_pairs: + request: + template: /open/api/v2/market/symbols + pair_template: null + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + symbol: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - symbol + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - data + - symbol + type: + - str + - split + - "_" + - 1 + + tickers: + request: + template: /open/api/v2/market/ticker + pair_template: + template: "{first}_{second}" + lower_case: false + alias: symbol + params: null + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + symbol: + type: str + volume: + type: str + bid: + type: str + ask: + type: str + last: + type: str + time: + type: int + + mapping: + - key: last_price + path: + - data + - last + type: + - str + - float + - key: time + path: + - data + - time + type: + - float + - from_timestamp + - 1 + - key: best_bid + path: + - data + - bid + type: + - str + - float + - key: best_ask + path: + - data + - ask + type: + - str + - float + - key: daily_volume + path: + - data + - volume + type: + - str + - float + + historic_rates: + request: + template: /open/api/v2/market/kline + pair_template: + template: "{first}_{second}" + lower_case: false + alias: symbol + params: + interval: + allowed: + minutes: 1m + hours: 60m + days: 1d + months: 1M + default: 1d + limit: + max: 1000 + default: 100 + start_time: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 100 + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + 0: # time + type: int + 1: # open + type: str + 2: # close + type: str + 3: # high + type: str + 4: # low + type: str + 5: # quote_vol + type: str + 6: # base_vol + type: str + + mapping: + - key: time + path: + - data + - 0 + type: + - float + - from_timestamp + - 0 + - key: open + path: + - data + - 1 + type: + - str + - float + - key: high + path: + - data + - 3 + type: + - str + - float + - key: low + path: + - data + - 4 + type: + - str + - float + - key: close + path: + - data + - 2 + type: + - str + - float + - key: volume + path: + - data + - 6 + type: + - str + - float + + + trades: + request: + template: /open/api/v2/market/deals + pair_template: + template: "{first}_{second}" + lower_case: false + alias: symbol + params: + limit: + max: 1000 + default: 1000 + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + trade_time: # time + type: int + trade_price: # open + type: str + trade_quantity: # close + type: str + trade_type: # high + type: str + + mapping: + - key: time + path: + - data + - trade_time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - data + - trade_time + type: + - float + - key: direction + path: + - data + - trade_type + type: + - value + - map + - "BID" + - "buy" + - "ASK" + - "sell" + + - key: price + path: + - data + - trade_price + type: + - str + - float + - key: amount + path: + - data + - trade_quantity + type: + - str + - float +# + order_books: + request: + template: /open/api/v2/market/depth + pair_template: + template: "{first}_{second}" + lower_case: false + alias: symbol + params: + depth: + max: 2000 + default: 50 + + response: + type: dict + values: + data: + type: dict + values: + version: + type: str + asks: + type: list + values: + type: dict + values: + price: + type: str + quantity: + type: str + bids: + type: list + values: + type: dict + values: + price: + type: str + quantity: + typs: str + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: + - data + - version + type: + - str + - float + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - data + - bids + - quantity + type: + - str + - float + - key: bids_price + path: + - data + - bids + - price + type: + - str + - float + - key: asks_amount + path: + - data + - asks + - quantity + type: + - str + - float + - key: asks_price + path: + - data + - asks + - price + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/mexo.yaml b/pandas_datareader/crypto_utils/resources/mexo.yaml new file mode 100644 index 00000000..997d3b45 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/mexo.yaml @@ -0,0 +1,304 @@ +name: mexo +is_exchange: true +api_docs: https://github.com/mexo-tech/Mexo-OpenApi/blob/master/doc/rest-api.md +api_url: https://api.mexo.io/ +rate_limit: + max: 1500 + unit: 60 + +requests: + currency_pairs: + request: + template: openapi/v1/brokerInfo + pair_template: null + params: null + + response: + type: dict + values: + symbols: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + + mapping: + - key: currency_pair_first + path: + - symbols + - baseAsset + type: + - str + - key: currency_pair_second + path: + - symbols + - quoteAsset + type: + - str + + tickers: + request: + template: openapi/quote/v1/ticker/price + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: null + + response: + type: dict + values: + symbol: + type: str + price: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - price + type: + - str + - float + + order_books: + request: + template: openapi/quote/v1/depth + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 100 + default: 100 + response: + type: dict + values: + time: + type: int + bids: + type: list + values: + type: list + 0: #price + type: str + 1: #qty + type: str + asks: + type: list + values: + type: list + 0: + type: str + 1: + type: str + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - time + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + + trades: + request: + template: openapi/quote/v1/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 1000 + default: 500 + response: + type: list + value: + type: dict + values: + price: + type: str + qty: + typ: str + time: + type: int + isBuyerMaker: + type: bool + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - True + - sell + - False + - buy + - key: id + path: + - time + type: + - int + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + + historic_rates: + request: + template: openapi/quote/v1/klines + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + months: 1M + default: 1d + limit: + type: int + max: 1000 + default: 1000 + endTime: + function: last_timestamp + type: + - datetime + - timestampms + + response: + type: list + values: + type: list + values: + 0: #timestamp + type: int + 1: #open + type: str + 2: #high + type: str + 3: #low + type: str + 4: #close + type: str + 5: #volume + type: str + 6: #close time + type: int + 7: # quote Asset volume + type: str + 8: # number of trades + type: int + 9: # taker buy base asset volume + type: str + 10: # taker buy quote asset volume + type: str + + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/nicehash.yaml b/pandas_datareader/crypto_utils/resources/nicehash.yaml new file mode 100644 index 00000000..2e5efdbc --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/nicehash.yaml @@ -0,0 +1,255 @@ +# Tickers only with no split parameter in the CP +name: nicehash +exchange: true + +rate_limit: null + +api_url: https://api2.nicehash.com/exchange/api/v2/ + +requests: + currency_pairs: + request: + template: info/status + pair_template: null + params: null + + response: + type: dict + values: + symbols: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + + mapping: + - key: currency_pair_first + path: + - symbols + - baseAsset + type: + - str + - key: currency_pair_second + path: + - symbols + - quoteAsset + type: + - str + + + historic_rates: + request: + template: info/candlesticks + pair_template: + template: "{first}{second}" + lower_case: false + alias: market + params: + resolution: + allowed: + minutes: 1 + hours: 60 + days: 1440 + default: 1440 # daily + from: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 2000 + to: + function: last_timestamp + type: + - datetime + - timestamp + response: + type: list + values: + type: dict + values: + time: + type: int + open: + type: float + close: + type: float + high: + type: float + low: + type: float + volume: + type: float + quote_volume: + type: float + + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 0 + - key: open + path: + - open + type: + - float + - key: high + path: + - high + type: + - float + - key: low + path: + - low + type: + - float + - key: close + path: + - close + type: + - float + - key: volume + path: + - volume + type: + - float + + trades: + request: + template: info/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: market + params: + limit: + default: 200 + response: + type: list + values: + type: dict + values: + id: + type: str + dir: + type: str + price: + type: flaot + qty: + type: float + sndQty: + type: float + time: + type: int + + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 2 + - key: id + path: + - id + type: + - str + - key: direction + path: + - dir + type: + - str + - key: price + path: + - price + type: + - float + - key: amount + path: + - qty + type: + - float + + order_books: + request: + template: orderbook + pair_template: + template: "{first}{second}" + lower_case: false + alias: market + params: + limit: + default: 50 + + response: + type: dict + values: + tick: + type: int + buy: + type: list + values: + type: list + values: + 0: + type: float + 1: + type: float + sell: + type: list + values: + type: list + values: + 0: + type: float + 1: + type: float + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: + - tick + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - buy + - 1 + type: + - float + - key: bids_price + path: + - buy + - 0 + type: + - float + - key: asks_amount + path: + - sell + - 1 + type: + - float + - key: asks_price + path: + - sell + - 0 + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/nominex.yaml b/pandas_datareader/crypto_utils/resources/nominex.yaml new file mode 100644 index 00000000..b0084fe2 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/nominex.yaml @@ -0,0 +1,225 @@ +# Cannot extract bid/sell side from orderbooks. +name: nominex +exchange: true + +rate_limit: null +api_docs: https://developer.nominex.io/#parameters +api_url: https://nominex.io/api/rest/v1/ + +requests: + currency_pairs: + request: + template: pairs + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + name: + type: str + + mapping: + - key: currency_pair_first + path: + - name + type: + - str + - split + - "/" + - 0 + - key: currency_pair_second + path: + - name + type: + - str + - split + - "/" + - 1 + + tickers: + request: + template: ticker/{currency_pair} + pair_template: + template: "{first}/{second}" + lower_case: false + params: null + response: + type: dict + values: + bid: + type: float + ask: + type: float + baseVolume: + type: float + price: + type: float + + mapping: + - key: last_price + path: + - price + type: + - float + - key: time + path: [] + type: + - none + - now + - key: best_bid + path: + - bid + type: + - float + - key: best_ask + path: + - ask + type: + - float + - key: daily_volume + path: + - baseVolume + type: + - float + + historic_rates: + request: + template: candles/{currency_pair}/{frequency} + pair_template: + template: "{first}/{second}" + lower_case: false + params: + frequency: + allowed: + minutes: TF1M + hours: TF1H + days: TF1D + weeks: TF7D + months: TF1MO + default: TF1D + limit: + default: 400 # max + end: + function: last_timestamp + type: + - datetime + - timestampms + response: + type: list + values: + type: dict + values: + timestamp: + type: int + open: + type: float + close: + type: float + high: + type: float + low: + type: float + volume: + type: float + + + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: open + path: + - open + type: + - float + - key: high + path: + - high + type: + - float + - key: low + path: + - low + type: + - float + - key: close + path: + - close + type: + - float + - key: volume + path: + - volume + type: + - float + + + trades: + request: + template: trades/{currency_pair} + pair_template: + template: "{first}/{second}" + lower_case: false + params: + limit: + default: 200 # max + + response: + type: dict + values: + items: + type: list + values: + type: dict + values: + id: + type: int + timestamp: + type: int + amount: + type: float + price: + type: float + side: + type: str + + mapping: + - key: time + path: + - items + - timestamp + type: + - float + - from_timestamp + - 1 + - key: id + path: + - items + - id + type: + - int + - key: direction + path: + - items + - side + type: + - str + - key: price + path: + - items + - price + type: + - float + - key: amount + path: + - items + - amount + type: + - float diff --git a/pandas_datareader/crypto_utils/resources/oceanex.yaml b/pandas_datareader/crypto_utils/resources/oceanex.yaml new file mode 100644 index 00000000..bc7ff21f --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/oceanex.yaml @@ -0,0 +1,380 @@ +name: oceanex +exchange: true + +rate_limit: + max: 3000 + unit: 60 + +api_url: https://api.oceanex.pro/v1/ + +requests: + currency_pairs: + request: + template: markets + pair_template: null + params: null + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + name: + type: str + + mapping: + - key: currency_pair_first + path: + - data + - name + type: + - str + - split + - "/" + - 0 + - key: currency_pair_second + path: + - data + - name + type: + - str + - split + - "/" + - 1 + + tickers: + request: + template: tickers + pair_template: null + params: null + response: + type: dict + values: + data: + type: dict + values: + currency_pair: + type: dict + values: + base_unit: + type: str + quote_unit: + type: str + at: + type: int + sell: + type: str + buy: + type: str + last: + type: str + volume: + type: str + mapping: + - key: currency_pair_first + path: + - data + - dict_values + - base_unit + type: + - str + - key: currency_pair_second + path: + - data + - dict_values + - quote_unit + type: + - str + - key: last_price + path: + - data + - dict_values + - last + type: + - str + - float + - key: time + path: + - data + - dict_values + - at + type: + - float + - from_timestamp + - 0 + - key: best_bid + path: + - data + - dict_values + - buy + type: + - str + - float + - key: best_ask + path: + - data + - dict_values + - sell + type: + - str + - float + - key: daily_volume + path: + - data + - dict_values + - volume + type: + - str + - float + + historic_rates: + request: + template: k + pair_template: + template: "{first}{second}" + lower_case: true + alias: market + params: + limit: + max: null + default: 10000 + period: + allowed: + minutes: 1 + hours: 60 + days: 1440 + default: 1440 #daily + timestamp: + function: last_timestamp # data after that timestamp + type: + - datetime + - timedelta + - interval + - 10000 + response: + type: dict + values: + data: + type: list + values: + type: list + values: + 0: # timestamp + type: int + 1: #open + type: float + 2: #high + type: float + 3: #low + type: float + 4: #close + type: float + 5: #vol + type: float + + mapping: + - key: time + path: + - data + - 0 + type: + - float + - from_timestamp + - 0 + - key: open + path: + - data + - 1 + type: + - float + - key: high + path: + - data + - 2 + type: + - float + - key: low + path: + - data + - 3 + type: + - float + - key: close + path: + - data + - 4 + type: + - float + - key: volume + path: + - data + - 5 + type: + - float + + + trades: + request: + template: trades + pair_template: + template: "{first}{second}" + lower_case: true + alias: market + params: + limit: + default: 200 + + response: + type: dict + values: + data: + type: list + values: + type: dict + values: + id: + type: int + price: + type: str + volume: + type: str + side: + type: str + created_on: + type: int + + + mapping: + - key: time + path: + - data + - created_on + type: + - float + - from_timestamp + - 0 + - key: id + path: + - data + - id + type: + - int + - key: direction + path: + - data + - side + type: + - value + - map + - bid + - buy + - ask + - sell + - key: price + path: + - data + - price + type: + - str + - float + - key: amount + path: + - data + - volume + type: + - str + - float + + order_books: + request: + template: order_book + pair_template: + template: "{first}{second}" + lower_case: true + alias: market + params: + limit: + max: 300 + default: 50 + + response: + type: dict + values: + data: + type: dict + values: + timestamp: + type: int + asks: + type: list + values: + type: list + values: + 0: # price + type: str + 1: #qty + type: str + bids: + type: list + values: + type: list + values: + 0: # price + type: str + 1: #qty + type: str + mapping: + - key: time + path: + - data + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - data + - timestamp + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - data + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - data + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - data + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - data + - asks + - 0 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/okcoin.yaml b/pandas_datareader/crypto_utils/resources/okcoin.yaml new file mode 100644 index 00000000..d0846e3b --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/okcoin.yaml @@ -0,0 +1,338 @@ +name: okcoin +exchange: true + +api_url: https://www.okcoin.com/api/spot/v3/ +rate_limit: + max: 360 + unit: 60 + +requests: + currency_pairs: + request: + template: instruments + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + base_currency: + type: str + quote_currency: + type: str + mapping: + - key: currency_pair_first + path: + - base_currency + type: + - str + - key: currency_pair_second + path: + - quote_currency + type: + - str + + + tickers: + request: + template: instruments/ticker + pair_template: null # + params: null + response: + type: list + values: + type: dict + values: + instrument_id: + type: str + last: + type: str + bid: + type: str + ask: + type: str + base_volume_24h: + type: str + timestamp: + type: str + quote_volume_24h: + type: str + mapping: + - key: currency_pair_first + path: + - product_id + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - product_id + type: + - str + - split + - "-" + - 1 + - key: time + path: + - timestamp + type: + - str + - dateparser + - key: last_price + path: + - last + type: + - str + - float + - key: best_ask + path: + - ask + type: + - str + - float + - key: best_bid + path: + - bid + type: + - str + - float + - key: daily_volume + path: + - base_volume_24h + type: + - str + - float + + order_books: + request: + template: instruments/{currency_pair}/book + pair_template: # e.g. btc_usd + template: "{first}-{second}" + lower_case: false + params: + size: + type: int + min: 1 + max: 200 + required: false + default: 50 + merge: + type: int + possible: + - 1 + - 0.1 + required: false + response: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: # price + type: str + 1: # size + type: str + bids: + type: list + values: + type: list + values: + 0: # price + type: str + 1: # size + type: str + timestamp: + type: str + mapping: + - key: time + path: + - timestamp + type: + - str + - dateparser + - key: id + path: + - timestamp + type: + - str + - dateparser + - totimestamp + - key: position + path: [] + type: + - none + - range + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + + trades: + request: + template: instruments/{currency_pair}/trades + pair_template: # e.g. btc_usd + template: "{first}-{second}" + lower_case: false + params: + limit: + type: int + max: 100 + default: 100 + response: + type: list + values: + type: dict + values: + timestamp: + type: str + price: + type: str + size: + type: str + trade_id: + type: str + side: + type: str + mapping: + - key: time + path: + - timestamp + type: + - str + - dateparser + - key: id + path: + - timestamp + type: + - str + - dateparser + - totimestamp + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - size + type: + - str + - key: direction + path: + - side + type: + - str + + historic_rates: + request: + template: instruments/{currency_pair}/candles + pair_template: # e.g. btc_usd + template: "{first}-{second}" + lower_case: false + params: + granularity: + allowed: + minutes: 60 + hours: 3600 + days: 86400 + weeks: 604800 + default: 86400 # 1 day +# start: #returns only the last 200 entries until end or "today". +# function: last_timestamp +# type: +# - datetime +# - timedelta +# - interval +# - 1000 +# - fromtimestamp +# - "%Y-%m-%dT%H:%M:%S.%fZ" + end: + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S.%fZ" # e.g. 2020-11-10T16:00:00.000Z + response: + type: list + values: + type: list + values: + 0: # timestamp + type: str + 1: # open + type: str + 2: # high + type: str + 3: # low + type: str + 4: # close + type: str + 5: # volume + type: str + mapping: + - key: time + path: + - 0 + type: + - str + - dateparser + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float diff --git a/pandas_datareader/crypto_utils/resources/okex.yaml b/pandas_datareader/crypto_utils/resources/okex.yaml new file mode 100644 index 00000000..7cde4876 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/okex.yaml @@ -0,0 +1,360 @@ +name: okex +exchange: true + +api_url: https://www.okex.com/api/spot/v3/ +rate_limit: + max: 20 + unit: 2 +requests: + currency_pairs: + request: + template: instruments + pair_template: null + params: null + + response: + type: list + values: + type: dict + values: + base_currency: + type: str + category: + type: str + instrument_id: + type: str + min_size: + type: str + quote_currency: + type: str + size_increment: + type: str + tick_size: + type: str + mapping: + - key: currency_pair_first + path: + - base_currency + type: + - str + - lower + - key: currency_pair_second + path: + - quote_currency + type: + - str + - lower + + + tickers: + request: + template: instruments/ticker + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + best_ask: + type: str + best_bid: + type: str + instrument_id: + type: str + product_id: + type: str + last: + type: str + last_qty: + type: str + ask: + type: str + best_ask_size: + type: str + bid: + type: str + best_bid_size: + type: str + open: + type: str + open_24h: + type: str + high_24h: + type: str + low_24h: + type: str + base_volume_24h: + type: str + timestamp: + type: str + qutote_volume_24h: + type: str + + mapping: + - key: currency_pair_first + path: + - instrument_id + type: + - str + - split + - "-" + - 0 + - key: currency_pair_second + path: + - instrument_id + type: + - str + - split + - "-" + - 1 + - key: best_bid + path: + - best_bid + type: + - str + - float + - key: last_price + path: + - last + type: + - str + - float + - key: best_ask + path: + - best_ask + type: + - str + - float + - key: daily_volume + path: + - base_volume_24h + type: + - str + - float +# + order_books: + request: + template: instruments/{currency_pair}/book + pair_template: # e.g. btc_usd + template: "{first}-{second}" + lower_case: false + params: + size: + min: 1 + max: 200 + default: 50 + response: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: # price + type: float + 1: # size + type: float + bids: + type: list + values: + type: list + values: + 0: # price + type: float + 1: # size + type: float + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: asks_price + path: + - asks + - 0 + type: + - float + - key: asks_amount + path: + - asks + - 1 + type: + - float + - key: bids_price + path: + - bids + - 0 + type: + - float + - key: bids_amount + path: + - bids + - 1 + type: + - float + + trades: + request: + template: instruments/{currency_pair}/trades + pair_template: # e.g. btc_usd + template: "{first}-{second}" + lower_case: false + params: + limit: # get recently 60 pieces of data starting from the given tid (optional) + type: str + required: false + default: 100 + response: + type: list + values: + type: dict + values: + 0: + type: str + 1: + type: str + 2: + type: str + 3: + type: str + 4: + type: str + 5: + type: str + mapping: + - key: time + path: + - dict_values + - 1 + type: + - str + - strptime + - "%Y-%m-%dT%H:%M:%S.%fZ" + - key: price + path: + - dict_values + - 3 + type: + - str + - float + - key: amount + path: + - dict_values + - 4 + type: + - str + - float + - key: direction + path: + - dict_values + - 5 + type: + - str + - key: id + path: + - dict_values + - 2 + type: + - str + - int + + historic_rates: + request: + template: instruments/{currency_pair}/candles + pair_template: # e.g. btc_usd + template: "{first}-{second}" + lower_case: false + params: + granularity: + allowed: + minutes: 60 + hours: 3600 + days: 86400 + weeks: 604800 + default: 86400 # 1day + limit: + default: 300 + start: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 300 + - from_timestamp + - 0 + - "%Y-%m-%dT%H:%M:%S.%fZ" + end: + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S.%fZ" + response: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + 2: + type: str + 3: + type: str + 4: + type: str + 5: + type: str + mapping: + - key: time + path: + - 0 + type: + - str + - strptime + - "%Y-%m-%dT%H:%M:%S.%fZ" + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float diff --git a/pandas_datareader/crypto_utils/resources/omgfin.yaml b/pandas_datareader/crypto_utils/resources/omgfin.yaml new file mode 100644 index 00000000..9f17a715 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/omgfin.yaml @@ -0,0 +1,359 @@ +#ToDO: HR endpoint is not really working. Frequently returning data is non-json format (status 503) which can not +# be parsed. + +name: omgfin +api_url: https://omgfin.com/api/v1/ +rate_limit: + max: 600 + unit: 60 + + +requests: + + currency_pairs: + request: + template: exchangeInfo + pair_template: null + params: null + + response: + type: dict + values: + symbols: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + mapping: + - key: currency_pair_first + path: + - symbols + - baseAsset + type: + - str + - key: currency_pair_second + path: + - symbols + - quoteAsset + type: + - str + + tickers: + request: + template: ticker/summary + pair_template: null + params: null + response: + type: dict + values: + currency_pair: + type: dict + values: + last: + type: str + lowestAsk: + type: str + highest_bid: + type: str + percentChange: + type: str + baseVolume: + type: str + quoteVolume: + type: str + high24h: + type: str + low24h: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - dict_values + - last + type: + - str + - float + - key: best_bid + path: + - dict_values + - highestBid + type: + - str + - float + - key: best_ask + path: + - dict_values + - lowestAsk + type: + - str + - float + - key: daily_volume + path: + - dict_values + - baseVolume + type: + - str + - float + + historic_rates: + request: + template: klines + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + default: 1d + limit: + default: 300 # max: 300 +# startTime: +# function: last_timestamp +# type: +# - datetime +# - timedeltams +# - interval +# - 300 + endTime: + function: last_timestamp + type: + - datetime + - timestampms + response: + type: list + values: + type: dict + values: + OT: + type: int + O: + type: str + H: + type: str + L: + type: str + C: + type: str + CT: + type: int + QV: + type: str + V: + type: str + + mapping: + - key: time + path: + - CT + type: + - float + - from_timestamp + - 1 + - key: open + path: + - O + type: + - str + - float + - key: high + path: + - H + type: + - str + - float + - key: low + path: + - L + type: + - str + - float + - key: close + path: + - C + type: + - str + - float + - key: volume + path: + - V + type: + - str + - float + + + trades: + request: + template: trades/{currency_pair} + pair_template: + template: "{first}{second}" + lower_case: false + params: + limit: + max: 1000 + default: 500 + + response: + type: list + values: + type: dict + values: + id: + type: int + price: + type: str + qty: + type: str + time: + type: int + isBuyerMaker: + type: str + isBestMatch: + type: str + + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - id + type: + - int + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - True + - sell + - False + - buy + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + + order_books: + request: + template: orderbook/{currency_pair} + pair_template: + template: "{first}{second}" + lower_case: false + params: + limit: + max: 500 + default: 50 + + response: + type: dict + values: + timestamp: + type: int + bids: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + asks: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - timestamp + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/p2pb2b.yaml b/pandas_datareader/crypto_utils/resources/p2pb2b.yaml new file mode 100644 index 00000000..b226b2ba --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/p2pb2b.yaml @@ -0,0 +1,393 @@ +# ToDo: Function für einen Offset für HR schreiben. + +name: p2pb2b +exchange: true +rate_limit: + max: 100 + unit: 60 +api_url: https://api.p2pb2b.io/api/v2/public/ + +requests: + currency_pairs: + request: + template: markets + pair_template: null + params: null + response: + type: dict + values: + result: + type: list + values: + type: dict + values: + name: + type: str + stock: + type: str + money: + type: str + mapping: + - key: currency_pair_first + path: + - result + - stock + type: + - str + - key: currency_pair_second + path: + - result + - money + type: + - str + + tickers: + request: + template: tickers + pair_template: null + params: null + response: + type: dict + values: + success: + type: bool + message: + type: str + resulst: + type: dict + values: + currency_pair: + type: dict + values: + at: + type: int + ticker: + type: dict + values: + bid: + type: float + ask: + type: float + low: + type: float + high: + type: float + last: + type: float + vol: + type: float + change: + type: float + mapping: + - key: time + path: + - result + - dict_values + - at + type: + - float + - from_timestamp + - 0 + - key: currency_pair_first + path: + - result + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - result + - dict_key + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - result + - dict_values + - ticker + - last + type: + - float + - key: best_bid + path: + - result + - dict_values + - ticker + - bid + type: + - float + - key: best_ask + path: + - result + - dict_values + - ticker + - ask + type: + - float + - key: daily_volume + path: + - result + - dict_values + - ticker + - vol + type: + - float + + trades: + request: + template: history + pair_template: + template: "{first}_{second}" + lower_case: false + alias: market + params: + lastId: + type: int + default: 1 + limit: + type: int + default: 100 + response: + type: dict + values: + success: + type: bool + message: + type: str + result: + type: list + values: + type: dict + values: + id: + type: int + type: + type: str + time: + type: int + amount: + type: float + price: + type: float + + mapping: + - key: time + path: + - result + - time + type: + - float + - from_timestamp + - 0 + - key: id + path: + - result + - id + type: + - int + - key: amount + path: + - result + - amount + type: + - float + - key: price + path: + - result + - price + type: + - float + - key: direction + path: + - result + - type + type: + - str + + order_books: + request: + template: depth/result + pair_template: + template: "{first}_{second}" + lower_case: false + alias: market + params: + limit: + type: int + default: 100 + interval: + default: "0" + + response: + type: dict + values: + result: + type: dict + asks: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + bids: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + cache_time: + type: float + current_time: + type: float + mapping: + - key: id + path: + - cache_time + type: + - float + - int + - key: time + path: + - cache_time + type: + - float + - from_timestamp + - 0 + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - result + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - result + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - result + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - result + - asks + - 1 + type: + - str + - float + + historic_rates: + request: + template: market/kline + pair_template: + template: "{first}_{second}" + lower_case: false + alias: market + params: + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + default: 1d + limit: + type: int + default: 500 + + response: + type: dict + values: + result: + type: list + values: + type: dict + values: + 0: #time + type: int + 1: #open + type: str + 2: #close + type: str + 3: #high + type: str + 4: #low + type: str + 5: #volume + type: str + 6: #amount + type: str + + mapping: + - key: time + path: + - result + - 0 + type: + - float + - from_timestamp + - 0 + - key: open + path: + - result + - 1 + type: + - str + - float + - key: high + path: + - result + - 3 + type: + - str + - float + - key: low + path: + - result + - 4 + type: + - str + - float + - key: close + path: + - result + - 2 + type: + - str + - float + - key: volume + path: + - result + - 5 + type: + - str + - float + + + diff --git a/pandas_datareader/crypto_utils/resources/poloniex.yaml b/pandas_datareader/crypto_utils/resources/poloniex.yaml new file mode 100644 index 00000000..bd36eb8f --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/poloniex.yaml @@ -0,0 +1,348 @@ +name: poloniex +exchange: true +api_url: https://poloniex.com/ +rate_limit: null +requests: + currency_pairs: + request: + template: public?command=returnTicker + pair_template: null + params: null + response: + type: dict + values: + currency_pair: # variable key, each currency pair e.g. ltc_btc + type: dict + values: + last: + type: float + lowestAsk: + type: float + highestBid: + type: float + percentChange: + type: float + baseVolume: + type: float + quoteVolume: + type: float + isFrozen: + type: int + high24hr: + type: float + low24hr: + type: float + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - splitupper + - "_" + - 1 + - key: currency_pair_second + path: + - dict_key + type: + - str + - splitupper + - "_" + - 0 + + tickers: + request: + template: public?command=returnTicker + pair_template: null + params: null + response: + type: dict + values: + currency_pair: # variable key, each currency pair e.g. ltc_btc + type: dict + values: + last: + type: float + lowestAsk: + type: float + highestBid: + type: float + percentChange: + type: float + baseVolume: + type: float + quoteVolume: + type: float + isFrozen: + type: int + high24hr: + type: float + low24hr: + type: float + mapping: + - key: time + path: [] + type: + - none + - now + - key: currency_pair_first + path: + - dict_key + type: + - str + - splitupper + - "_" + - 1 + - key: currency_pair_second + path: + - dict_key + type: + - str + - splitupper + - "_" + - 0 + - key: last_price + path: + - dict_values + - last + type: + - float + - key: best_bid + path: + - dict_values + - highestBid + type: + - float + - key: best_ask + path: + - dict_values + - lowestAsk + type: + - float + - key: daily_volume + path: + - dict_values + - base_volume + type: + - float + + historic_rates: + request: + template: public?command=returnChartData + pair_template: + template: "{second}_{first}" + alias: currencyPair + lower_case: false + params: + start: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1000 +# type: int +# default: 946684800 # 01.01.2000 + period: + allowed: + minutes: 300 + hours: 7200 + days: 86400 + default: 86400 #1 Day in Seconds + + response: + type: list + values: + type: dict + values: + date: + type: int + high: + type: float + low: + type: float + open: + type: float + close: + type: float + quoteVolume: + type: float + weightedAverage: + type: flaot + + mapping: + - key: time + path: + - date + type: + - float + - from_timestamp + - 0 + - key: close + path: + - close + type: + - float + - key: open + path: + - open + type: + - float + - key: high + path: + - high + type: + - float + - key: low + path: + - low + type: + - float + - key: volume + path: + - volume + type: + - float + + order_books: + request: + template: public?command=returnOrderBook + pair_template: + template: "{second}_{first}" + alias: currencyPair + lower_case: false + params: + depth: + type: int + default: 100 + + response: + type: dict + values: + ask: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: float + bids: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: float + is_frozen: + type: str + seq: + type: int + + mapping: + - key: time + path: [] + type: + - none + - now + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - float + - key: id + path: + - seq + type: + - int + - key: position + path: [] + type: + - none + - range + + trades: + request: + template: public?command=returnTradeHistory + pair_template: + template: "{second}_{first}" + alias: currencyPair + lower_case: false + params: null + + response: + type: list + values: + type: dict + values: + globalTradeID: + type: int + tradeID: + type: int + date: + type: str + type: + type: str + rate: + type: str + amount: + type: str + total: + type: str + orderNumber: + type: str + mapping: + - key: time + path: + - date + type: + - str + - strptime + - "%Y-%m-%d %H:%M:%S" + - key: id + path: + - tradeID + type: + - str + - int + - key: price + path: + - rate + type: + - str + - float + - key: amount + path: + - amount + type: + - str + - float + - key: direction + path: + - type + type: + - str diff --git a/pandas_datareader/crypto_utils/resources/therocktrading.yaml b/pandas_datareader/crypto_utils/resources/therocktrading.yaml new file mode 100644 index 00000000..032ada09 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/therocktrading.yaml @@ -0,0 +1,340 @@ +name: therocktrading +exchange: true + +rate_limit: + max: 600 + unit: 60 + +api_url: https://api.therocktrading.com/v1/ + +requests: + currency_pairs: + request: + template: funds + pair_template: null + params: null + + response: + type: dict + values: + funds: + type: list + values: + type: dict + values: + base_currency: + type: str + trade_currency: + type: str + + + mapping: + - key: currency_pair_first + path: + - funds + - trade_currency + type: + - str + - key: currency_pair_second + path: + - funds + - base_currency + type: + - str + + tickers: + request: + template: funds/{currency_pair}/ticker + pair_template: + template: "{first}{second}" + lower_case: false + params: null + response: + type: dict + values: + date: + type: str + bid: + type: str + ask: + type: str + last: + type: str + volume: + type: str + traded_volume: + type: str + + mapping: + - key: last_price + path: + - last + type: + - str + - float + - key: time + path: + - date + type: + - str + - dateparser + - key: best_bid + path: + - bid + type: + - str + - float + - key: best_ask + path: + - ask + type: + - str + - float + - key: daily_volume + path: + - volume + type: + - str + - float + + historic_rates: + request: + template: funds/{currency_pair}/ohlc_statistics + pair_template: + template: "{first}{second}" + lower_case: false + params: + period: + allowed: + minutes: 1 + hours: 60 +# days: 1440 +# weeks: 10080 +# months: 43200 + default: 60 + before: + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S%Z" + after: + function: last_timestamp + type: + - datetime + - timedelta + - interval + - 1000 #max interval 60 DAYS! + - from_timestamp + - 0 + - "%Y-%m-%dT%H:%M:%S%Z" +# default: "2020-03-19T17:25:00.000Z" + sort: + default: DESC + response: + type: list + values: + type: dict + values: + open: + type: float + high: + type: float + low: + type: float + close: + type: float + base_volume: + type: float + trade_volume: + type: float + interval_starts_at: + type: str + interval_ends_at: + type: str + + mapping: + - key: time + path: + - interval_ends_at + type: + - str + - dateparser + - key: open + path: + - open + type: + - float + - key: high + path: + - high + type: + - float + - key: low + path: + - low + type: + - float + - key: close + path: + - close + type: + - float + - key: volume + path: + - traded_volume + type: + - float + + trades: + request: + template: funds/{currency_pair}/trades + pair_template: + template: "{first}{second}" + lower_case: false + params: +# before: +# function: last_timestamp +# type: +# - datetime +# - format +# - "%Y-%m-%dT%H:%M:%S%Z" +# after: +# function: last_timestamp +# type: +# - datetime +# - timedelta +# - interval +# - 1000 +# - fromtimestamp +# - "%Y-%m-%dT%H:%M:%S%Z" + per_page: + max: 250 + default: 250 + + response: + type: dict + values: + type: list + values: + type: dict + values: + trade_id: + type: int + amount: + type: float + price: + type: float + side: + type: str + date: + type: str + + + mapping: + - key: time + path: + - trades + - date + type: + - str + - dateparser + - key: id + path: + - trades + - id + type: + - int + - key: direction + path: + - trades + - side + type: + - str + - key: price + path: + - trades + - price + type: + - float + - key: amount + path: + - trades + - amount + type: + - float + + order_books: + request: + template: funds/{currency_pair}/orderbook + pair_template: + template: "{first}{second}" + lower_case: false + params: + limit: + default: 50 + response: + type: dict + values: + date: + type: str + asks: + type: list + values: + type: dict + values: + price: + type: float + amount: + type: float + bids: + type: list + values: + type: dict + values: + price: + type: float + amount: + type: float + + mapping: + - key: time + path: + - date + type: + - str + - dateparser + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - amount + type: + - float + - key: bids_price + path: + - bids + - price + type: + - float + - key: asks_amount + path: + - asks + - amount + type: + - float + - key: asks_price + path: + - asks + - price + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/upbit.yaml b/pandas_datareader/crypto_utils/resources/upbit.yaml new file mode 100644 index 00000000..0beb46fa --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/upbit.yaml @@ -0,0 +1,320 @@ +name: upbit +exchange: true +api_url: https://api.upbit.com/v1/ +rate_limit: null + +requests: + currency_pairs: + request: + template: market/all + pair_template: null + params: null + response: + type: list + values: + type: dict + values: + market: # e.g. KRW-BTC + type: str + korean_name: + type: str + english_name: + type: str + mapping: + - key: currency_pair_first + path: + - market + type: + - str + - split + - "-" + - 1 + - key: currency_pair_second + path: + - market + type: + - str + - split + - "-" + - 0 + + historic_rates: + request: + template: candles/{frequency} + pair_template: # e.g. KRW-BTC + template: "{second}-{first}" + lower_case: false + alias: market + params: + frequency: + allowed: + minutes: minutes/1 + hours: minutes/60 + days: days + weeks: weeks + months: months + default: days + to: + function: last_timestamp + type: + - datetime + - format + - "%Y-%m-%dT%H:%M:%S.%fZ" + count: + type: int + max: 200 + default: 200 + response: + type: list + values: + type: dict + values: + market: + type: str + candle_date_time_utc: + type: + - str + candle_date_time_kst: + type: + - str + opening_price: + type: float + high_price: + type: float + low_price: + type: float + trade_price: + type: float + timestamp: + type: + - int + candle_acc_trade_price: + type: float + candle_acc_trade_volume: + type: float + mapping: + - key: open + path: + - opening_price + type: + - float + - key: high + path: + - high_price + type: + - float + - key: low + path: + - low_price + type: + - float + - key: close + path: + - trade_price + type: + - float + - key: time + path: + - candle_date_time_utc + type: + - str + - dateparser + - key: volume + path: + - candle_acc_trade_volume + type: + - float + + trades: + request: + template: trades/ticks + pair_template: # e.g. KRW-BTC + template: "{second}-{first}" + lower_case: false + alias: market + params: + count: + type: int + default: 1000 + response: + type: list + values: + type: dict + values: + market: + type: str + trade_date_utc: + type: + - str + - strptime + - "%Y-%m-%d" + trade_time_utc: + type: + - str + - strptime + - "%H:%M:%S" + timestamp: + type: + - float + - from_timestamp + - 0 + trade_price: + type: float + trade_volume: + type: float + prev_closing_price: + type: float + change_price: + type: float + ask_bid: # ask or bid + type: str + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: price + path: + - trade_price + type: + - float + - key: amount + path: + - trade_volume + type: + - float + - key: direction + path: + - ask_bid + type: + - value + - map + - ASK + - sell + - BID + - buy + - key: id + path: + - sequential_id + type: + - float + + tickers: + request: + template: ticker + pair_template: + template: "{second}-{first}" + lower_case: false + alias: markets + params: null + response: + type: list + values: + type: dict + values: + market: + type: str + trade_date: + type: str + trade_time: + type: str + trade_timestamp: + type: int + trade_price: + type: int + mapping: + - key: time + path: + - trade_timestamp + type: + - float + - from_timestamp + - 1 + - key: last_price + path: + - trade_price + type: + - float + + order_books: + request: + template: orderbook + pair_template: # e.g. KRW-BTC + template: "{second}-{first}" + lower_case: false + alias: markets + params: null + response: + type: list + values: + type: dict + values: + market: + type: str + timestamp: + type: + - float + - from_timestamp + - 0 + total_ask_size: + type: float + total_bid_size: + type: float + orderbook_units: + type: list + values: + type: dict + values: + ask_price: + type: float + bid_price: + type: float + ask_size: + type: float + bid_size: + type: float + mapping: + - key: time + path: + - timestamp + type: + - float + - from_timestamp + - 1 + - key: id + path: + - timestamp + type: + - int + - key: position + path: [] + type: + - none + - range + - key: asks_price + path: + - orderbook_units + - ask_price + type: + - float + - key: bids_price + path: + - orderbook_units + - bid_price + type: + - float + - key: asks_amount + path: + - orderbook_units + - ask_size + type: + - float + - key: bids_amount + path: + - orderbook_units + - bid_size + type: + - float diff --git a/pandas_datareader/crypto_utils/resources/vindax.yaml b/pandas_datareader/crypto_utils/resources/vindax.yaml new file mode 100644 index 00000000..2f6c7f90 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/vindax.yaml @@ -0,0 +1,350 @@ +name: vindax +exchange: true +api_url: https://api.vindax.com/api/v1/ +rate_limit: + max: 6 + unit: 1 + +requests: + currency_pairs: + request: + template: returnTicker + pair_template: null + params: null + response: + type: dict + values: + currency_pair: + type: dict + + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + + tickers: + request: + template: returnTicker + pair_template: null + params: null + response: + type: dict + values: + currency_pair: + type: dict + values: + quote_volume: + type: str + symbol: + type: str + percentChange: + type: float + last: + type: float + highestBid: + type: float + lowsetAsk: + type: float + baseVolume: + type: float + openTime: + type: int + closeTime: + type: int + high24hr: + type: float + low24hr: + type: float + isFrozen: + type: bool + + mapping: + - key: time + path: [] + type: + - none + - now + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - dict_values + - last + type: + - float + - key: best_bid + path: + - dict_values + - highestBid + type: + - float + - key: best_ask + path: + - dict_values + - lowsetAsk + type: + - float + + + order_books: + request: + template: depth + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 1000 + default: 50 + response: + type: dict + values: + lastUpdateId: + type: str + bids: + type: list + values: + type: list + values: + 0: #Price + type: float + 1: #Qty + type: float + asks: + type: list + values: + type: list + values: + 0: + type: float + 1: + type: float + mapping: + - key: id + path: [] + type: + - none + - now_timestamp + - key: time + path: [] + type: + - none + - now + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - float + - key: asks_amount + path: + - asks + - 1 + type: + - float + - key: bids_price + path: + - bids + - 0 + type: + - float + - key: asks_price + path: + - asks + - 0 + type: + - float + + + trades: + request: + template: trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 500 + default: 100 + + response: + type: list + values: + type: dict + values: + id: + type: str + price: + type: str + qty: + type: str + time: + type: int + isBuyerMaker: + type: true + isBestMatch: + type: true + mapping: + - key: id + path: + - id + type: + - str + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - true + - sell + - false + - buy + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + + + + historic_rates: + request: + template: klines + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 500 + default: 1000 + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + default: 1d + endTime: + function: last_timestamp + type: + - datetime + - timestampms + + response: + type: list + values: + type: list + values: + 0: + type: int + 1: + type: str + 2: + type: str + 3: + type: str + 4: + type: str + 5: + type: str + 6: + type: str + 7: + type: str + mapping: + - key: time + path: + - [] + - 6 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - [] + - 1 + type: + - str + - float + - key: high + path: + - [] + - 2 + type: + - str + - float + - key: low + path: + - [] + - 3 + type: + - str + - float + - key: close + path: + - [] + - 4 + type: + - str + - float + - key: volume + path: + - [] + - 5 + type: + - str + - float diff --git a/pandas_datareader/crypto_utils/resources/xt.yaml b/pandas_datareader/crypto_utils/resources/xt.yaml new file mode 100644 index 00000000..757a2b96 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/xt.yaml @@ -0,0 +1,328 @@ + +name: xt +exchange: true +api_docs: https://github.com/xtpub/api-doc/blob/master/rest-api-v1-en.md +rate_limit: + max: 1000 + unit: 60 + +api_url: https://api.xt.com + +requests: + currency_pairs: + request: + template: /data/api/v1/getMarketConfig + pair_template: null + params: null + + response: + type: + type: list + values: + currency_pair: + type: dict + + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + + tickers: + request: + template: /data/api/v1/getTickers + pair_template: null + params: null + response: + type: dict + values: + currency_pair: + type: dict + values: + price: + type: float + ask: + type: float + bid: + type: float + coinVol: + type: float + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - dict_values + - price + type: + - float + - key: time + path: [] + type: + - none + - now + - key: best_bid + path: + - dict_values + - bid + type: + - float + - key: best_ask + path: + - dict_values + - ask + type: + - float + - key: daily_volume + path: + - dict_values + - coinVol + type: + - float + + historic_rates: + request: + template: /data/api/v1/getKLine + pair_template: + template: "{first}_{second}" + lower_case: true + alias: market + params: + type: + allowed: + minutes: 1min + hours: 1hour + days: 1day + weeks: 7day + months: 30day + default: 1day + since: + function: last_timestamp + type: + - datetime + - timestamp + response: + type: dict + values: + datas: + type: list + values: + type: list + values: + 0: #time + type: int + 1: #open + type: float + 2: #high + type: float + 3: #low + type: float + 4: #close + type: float + 5: #vol + type: float + 6: #turnover + type: float + + mapping: + - key: time + path: + - datas + - 0 + type: + - float + - from_timestamp + - 0 + - key: open + path: + - datas + - 1 + type: + - float + - key: high + path: + - datas + - 2 + type: + - float + - key: low + path: + - datas + - 3 + type: + - float + - key: close + path: + - datas + - 4 + type: + - float + - key: volume + path: + - datas + - 5 + type: + - float + + + trades: + request: + template: /data/api/v1/getTrades + pair_template: + template: "{first}_{second}" + lower_case: true + alias: market + params: null + + response: + type: list + values: + type: list + values: + 0: #time + type: int + 1: #price + type: float + 2: #quantity + type: float + 3: # directoin + type: str + 4: #id + type: int + + mapping: + - key: time + path: + - [] + - 0 + type: + - float + - from_timestamp + - 1 + - key: id + path: + - [] + - 4 + type: + - int + - key: direction + path: + - [] + - 3 + type: + - value + - map + - bid + - buy + - ask + - sell + - key: price + path: + - [] + - 1 + type: + - float + - key: amount + path: + - [] + - 2 + type: + - float + + order_books: + request: + template: /data/api/v1/getDepth + pair_template: + template: "{first}_{second}" + lower_case: true + alias: market + params: null + + response: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: #price + type: float + 1: #quantity + type: float + bids: + type: list + values: + type: list + values: + 0: #price + type: float + 1: #quantity + type: float + + mapping: + - key: time + path: [] + type: + - none + - now + - key: id + path: [] + type: + - none + - now_timestamp + - key: position + path: [] + type: + - none + - range + - key: bids_amount + path: + - bids + - 1 + type: + - float + - key: bids_price + path: + - bids + - 0 + type: + - float + - key: asks_amount + path: + - asks + - 1 + type: + - float + - key: asks_price + path: + - asks + - 0 + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/xtheta_global.yaml b/pandas_datareader/crypto_utils/resources/xtheta_global.yaml new file mode 100644 index 00000000..c336d4ad --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/xtheta_global.yaml @@ -0,0 +1,303 @@ +name: xtheta_global +is_exchange: true + +api_url: https://api.xthetaglobal.com/ +rate_limit: + max: 1500 + unit: 60 + +requests: + currency_pairs: + request: + template: openapi/v1/brokerInfo + pair_template: null + params: null + + response: + type: dict + values: + symbols: + type: list + values: + type: dict + values: + baseAsset: + type: str + quoteAsset: + type: str + + mapping: + - key: currency_pair_first + path: + - symbols + - baseAsset + type: + - str + - key: currency_pair_second + path: + - symbols + - quoteAsset + type: + - str + + tickers: + request: + template: openapi/quote/v1/ticker/price + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: null + + response: + type: dict + values: + symbol: + type: str + price: + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: last_price + path: + - price + type: + - str + - float + + order_books: + request: + template: openapi/quote/v1/depth + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 100 + default: 100 + response: + type: dict + values: + time: + type: int + bids: + type: list + values: + type: list + 0: #price + type: str + 1: #qty + type: str + asks: + type: list + values: + type: list + 0: + type: str + 1: + type: str + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: id + path: + - time + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bids + - 0 + type: + - str + - float + - key: bids_amount + path: + - bids + - 1 + type: + - str + - float + - key: asks_price + path: + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - asks + - 1 + type: + - str + - float + + trades: + request: + template: openapi/quote/v1/trades + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + limit: + type: int + max: 1000 + default: 500 + response: + type: list + value: + type: dict + values: + price: + type: str + qty: + typ: str + time: + type: int + isBuyerMaker: + type: bool + mapping: + - key: time + path: + - time + type: + - float + - from_timestamp + - 1 + - key: direction + path: + - isBuyerMaker + type: + - value + - map + - True + - sell + - False + - buy + - key: id + path: + - time + type: + - int + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - qty + type: + - str + - float + + historic_rates: + request: + template: openapi/quote/v1/klines + pair_template: + template: "{first}{second}" + lower_case: false + alias: symbol + params: + interval: + allowed: + minutes: 1m + hours: 1h + days: 1d + weeks: 1w + default: 1d + limit: + type: int + max: 1000 + default: 1000 + endTime: + function: last_timestamp + type: + - datetime + - timestampms + + response: + type: list + values: + type: list + values: + 0: #timestamp + type: int + 1: #open + type: str + 2: #high + type: str + 3: #low + type: str + 4: #close + type: str + 5: #volume + type: str + 6: #close time + type: int + 7: # quote Asset volume + type: str + 8: # number of trades + type: int + 9: # taker buy base asset volume + type: str + 10: # taker buy quote asset volume + type: str + + mapping: + - key: time + path: + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - 1 + type: + - str + - float + - key: high + path: + - 2 + type: + - str + - float + - key: low + path: + - 3 + type: + - str + - float + - key: close + path: + - 4 + type: + - str + - float + - key: volume + path: + - 5 + type: + - str + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/zb.yaml b/pandas_datareader/crypto_utils/resources/zb.yaml new file mode 100644 index 00000000..dd56aa37 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/zb.yaml @@ -0,0 +1,322 @@ +name: zb +is_exchange: true +api_docs: https://www.zb.com/en/api +api_url: http://api.zb.land/ +rate_limit: + max: 60 + unit: 60 + +requests: + currency_pairs: + request: + template: data/v1/markets + pair_template: null + params: null + + response: + type: dict + values: + currency_pair: + type: dict + values: + priceScale: + type: int + + mapping: + - key: currency_pair_first + path: + - dict_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - dict_key + type: + - str + - split + - "_" + - 1 + + tickers: + request: + template: data/v1/ticker + pair_template: + template: "{first}_{second}" + lower_case: true + alias: market + params: null + + response: + type: dict + values: + date: + type: int + ticker: + type: dict + values: + vol: + type: str + last: + type: str + buy: + type: str + sell: + type: str + mapping: + - key: time + path: + - date + type: + - str + - float + - from_timestamp + - 1 + - key: last_price + path: + - ticker + - last + type: + - str + - float + - key: best_ask + path: + - ticker + - sell + type: + - str + - float + - key: best_bid + path: + - ticker + - buy + type: + - str + - float + - key: daily_volume + path: + - ticker + - vol + type: + - str + - float + + + order_books: + request: + template: data/v1/depth + pair_template: + template: "{first}_{second}" + lower_case: true + alias: market + params: + size: + type: int + max: 50 + default: 50 + response: + type: dict + values: + timestamp: + type: int + bids: + type: list + values: + type: list + 0: #price + type: float + 1: #qty + type: float + asks: + type: list + values: + type: list + 0: + type: float + 1: + type: float + mapping: + - key: timestamp + path: + - timestamp + type: + - float + - from_timestamp + - 0 + - key: id + path: + - timestamp + type: + - int + - key: position + path: [] + type: + - none + - range + - key: bids_price + path: + - bids + - 0 + type: + - float + - key: bids_amount + path: + - bids + - 1 + type: + - float + - key: asks_price + path: + - asks + - 0 + type: + - float + - key: asks_amount + path: + - asks + - 1 + type: + - float + + trades: + request: + template: data/v1/trades + pair_template: + template: "{first}_{second}" + lower_case: true + alias: market + params: null + response: + type: list + value: + type: dict + values: + price: + type: str + amount: + typ: str + date: + type: int + type: + type: str + tid: + type: int + mapping: + - key: time + path: + - date + type: + - float + - from_timestamp + - 0 + - key: direction + path: + - type + type: + - str + - key: id + path: + - tid + type: + - int + - key: price + path: + - price + type: + - str + - float + - key: amount + path: + - amount + type: + - str + - float + + historic_rates: + request: + template: data/v1/kline + pair_template: + template: "{first}_{second}" + lower_case: true + alias: market + params: + type: + allowed: + minutes: 1min + days: 1day + hours: 1hour + weeks: 1week + default: 1day + since: + function: last_timestamp + type: + - datetime + - timedeltams + - interval + - 1000 + limit: + type: int + max: 1000 + default: 1000 + + + response: + type: dict + values: + data: + type: list + values: + 0: #timestamp + type: int + 1: #open + type: float + 2: #high + type: float + 3: #low + type: float + 4: #close + type: float + 5: #volume + type: float + + mapping: + - key: time + path: + - data + - 0 + type: + - float + - from_timestamp + - 1 + - key: open + path: + - data + - 1 + type: + - float + - key: high + path: + - data + - 2 + type: + - float + - key: low + path: + - data + - 3 + type: + - float + - key: close + path: + - data + - 4 + type: + - float + - key: volume + path: + - data + - 5 + type: + - float \ No newline at end of file diff --git a/pandas_datareader/crypto_utils/resources/zbg.yaml b/pandas_datareader/crypto_utils/resources/zbg.yaml new file mode 100644 index 00000000..91d05d98 --- /dev/null +++ b/pandas_datareader/crypto_utils/resources/zbg.yaml @@ -0,0 +1,405 @@ +# Trade direction is available but not certain what is meant... +name: zbg +exchange: true +api_url: https://kline.zbg.com/ + +rate_limit: + max: 1000 + unit: 60 + +requests: + currency_pairs: + request: + template: /exchange/api/v1/common/symbols + pair_template: null + params: null + + response: + type: dict + values: + datas: + type: list + values: + type: dict + values: + symbol: + type: str + base-currency: + type: str + quote-currency: + type: str + + mapping: + - key: currency_pair_first + path: + - datas + - base-currency + type: + - str + - key: currency_pair_second + path: + - datas + - quote-currency + type: + - str + + + tickers: + request: + template: api/data/v1/tickers + pair_template: null + params: + isUseMarketName: + type: str + default: "true" + response: + type: dict + values: + datas: + type: dict + values: + currency_pair: + type: list + values: + 0: #marketId + type: str + 1: #last price + type: str + 2: #highest price + type: str + 3: #lowest + type: str + 4: #24h volume + type: str + 5: #24h change + type: str + 6: # + type: str + 7: #top buying price + type: str + 8: #top selling price + type: str + 9: #24h volume in unit of buyers currency + type: str + mapping: + - key: time + path: [] + type: + - none + - now + - key: currency_pair_first + path: + - datas + - list_key + type: + - str + - split + - "_" + - 0 + - key: currency_pair_second + path: + - datas + - list_key + type: + - str + - split + - "_" + - 1 + - key: last_price + path: + - datas + - list_values + - 1 + type: + - str + - float + - key: daily_volume + path: + - datas + - list_values + - 4 + type: + - str + - float + - key: best_bid + path: + - datas + - list_values + - 7 + type: + - str + - float + - key: best_ask + path: + - datas + - list_values + - 8 + type: + - str + - float + + + historic_rates: + request: + template: api/data/v1/klines + pair_template: + template: "{first}_{second}" + lower_case: false + alias: marketName + params: + type: + allowed: + minutes: 1M + hours: 1H + days: 1D + weeks: 1W + default: 1D + dataSize: + type: int + default: 10000 + + response: + type: dict + values: + datas: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + 2: # pair + type: str + 3: # time + type: str + 4: # open + type: str + 5: # high + type: str + 6: # low + type: str + 7: # close + type: str + 8: # base volume + type: str + 13: # quote volume + type: str + mapping: + - key: time + path: + - datas + - 3 + type: + - str + - float + - from_timestamp + - 0 + - key: open + path: + - datas + - 4 + type: + - str + - float + - key: high + path: + - datas + - 5 + type: + - str + - float + - key: low + path: + - datas + - 6 + type: + - str + - float + - key: close + path: + - datas + - 7 + type: + - str + - float + - key: volume + path: + - datas + - 8 + type: + - str + - float + + trades: + request: + template: /api/data/v1/trades + pair_template: + template: "{first}_{second}" + lower_case: false + alias: marketName + params: + dataSize: + type: int + max: 1000 + default: 1000 + + response: + type: dict + values: + datas: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + 2: # time + type: str + 3: # pair + type: str + 4: # direction + type: str + 5: # price + type: str + 6: # qty + type: str + mapping: + - key: id + path: + - datas + - 2 + type: + - str + - int + - key: time + path: + - datas + - 2 + type: + - str + - float + - from_timestamp + - 0 + - key: price + path: + - datas + - 5 + type: + - str + - float + - key: amount + path: + - datas + - 6 + type: + - str + - float +# - key: direction # not certain what bid and ask for a direction is +# path: +# - datas +# - 4 +# type: +# - map +# - values +# - bid +# - sell +# - ask +# - buy + + order_books: + request: + template: api/data/v1/entrusts + pair_template: + template: "{first}_{second}" + lower_case: false + alias: marketName + params: + dataSize: + type: int + max: 200 + default: 50 + + response: + type: dict + values: + datas: + type: dict + values: + asks: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + bids: + type: list + values: + type: list + values: + 0: + type: str + 1: + type: str + timestamp: + type: str + mapping: + - key: id + path: + - datas + - timestamp + type: + - str + - int + - key: position + path: [] + type: + - none + - range + - key: time + path: + - datas + - timestamp + type: + - str + - float + - from_timestamp + - 0 + - key: bids_amount + path: + - datas + - bids + - 1 + type: + - str + - float + - key: bids_price + path: + - datas + - bids + - 0 + type: + - str + - float + - key: asks_price + path: + - datas + - asks + - 0 + type: + - str + - float + - key: asks_amount + path: + - datas + - asks + - 1 + type: + - str + - float From fa1789c07be1cc5a5d21fea4fe0597decb87ea62 Mon Sep 17 00:00:00 2001 From: Steffen Date: Sun, 28 Nov 2021 14:27:47 +0100 Subject: [PATCH 20/25] Codestype Black --- pandas_datareader/__init__.py | 2 +- pandas_datareader/crypto.py | 57 +- pandas_datareader/crypto_utils/_paths.py | 4 +- pandas_datareader/crypto_utils/exchange.py | 152 +++- pandas_datareader/crypto_utils/mapping.py | 64 +- pandas_datareader/crypto_utils/time_helper.py | 6 +- pandas_datareader/crypto_utils/utilities.py | 200 +++-- pandas_datareader/data.py | 6 +- pandas_datareader/exceptions.py | 2 +- pandas_datareader/tests/test_cryptoreader.py | 752 ++++++++---------- 10 files changed, 639 insertions(+), 606 deletions(-) diff --git a/pandas_datareader/__init__.py b/pandas_datareader/__init__.py index 2ab84c1b..6c9dbdf7 100644 --- a/pandas_datareader/__init__.py +++ b/pandas_datareader/__init__.py @@ -28,7 +28,7 @@ get_records_iex, get_summary_iex, get_tops_iex, - get_data_crypto + get_data_crypto, ) PKG = os.path.dirname(__file__) diff --git a/pandas_datareader/crypto.py b/pandas_datareader/crypto.py index cc0da8c1..2ca8821e 100644 --- a/pandas_datareader/crypto.py +++ b/pandas_datareader/crypto.py @@ -25,13 +25,15 @@ class CryptoReader(Exchange, ABC): the _BaseReader. """ - def __init__(self, - exchange_name: str, - symbols: Union[str, dict], - start: Union[str, datetime] = datetime(2009, 1, 1), - end: Union[str, datetime] = None, - interval: str = "days", - **kwargs): + def __init__( + self, + exchange_name: str, + symbols: Union[str, dict], + start: Union[str, datetime] = datetime(2009, 1, 1), + end: Union[str, datetime] = None, + interval: str = "days", + **kwargs, + ): """ Constructor. Inherits from the Exchange and _BaseReader class. @param exchange_name: String repr of the exchange name @@ -42,7 +44,9 @@ def __init__(self, @param **kwargs: Additional kw-arguments for the _BaseReader class. """ - super(CryptoReader, self).__init__(exchange_name, interval, symbols, start, end, **kwargs) + super(CryptoReader, self).__init__( + exchange_name, interval, symbols, start, end, **kwargs + ) def _get_data(self) -> Dict: """ Requests the data and returns the response json. @@ -76,8 +80,10 @@ def read(self, new_symbols: str = None) -> pd.DataFrame: # Check if the provided currency-pair is listed on the exchange. if not self._check_symbols(): - raise KeyError(f"The provided currency-pair is not listed on '{self.name.capitalize()}'. " - f"Call CryptoReader.get_currency_pairs() for an overview.") + raise KeyError( + f"The provided currency-pair is not listed on '{self.name.capitalize()}'. " + f"Call CryptoReader.get_currency_pairs() for an overview." + ) result = list() # Repeat until no "older" timestamp is delivered. Cryptocurrency exchanges often restrict the amount of @@ -103,7 +109,7 @@ def read(self, new_symbols: str = None) -> pd.DataFrame: # Find the place in the mapping list for the key "time". time_key = {v: k for k, v in enumerate(mappings)} - time_key = time_key.get('time') + time_key = time_key.get("time") # Extract the minimum timestamp from the response for further requests. new_time = min(item[time_key] for item in data) @@ -136,7 +142,9 @@ def get_all_exchanges() -> List: return get_exchange_names() - def get_currency_pairs(self, raw_data: bool = False) -> Optional[Union[pd.DataFrame, List]]: + def get_currency_pairs( + self, raw_data: bool = False + ) -> Optional[Union[pd.DataFrame, List]]: """ Requests all supported currency pairs from the exchange. @param raw_data: Return the raw data as a list of tuples. @@ -151,19 +159,32 @@ def get_currency_pairs(self, raw_data: bool = False) -> Optional[Union[pd.DataFr except (requests.exceptions.MissingSchema, Exception): return None - return pd.DataFrame(resp, columns=["Exchange", "Base", "Quote"]) if not raw_data else resp + return ( + pd.DataFrame(resp, columns=["Exchange", "Base", "Quote"]) + if not raw_data + else resp + ) def _check_symbols(self) -> bool: """ Checks if the specified currency-pair is listed on the exchange""" currency_pairs = self.get_currency_pairs(raw_data=True) - symbols = self.symbols.keys() if isinstance(self.symbols, dict) else [self.symbols] + symbols = ( + self.symbols.keys() if isinstance(self.symbols, dict) else [self.symbols] + ) if currency_pairs is None: - warnings.warn("Currency-pair request is dysfunctional. Check for valid symbols is skipped.") + warnings.warn( + "Currency-pair request is dysfunctional. Check for valid symbols is skipped." + ) return True - return all([(self.name, *symbol.lower().split("/")) in currency_pairs for symbol in symbols]) + return all( + [ + (self.name, *symbol.lower().split("/")) in currency_pairs + for symbol in symbols + ] + ) def _await_rate_limit(self): """ Sleep time in order to not violate the rate limit, measured in requests per minute.""" @@ -182,6 +203,8 @@ def _index_and_cut_dataframe(self, dataframe: pd.DataFrame) -> pd.DataFrame: dataframe.sort_index(inplace=True) # Returned timestamps from the exchanges are converted into UTC and therefore timezone aware. # Make start and end dates timezone aware in order to make them comparable. - dataframe = dataframe.loc[pytz.utc.localize(self.start): pytz.utc.localize(self.end)] + dataframe = dataframe.loc[ + pytz.utc.localize(self.start) : pytz.utc.localize(self.end) + ] return sort_columns(dataframe) diff --git a/pandas_datareader/crypto_utils/_paths.py b/pandas_datareader/crypto_utils/_paths.py index 4e036a22..8288746e 100644 --- a/pandas_datareader/crypto_utils/_paths.py +++ b/pandas_datareader/crypto_utils/_paths.py @@ -12,5 +12,7 @@ # sys.path.insert(0, os.path.dirname(__file__)) all_paths = { - "yaml_path": Path(os.path.dirname(os.path.realpath(__file__))).joinpath("resources/"), + "yaml_path": Path(os.path.dirname(os.path.realpath(__file__))).joinpath( + "resources/" + ), } diff --git a/pandas_datareader/crypto_utils/exchange.py b/pandas_datareader/crypto_utils/exchange.py index a9e9f947..aece2c53 100644 --- a/pandas_datareader/crypto_utils/exchange.py +++ b/pandas_datareader/crypto_utils/exchange.py @@ -9,7 +9,11 @@ from collections import OrderedDict, deque import itertools -from pandas_datareader.crypto_utils.utilities import yaml_loader, replace_list_item, split_str_to_list +from pandas_datareader.crypto_utils.utilities import ( + yaml_loader, + replace_list_item, + split_str_to_list, +) from pandas_datareader.crypto_utils.mapping import extract_mappings from pandas_datareader.crypto_utils.mapping import convert_type from pandas_datareader.base import _BaseReader @@ -20,7 +24,7 @@ class Exchange(_BaseReader, ABC): """ Class for every exchange supported. The class extracts the request url, fits parameters, extracts the values from the response json and performs type-conversions.""" - def __init__(self, exchange_name: str, interval: str = 'days', *args, **kwargs): + def __init__(self, exchange_name: str, interval: str = "days", *args, **kwargs): """ Constructor. @param exchange_name: The exchange name. @@ -92,11 +96,16 @@ def url_and_params(self, request_type): pair_formatted = self.apply_currency_pair_format(currency_pair) parameters = self.param_dict.get(request_type).get("params") - parameters.update({key: parameters[key][currency_pair] - for key, val in parameters.items() if isinstance(val, dict)}) + parameters.update( + { + key: parameters[key][currency_pair] + for key, val in parameters.items() + if isinstance(val, dict) + } + ) if not pair_template and request_type == "currency_pairs": - self._url_and_params = {'url': url, 'params': parameters} + self._url_and_params = {"url": url, "params": parameters} return # Case 1: Currency-Pairs in request parameters: eg. www.test.com?market=BTC-USD @@ -107,15 +116,17 @@ def url_and_params(self, request_type): parameters.update({"currency_pair": pair_formatted}) else: - self._url_and_params = {'url': url, 'params': parameters} + self._url_and_params = {"url": url, "params": parameters} return - variables = [item[1] for item in string.Formatter().parse(url) if item[1] is not None] + variables = [ + item[1] for item in string.Formatter().parse(url) if item[1] is not None + ] url_formatted = url.format(**parameters) # Drop params who are filled directly into the url parameters = {k: v for k, v in parameters.items() if k not in variables} - self._url_and_params = {'url': url_formatted, 'params': parameters} + self._url_and_params = {"url": url_formatted, "params": parameters} @param_dict.setter def param_dict(self, request_type: str): @@ -127,7 +138,9 @@ def param_dict(self, request_type: str): request_dict = self.yaml_file.get("requests").get(request_type).get("request") request_parameters = dict() - request_parameters["url"] = self.yaml_file.get("api_url", "") + request_dict.get("template", "") + request_parameters["url"] = self.yaml_file.get( + "api_url", "" + ) + request_dict.get("template", "") request_parameters["pair_template"] = request_dict.get("pair_template", None) urls = dict() parameter = dict() @@ -139,8 +152,12 @@ def param_dict(self, request_type: str): self._param_dict = urls return - mapping: dict = {"allowed": self._allowed, "function": self._function, - "default": self._default, "type": self._type_con} + mapping: dict = { + "allowed": self._allowed, + "function": self._function, + "default": self._default, + "type": self._type_con, + } # enumerate mapping dict to sort parameter values accordingly, i.e. {"allowed": 0, "function": 1, ...} mapping_index = {val: key for key, val in enumerate(mapping.keys())} @@ -150,7 +167,9 @@ def param_dict(self, request_type: str): # Sort the dict options according to the mapping-keys to ensure the right order of function calls. # Otherwise a (valid) specified value might be overwritten by the default value. options = {k: v for k, v in options.items() if k in mapping.keys()} - options = OrderedDict(sorted(options.items(), key=lambda x: mapping_index.get(x[0]))) + options = OrderedDict( + sorted(options.items(), key=lambda x: mapping_index.get(x[0])) + ) if not parameters[param].get("required", True): continue @@ -178,7 +197,13 @@ def _allowed(self, val: dict, **_: dict) -> Any: value = val.get(self.interval, None) if not bool(value): - all_intervals = {"minutes": 1, "hours": 2, "days": 3, "weeks": 4, "months": 5} + all_intervals = { + "minutes": 1, + "hours": 2, + "days": 3, + "weeks": 4, + "months": 5, + } self.interval = {v: k for k, v in val.items() if all_intervals.get(k)} return value @@ -192,7 +217,10 @@ def _function(self, val: str, **kwargs: dict) -> Dict[str, datetime]: """ if val == "last_timestamp": - return {cp: self._get_first_timestamp(last_ts) for cp, last_ts in kwargs.get("currency_pairs").items()} + return { + cp: self._get_first_timestamp(last_ts) + for cp, last_ts in kwargs.get("currency_pairs").items() + } def _default(self, val: str, **kwargs: dict) -> Optional[str]: """ Returns the default value if kwargs value (the parameter) is None. @@ -202,7 +230,9 @@ def _default(self, val: str, **kwargs: dict) -> Optional[str]: @return: Default value as a string. """ - default_val = val if not bool(kwargs.get("has_value")) else kwargs.get("has_value") + default_val = ( + val if not bool(kwargs.get("has_value")) else kwargs.get("has_value") + ) if isinstance(self.interval, dict): self.interval = self.interval.get(default_val, None) @@ -229,7 +259,10 @@ def _type_con(self, val: Any, **kwargs: dict) -> Any: # return {cp: convert_type(param_value[cp], deque(conv_params)) for cp in currency_pairs} # ToDo: Check if the above line works. The older version needed both if statements below. if isinstance(param_value, dict): - return {cp: convert_type(param_value[cp], deque(conv_params)) for cp in kwargs.get("currency_pairs")} + return { + cp: convert_type(param_value[cp], deque(conv_params)) + for cp in kwargs.get("currency_pairs") + } elif isinstance(conv_params, list): return convert_type(param_value, deque(conv_params)) @@ -248,7 +281,9 @@ def _get_first_timestamp(self, last_ts: datetime) -> datetime: else: return self.end - def format_data(self, responses: Union[Dict, List]) -> Tuple[Optional[List], Optional[List]]: + def format_data( + self, responses: Union[Dict, List] + ) -> Tuple[Optional[List], Optional[List]]: """ Extracts and formats the response data, according to the mapping keys and path. Data is then ordered and returned as a tuple. @@ -260,16 +295,22 @@ def format_data(self, responses: Union[Dict, List]) -> Tuple[Optional[List], Opt raise EmptyResponseError results = list() - mappings = extract_mappings(self.name, self.yaml_file.get('requests')).get('historic_rates') + mappings = extract_mappings(self.name, self.yaml_file.get("requests")).get( + "historic_rates" + ) mapping_keys = [mapping.key for mapping in mappings] # creating dictionary where key is the name of the mapping which holds an empty list - temp_results = dict(zip((key for key in mapping_keys), itertools.repeat([], len(mappings)))) + temp_results = dict( + zip((key for key in mapping_keys), itertools.repeat([], len(mappings))) + ) try: for mapping in mappings: if "interval" in mapping.types: - mapping.types = replace_list_item(mapping.types, "interval", self.interval) + mapping.types = replace_list_item( + mapping.types, "interval", self.interval + ) temp_results[mapping.key] = mapping.extract_value(responses) @@ -286,25 +327,36 @@ def format_data(self, responses: Union[Dict, List]) -> Tuple[Optional[List], Opt # CHANGE: One filed invalid -> all fields invalid. # changed this in order to avoid responses kicked out just because of one invalid field. # The response will be filtered out in the DB-Handler if the primary-keys are missing anyways. - if all(value is None and not isinstance(value, datetime) for value in list(temp_results.values())): + if all( + value is None and not isinstance(value, datetime) + for value in list(temp_results.values()) + ): return None, None # asserting that the extracted lists for each mapping are having the same length assert (len(results[0]) == len(result) for result in temp_results) - len_results = {key: len(value) for key, value in temp_results.items() if hasattr(value, "__iter__")} + len_results = { + key: len(value) + for key, value in temp_results.items() + if hasattr(value, "__iter__") + } len_results = max(len_results.values()) if bool(len_results) else 1 # update new keys only if not already exists to prevent overwriting! # temp_results = {"time": time, **temp_results} - result = [v if hasattr(v, "__iter__") - else itertools.repeat(v, len_results) for k, v in temp_results.items()] + result = [ + v if hasattr(v, "__iter__") else itertools.repeat(v, len_results) + for k, v in temp_results.items() + ] result = list(itertools.zip_longest(*result)) return result, list(temp_results.keys()) - def format_currency_pairs(self, response: Tuple[str, dict]) -> Optional[Iterator[Tuple[str, str, str]]]: + def format_currency_pairs( + self, response: Tuple[str, dict] + ) -> Optional[Iterator[Tuple[str, str, str]]]: """ Extracts the currency-pairs of out of the given json-response that was collected from the Rest-API of this exchange. @@ -318,9 +370,10 @@ def format_currency_pairs(self, response: Tuple[str, dict]) -> Optional[Iterator (self.name, name of first currency-pair, name of second currency-pair) """ - results = {"currency_pair_first": [], - "currency_pair_second": []} - mappings = extract_mappings(self.name, self.yaml_file.get('requests')).get('currency_pairs') + results = {"currency_pair_first": [], "currency_pair_second": []} + mappings = extract_mappings(self.name, self.yaml_file.get("requests")).get( + "currency_pairs" + ) for mapping in mappings: results[mapping.key] = mapping.extract_value(response) @@ -334,16 +387,30 @@ def format_currency_pairs(self, response: Tuple[str, dict]) -> Optional[Iterator # Check if all dict values do have the same length values = list(results.values()) # Get the max length from all dict values - len_results = {key: len(value) for key, value in results.items() if hasattr(value, "__iter__")} + len_results = { + key: len(value) + for key, value in results.items() + if hasattr(value, "__iter__") + } len_results = max(len_results.values()) if bool(len_results) else 1 if not all(len(value) == len_results for value in values): # Update all dict values with equal length - results.update({k: itertools.repeat(*v, len_results) for k, v in results.items() if len(v) == 1}) - - return list(itertools.zip_longest(itertools.repeat(self.name, len_results), - results["currency_pair_first"], - results["currency_pair_second"])) + results.update( + { + k: itertools.repeat(*v, len_results) + for k, v in results.items() + if len(v) == 1 + } + ) + + return list( + itertools.zip_longest( + itertools.repeat(self.name, len_results), + results["currency_pair_first"], + results["currency_pair_second"], + ) + ) def reset_request_start_date(self): """ Reset the end date for the symbols in order to be able to restart a request from the end date.""" @@ -360,7 +427,10 @@ def get_rate_limit(self) -> Union[int, float]: if self.yaml_file["rate_limit"]["max"] <= 0: rate_limit = 0 else: - rate_limit = self.yaml_file["rate_limit"]["unit"] / self.yaml_file["rate_limit"]["max"] + rate_limit = ( + self.yaml_file["rate_limit"]["unit"] + / self.yaml_file["rate_limit"]["max"] + ) else: rate_limit = 0 @@ -376,10 +446,14 @@ def apply_currency_pair_format(self, currency_pair: str) -> str: try: first, second = currency_pair.split("/") except ValueError as e: - raise Exception("Base and quote currency are indistinguishable." - " Currencies must be split by '/': %s" % currency_pair) from e - - request_url_and_params = self.yaml_file.get("requests").get("historic_rates").get("request") + raise Exception( + "Base and quote currency are indistinguishable." + " Currencies must be split by '/': %s" % currency_pair + ) from e + + request_url_and_params = ( + self.yaml_file.get("requests").get("historic_rates").get("request") + ) pair_template_dict = request_url_and_params["pair_template"] pair_template = pair_template_dict["template"] diff --git a/pandas_datareader/crypto_utils/mapping.py b/pandas_datareader/crypto_utils/mapping.py index 7e95f48b..1c501947 100644 --- a/pandas_datareader/crypto_utils/mapping.py +++ b/pandas_datareader/crypto_utils/mapping.py @@ -88,10 +88,7 @@ class Mapping: type conversions within the method "extract_value()". """ - def __init__(self, - key: str, - path: List[str], - types: List[str]): + def __init__(self, key: str, path: List[str], types: List[str]): """ Constructor of Mapping. Constructor method for constructing method objects. @@ -113,8 +110,12 @@ def __init__(self, self.path = path self.types = types - def traverse_path(self, response: Dict[str, Any], path_queue: Deque[str], - currency_pair_info: Tuple[str, str, str] = None) -> Any: + def traverse_path( + self, + response: Dict[str, Any], + path_queue: Deque[str], + currency_pair_info: Tuple[str, str, str] = None, + ) -> Any: """ Traverses the path on a response. Helper method for traversing the path on the given response dict (subset). @@ -158,12 +159,14 @@ def traverse_path(self, response: Dict[str, Any], path_queue: Deque[str], return traversed - def extract_value(self, - response: Any, - path_queue: Deque[str] = None, - types_queue: Deque[str] = None, - iterate: bool = True, - currency_pair_info: Tuple[str, str, str] = (None, None, None)) -> Any: + def extract_value( + self, + response: Any, + path_queue: Deque[str] = None, + types_queue: Deque[str] = None, + iterate: bool = True, + currency_pair_info: Tuple[str, str, str] = (None, None, None), + ) -> Any: """ Extracts the value specified by "self.path". Extracts the value specified by the path sequence and converts it @@ -218,17 +221,12 @@ def extract_value(self, for item in response: if is_scalar(item): - return self.extract_value(response, - path_queue, - types_queue, - iterate=False) + return self.extract_value( + response, path_queue, types_queue, iterate=False + ) result.append( - self.extract_value( - item, - deque(path_queue), - deque(types_queue) - ) + self.extract_value(item, deque(path_queue), deque(types_queue)) ) return result @@ -243,18 +241,20 @@ def extract_value(self, else: # Traverse path - response = self.traverse_path(response, path_queue, currency_pair_info=currency_pair_info) + response = self.traverse_path( + response, path_queue, currency_pair_info=currency_pair_info + ) - if types_queue and response is not None: # None to allow to change 0 to boolean. + if ( + types_queue and response is not None + ): # None to allow to change 0 to boolean. if isinstance(response, list): result = list() for item in response: - result.append( - convert_type(item, deque(types_queue)) - ) + result.append(convert_type(item, deque(types_queue))) # for dict_key special_case aka. test_extract_value_list_containing_dict_where_key_is_value() in test_mapping.py if len(result) == 1: @@ -277,7 +277,9 @@ def __str__(self) -> str: return " / ".join(string_path) + " -> " + str(self.key) -def extract_mappings(exchange_name: str, requests: Dict[str, Any]) -> Dict[str, List[Mapping]]: +def extract_mappings( + exchange_name: str, requests: Dict[str, Any] +) -> Dict[str, List[Mapping]]: """ Helper-Method which should be only called by the constructor. Extracts out of a given exchange .yaml-requests-section for each request the necessary mappings so the values can be extracted from @@ -313,9 +315,13 @@ def extract_mappings(exchange_name: str, requests: Dict[str, Any]) -> Dict[str, try: for entry in mapping: - mapping_list.append(Mapping(entry["key"], entry["path"], entry["type"])) + mapping_list.append( + Mapping(entry["key"], entry["path"], entry["type"]) + ) except KeyError: - print(f"Error loading mappings of {exchange_name} in {request}: {entry}") + print( + f"Error loading mappings of {exchange_name} in {request}: {entry}" + ) break response_mappings[request] = mapping_list diff --git a/pandas_datareader/crypto_utils/time_helper.py b/pandas_datareader/crypto_utils/time_helper.py index 26f58c6f..ebbc4b6b 100644 --- a/pandas_datareader/crypto_utils/time_helper.py +++ b/pandas_datareader/crypto_utils/time_helper.py @@ -40,7 +40,7 @@ class TimeHelper: "hours": "hour", "days": "day", "weeks": "week", - "months": "month" + "months": "month", } @staticmethod @@ -115,7 +115,9 @@ def to_timestamp(date_time: datetime, unit: TimeUnit = TimeUnit.SECONDS) -> floa return date_time.replace(tzinfo=timezone.utc).timestamp() * (1000 ** int(unit)) @staticmethod - def start_end_conversion(date_time: datetime, frequency: str, to_end: bool = True) -> datetime: + def start_end_conversion( + date_time: datetime, frequency: str, to_end: bool = True + ) -> datetime: """ Returns the beginning/end of a period. @param date_time: The datetime object to be converted. diff --git a/pandas_datareader/crypto_utils/utilities.py b/pandas_datareader/crypto_utils/utilities.py index 9cb600e9..788820a4 100644 --- a/pandas_datareader/crypto_utils/utilities.py +++ b/pandas_datareader/crypto_utils/utilities.py @@ -20,188 +20,166 @@ import pandas_datareader.crypto_utils._paths as _paths TYPE_CONVERSIONS = { - ("float", "from_timestamp"): { - "function": TimeHelper.from_timestamp, - "params": 1 - }, - ("bool", "int"): { - "function": int, - "params": 0 - }, - ("float", "int"): { - "function": int, - "params": 0 - }, - ("int", "bool"): { - "function": bool, - "params": 0 - }, - ("int", "div"): { - "function": lambda integer, div: integer / (1 * div), - "params": 1 - }, - ("any", "value"): { - "function": lambda number: float(number) > 0, - "params": 0 - }, - ("str", "bool"): { - "function": lambda string: string.lower() == "true", - "params": 0 - }, - ("str", "int"): { - "function": int, - "params": 0 - }, - ("str", "float"): { - "function": float, - "params": 0 - }, + ("float", "from_timestamp"): {"function": TimeHelper.from_timestamp, "params": 1}, + ("bool", "int"): {"function": int, "params": 0}, + ("float", "int"): {"function": int, "params": 0}, + ("int", "bool"): {"function": bool, "params": 0}, + ("int", "div"): {"function": lambda integer, div: integer / (1 * div), "params": 1}, + ("any", "value"): {"function": lambda number: float(number) > 0, "params": 0}, + ("str", "bool"): {"function": lambda string: string.lower() == "true", "params": 0}, + ("str", "int"): {"function": int, "params": 0}, + ("str", "float"): {"function": float, "params": 0}, ("str", "float_absolut"): { "function": lambda string: abs(float(string)), - "params": 0 + "params": 0, }, ("str", "floatNA"): { "function": lambda string: float(string) if string != "N/A" else None, - "params": 0 + "params": 0, }, ("str", "strptime"): { "function": lambda string, *args: datetime.datetime.strptime(string, args[0]), - "params": 1 + "params": 1, }, ("strptime_w_f", "strptime_wo_f"): { - "function": lambda string, *args: datetime.datetime.strptime(string.split(".")[0], *args), - "params": 1 + "function": lambda string, *args: datetime.datetime.strptime( + string.split(".")[0], *args + ), + "params": 1, }, ("str", "split"): { - "function": lambda string, *args: string.split(args[0])[args[1]] if args[0] in string else None, - "params": 2 + "function": lambda string, *args: string.split(args[0])[args[1]] + if args[0] in string + else None, + "params": 2, }, ("str", "splitupper"): { "function": lambda string, *args: string.split(args[0])[args[1]].upper(), - "params": 2 + "params": 2, }, ("str", "slice"): { - "function": lambda string, *args: string[args[0]:args[1]], - "params": 2 - }, - ("str", "upper"): { - "function": lambda string: string.upper(), - "params": 0 - }, - ("str", "lower"): { - "function": lambda string: string.lower(), - "params": 0 - }, - ("str", "dateparser"): { - "function": dateutil.parser.parse, - "params": 0 + "function": lambda string, *args: string[args[0] : args[1]], + "params": 2, }, + ("str", "upper"): {"function": lambda string: string.upper(), "params": 0}, + ("str", "lower"): {"function": lambda string: string.lower(), "params": 0}, + ("str", "dateparser"): {"function": dateutil.parser.parse, "params": 0}, ("datetime", "strftime"): { "function": lambda time, *args: datetime.datetime.strftime(time, args[0]), - "params": 1 + "params": 1, }, ("dateparser", "totimestamp"): { "function": lambda time: int(time.timestamp()), - "params": 0 + "params": 0, }, ("datetime", "totimestamp"): { "function": lambda time: int(time.timestamp()), - "params": 0 + "params": 0, }, ("datetime", "totimestampms"): { "function": lambda time: int(round(time.timestamp() * 1000)), - "params": 0 + "params": 0, }, ("datetime", "utctotimestamp"): { "function": lambda time: calendar.timegm(time.utctimetuple()), - "params": 0 + "params": 0, }, ("strptime", "totimestamp"): { - "function": lambda string, *args: int(datetime.datetime.timestamp(datetime.datetime.strptime(string, args[0]))), - "params": 1 + "function": lambda string, *args: int( + datetime.datetime.timestamp(datetime.datetime.strptime(string, args[0])) + ), + "params": 1, }, ("none", "nowstrptime"): { - "function": lambda arg: TimeHelper.now().replace(hour=0, minute=0, second=0, microsecond=0), - "params": 0 - }, - ("none", "now"): { - "function": TimeHelper.now, - "params": 0 + "function": lambda arg: TimeHelper.now().replace( + hour=0, minute=0, second=0, microsecond=0 + ), + "params": 0, }, + ("none", "now"): {"function": TimeHelper.now, "params": 0}, ("none", "now_format"): { "function": lambda spec: format(TimeHelper.now(), spec), - "params": 1 + "params": 1, }, ("none", "constant"): { # Returns the first argument "function": lambda *args: args[0], - "params": 1 - }, - ("none", "range"): { - "function": lambda: range(1), - "params": 0 + "params": 1, }, + ("none", "range"): {"function": lambda: range(1), "params": 0}, ("value", "map"): { # translate into buy/sell. Args: {0: 'buy', 1:'sell'} and arg[0] is the response value (i.e. 0/1) "function": lambda *args: {args[1]: args[2], args[3]: args[4]}[args[0]], - "params": 4 + "params": 4, }, ("str", "split_at_del_or_index"): { - "function": lambda string, *args: string.split(args[0])[args[2]] if len(string) != len( - string.split(args[0])[0]) else string[:args[1]] if args[2] == 0 else string[args[1]:], - "params": 3 # delimiter, index, 0 or 1 aka. left or right + "function": lambda string, *args: string.split(args[0])[args[2]] + if len(string) != len(string.split(args[0])[0]) + else string[: args[1]] + if args[2] == 0 + else string[args[1] :], + "params": 3, # delimiter, index, 0 or 1 aka. left or right }, ("none", "now_timestamp"): { "function": lambda: int(TimeHelper.now_timestamp()), - "params": 0 + "params": 0, }, ("none", "now_timestampms"): { "function": lambda: int(TimeHelper.now_timestamp(TimeUnit.MILLISECONDS)), - "params": 0 + "params": 0, }, ("now", "timedelta"): { - "function": lambda delta: int(TimeHelper.to_timestamp(TimeHelper.now() - timedelta(days=int(delta)))), - "params": 1 + "function": lambda delta: int( + TimeHelper.to_timestamp(TimeHelper.now() - timedelta(days=int(delta))) + ), + "params": 1, }, ("datetime", "timedelta"): { "function": lambda time, interval, delta: int( - TimeHelper.to_timestamp(time - timedelta(**{interval: int(delta)}))), - "params": 2 + TimeHelper.to_timestamp(time - timedelta(**{interval: int(delta)})) + ), + "params": 2, }, ("utcfromtimestamp", "timedelta"): { - "function": lambda time, interval, value: TimeHelper.from_timestamp(time) - timedelta( - **{interval: value}) if - isinstance(time, int) else dateutil.parser.parse(time) - timedelta(**{interval: value}), - "params": 2 + "function": lambda time, interval, value: TimeHelper.from_timestamp(time) + - timedelta(**{interval: value}) + if isinstance(time, int) + else dateutil.parser.parse(time) - timedelta(**{interval: value}), + "params": 2, }, ("datetime", "timedeltams"): { "function": lambda time, interval, delta: int( - TimeHelper.to_timestamp(time - timedelta(**{interval: int(delta)}))) * 1000, - "params": 2 + TimeHelper.to_timestamp(time - timedelta(**{interval: int(delta)})) + ) + * 1000, + "params": 2, }, ("datetime", "timestamp"): { "function": lambda time: int(TimeHelper.to_timestamp(time)), - "params": 0 + "params": 0, }, ("datetime", "timestampms"): { "function": lambda time: int(TimeHelper.to_timestamp(time)) * 1000, - "params": 0 - }, - ("datetime", "format"): { - "function": format, - "params": 1 + "params": 0, }, + ("datetime", "format"): {"function": format, "params": 1}, ("timedelta", "from_timestamp"): { - "function": lambda time, unit, spec: format(TimeHelper.from_timestamp(time, unit), spec), - "params": 2 + "function": lambda time, unit, spec: format( + TimeHelper.from_timestamp(time, unit), spec + ), + "params": 2, }, ("from_timestamp", "to_start"): { - "function": lambda time, interval: TimeHelper.start_end_conversion(time, interval, False), - "params": 1 + "function": lambda time, interval: TimeHelper.start_end_conversion( + time, interval, False + ), + "params": 1, }, ("from_timestamp", "to_end"): { - "function": lambda time, interval: TimeHelper.start_end_conversion(time, interval, True), - "params": 1 - } + "function": lambda time, interval: TimeHelper.start_end_conversion( + time, interval, True + ), + "params": 1, + }, } """ Type Conversions used to convert extracted values from the API-Response into the desired type ("first", "second"). @@ -236,11 +214,15 @@ def yaml_loader(exchange: str) -> Dict[str, Any]: path = _paths.all_paths.get("yaml_path") try: - with open(path.joinpath(".".join([exchange.lower(), "yaml"])), "r", encoding="UTF-8") as file: + with open( + path.joinpath(".".join([exchange.lower(), "yaml"])), "r", encoding="UTF-8" + ) as file: return yaml.load(file, Loader=yaml.FullLoader) except FileNotFoundError: - print(f"\nFile {path.joinpath('.'.join([exchange.lower(), 'yaml']))} not found.") + print( + f"\nFile {path.joinpath('.'.join([exchange.lower(), 'yaml']))} not found." + ) def get_exchange_names() -> Optional[List[str]]: @@ -303,7 +285,7 @@ def sort_columns(dataframe: pd.DataFrame) -> pd.DataFrame: """ # remove columns not returned by the exchange and maintain order. - columns = ['open', 'high', 'low', 'close', 'volume', 'market_cap'] + columns = ["open", "high", "low", "close", "volume", "market_cap"] columns = sorted(set(columns).intersection(dataframe.columns), key=columns.index) return dataframe.loc[:, columns] diff --git a/pandas_datareader/data.py b/pandas_datareader/data.py index ec334b0b..2c53ad58 100644 --- a/pandas_datareader/data.py +++ b/pandas_datareader/data.py @@ -63,7 +63,7 @@ "get_dailysummary_iex", "get_data_stooq", "DataReader", - "get_data_crypto" + "get_data_crypto", ] @@ -368,7 +368,7 @@ def DataReader( "av-intraday", "econdb", "naver", - *crypto_exchanges + *crypto_exchanges, ] if data_source not in expected_source: @@ -709,5 +709,5 @@ def Options(symbol, data_source=None, session=None): else: raise NotImplementedError("currently only yahoo supported") -crypto_exchanges = get_exchange_names() +crypto_exchanges = get_exchange_names() diff --git a/pandas_datareader/exceptions.py b/pandas_datareader/exceptions.py index bb87554b..bbbc01c6 100644 --- a/pandas_datareader/exceptions.py +++ b/pandas_datareader/exceptions.py @@ -17,6 +17,6 @@ class UnstableAPIWarning(Warning): class ImmediateDeprecationError(Exception): pass + class EmptyResponseError(Exception): pass - diff --git a/pandas_datareader/tests/test_cryptoreader.py b/pandas_datareader/tests/test_cryptoreader.py index e950e821..e768017b 100644 --- a/pandas_datareader/tests/test_cryptoreader.py +++ b/pandas_datareader/tests/test_cryptoreader.py @@ -21,8 +21,8 @@ class TestCryptoReader: """ Unit tests for the CryptoReader.""" - exchange_name = 'coinbase' - symbols = 'btc/usd' + exchange_name = "coinbase" + symbols = "btc/usd" CryptoReader = CryptoReader(exchange_name, symbols) def test_get_all_exchanges(self): @@ -43,9 +43,9 @@ def test_read(self): def test_request_new_symbol(self): """ Test to request NEW symbols.""" - result = self.CryptoReader.read('eth/usd') + result = self.CryptoReader.read("eth/usd") - assert 'eth/usd' in self.CryptoReader.symbols.keys() + assert "eth/usd" in self.CryptoReader.symbols.keys() assert isinstance(result, pd.DataFrame) assert not result.empty @@ -56,7 +56,9 @@ def test_reset_request_start_date(self): self.CryptoReader.symbols.update({key: datetime.datetime(2020, 1, 1)}) self.CryptoReader.reset_request_start_date() - assert self.CryptoReader.symbols.get(key).date() == datetime.datetime.now().date() + assert ( + self.CryptoReader.symbols.get(key).date() == datetime.datetime.now().date() + ) def test_check_symbols(self): """ Test checking if the provided currency-pair is listed on an exchange.""" @@ -81,9 +83,15 @@ def test_iterate_requests_until_end(self): def test_sort_result_columns(self): """ Test to sort the columns of the response.""" - ordered_cols = ['open', 'high', 'low', 'close'] - response = pd.DataFrame({'high': range(0, 5), 'close': range(0, 5), - 'open': range(0, 5), 'low': range(0, 5)}) + ordered_cols = ["open", "high", "low", "close"] + response = pd.DataFrame( + { + "high": range(0, 5), + "close": range(0, 5), + "open": range(0, 5), + "low": range(0, 5), + } + ) response = sort_columns(dataframe=response) assert all(ordered_cols == response.columns) @@ -91,17 +99,27 @@ def test_sort_result_columns(self): def test_ensure_correct_column_names(self): """ Test to ensure specific column names.""" - response = pd.DataFrame({'High': range(0, 5), 'CLOSE': range(0, 5), - 'oPen': range(0, 5), 'low': range(0, 5)}) + response = pd.DataFrame( + { + "High": range(0, 5), + "CLOSE": range(0, 5), + "oPen": range(0, 5), + "low": range(0, 5), + } + ) response = sort_columns(dataframe=response) - assert response.columns == 'low' + assert response.columns == "low" def test_cut_response_and_set_index(self): """ Test to cut the response to the initially defined start/end dates.""" - response = pd.DataFrame({'open': range(0, 100), - 'time': pd.period_range(end='2020-12-31', periods=100, freq="d")}) + response = pd.DataFrame( + { + "open": range(0, 100), + "time": pd.period_range(end="2020-12-31", periods=100, freq="d"), + } + ) self.CryptoReader.start = datetime.datetime(2020, 12, 1) self.CryptoReader.end = datetime.datetime(2020, 12, 20) @@ -115,16 +133,18 @@ def test_cut_response_and_set_index(self): class TestExchange: """ Unit tests for the Exchange class.""" + # ToDo: Create test-exchange yaml file and use it instead for this class. - exchange_name = 'coinbase' - symbols = 'btc/usd' + exchange_name = "coinbase" + symbols = "btc/usd" CryptoReader = CryptoReader(exchange_name, symbols) def test_extract_mappings(self): """ Test to extract the mapping keys and values from the yaml files.""" - result = extract_mappings(self.CryptoReader.name, - self.CryptoReader.yaml_file.get('requests')).get('historic_rates') + result = extract_mappings( + self.CryptoReader.name, self.CryptoReader.yaml_file.get("requests") + ).get("historic_rates") assert isinstance(result, list) assert result @@ -138,7 +158,9 @@ def test_all_exchanges_have_mappings_and_necessary_values(self): for exchange in exchanges: file = yaml_loader(exchange) - result = extract_mappings(exchange, file.get('requests')).get('historic_rates') + result = extract_mappings(exchange, file.get("requests")).get( + "historic_rates" + ) assert isinstance(result, list) assert result @@ -149,11 +171,18 @@ def test_necessary_values_in_mappings(self): for exchange in exchanges: file = yaml_loader(exchange) - mappings = extract_mappings(exchange, file.get('requests')).get('historic_rates') + mappings = extract_mappings(exchange, file.get("requests")).get( + "historic_rates" + ) for mapping in mappings: # Check if the object dict contains all necessary keys and not-None values. - assert all([item in mapping.__dict__.keys() for item in ['key', 'path', 'types']]) + assert all( + [ + item in mapping.__dict__.keys() + for item in ["key", "path", "types"] + ] + ) assert all([val is not None for _, val in mapping.__dict__.items()]) def test_extract_param_dict(self): @@ -223,68 +252,44 @@ class TestMapping: def test_extract_value_split_index_zero(self): """ Test of splitting a str and taking the index zero.""" - mapping = Mapping("exchange_name", - ["product_id"], - ["str", "split", "-", 0]) - result = mapping.extract_value({ - "product_id": "BTC-ETH" - }) + mapping = Mapping("exchange_name", ["product_id"], ["str", "split", "-", 0]) + result = mapping.extract_value({"product_id": "BTC-ETH"}) assert result == "BTC" def test_extract_value_split_index_one(self): """ Test of splitting a str and taking the index one.""" - mapping = Mapping("exchange_name", - ["product_id"], - ["str", "split", "-", 1]) - result = mapping.extract_value({ - "product_id": "BTC-ETH" - }) + mapping = Mapping("exchange_name", ["product_id"], ["str", "split", "-", 1]) + result = mapping.extract_value({"product_id": "BTC-ETH"}) assert result == "ETH" def test_extract_value_split_index_two(self): """ Test of splitting a str and taking the index two.""" - mapping = Mapping("exchange_name", - ["product_id"], - ["str", "split", "-", 2]) - result = mapping.extract_value({ - "product_id": "BTC-ETH-USD" - }) + mapping = Mapping("exchange_name", ["product_id"], ["str", "split", "-", 2]) + result = mapping.extract_value({"product_id": "BTC-ETH-USD"}) assert result == "USD" def test_extract_value_slice_first_half(self): """ Test of slicing a str and taking the first half.""" - mapping = Mapping("exchange_name", - ["product_id"], - ["str", "slice", 0, 3]) - result = mapping.extract_value({ - "product_id": "BTCETH" - }) + mapping = Mapping("exchange_name", ["product_id"], ["str", "slice", 0, 3]) + result = mapping.extract_value({"product_id": "BTCETH"}) assert result == "BTC" def test_extract_value_slice_second_half(self): """ Test of slicing a str and taking the second half.""" - mapping = Mapping("exchange_name", - ["product_id"], - ["str", "slice", 3, 6]) - result = mapping.extract_value({ - "product_id": "BTCETH" - }) + mapping = Mapping("exchange_name", ["product_id"], ["str", "slice", 3, 6]) + result = mapping.extract_value({"product_id": "BTCETH"}) assert result == "ETH" def test_extract_value_str_to_bool_true(self): """ Test of conversion from str to bool in case of True.""" - mapping = Mapping("active", - ["active"], - ["str", "bool"]) + mapping = Mapping("active", ["active"], ["str", "bool"]) - result = mapping.extract_value({ - "active": "True" - }) + result = mapping.extract_value({"active": "True"}) assert isinstance(result, bool) assert result @@ -292,13 +297,9 @@ def test_extract_value_str_to_bool_true(self): def test_extract_value_str_to_bool_true_lowercase(self): """ Test of conversion from str to bool in case of lowercase True.""" - mapping = Mapping("active", - ["active"], - ["str", "bool"]) + mapping = Mapping("active", ["active"], ["str", "bool"]) - result = mapping.extract_value({ - "active": "true" - }) + result = mapping.extract_value({"active": "true"}) assert isinstance(result, bool) assert result @@ -306,13 +307,9 @@ def test_extract_value_str_to_bool_true_lowercase(self): def test_extract_value_str_to_bool_true_uppercase(self): """ Test of conversion from str to bool in case of uppercase True.""" - mapping = Mapping("active", - ["active"], - ["str", "bool"]) + mapping = Mapping("active", ["active"], ["str", "bool"]) - result = mapping.extract_value({ - "active": "TRUE" - }) + result = mapping.extract_value({"active": "TRUE"}) assert isinstance(result, bool) assert result @@ -320,13 +317,9 @@ def test_extract_value_str_to_bool_true_uppercase(self): def test_extract_value_str_to_bool_false(self): # """ Test of conversion from str to bool in case of False.""" - mapping = Mapping("active", - ["active"], - ["str", "bool"]) + mapping = Mapping("active", ["active"], ["str", "bool"]) - result = mapping.extract_value({ - "active": "False" - }) + result = mapping.extract_value({"active": "False"}) assert isinstance(result, bool) assert not result @@ -334,13 +327,9 @@ def test_extract_value_str_to_bool_false(self): # def test_extract_value_str_to_bool_false_lowercase(self): """ Test of conversion from str to bool in case of lowercase False.""" - mapping = Mapping("active", - ["active"], - ["str", "bool"]) + mapping = Mapping("active", ["active"], ["str", "bool"]) - result = mapping.extract_value({ - "active": "false" - }) + result = mapping.extract_value({"active": "false"}) assert isinstance(result, bool) assert not result @@ -348,13 +337,9 @@ def test_extract_value_str_to_bool_false_lowercase(self): def test_extract_value_str_to_bool_false_uppercase(self): """ Test of conversion from str to bool in case of uppercase False.""" - mapping = Mapping("active", - ["active"], - ["str", "bool"]) + mapping = Mapping("active", ["active"], ["str", "bool"]) - result = mapping.extract_value({ - "active": "FALSE" - }) + result = mapping.extract_value({"active": "FALSE"}) assert isinstance(result, bool) assert not result @@ -362,13 +347,9 @@ def test_extract_value_str_to_bool_false_uppercase(self): def test_extract_value_str_to_bool_false_anything(self): """ Test of conversion from str to bool in case of anything.""" - mapping = Mapping("active", - ["active"], - ["str", "bool"]) + mapping = Mapping("active", ["active"], ["str", "bool"]) - result = mapping.extract_value({ - "active": "anything" - }) + result = mapping.extract_value({"active": "anything"}) assert isinstance(result, bool) assert not result @@ -376,13 +357,9 @@ def test_extract_value_str_to_bool_false_anything(self): def test_extract_value_bool_to_int_true(self): """ Test of conversion from bool to int in case of True.""" - mapping = Mapping("active", - ["active"], - ["bool", "int"]) + mapping = Mapping("active", ["active"], ["bool", "int"]) - result = mapping.extract_value({ - "active": True - }) + result = mapping.extract_value({"active": True}) assert isinstance(result, int) assert result == 1 @@ -390,13 +367,9 @@ def test_extract_value_bool_to_int_true(self): def test_extract_value_bool_to_int_false(self): """ Test of conversion from bool to int in case of False.""" - mapping = Mapping("active", - ["active"], - ["bool", "int"]) + mapping = Mapping("active", ["active"], ["bool", "int"]) - result = mapping.extract_value({ - "active": False - }) + result = mapping.extract_value({"active": False}) assert isinstance(result, int) assert result == 0 @@ -404,13 +377,9 @@ def test_extract_value_bool_to_int_false(self): def test_extract_value_int_to_bool_one(self): """ Test of conversion from int to bool in case of one.""" - mapping = Mapping("active", - ["active"], - ["int", "bool"]) + mapping = Mapping("active", ["active"], ["int", "bool"]) - result = mapping.extract_value({ - "active": 1 - }) + result = mapping.extract_value({"active": 1}) assert isinstance(result, bool) assert result @@ -418,13 +387,9 @@ def test_extract_value_int_to_bool_one(self): def test_extract_value_int_to_bool_zero(self): """ Test of conversion from int to bool in case of zero.""" - mapping = Mapping("active", - ["active"], - ["int", "bool"]) + mapping = Mapping("active", ["active"], ["int", "bool"]) - result = mapping.extract_value({ - "active": 0 - }) + result = mapping.extract_value({"active": 0}) assert isinstance(result, bool) assert not result @@ -432,13 +397,9 @@ def test_extract_value_int_to_bool_zero(self): def test_extract_value_int_to_bool_two(self): """ Test of conversion from int to bool in case of two.""" - mapping = Mapping("active", - ["active"], - ["int", "bool"]) + mapping = Mapping("active", ["active"], ["int", "bool"]) - result = mapping.extract_value({ - "active": 2 - }) + result = mapping.extract_value({"active": 2}) assert isinstance(result, bool) assert result @@ -446,13 +407,9 @@ def test_extract_value_int_to_bool_two(self): def test_extract_value_int_to_bool_neg_two(self): """ Test of conversion from int to bool in case of negative two.""" - mapping = Mapping("active", - ["active"], - ["int", "bool"]) + mapping = Mapping("active", ["active"], ["int", "bool"]) - result = mapping.extract_value({ - "active": -2 - }) + result = mapping.extract_value({"active": -2}) assert isinstance(result, bool) assert result @@ -460,13 +417,9 @@ def test_extract_value_int_to_bool_neg_two(self): def test_extract_value_int_fromtimestamp(self): """ Test of conversion from an int timestamp to datetime.""" - mapping = Mapping("time", - ["time"], - ["float", "from_timestamp", "0"]) + mapping = Mapping("time", ["time"], ["float", "from_timestamp", "0"]) - result = mapping.extract_value({ - "time": 1538122622 - }) + result = mapping.extract_value({"time": 1538122622}) assert isinstance(result, datetime.datetime) # Different results depending on timezone @@ -475,26 +428,18 @@ def test_extract_value_int_fromtimestamp(self): def test_extract_value_int_utcfromtimestamp(self): """ Test of conversion from an int UTC timestamp to datetime.""" - mapping = Mapping("time", - ["time"], - ["float", "from_timestamp", "1"]) + mapping = Mapping("time", ["time"], ["float", "from_timestamp", "1"]) - result = mapping.extract_value({ - "time": 1538122622 - }) + result = mapping.extract_value({"time": 1538122622}) assert isinstance(result, datetime.datetime) def test_extract_value_int_fromtimestampms(self): """ Test of conversion from an int timestamp with ms to datetime.""" - mapping = Mapping("time", - ["time"], - ["float", "from_timestamp", "1"]) + mapping = Mapping("time", ["time"], ["float", "from_timestamp", "1"]) - result = mapping.extract_value({ - "time": 1538122622123 - }) + result = mapping.extract_value({"time": 1538122622123}) assert isinstance(result, datetime.datetime) assert result.microsecond == 123000 @@ -502,13 +447,9 @@ def test_extract_value_int_fromtimestampms(self): def test_extract_value_float_fromtimestamp(self): """ Test of conversion from a float timestamp to datetime.""" - mapping = Mapping("time", - ["time"], - ["float", "from_timestamp", "0"]) + mapping = Mapping("time", ["time"], ["float", "from_timestamp", "0"]) - result = mapping.extract_value({ - "time": 1538122622.123 - }) + result = mapping.extract_value({"time": 1538122622.123}) assert isinstance(result, datetime.datetime) assert result.microsecond == 123000 @@ -516,13 +457,9 @@ def test_extract_value_float_fromtimestamp(self): def test_extract_value_float_utcfromtimestamp(self): """ Test of conversion from a float UTC timestamp to datetime.""" - mapping = Mapping("time", - ["time"], - ["float", "from_timestamp", "0"]) + mapping = Mapping("time", ["time"], ["float", "from_timestamp", "0"]) - result = mapping.extract_value({ - "time": 1538122622.123 - }) + result = mapping.extract_value({"time": 1538122622.123}) assert isinstance(result, datetime.datetime) assert result.microsecond == 123000 @@ -530,13 +467,9 @@ def test_extract_value_float_utcfromtimestamp(self): def test_extract_value_str_to_int_zero(self): """ Test of conversion from str to int in case of zero.""" - mapping = Mapping("number", - ["number"], - ["str", "int"]) + mapping = Mapping("number", ["number"], ["str", "int"]) - result = mapping.extract_value({ - "number": "0" - }) + result = mapping.extract_value({"number": "0"}) assert isinstance(result, int) assert result == 0 @@ -544,13 +477,9 @@ def test_extract_value_str_to_int_zero(self): def test_extract_value_str_to_int_one(self): """ Test of conversion from str to int in case of one.""" - mapping = Mapping("number", - ["number"], - ["str", "int"]) + mapping = Mapping("number", ["number"], ["str", "int"]) - result = mapping.extract_value({ - "number": "1" - }) + result = mapping.extract_value({"number": "1"}) assert isinstance(result, int) assert result == 1 @@ -558,13 +487,9 @@ def test_extract_value_str_to_int_one(self): def test_extract_value_str_to_int_two(self): """ Test of conversion from str to int in case of two.""" - mapping = Mapping("number", - ["number"], - ["str", "int"]) + mapping = Mapping("number", ["number"], ["str", "int"]) - result = mapping.extract_value({ - "number": "2" - }) + result = mapping.extract_value({"number": "2"}) assert isinstance(result, int) assert result == 2 @@ -572,13 +497,9 @@ def test_extract_value_str_to_int_two(self): def test_extract_value_str_to_int_twelve(self): """ Test of conversion from str to int in case of twelve.""" - mapping = Mapping("number", - ["number"], - ["str", "int"]) + mapping = Mapping("number", ["number"], ["str", "int"]) - result = mapping.extract_value({ - "number": "12" - }) + result = mapping.extract_value({"number": "12"}) assert isinstance(result, int) assert result == 12 @@ -586,13 +507,9 @@ def test_extract_value_str_to_int_twelve(self): def test_extract_value_str_to_int_neg_one(self): """ Test of conversion from str to int in case negative one.""" - mapping = Mapping("number", - ["number"], - ["str", "int"]) + mapping = Mapping("number", ["number"], ["str", "int"]) - result = mapping.extract_value({ - "number": "-1" - }) + result = mapping.extract_value({"number": "-1"}) assert isinstance(result, int) assert result == -1 @@ -600,13 +517,9 @@ def test_extract_value_str_to_int_neg_one(self): def test_extract_value_str_to_float_zero(self): """ Test of conversion from str to float in case of zero.""" - mapping = Mapping("number", - ["number"], - ["str", "float"]) + mapping = Mapping("number", ["number"], ["str", "float"]) - result = mapping.extract_value({ - "number": "0.0" - }) + result = mapping.extract_value({"number": "0.0"}) assert isinstance(result, float) assert result == 0.0 @@ -614,13 +527,9 @@ def test_extract_value_str_to_float_zero(self): def test_extract_value_str_to_float_one(self): """ Test of conversion from str to float in case of one.""" - mapping = Mapping("number", - ["number"], - ["str", "float"]) + mapping = Mapping("number", ["number"], ["str", "float"]) - result = mapping.extract_value({ - "number": "1.0" - }) + result = mapping.extract_value({"number": "1.0"}) assert isinstance(result, float) assert result == 1.0 @@ -628,13 +537,9 @@ def test_extract_value_str_to_float_one(self): def test_extract_value_str_to_float_two(self): """ Test of conversion from str to float in case of two.""" - mapping = Mapping("number", - ["number"], - ["str", "float"]) + mapping = Mapping("number", ["number"], ["str", "float"]) - result = mapping.extract_value({ - "number": "2.0" - }) + result = mapping.extract_value({"number": "2.0"}) assert isinstance(result, float) assert result == 2.0 @@ -642,13 +547,9 @@ def test_extract_value_str_to_float_two(self): def test_extract_value_str_to_float_twelve(self): """ Test of conversion from str to float in case of twelve.""" - mapping = Mapping("number", - ["number"], - ["str", "float"]) + mapping = Mapping("number", ["number"], ["str", "float"]) - result = mapping.extract_value({ - "number": "12.0" - }) + result = mapping.extract_value({"number": "12.0"}) assert isinstance(result, float) assert result == 12.0 @@ -656,13 +557,9 @@ def test_extract_value_str_to_float_twelve(self): def test_extract_value_str_to_float_pi(self): """ Test of conversion from str to float in case of Pi.""" - mapping = Mapping("number", - ["number"], - ["str", "float"]) + mapping = Mapping("number", ["number"], ["str", "float"]) - result = mapping.extract_value({ - "number": "3.141592654" - }) + result = mapping.extract_value({"number": "3.141592654"}) assert isinstance(result, float) assert result == 3.141592654 @@ -670,13 +567,9 @@ def test_extract_value_str_to_float_pi(self): def test_extract_value_str_to_float_neg_one(self): """ Test of conversion from str to float in case of negative one.""" - mapping = Mapping("number", - ["number"], - ["str", "float"]) + mapping = Mapping("number", ["number"], ["str", "float"]) - result = mapping.extract_value({ - "number": "-1.0" - }) + result = mapping.extract_value({"number": "-1.0"}) assert isinstance(result, float) assert result == -1.0 @@ -684,13 +577,9 @@ def test_extract_value_str_to_float_neg_one(self): def test_extract_value_str_to_float_neg_pi(self): """ Test of conversion from str to float in case of negative Pi.""" - mapping = Mapping("number", - ["number"], - ["str", "float"]) + mapping = Mapping("number", ["number"], ["str", "float"]) - result = mapping.extract_value({ - "number": "-3.141592654" - }) + result = mapping.extract_value({"number": "-3.141592654"}) assert isinstance(result, float) assert result == -3.141592654 @@ -698,13 +587,11 @@ def test_extract_value_str_to_float_neg_pi(self): def test_extract_value_datetime_totimestamp(self): """ Test of conversion from datetome to timestamp.""" - mapping = Mapping("date", - ["date"], - ["datetime", "totimestamp"]) + mapping = Mapping("date", ["date"], ["datetime", "totimestamp"]) - result = mapping.extract_value({ - "date": datetime.datetime(2018, 10, 11, 11, 20) - }) + result = mapping.extract_value( + {"date": datetime.datetime(2018, 10, 11, 11, 20)} + ) assert isinstance(result, int) # Different results depending on timezone @@ -713,13 +600,11 @@ def test_extract_value_datetime_totimestamp(self): def test_extract_value_datetime_totimestampms(self): """ Test of conversion from datetome to timestamp with ms.""" - mapping = Mapping("date", - ["date"], - ["datetime", "totimestampms"]) + mapping = Mapping("date", ["date"], ["datetime", "totimestampms"]) - result = mapping.extract_value({ - "date": datetime.datetime(2018, 10, 11, 11, 20, 0, 123000) - }) + result = mapping.extract_value( + {"date": datetime.datetime(2018, 10, 11, 11, 20, 0, 123000)} + ) assert isinstance(result, int) # Different results depending on timezone @@ -728,13 +613,11 @@ def test_extract_value_datetime_totimestampms(self): def test_extract_value_datetime_utctotimestamp(self): """ Test of conversion from datetome to UTC timestamp.""" - mapping = Mapping("date", - ["date"], - ["datetime", "utctotimestamp"]) + mapping = Mapping("date", ["date"], ["datetime", "utctotimestamp"]) - result = mapping.extract_value({ - "date": datetime.datetime(2018, 10, 11, 11, 20, 0) - }) + result = mapping.extract_value( + {"date": datetime.datetime(2018, 10, 11, 11, 20, 0)} + ) assert isinstance(result, int) # Different results depending on timezone @@ -742,13 +625,9 @@ def test_extract_value_datetime_utctotimestamp(self): def test_extract_value_str_strptime_date(self): """ Test of conversion timestring via strptime in case of a date.""" - mapping = Mapping("date", - ["date"], - ["str", "strptime", "%Y-%m-%d"]) + mapping = Mapping("date", ["date"], ["str", "strptime", "%Y-%m-%d"]) - result = mapping.extract_value({ - "date": "2018-10-11" - }) + result = mapping.extract_value({"date": "2018-10-11"}) assert isinstance(result, datetime.datetime) assert result == datetime.datetime(2018, 10, 11) @@ -756,13 +635,9 @@ def test_extract_value_str_strptime_date(self): def test_extract_value_str_strptime_datetime(self): """ Test of conversion timestring via strptime in case of a datetime.""" - mapping = Mapping("date", - ["date"], - ["str", "strptime", "%Y-%m-%d %H:%M"]) + mapping = Mapping("date", ["date"], ["str", "strptime", "%Y-%m-%d %H:%M"]) - result = mapping.extract_value({ - "date": "2018-10-11 12:06" - }) + result = mapping.extract_value({"date": "2018-10-11 12:06"}) assert isinstance(result, datetime.datetime) assert result == datetime.datetime(2018, 10, 11, 12, 6) @@ -770,13 +645,9 @@ def test_extract_value_str_strptime_datetime(self): def test_extract_value_datetime_strftime_date(self): """ Test of conversion from datetime via strftime in case of a date.""" - mapping = Mapping("date", - ["date"], - ["datetime", "strftime", "%Y-%m-%d"]) + mapping = Mapping("date", ["date"], ["datetime", "strftime", "%Y-%m-%d"]) - result = mapping.extract_value({ - "date": datetime.datetime(2018, 10, 11) - }) + result = mapping.extract_value({"date": datetime.datetime(2018, 10, 11)}) assert isinstance(result, str) assert result == "2018-10-11" @@ -784,13 +655,9 @@ def test_extract_value_datetime_strftime_date(self): def test_extract_value_datetime_strftime_datetime(self): """ Test of conversion from datetime via strftime in case of a dt.""" - mapping = Mapping("date", - ["date"], - ["datetime", "strftime", "%Y-%m-%d %H:%M"]) + mapping = Mapping("date", ["date"], ["datetime", "strftime", "%Y-%m-%d %H:%M"]) - result = mapping.extract_value({ - "date": datetime.datetime(2018, 10, 11, 12, 6) - }) + result = mapping.extract_value({"date": datetime.datetime(2018, 10, 11, 12, 6)}) assert isinstance(result, str) assert result == "2018-10-11 12:06" @@ -798,14 +665,9 @@ def test_extract_value_datetime_strftime_datetime(self): def test_extract_value_dict_key(self): """ Test of extract value for dict_keys without further processing.""" - mapping = Mapping("pair", - ["dict_key"], - ["str"]) + mapping = Mapping("pair", ["dict_key"], ["str"]) - result = mapping.extract_value({ - "BTC_USD": "value", - "ETH_EUR": "value" - }) + result = mapping.extract_value({"BTC_USD": "value", "ETH_EUR": "value"}) assert isinstance(result, list) assert result == ["BTC_USD", "ETH_EUR"] @@ -813,14 +675,9 @@ def test_extract_value_dict_key(self): def test_extract_value_dict_key_split_index_zero(self): """ Test of extract value for dict_keys with split and index 0.""" - mapping = Mapping("pair", - ["dict_key"], - ["str", "split", "_", 0]) + mapping = Mapping("pair", ["dict_key"], ["str", "split", "_", 0]) - result = mapping.extract_value({ - "BTC_USD": "value", - "ETH_EUR": "value" - }) + result = mapping.extract_value({"BTC_USD": "value", "ETH_EUR": "value"}) assert isinstance(result, list) assert result == ["BTC", "ETH"] @@ -828,14 +685,9 @@ def test_extract_value_dict_key_split_index_zero(self): def test_extract_value_dict_key_split_index_one(self): """ Test of extract value for dict_keys with split and index 1.""" - mapping = Mapping("pair", - ["dict_key"], - ["str", "split", "_", 1]) + mapping = Mapping("pair", ["dict_key"], ["str", "split", "_", 1]) - result = mapping.extract_value({ - "BTC_USD": "value", - "ETH_EUR": "value" - }) + result = mapping.extract_value({"BTC_USD": "value", "ETH_EUR": "value"}) assert isinstance(result, list) assert result == ["USD", "EUR"] @@ -843,24 +695,22 @@ def test_extract_value_dict_key_split_index_one(self): def test_extract_value_where_pair_can_not_be_split(self): """ Test extract value for special case where value is currency pair but cannot be extracted since there is no delimiter for splitting the pair.""" - mapping = Mapping("first", - [], - ["first_currency"]) - result = mapping.extract_value(['ETHBTC', 'XRPBTC'], currency_pair_info=('XRP', 'BTC', 'XRPBTC')) + mapping = Mapping("first", [], ["first_currency"]) + result = mapping.extract_value( + ["ETHBTC", "XRPBTC"], currency_pair_info=("XRP", "BTC", "XRPBTC") + ) assert result == "XRP" - mapping = Mapping('second', - [], - ["second_currency"]) - result = mapping.extract_value(['ETHBTC', 'XRPBTC'], currency_pair_info=('ETH', 'BTC', 'ETHBTC')) + mapping = Mapping("second", [], ["second_currency"]) + result = mapping.extract_value( + ["ETHBTC", "XRPBTC"], currency_pair_info=("ETH", "BTC", "ETHBTC") + ) assert result == "BTC" def test_extract_value_list(self): """Test of extracting all elements in a list.""" - mapping = Mapping("number_as_string", - [[]], - ['str']) - value_list = ['1.0', '1.1', '1.2', '1.3', '2.4', '2.5', '3.6', '3.7'] + mapping = Mapping("number_as_string", [[]], ["str"]) + value_list = ["1.0", "1.1", "1.2", "1.3", "2.4", "2.5", "3.6", "3.7"] result = mapping.extract_value(value_list) assert value_list == result @@ -869,87 +719,167 @@ def test_extract_value_list_containing_dict_with_key(self): """ Test of extract value for a list that contains a dict for each index with a known key.""" # list element directly holds value behind key - mapping = Mapping('first_currency', - ['first'], - ['str']) - - extract_list = [{'first': 'BTC'}, - {'first': 'ETH'}, - {'first': 'XRP'}, - {'first': 'DOGE'}, - {'first': 'XSA'}, - {'first': 'TEST'}] + mapping = Mapping("first_currency", ["first"], ["str"]) + + extract_list = [ + {"first": "BTC"}, + {"first": "ETH"}, + {"first": "XRP"}, + {"first": "DOGE"}, + {"first": "XSA"}, + {"first": "TEST"}, + ] result = mapping.extract_value(extract_list) - value_list = ['BTC', 'ETH', 'XRP', 'DOGE', 'XSA', 'TEST'] + value_list = ["BTC", "ETH", "XRP", "DOGE", "XSA", "TEST"] assert value_list == result # list element holds dict that holds another dict which holds the value behind key - mapping = Mapping('first_currency', - ['a', 'first'], # ['dict_values', 'first'] works also since it's only one level - ['str']) - - extract_list = [{'a': {'first': 'BTC', 'second': 'should not matter'}}, - {'a': {'first': 'ETH', 'second': 'should not matter'}}, - {'a': {'first': 'XRP', 'second': 'should not matter'}}, - {'a': {'first': 'DOGE', 'second': 'should not matter'}}, - {'a': {'first': 'XSA', 'second': 'should not matter'}}, - {'a': {'first': 'TEST', 'second': 'should not matter'}}] + mapping = Mapping( + "first_currency", + [ + "a", + "first", + ], # ['dict_values', 'first'] works also since it's only one level + ["str"], + ) + + extract_list = [ + {"a": {"first": "BTC", "second": "should not matter"}}, + {"a": {"first": "ETH", "second": "should not matter"}}, + {"a": {"first": "XRP", "second": "should not matter"}}, + {"a": {"first": "DOGE", "second": "should not matter"}}, + {"a": {"first": "XSA", "second": "should not matter"}}, + {"a": {"first": "TEST", "second": "should not matter"}}, + ] result = mapping.extract_value(extract_list) assert value_list == result # list element with few more levels of dictionaries - mapping = Mapping('first_currency', - ['a', 'b', 'c', 'd', 'first'], - ['str']) + mapping = Mapping("first_currency", ["a", "b", "c", "d", "first"], ["str"]) extract_list = [ - {'a': {'b': {'c': {'d': {'first': 'BTC', 'second': 'should not matter'}, 'dist': 'other_value'}}}}, - {'a': {'b': {'c': {'d': {'first': 'ETH', 'second': 'should not matter'}}, 'dist': 'other_value'}}}, - {'a': {'b': {'c': {'d': {'first': 'XRP', 'second': 'should not matter'}}}, 'dist': 'other_value'}}, - {'a': {'b': {'c': {'d': {'first': 'DOGE', 'second': 'should not matter'}}}}, 'dist': 'other_value'}, - {'a': {'b': {'c': {'d': {'first': 'XSA', 'second': 'should not matter'}}}, 'dist': 'other_value'}}, - {'a': {'b': {'c': {'d': {'first': 'TEST', 'second': 'should not matter'}}, 'dist': 'other_value'}}}] + { + "a": { + "b": { + "c": { + "d": {"first": "BTC", "second": "should not matter"}, + "dist": "other_value", + } + } + } + }, + { + "a": { + "b": { + "c": {"d": {"first": "ETH", "second": "should not matter"}}, + "dist": "other_value", + } + } + }, + { + "a": { + "b": {"c": {"d": {"first": "XRP", "second": "should not matter"}}}, + "dist": "other_value", + } + }, + { + "a": { + "b": {"c": {"d": {"first": "DOGE", "second": "should not matter"}}} + }, + "dist": "other_value", + }, + { + "a": { + "b": {"c": {"d": {"first": "XSA", "second": "should not matter"}}}, + "dist": "other_value", + } + }, + { + "a": { + "b": { + "c": {"d": {"first": "TEST", "second": "should not matter"}}, + "dist": "other_value", + } + } + }, + ] result = mapping.extract_value(extract_list) assert value_list == result def test_extract_values_dict_values(self): """ Test of extract values for the special case that each key of a dictionary holds the values.""" - mapping = Mapping('first_currency', - ['dict_values'], - ['str']) - - extract_dict = {'1': 'XRP', - 2: 'ETH', - '3': 'BTC', - 4: 'DOGE'} + mapping = Mapping("first_currency", ["dict_values"], ["str"]) + + extract_dict = {"1": "XRP", 2: "ETH", "3": "BTC", 4: "DOGE"} result = mapping.extract_value(extract_dict) - value_list = ['XRP', 'ETH', 'BTC', 'DOGE'] + value_list = ["XRP", "ETH", "BTC", "DOGE"] assert value_list == result # extracting dicts with dict_values -> aka flattening the json - mapping = Mapping('first_currency', - ['dict_values', 'first'], - ['str']) - - extract_dict = {'1': {'first': 'XRP', 'second': 'Whatever'}, - 2: {'first': 'ETH', 'second': 'Whatever'}, - '3': {'first': 'BTC', 'second': 'Whatever'}, - 4: {'first': 'DOGE', 'second': 'Whatever'}} + mapping = Mapping("first_currency", ["dict_values", "first"], ["str"]) + + extract_dict = { + "1": {"first": "XRP", "second": "Whatever"}, + 2: {"first": "ETH", "second": "Whatever"}, + "3": {"first": "BTC", "second": "Whatever"}, + 4: {"first": "DOGE", "second": "Whatever"}, + } result = mapping.extract_value(extract_dict) - value_list = ['XRP', 'ETH', 'BTC', 'DOGE'] + value_list = ["XRP", "ETH", "BTC", "DOGE"] assert value_list == result # How to not use dict_values, since other values will be filtered also - mapping = Mapping('first_currency', - ['dict_values', 'dict_values', 'dict_values', 'dict_values', 'first'], - ['str']) + mapping = Mapping( + "first_currency", + ["dict_values", "dict_values", "dict_values", "dict_values", "first"], + ["str"], + ) extract_list = [ - {'a': {'b': {'c': {'d': {'first': 'BTC', 'second': 'should not matter'}, 'dist': 'other_value'}}}}, - {'a': {'b': {'c': {'d': {'first': 'ETH', 'second': 'should not matter'}}, 'dist': 'other_value'}}}, - {'a': {'b': {'c': {'d': {'first': 'XRP', 'second': 'should not matter'}}}, 'dist': 'other_value'}}, - {'a': {'b': {'c': {'d': {'first': 'DOGE', 'second': 'should not matter'}}}}, 'dist': 'other_value'}, - {'a': {'b': {'c': {'d': {'first': 'XSA', 'second': 'should not matter'}}}, 'dist': 'other_value'}}, - {'a': {'b': {'c': {'d': {'first': 'TEST', 'second': 'should not matter'}}, 'dist': 'other_value'}}}] + { + "a": { + "b": { + "c": { + "d": {"first": "BTC", "second": "should not matter"}, + "dist": "other_value", + } + } + } + }, + { + "a": { + "b": { + "c": {"d": {"first": "ETH", "second": "should not matter"}}, + "dist": "other_value", + } + } + }, + { + "a": { + "b": {"c": {"d": {"first": "XRP", "second": "should not matter"}}}, + "dist": "other_value", + } + }, + { + "a": { + "b": {"c": {"d": {"first": "DOGE", "second": "should not matter"}}} + }, + "dist": "other_value", + }, + { + "a": { + "b": {"c": {"d": {"first": "XSA", "second": "should not matter"}}}, + "dist": "other_value", + } + }, + { + "a": { + "b": { + "c": {"d": {"first": "TEST", "second": "should not matter"}}, + "dist": "other_value", + } + } + }, + ] with pytest.raises(TypeError): mapping.extract_value(extract_list) @@ -957,48 +887,54 @@ def test_extract_values_dict_values(self): def test_extract_value_list_containing_dict_where_key_is_value(self): """ Test of extract value for a list that contains a dict that contains a dict. The first dict only has one key, which is the value we search for.""" - mapping = Mapping('second_currency', - ['dict_key'], - ['str', 'split', '_', 1]) - extract_list = [{'btc_eth': {'other': 'values'}}, - {'btc_eur': {'other': 'values'}}, - {'btc_usd': {'other': 'values'}}, - {'btc_usdt': {'other': 'values'}}] - value_list = ['eth', 'eur', 'usd', 'usdt'] + mapping = Mapping("second_currency", ["dict_key"], ["str", "split", "_", 1]) + extract_list = [ + {"btc_eth": {"other": "values"}}, + {"btc_eur": {"other": "values"}}, + {"btc_usd": {"other": "values"}}, + {"btc_usdt": {"other": "values"}}, + ] + value_list = ["eth", "eur", "usd", "usdt"] result = mapping.extract_value(extract_list) assert value_list == result def test_extract_value_list_containing_dict_where_pair_is_key_to_values(self): """ Test of extract value for a list that contains dicts that hold a single dict. The key is the formatted currency pair that is needed to gain access to the value.""" - mapping = Mapping('value', - ['currency_pair', 1], - ['str', 'float']) - extract_dict = {'btc_eth': {1: '123.456'}, - 'btc_xrp': {1: '789.101'}, - 'xrp_eth': {1: '112.131'}, - 'doge_btc': {1: '415.161'}} + mapping = Mapping("value", ["currency_pair", 1], ["str", "float"]) + extract_dict = { + "btc_eth": {1: "123.456"}, + "btc_xrp": {1: "789.101"}, + "xrp_eth": {1: "112.131"}, + "doge_btc": {1: "415.161"}, + } value_list = [415.161, 112.131, 789.101, 123.456] # note that currency pair infos are from bottom to top if compared to extract_dict - currency_pair_infos = (('doge', 'BTC', 'doge_btc'), - ('xrp', 'eth', 'xrp_eth'), - ('btc', 'xrp', 'btc_xrp'), - ('btc', 'eth', 'btc_eth')) + currency_pair_infos = ( + ("doge", "BTC", "doge_btc"), + ("xrp", "eth", "xrp_eth"), + ("btc", "xrp", "btc_xrp"), + ("btc", "eth", "btc_eth"), + ) result = [] for currency_pair_info in currency_pair_infos: - result.append(mapping.extract_value(extract_dict, currency_pair_info=currency_pair_info)) + result.append( + mapping.extract_value( + extract_dict, currency_pair_info=currency_pair_info + ) + ) assert value_list == result def test_extract_value_dict_containing_list(self): """ Test of extract value where the response is a dict and the known key contains a list of the values.""" - mapping = Mapping('first_currency', - ['data'], - ['str', 'split', '_', 0]) - extract_dict = {'data': ['eth_btc', 'usd_btc', 'xrp_eth', 'eth_xrp'], - 'other_stuff': 'that does not matter'} - value_list = ['eth', 'usd', 'xrp', 'eth'] + mapping = Mapping("first_currency", ["data"], ["str", "split", "_", 0]) + extract_dict = { + "data": ["eth_btc", "usd_btc", "xrp_eth", "eth_xrp"], + "other_stuff": "that does not matter", + } + value_list = ["eth", "usd", "xrp", "eth"] result = mapping.extract_value(extract_dict) assert value_list == result @@ -1006,27 +942,35 @@ def test_extract_value_dict_containing_list_containing_dict_with_value(self): """ Test of extract value where the response is a dict and a known key contains a list of dicts that hold the value.""" - mapping = Mapping('value', - ['data', 'value'], - ['str', 'float']) - extract_dict = {'data': [{'value': '1.12'}, - {'value': '1.44'}, - {'value': '1.34'}, - {'value': '1.89'}]} + mapping = Mapping("value", ["data", "value"], ["str", "float"]) + extract_dict = { + "data": [ + {"value": "1.12"}, + {"value": "1.44"}, + {"value": "1.34"}, + {"value": "1.89"}, + ] + } value_list = [1.12, 1.44, 1.34, 1.89] result = mapping.extract_value(extract_dict) assert value_list == result - def test_extract_value_dict_containing_list_containing_dict_where_key_is_value(self): + def test_extract_value_dict_containing_list_containing_dict_where_key_is_value( + self, + ): """ Test of extract value where the response is a dict and a known key contains a list of dicts with a single key that is the value.""" - mapping = Mapping('second_currency', - ['data', 'dict_key'], - ['str', 'split', '_', 1]) - extract_dict = {'data': [{'eth_btc': {'other': 'values'}}, - {'btc_xrp': {'other': 'values'}}, - {'tsla_usd': {'other': 'values'}}, - {'usdt_eth': {'other': 'values'}}]} - value_list = ['btc', 'xrp', 'usd', 'eth'] + mapping = Mapping( + "second_currency", ["data", "dict_key"], ["str", "split", "_", 1] + ) + extract_dict = { + "data": [ + {"eth_btc": {"other": "values"}}, + {"btc_xrp": {"other": "values"}}, + {"tsla_usd": {"other": "values"}}, + {"usdt_eth": {"other": "values"}}, + ] + } + value_list = ["btc", "xrp", "usd", "eth"] result = mapping.extract_value(extract_dict) assert value_list == result From 176c64db243d291cabad95482d026a9e6dad5c7b Mon Sep 17 00:00:00 2001 From: Steffen Date: Sun, 28 Nov 2021 15:36:36 +0100 Subject: [PATCH 21/25] Fixed several linting issues. --- pandas_datareader/crypto.py | 44 +++++---- pandas_datareader/crypto_utils/_paths.py | 1 - pandas_datareader/crypto_utils/exchange.py | 92 +++++++++++-------- pandas_datareader/crypto_utils/mapping.py | 24 +++-- pandas_datareader/crypto_utils/time_helper.py | 5 +- pandas_datareader/crypto_utils/utilities.py | 11 ++- pandas_datareader/tests/test_cryptoreader.py | 35 ++++--- 7 files changed, 127 insertions(+), 85 deletions(-) diff --git a/pandas_datareader/crypto.py b/pandas_datareader/crypto.py index 2ca8821e..842cdbc2 100644 --- a/pandas_datareader/crypto.py +++ b/pandas_datareader/crypto.py @@ -20,16 +20,16 @@ class CryptoReader(Exchange, ABC): """ Class to request the data from a given exchange for a given currency-pair. - The class inherits from Exchange to extract and format the request urls, as well as to - extract and format the values from the response json. The requests are performed by - the _BaseReader. + The class inherits from Exchange to extract and format the request urls, + as well as to extract and format the values from the response json. + The requests are performed by the _BaseReader. """ def __init__( self, exchange_name: str, symbols: Union[str, dict], - start: Union[str, datetime] = datetime(2009, 1, 1), + start: Union[str, datetime] = "2009-01-01", end: Union[str, datetime] = None, interval: str = "days", **kwargs, @@ -68,10 +68,11 @@ def _get_data(self) -> Dict: return resp.json() def read(self, new_symbols: str = None) -> pd.DataFrame: - """ Requests and extracts the data. Requests may be performed iteratively over time - to collect the full time-series. + """ Requests and extracts the data. Requests may be performed iteratively + over time to collect the full time-series. - @param new_symbols: New currency-pair to request, if they differ from the constructor. + @param new_symbols: New currency-pair to request, if they differ from + the constructor. @return: pd.DataFrame of the returned data. """ @@ -81,14 +82,16 @@ def read(self, new_symbols: str = None) -> pd.DataFrame: # Check if the provided currency-pair is listed on the exchange. if not self._check_symbols(): raise KeyError( - f"The provided currency-pair is not listed on '{self.name.capitalize()}'. " + f"The provided currency-pair is not listed on " + f"'{self.name.capitalize()}'. " f"Call CryptoReader.get_currency_pairs() for an overview." ) result = list() - # Repeat until no "older" timestamp is delivered. Cryptocurrency exchanges often restrict the amount of - # data points returned by a single request, thus making it necessary to iterate backwards in time and merge - # the retrieved data. + # Repeat until no "older" timestamp is delivered. + # Cryptocurrency exchanges often restrict the amount of + # data points returned by a single request, thus making it + # necessary to iterate backwards in time and merge the retrieved data. while True: # perform request and extract data. resp = self._get_data() @@ -114,16 +117,18 @@ def read(self, new_symbols: str = None) -> pd.DataFrame: # Extract the minimum timestamp from the response for further requests. new_time = min(item[time_key] for item in data) - # Break the requesting if minimum timestamp is lower than initial start time. + # Break if min timestamp is lower than initial start time. if new_time.timestamp() <= self.start.timestamp(): break # Or continue requesting from the new timestamp. else: self.symbols.update({list(self.symbols.keys())[0]: new_time}) - # Move cursor to the next line to ensure that new print statements are executed correctly. + # Move cursor to the next line to ensure that + # new print statements are executed correctly. stdout.write("\n") - # If there is data put it into a pd.DataFrame, set index and cut it to fit the initial start/end time. + # If there is data put it into a pd.DataFrame, + # set index and cut it to fit the initial start/end time. if result: result = pd.DataFrame(result, columns=mappings) result = self._index_and_cut_dataframe(result) @@ -175,7 +180,8 @@ def _check_symbols(self) -> bool: if currency_pairs is None: warnings.warn( - "Currency-pair request is dysfunctional. Check for valid symbols is skipped." + "Currency-pair request is dysfunctional. " + "Check for valid symbols is skipped." ) return True @@ -187,7 +193,8 @@ def _check_symbols(self) -> bool: ) def _await_rate_limit(self): - """ Sleep time in order to not violate the rate limit, measured in requests per minute.""" + """ Sleep time in order to not violate the rate limit, + measured in requests per minute.""" time.sleep(self.rate_limit) @@ -201,8 +208,9 @@ def _index_and_cut_dataframe(self, dataframe: pd.DataFrame) -> pd.DataFrame: # Reindex dataframe and cut it to the specified start and end dates. dataframe.set_index("time", inplace=True) dataframe.sort_index(inplace=True) - # Returned timestamps from the exchanges are converted into UTC and therefore timezone aware. - # Make start and end dates timezone aware in order to make them comparable. + # Returned timestamps from the exchanges are converted into UTC + # and therefore timezone aware. Make start and end dates + # timezone aware in order to make them comparable. dataframe = dataframe.loc[ pytz.utc.localize(self.start) : pytz.utc.localize(self.end) ] diff --git a/pandas_datareader/crypto_utils/_paths.py b/pandas_datareader/crypto_utils/_paths.py index 8288746e..ee30af29 100644 --- a/pandas_datareader/crypto_utils/_paths.py +++ b/pandas_datareader/crypto_utils/_paths.py @@ -6,7 +6,6 @@ """ import os -import sys from pathlib import Path # sys.path.insert(0, os.path.dirname(__file__)) diff --git a/pandas_datareader/crypto_utils/exchange.py b/pandas_datareader/crypto_utils/exchange.py index aece2c53..ef2b5dba 100644 --- a/pandas_datareader/crypto_utils/exchange.py +++ b/pandas_datareader/crypto_utils/exchange.py @@ -21,8 +21,9 @@ class Exchange(_BaseReader, ABC): - """ Class for every exchange supported. The class extracts the request url, fits parameters, - extracts the values from the response json and performs type-conversions.""" + """ Class for every exchange supported. The class extracts the request url, + fits parameters, extracts the values from the response json and + performs type-conversions.""" def __init__(self, exchange_name: str, interval: str = "days", *args, **kwargs): """ Constructor. @@ -86,7 +87,8 @@ def url_and_params(self, request_type): """ Formats the request url, inserts the currency-pair representation and/or extracts the parameters specified for the exchange and request. - @param request_type: The request type. Default: "historic_rates". Possible: "historic_rates", "currency_pairs". + @param request_type: The request type. Default: "historic_rates". + Possible: "historic_rates", "currency_pairs". @return Tuple of formatted url and formatted parameters. """ @@ -132,7 +134,8 @@ def url_and_params(self, request_type): def param_dict(self, request_type: str): """ Extracts the request url from the yaml-file and implements the parameters. - @param request_type: Request name, default: "historic_rates". Possible: "historic_rates", "currency_pairs". + @param request_type: Request name, default: "historic_rates". + Possible: "historic_rates", "currency_pairs". @return: Dict of the extracted url and parameters. """ @@ -159,13 +162,17 @@ def param_dict(self, request_type: str): "type": self._type_con, } - # enumerate mapping dict to sort parameter values accordingly, i.e. {"allowed": 0, "function": 1, ...} + # enumerate mapping dict to sort parameter values accordingly, + # i.e. {"allowed": 0, "function": 1, ...} mapping_index = {val: key for key, val in enumerate(mapping.keys())} for param, options in parameters.items(): - # Kick out all option keys which are not in the mapping dict or where required: False. - # Sort the dict options according to the mapping-keys to ensure the right order of function calls. - # Otherwise a (valid) specified value might be overwritten by the default value. + # - Kick out all option keys which are not in the mapping dict + # or where required: False. + # - Sort the dict options according to the mapping-keys to ensure + # the right order of function calls. + # - Otherwise a (valid) specified value might be overwritten + # by the default value. options = {k: v for k, v in options.items() if k in mapping.keys()} options = OrderedDict( sorted(options.items(), key=lambda x: mapping_index.get(x[0])) @@ -173,7 +180,8 @@ def param_dict(self, request_type: str): if not parameters[param].get("required", True): continue - # Iterate over the functions and fill the params dict with values. Kwargs are needed only partially. + # Iterate over the functions and fill the params dict with values. + # Kwargs are needed only partially. kwargs = {"has_value": None, "currency_pairs": self.symbols} for key, val in options.items(): kwargs.update({"has_value": parameter.get(param, None)}) @@ -184,7 +192,8 @@ def param_dict(self, request_type: str): self._param_dict = urls def _allowed(self, val: dict, **_: dict) -> Any: - """ Extract the configured value from all allowed values. If there is no match, return str "default". + """ Extract the configured value from all allowed values. + If there is no match, return str "default". @param val: dict of allowed key, value pairs. @param _: unused additional arguments needed in other methods. @@ -249,15 +258,19 @@ def _type_con(self, val: Any, **kwargs: dict) -> Any: param_value = kwargs.get("has_value", None) conv_params = val - # to avoid conversion when only a type declaration was done. If a parameter is of type "int". + # to avoid conversion when only a type declaration was done. + # If a parameter is of type "int". if isinstance(conv_params, str) or len(conv_params) < 2: return param_value - # replace the key "interval" with the interval specified in the configuration file. + # replace the key "interval" with the interval specified + # in the configuration file. conv_params = [self.interval if x == "interval" else x for x in conv_params] - # return {cp: convert_type(param_value[cp], deque(conv_params)) for cp in currency_pairs} - # ToDo: Check if the above line works. The older version needed both if statements below. + # return {cp: convert_type(param_value[cp], deque(conv_params)) + # for cp in currency_pairs} + # ToDo: Check if the above line works. + # The older version needed both if statements below. if isinstance(param_value, dict): return { cp: convert_type(param_value[cp], deque(conv_params)) @@ -284,11 +297,12 @@ def _get_first_timestamp(self, last_ts: datetime) -> datetime: def format_data( self, responses: Union[Dict, List] ) -> Tuple[Optional[List], Optional[List]]: - """ Extracts and formats the response data, according to the mapping keys and path. - Data is then ordered and returned as a tuple. + """ Extracts and formats the response data, according to the + mapping keys and path. Data is then ordered and returned as a tuple. @param responses: The response json - @return: Tuple of extracted and formatted data and a list of the mapping keys in the same order. + @return: Tuple of extracted and formatted data and a list of the + mapping keys in the same order. """ if not responses: @@ -300,7 +314,7 @@ def format_data( ) mapping_keys = [mapping.key for mapping in mappings] - # creating dictionary where key is the name of the mapping which holds an empty list + # creating dict where key is the name of the mapping which holds an empty list temp_results = dict( zip((key for key in mapping_keys), itertools.repeat([], len(mappings))) ) @@ -315,8 +329,9 @@ def format_data( temp_results[mapping.key] = mapping.extract_value(responses) if isinstance(temp_results[mapping.key], str): - # Bugfix: if value is a single string, it is an iterable, and the string will - # be split in every letter. Therefore it is put into a list. + # Bugfix: if value is a single string, it is an iterable, + # and the string will be split in every letter. + # Therefore it is put into a list. temp_results[mapping.key] = [temp_results[mapping.key]] except Exception: @@ -325,15 +340,17 @@ def format_data( else: # CHANGE: One filed invalid -> all fields invalid. - # changed this in order to avoid responses kicked out just because of one invalid field. - # The response will be filtered out in the DB-Handler if the primary-keys are missing anyways. + # Changed this in order to avoid responses kicked out just because + # of one invalid field. The response will be filtered out + # in the DB-Handler if the primary-keys are missing anyways. if all( value is None and not isinstance(value, datetime) for value in list(temp_results.values()) ): return None, None - # asserting that the extracted lists for each mapping are having the same length + # asserting that the extracted lists for each mapping are + # having the same length assert (len(results[0]) == len(result) for result in temp_results) len_results = { @@ -363,11 +380,10 @@ def format_currency_pairs( Process is similar to @see{self.format_ticker()}. - @param response: - Raw json-response from the Rest-API of this exchange that needs be formatted. - @return: - Iterator containing tuples of the following structure: - (self.name, name of first currency-pair, name of second currency-pair) + @param response: Raw json-response from the Rest-API of this exchange + that needs be formatted. + @return: Iterator containing tuples of the following structure: + (self.name, name of base currency, name of quote currency) """ results = {"currency_pair_first": [], "currency_pair_second": []} @@ -379,8 +395,8 @@ def format_currency_pairs( results[mapping.key] = mapping.extract_value(response) if isinstance(results[mapping.key], str): - # If the result is only one currency, it will be split into every letter. - # To avoid this, put it into a list. + # If the result is only one currency, it will be split + # into every letter. To avoid this, put it into a list: results[mapping.key] = [results[mapping.key]] results[mapping.key] = [item.lower() for item in results[mapping.key]] @@ -413,7 +429,8 @@ def format_currency_pairs( ) def reset_request_start_date(self): - """ Reset the end date for the symbols in order to be able to restart a request from the end date.""" + """ Reset the end date for the symbols in order to be able to restart + a request from the end date.""" key = list(self.symbols.keys())[0] self.symbols.update({key: self.end}) @@ -421,7 +438,8 @@ def reset_request_start_date(self): def get_rate_limit(self) -> Union[int, float]: """ Calculates the rate-limit of an exchange. - @return: The rate limit, i.e. time to "sleep" to not violate the limit in seconds. + @return: The rate limit, i.e. time to "sleep" to not violate the + limit in seconds. """ if self.yaml_file.get("rate_limit"): if self.yaml_file["rate_limit"]["max"] <= 0: @@ -437,11 +455,12 @@ def get_rate_limit(self) -> Union[int, float]: return rate_limit def apply_currency_pair_format(self, currency_pair: str) -> str: - """ Helper method that applies the format described in the yaml for the specific - request on the given currency-pair. + """ Helper method that applies the format described in the yaml + for the specific request on the given currency-pair. @param currency_pair: String repr of the currency-pair - @return: String of the formatted currency-pair. Example: BTC and ETH -> "btc_eth" + @return: String of the formatted currency-pair. + Example: BTC and ETH -> "btc_eth" """ try: first, second = currency_pair.split("/") @@ -474,5 +493,6 @@ def symbol_setter(self, new_symbols: Union[str, dict]): if isinstance(new_symbols, str): new_symbols = split_str_to_list(new_symbols) - # Create a new dict with new symbols as keys and the end timestamp as values. + # Create a new dict with new symbols as keys and + # the end timestamp as values. self.symbols = dict.fromkeys(new_symbols, self.end) diff --git a/pandas_datareader/crypto_utils/mapping.py b/pandas_datareader/crypto_utils/mapping.py index 1c501947..6162af58 100644 --- a/pandas_datareader/crypto_utils/mapping.py +++ b/pandas_datareader/crypto_utils/mapping.py @@ -51,8 +51,9 @@ def convert_type(value: Any, types_queue: Deque[str]) -> Any: for _ in range(conversion["params"]): params.append(types_queue.popleft()) - # Change here to avoid "None" as result value in the params when no value to convert is needed (i.e. when - # methods are called with ("none", ...). + # Change here to avoid "None" as result value in the params when no + # value to convert is needed (i.e. when methods are called with + # ("none", ...). # if not result and isinstance(result, (str, list)): try: if result is None: @@ -125,7 +126,8 @@ def traverse_path( @param path_queue: The queue of path traversal instructions. @type path_queue: deque @param currency_pair_info: The formatted String of a currency pair. - For special case that the key of a dictionary is the formatted currency pair string. + For special case that the key of a dictionary + is the formatted currency pair string. @type currency_pair_info: tuple[str, str, str] @return: The traversed response dict. @@ -145,7 +147,7 @@ def traverse_path( elif path_element == "list_values": traversed = list(response.values()) elif path_element == []: - # Special case to extract multiple values from a single list ["USD","BTC",...] + # Case to extract multiple values from a single list ["USD","BTC",...] traversed = response elif path_element == "currency_pair" and currency_pair_info[2] is not None: traversed = response[currency_pair_info[2]] @@ -200,7 +202,8 @@ def extract_value( return None if not path_queue: - # TODO: after integration tests, look if clause for first and second currency can be deleted! + # TODO: after integration tests, look if clause for first + # and second currency can be deleted! if types_queue[0] == "first_currency": return currency_pair_info[0] elif types_queue[0] == "second_currency": @@ -256,7 +259,9 @@ def extract_value( for item in response: result.append(convert_type(item, deque(types_queue))) - # for dict_key special_case aka. test_extract_value_list_containing_dict_where_key_is_value() in test_mapping.py + # for dict_key special_case aka. + # test_extract_value_list_containing_dict_where_key_is_value() + # in test_mapping.py if len(result) == 1: result = result[0] @@ -320,7 +325,8 @@ def extract_mappings( ) except KeyError: print( - f"Error loading mappings of {exchange_name} in {request}: {entry}" + f"Error loading mappings of {exchange_name} " + f"in {request}: {entry}" ) break @@ -332,8 +338,8 @@ def extract_mappings( def is_scalar(value: Any) -> bool: """ Indicates whether a value is a scalar or not. - Convenience function returning a bool whether the provided value is a single value or not. - Strings count as scalar although they are iterable. + Convenience function returning a bool whether the provided value + is a single value or not. Strings count as scalar although they are iterable. @param value: The value to evaluate concerning whether it is a single value or multiple values (iterable). diff --git a/pandas_datareader/crypto_utils/time_helper.py b/pandas_datareader/crypto_utils/time_helper.py index ebbc4b6b..0b636625 100644 --- a/pandas_datareader/crypto_utils/time_helper.py +++ b/pandas_datareader/crypto_utils/time_helper.py @@ -45,9 +45,8 @@ class TimeHelper: @staticmethod def now() -> datetime: - """ Get the current datetime (UTC+0). - - The accuracy is limited to milliseconds and the remaining microseconds are cleared. + """ Get the current datetime (UTC+0). The accuracy is limited to + milliseconds and the remaining microseconds are cleared. @return: The current datetime (UTC+0). @rtype: datetime diff --git a/pandas_datareader/crypto_utils/utilities.py b/pandas_datareader/crypto_utils/utilities.py index 788820a4..d70949a1 100644 --- a/pandas_datareader/crypto_utils/utilities.py +++ b/pandas_datareader/crypto_utils/utilities.py @@ -107,7 +107,8 @@ }, ("none", "range"): {"function": lambda: range(1), "params": 0}, ("value", "map"): { - # translate into buy/sell. Args: {0: 'buy', 1:'sell'} and arg[0] is the response value (i.e. 0/1) + # translate into buy/sell. Args: {0: 'buy', 1:'sell'} and arg[0] + # is the response value (i.e. 0/1) "function": lambda *args: {args[1]: args[2], args[3]: args[4]}[args[0]], "params": 4, }, @@ -182,9 +183,11 @@ }, } """ - Type Conversions used to convert extracted values from the API-Response into the desired type ("first", "second"). - The values are specified in the .yaml-file of each exchange under the "mapping" of each method. - The function is called in the Mapping Class of utilities.py under the method convert_types(). + Type Conversions used to convert extracted values from the API-Response + into the desired type ("first", "second"). The values are specified in the + .yaml-file of each exchange under the "mapping" of each method. + The function is called in the Mapping Class of utilities.py under + the method convert_types(). "first": The actual type extracted from the API-Request (.json) diff --git a/pandas_datareader/tests/test_cryptoreader.py b/pandas_datareader/tests/test_cryptoreader.py index e768017b..0fab2703 100644 --- a/pandas_datareader/tests/test_cryptoreader.py +++ b/pandas_datareader/tests/test_cryptoreader.py @@ -75,8 +75,8 @@ def test_check_wrong_splitting_symbol(self): self.CryptoReader.read() def test_iterate_requests_until_end(self): - """ Tests to iterate the request with updated timestamps until no more timestamp is collected - or start time is reached.""" + """ Tests to iterate the request with updated timestamps until + no more timestamp is collected or start time is reached.""" # ToDo pass @@ -176,7 +176,8 @@ def test_necessary_values_in_mappings(self): ) for mapping in mappings: - # Check if the object dict contains all necessary keys and not-None values. + # Check if the object dict contains all necessary keys + # and not-None values. assert all( [ item in mapping.__dict__.keys() @@ -212,7 +213,7 @@ def test_format_url_and_params(self): assert isinstance(self.CryptoReader.params, dict) def test_all_exchange_apis(self): - """ Test if the API of every exchange is correctly implemented and functional.""" + """ Test if the API of every exchange is correctly implemented.""" # ToDo pass @@ -693,8 +694,8 @@ def test_extract_value_dict_key_split_index_one(self): assert result == ["USD", "EUR"] def test_extract_value_where_pair_can_not_be_split(self): - """ Test extract value for special case where value is currency pair but cannot be extracted - since there is no delimiter for splitting the pair.""" + """ Test extract value for case where value is currency pair but cannot + be extracted since there is no delimiter for splitting the pair.""" mapping = Mapping("first", [], ["first_currency"]) result = mapping.extract_value( ["ETHBTC", "XRPBTC"], currency_pair_info=("XRP", "BTC", "XRPBTC") @@ -716,7 +717,8 @@ def test_extract_value_list(self): assert value_list == result def test_extract_value_list_containing_dict_with_key(self): - """ Test of extract value for a list that contains a dict for each index with a known key.""" + """ Test of extract value for a list that contains a dict for each + index with a known key.""" # list element directly holds value behind key mapping = Mapping("first_currency", ["first"], ["str"]) @@ -733,7 +735,8 @@ def test_extract_value_list_containing_dict_with_key(self): value_list = ["BTC", "ETH", "XRP", "DOGE", "XSA", "TEST"] assert value_list == result - # list element holds dict that holds another dict which holds the value behind key + # list element holds dict that holds another dict which holds the + # value behind key mapping = Mapping( "first_currency", [ @@ -807,7 +810,8 @@ def test_extract_value_list_containing_dict_with_key(self): assert value_list == result def test_extract_values_dict_values(self): - """ Test of extract values for the special case that each key of a dictionary holds the values.""" + """ Test of extract values for the special case that each key of a + dictionary holds the values.""" mapping = Mapping("first_currency", ["dict_values"], ["str"]) extract_dict = {"1": "XRP", 2: "ETH", "3": "BTC", 4: "DOGE"} @@ -886,7 +890,7 @@ def test_extract_values_dict_values(self): def test_extract_value_list_containing_dict_where_key_is_value(self): """ Test of extract value for a list that contains a dict that contains a dict. - The first dict only has one key, which is the value we search for.""" + The first dict only has one key, which is the value we search for.""" mapping = Mapping("second_currency", ["dict_key"], ["str", "split", "_", 1]) extract_list = [ {"btc_eth": {"other": "values"}}, @@ -899,8 +903,9 @@ def test_extract_value_list_containing_dict_where_key_is_value(self): assert value_list == result def test_extract_value_list_containing_dict_where_pair_is_key_to_values(self): - """ Test of extract value for a list that contains dicts that hold a single dict. - The key is the formatted currency pair that is needed to gain access to the value.""" + """ Test of extract value for a list that contains dicts that hold + a single dict. The key is the formatted currency pair that is needed + to gain access to the value.""" mapping = Mapping("value", ["currency_pair", 1], ["str", "float"]) extract_dict = { "btc_eth": {1: "123.456"}, @@ -910,7 +915,8 @@ def test_extract_value_list_containing_dict_where_pair_is_key_to_values(self): } value_list = [415.161, 112.131, 789.101, 123.456] - # note that currency pair infos are from bottom to top if compared to extract_dict + # note that currency pair infos are from bottom to top + # if compared to extract_dict currency_pair_infos = ( ("doge", "BTC", "doge_btc"), ("xrp", "eth", "xrp_eth"), @@ -928,7 +934,8 @@ def test_extract_value_list_containing_dict_where_pair_is_key_to_values(self): assert value_list == result def test_extract_value_dict_containing_list(self): - """ Test of extract value where the response is a dict and the known key contains a list of the values.""" + """ Test of extract value where the response is a dict and the + known key contains a list of the values.""" mapping = Mapping("first_currency", ["data"], ["str", "split", "_", 0]) extract_dict = { "data": ["eth_btc", "usd_btc", "xrp_eth", "eth_xrp"], From 948689915a4353c9a29a6837d08561401c05ba3d Mon Sep 17 00:00:00 2001 From: Steffen Date: Tue, 21 Dec 2021 14:24:52 +0100 Subject: [PATCH 22/25] -Fixed several linting issues -Fixed splitting parameter for platforms -New unit tests -Adjusted parameter order for CryptoReader to match the DataReader --- docs/source/remote_data.rst | 23 ++++++++++---- pandas_datareader/crypto.py | 30 ++++++++++++++----- pandas_datareader/crypto_utils/exchange.py | 18 +++++++---- pandas_datareader/crypto_utils/mapping.py | 2 +- .../crypto_utils/resources/bleutrade.yaml | 2 +- .../crypto_utils/resources/coinbase.yaml | 2 +- .../crypto_utils/resources/coinpaprika.yaml | 1 - .../crypto_utils/resources/gemini.yaml | 2 +- .../crypto_utils/resources/omgfin.yaml | 2 +- .../crypto_utils/resources/p2pb2b.yaml | 2 -- pandas_datareader/crypto_utils/utilities.py | 8 ++--- pandas_datareader/tests/test_cryptoreader.py | 26 ++++++++++++++-- 12 files changed, 85 insertions(+), 33 deletions(-) diff --git a/docs/source/remote_data.rst b/docs/source/remote_data.rst index 9e19b10e..82c52e63 100644 --- a/docs/source/remote_data.rst +++ b/docs/source/remote_data.rst @@ -770,7 +770,7 @@ The following endpoints are available: Cryptocurrency Data =================== -Access historical data feed from the most popular and liquid exchanges and platforms and return OHLCV candles. +Access historical data feed from the most popular and liquid exchanges, aggregating platforms, and return OHLCV candles. Platforms such as ``Coingecko`` or ``Coinpaprika`` return in addition the global turnover volume and market capitalization. The ``CryptoReader`` offers helpful methods to print all supported exchanges/platforms and their listed @@ -792,17 +792,28 @@ Data can be retrieved with the ``DataReader`` class, which takes the following a .. ipython:: python import pandas_datareader.data as web - df = web.DataReader("btc/usd", "coinbase") + df = web.DataReader("btc-usd", "coinbase") df.head() + open high low close volume + time + 2015-07-20 23:59:59+00:00 277.98 280.00 277.37 280.00 782.883420 + 2015-07-21 23:59:59+00:00 279.96 281.27 276.85 277.32 4943.559434 + 2015-07-22 23:59:59+00:00 277.33 278.54 275.01 277.89 4687.909383 + 2015-07-23 23:59:59+00:00 277.96 279.75 276.28 277.39 5306.919575 + 2015-07-24 23:59:59+00:00 277.23 291.52 276.43 289.12 7362.469083 Additionally, the ``CryptoReader`` can be used directly: .. ipython:: python from pandas_datareader.crypto import CryptoReader - reader = CryptoReader("btc/usd", "coinbase", interval="minutes", start="2021-10-01", end="2021-10-31") + reader = CryptoReader("eth/usd", "coinbase", interval="minutes", start="2021-10-01", end="2021-10-05") df = reader.read() df.head() - - df = reader.read("eth/usd") - df.head() + open high low close volume + time + 2021-10-01 00:00:59+00:00 43828.89 43837.30 43802.92 43834.03 7.136981 + 2021-10-01 00:01:59+00:00 43834.88 43884.01 43834.88 43884.01 11.246865 + 2021-10-01 00:02:59+00:00 43884.01 43970.02 43804.29 43970.02 27.248120 + 2021-10-01 00:03:59+00:00 43970.02 43999.36 43918.60 43982.30 13.401548 + 2021-10-01 00:04:59+00:00 43980.72 44000.00 43946.80 43994.93 14.669717 \ No newline at end of file diff --git a/pandas_datareader/crypto.py b/pandas_datareader/crypto.py index 842cdbc2..4b47e94f 100644 --- a/pandas_datareader/crypto.py +++ b/pandas_datareader/crypto.py @@ -27,23 +27,26 @@ class CryptoReader(Exchange, ABC): def __init__( self, - exchange_name: str, symbols: Union[str, dict], - start: Union[str, datetime] = "2009-01-01", + exchange_name: str, + start: Union[str, datetime] = None, end: Union[str, datetime] = None, interval: str = "days", **kwargs, ): """ Constructor. Inherits from the Exchange and _BaseReader class. - @param exchange_name: String repr of the exchange name @param symbols: Currency pair to request (i.e. BTC-USD) + @param exchange_name: String repr of the exchange name @param start: The start time of the request, handed over to the BaseReader. @param end: The end time of the request, handed over to the BaseReader. @param interval: Candle interval (i.e. minutes, hours, days, weeks, months) @param **kwargs: Additional kw-arguments for the _BaseReader class. """ + if not start: + start = datetime(2009, 1, 1) + super(CryptoReader, self).__init__( exchange_name, interval, symbols, start, end, **kwargs ) @@ -56,7 +59,6 @@ def _get_data(self) -> Dict: # Extract and format the url and parameters for the request self.param_dict = "historic_rates" - # self.get_formatted_url_and_params(self.param_dict, *self.symbols.keys()) self.url_and_params = "historic_rates" # Perform the request @@ -80,7 +82,7 @@ def read(self, new_symbols: str = None) -> pd.DataFrame: self.symbol_setter(new_symbols) # Check if the provided currency-pair is listed on the exchange. - if not self._check_symbols(): + if not self._check_symbols: raise KeyError( f"The provided currency-pair is not listed on " f"'{self.name.capitalize()}'. " @@ -88,6 +90,7 @@ def read(self, new_symbols: str = None) -> pd.DataFrame: ) result = list() + mappings = list() # Repeat until no "older" timestamp is delivered. # Cryptocurrency exchanges often restrict the amount of # data points returned by a single request, thus making it @@ -170,6 +173,7 @@ def get_currency_pairs( else resp ) + @property def _check_symbols(self) -> bool: """ Checks if the specified currency-pair is listed on the exchange""" @@ -185,10 +189,20 @@ def _check_symbols(self) -> bool: ) return True - return all( + return any( [ - (self.name, *symbol.lower().split("/")) in currency_pairs - for symbol in symbols + all( + [ + (self.name, *symbol.lower().split("/")) in currency_pairs + for symbol in symbols + ] + ), + all( + [ + (self.name, *symbol.lower().split("-")) in currency_pairs + for symbol in symbols + ] + ), ] ) diff --git a/pandas_datareader/crypto_utils/exchange.py b/pandas_datareader/crypto_utils/exchange.py index ef2b5dba..395eccc4 100644 --- a/pandas_datareader/crypto_utils/exchange.py +++ b/pandas_datareader/crypto_utils/exchange.py @@ -464,11 +464,19 @@ def apply_currency_pair_format(self, currency_pair: str) -> str: """ try: first, second = currency_pair.split("/") - except ValueError as e: - raise Exception( - "Base and quote currency are indistinguishable." - " Currencies must be split by '/': %s" % currency_pair - ) from e + + except ValueError: + try: + first, second = currency_pair.split("-") + + except ValueError as e: + raise Exception( + "Base and quote currency are indistinguishable." + " Symbols must be split by either '/' or '-'." + " Hyphenated currencies must be split by '/'," + " i.e.: 'btc-bitcoin/usd'." + " The currently provided symbols are: '%s'" % currency_pair + ) from e request_url_and_params = ( self.yaml_file.get("requests").get("historic_rates").get("request") diff --git a/pandas_datareader/crypto_utils/mapping.py b/pandas_datareader/crypto_utils/mapping.py index 6162af58..6f2ceed9 100644 --- a/pandas_datareader/crypto_utils/mapping.py +++ b/pandas_datareader/crypto_utils/mapping.py @@ -203,7 +203,7 @@ def extract_value( if not path_queue: # TODO: after integration tests, look if clause for first - # and second currency can be deleted! + # and second currency can be deleted! if types_queue[0] == "first_currency": return currency_pair_info[0] elif types_queue[0] == "second_currency": diff --git a/pandas_datareader/crypto_utils/resources/bleutrade.yaml b/pandas_datareader/crypto_utils/resources/bleutrade.yaml index 6906c553..9ebc6bb9 100644 --- a/pandas_datareader/crypto_utils/resources/bleutrade.yaml +++ b/pandas_datareader/crypto_utils/resources/bleutrade.yaml @@ -1,4 +1,4 @@ -#ToDo: API Dokumentation nicht auffindbar. Historic Rates flexibeler Timestamp nicht implementiert. +#API Dokumentation nicht auffindbar. Historic Rates flexibeler Timestamp nicht implementiert. name: bleutrade exchange: true api_url: https://bleutrade.com/api/v3/ diff --git a/pandas_datareader/crypto_utils/resources/coinbase.yaml b/pandas_datareader/crypto_utils/resources/coinbase.yaml index c86b01ce..75000915 100644 --- a/pandas_datareader/crypto_utils/resources/coinbase.yaml +++ b/pandas_datareader/crypto_utils/resources/coinbase.yaml @@ -284,7 +284,7 @@ requests: days: 86400 default: 86400 response: - type: list # TODO: Header Entry? + type: list values: type: list values: diff --git a/pandas_datareader/crypto_utils/resources/coinpaprika.yaml b/pandas_datareader/crypto_utils/resources/coinpaprika.yaml index 654a2722..523e89d4 100644 --- a/pandas_datareader/crypto_utils/resources/coinpaprika.yaml +++ b/pandas_datareader/crypto_utils/resources/coinpaprika.yaml @@ -1,4 +1,3 @@ -# ToDo: Tickers fehlerhaft name: coinpaprika exchange: false diff --git a/pandas_datareader/crypto_utils/resources/gemini.yaml b/pandas_datareader/crypto_utils/resources/gemini.yaml index 6cecc2f6..612685ea 100644 --- a/pandas_datareader/crypto_utils/resources/gemini.yaml +++ b/pandas_datareader/crypto_utils/resources/gemini.yaml @@ -19,7 +19,7 @@ requests: type: list values: # each available currency pair, i.e. "btcusd" type: str - mapping: # TODO split Methode + mapping: # TODO: split Methode is not save - key: currency_pair_first path: - [] diff --git a/pandas_datareader/crypto_utils/resources/omgfin.yaml b/pandas_datareader/crypto_utils/resources/omgfin.yaml index 9f17a715..df32334b 100644 --- a/pandas_datareader/crypto_utils/resources/omgfin.yaml +++ b/pandas_datareader/crypto_utils/resources/omgfin.yaml @@ -1,4 +1,4 @@ -#ToDO: HR endpoint is not really working. Frequently returning data is non-json format (status 503) which can not +#HR endpoint is not really working. Frequently returning data is non-json format (status 503) which can not # be parsed. name: omgfin diff --git a/pandas_datareader/crypto_utils/resources/p2pb2b.yaml b/pandas_datareader/crypto_utils/resources/p2pb2b.yaml index b226b2ba..1a281aad 100644 --- a/pandas_datareader/crypto_utils/resources/p2pb2b.yaml +++ b/pandas_datareader/crypto_utils/resources/p2pb2b.yaml @@ -1,5 +1,3 @@ -# ToDo: Function für einen Offset für HR schreiben. - name: p2pb2b exchange: true rate_limit: diff --git a/pandas_datareader/crypto_utils/utilities.py b/pandas_datareader/crypto_utils/utilities.py index d70949a1..6049f639 100644 --- a/pandas_datareader/crypto_utils/utilities.py +++ b/pandas_datareader/crypto_utils/utilities.py @@ -222,10 +222,10 @@ def yaml_loader(exchange: str) -> Dict[str, Any]: ) as file: return yaml.load(file, Loader=yaml.FullLoader) - except FileNotFoundError: - print( - f"\nFile {path.joinpath('.'.join([exchange.lower(), 'yaml']))} not found." - ) + except FileNotFoundError as exc: + raise ValueError( + "Exchange '%s' is not supported." % exchange.capitalize() + ) from exc def get_exchange_names() -> Optional[List[str]]: diff --git a/pandas_datareader/tests/test_cryptoreader.py b/pandas_datareader/tests/test_cryptoreader.py index 0fab2703..0cbb87a5 100644 --- a/pandas_datareader/tests/test_cryptoreader.py +++ b/pandas_datareader/tests/test_cryptoreader.py @@ -23,7 +23,7 @@ class TestCryptoReader: exchange_name = "coinbase" symbols = "btc/usd" - CryptoReader = CryptoReader(exchange_name, symbols) + CryptoReader = CryptoReader(symbols=symbols, exchange_name=exchange_name) def test_get_all_exchanges(self): """ Test to return a list of all available exchanges.""" @@ -137,7 +137,29 @@ class TestExchange: # ToDo: Create test-exchange yaml file and use it instead for this class. exchange_name = "coinbase" symbols = "btc/usd" - CryptoReader = CryptoReader(exchange_name, symbols) + CryptoReader = CryptoReader(symbols=symbols, exchange_name=exchange_name) + + def test_unknown_exchange_name(self): + """ Test for an unsupported exchange.""" + + with pytest.raises(ValueError): + yaml_loader("not_supported_exchange") + + def test_correct_symbol_splitter(self): + """ Test to check for the correct symbol splitter.""" + + valid_symbols = ["btc-usd", "btc/usd", "btc-bitcoin/usd", "bitcoin/usd"] + invalid_symbols = ["btc$usd", "btc_usd", "btc-bitcoin-usd", "btc/bitcoin/usd"] + + formatted_pairs = [ + self.CryptoReader.apply_currency_pair_format(cp) for cp in valid_symbols + ] + assert all( + [isinstance(formatted_pair, str) for formatted_pair in formatted_pairs] + ) + + with pytest.raises(BaseException): + [self.CryptoReader.apply_currency_pair_format(cp) for cp in invalid_symbols] def test_extract_mappings(self): """ Test to extract the mapping keys and values from the yaml files.""" From 232728f479f4fe659f31e37dfe831f2efa38fc9f Mon Sep 17 00:00:00 2001 From: Steffen Date: Sat, 25 Dec 2021 13:06:12 +0100 Subject: [PATCH 23/25] -More unit tests -Listed currency-pair request simplified -Some small bug fixes --- docs/source/remote_data.rst | 30 ++++++- pandas_datareader/crypto.py | 17 ++-- pandas_datareader/crypto_utils/exchange.py | 2 +- pandas_datareader/crypto_utils/utilities.py | 37 +++++---- pandas_datareader/tests/test_cryptoreader.py | 87 ++++++++++++++------ 5 files changed, 125 insertions(+), 48 deletions(-) diff --git a/docs/source/remote_data.rst b/docs/source/remote_data.rst index 82c52e63..3569f363 100644 --- a/docs/source/remote_data.rst +++ b/docs/source/remote_data.rst @@ -770,7 +770,7 @@ The following endpoints are available: Cryptocurrency Data =================== -Access historical data feed from the most popular and liquid exchanges, aggregating platforms, and return OHLCV candles. +Access historical data feed from the most popular and liquid exchanges, data aggregating platforms, and return OHLCV candles. Platforms such as ``Coingecko`` or ``Coinpaprika`` return in addition the global turnover volume and market capitalization. The ``CryptoReader`` offers helpful methods to print all supported exchanges/platforms and their listed @@ -781,6 +781,32 @@ currency-pairs: from pandas_datareader.crypto import CryptoReader CryptoReader.get_all_exchanges() + ['50x', + 'alterdice', + ...] + +Or, if an exchange is selected but the supported cryptocurrency pairs are unknwon: + +.. ipython:: python + + from pandas_datareder.crypto import CryptoReader + + Reader = CryptoReader(exchange_name="coinbase") + Reader.get_currency_pairs() + + Exchange Base Quote + 0 COINBASE SUPER USDT + 1 COINBASE COMP USD + 2 COINBASE COVAL USD + 3 COINBASE GTC USD + 4 COINBASE ATOM BTC + .. ... ... ... + 399 COINBASE TRB BTC + 400 COINBASE GRT USD + 401 COINBASE BICO USD + 402 COINBASE FET USD + 403 COINBASE ORN USD + Data can be retrieved with the ``DataReader`` class, which takes the following arguments: * ``name`` - the currency-pair of interest @@ -807,7 +833,7 @@ Additionally, the ``CryptoReader`` can be used directly: .. ipython:: python from pandas_datareader.crypto import CryptoReader - reader = CryptoReader("eth/usd", "coinbase", interval="minutes", start="2021-10-01", end="2021-10-05") + reader = CryptoReader("eth-usd", "coinbase", interval="minutes", start="2021-10-01", end="2021-10-05") df = reader.read() df.head() open high low close volume diff --git a/pandas_datareader/crypto.py b/pandas_datareader/crypto.py index 4b47e94f..801ca114 100644 --- a/pandas_datareader/crypto.py +++ b/pandas_datareader/crypto.py @@ -27,8 +27,8 @@ class CryptoReader(Exchange, ABC): def __init__( self, - symbols: Union[str, dict], - exchange_name: str, + symbols: Union[str, dict] = None, + exchange_name: str = None, start: Union[str, datetime] = None, end: Union[str, datetime] = None, interval: str = "days", @@ -167,11 +167,14 @@ def get_currency_pairs( except (requests.exceptions.MissingSchema, Exception): return None - return ( - pd.DataFrame(resp, columns=["Exchange", "Base", "Quote"]) - if not raw_data - else resp - ) + if raw_data: + return resp + + # create pd.DataFrame and apply upper case to values + data = pd.DataFrame(resp, columns=["Exchange", "Base", "Quote"]) + data = data.apply(lambda x: x.str.upper(), axis=0) + + return data @property def _check_symbols(self) -> bool: diff --git a/pandas_datareader/crypto_utils/exchange.py b/pandas_datareader/crypto_utils/exchange.py index 395eccc4..0018018f 100644 --- a/pandas_datareader/crypto_utils/exchange.py +++ b/pandas_datareader/crypto_utils/exchange.py @@ -92,7 +92,7 @@ def url_and_params(self, request_type): @return Tuple of formatted url and formatted parameters. """ - currency_pair = list(self.symbols.keys())[0] + currency_pair = list(self.symbols.keys())[0] if self.symbols else " / " url = self.param_dict.get(request_type).get("url") pair_template = self.param_dict.get(request_type).get("pair_template") pair_formatted = self.apply_currency_pair_format(currency_pair) diff --git a/pandas_datareader/crypto_utils/utilities.py b/pandas_datareader/crypto_utils/utilities.py index 6049f639..6fd8c121 100644 --- a/pandas_datareader/crypto_utils/utilities.py +++ b/pandas_datareader/crypto_utils/utilities.py @@ -20,15 +20,21 @@ import pandas_datareader.crypto_utils._paths as _paths TYPE_CONVERSIONS = { - ("float", "from_timestamp"): {"function": TimeHelper.from_timestamp, "params": 1}, - ("bool", "int"): {"function": int, "params": 0}, - ("float", "int"): {"function": int, "params": 0}, - ("int", "bool"): {"function": bool, "params": 0}, - ("int", "div"): {"function": lambda integer, div: integer / (1 * div), "params": 1}, - ("any", "value"): {"function": lambda number: float(number) > 0, "params": 0}, - ("str", "bool"): {"function": lambda string: string.lower() == "true", "params": 0}, - ("str", "int"): {"function": int, "params": 0}, - ("str", "float"): {"function": float, "params": 0}, + ("float", "from_timestamp"): {"function": TimeHelper.from_timestamp, "params": 1,}, + ("bool", "int"): {"function": int, "params": 0,}, + ("float", "int"): {"function": int, "params": 0,}, + ("int", "bool"): {"function": bool, "params": 0,}, + ("int", "div"): { + "function": lambda integer, div: integer / (1 * div), + "params": 1, + }, + ("any", "value"): {"function": lambda number: float(number) > 0, "params": 0,}, + ("str", "bool"): { + "function": lambda string: string.lower() == "true", + "params": 0, + }, + ("str", "int"): {"function": int, "params": 0,}, + ("str", "float"): {"function": float, "params": 0,}, ("str", "float_absolut"): { "function": lambda string: abs(float(string)), "params": 0, @@ -61,9 +67,9 @@ "function": lambda string, *args: string[args[0] : args[1]], "params": 2, }, - ("str", "upper"): {"function": lambda string: string.upper(), "params": 0}, - ("str", "lower"): {"function": lambda string: string.lower(), "params": 0}, - ("str", "dateparser"): {"function": dateutil.parser.parse, "params": 0}, + ("str", "upper"): {"function": lambda string: string.upper(), "params": 0,}, + ("str", "lower"): {"function": lambda string: string.lower(), "params": 0,}, + ("str", "dateparser"): {"function": dateutil.parser.parse, "params": 0,}, ("datetime", "strftime"): { "function": lambda time, *args: datetime.datetime.strftime(time, args[0]), "params": 1, @@ -105,7 +111,7 @@ "function": lambda *args: args[0], "params": 1, }, - ("none", "range"): {"function": lambda: range(1), "params": 0}, + ("none", "range"): {"function": lambda: range(1), "params": 0,}, ("value", "map"): { # translate into buy/sell. Args: {0: 'buy', 1:'sell'} and arg[0] # is the response value (i.e. 0/1) @@ -212,6 +218,9 @@ def yaml_loader(exchange: str) -> Dict[str, Any]: @raise Exception: If the .yaml file could not be evaluated for a given exchange. """ + if not exchange: + raise ValueError("No exchange provided.") + exchange = exchange.replace(" ", "") path = _paths.all_paths.get("yaml_path") @@ -251,7 +260,7 @@ def get_exchange_names() -> Optional[List[str]]: return exchanges -def replace_list_item(replace_list: list, condition: str, value: str) -> list: +def replace_list_item(replace_list: list, condition: any, value: any) -> list: """ Replaces a specific value from a list. @param replace_list: The list in which the value needs to be replaced diff --git a/pandas_datareader/tests/test_cryptoreader.py b/pandas_datareader/tests/test_cryptoreader.py index 0cbb87a5..55d58175 100644 --- a/pandas_datareader/tests/test_cryptoreader.py +++ b/pandas_datareader/tests/test_cryptoreader.py @@ -6,6 +6,7 @@ - Exchange, - Mapping. """ +import itertools import pytest import datetime @@ -14,7 +15,12 @@ from pandas_datareader.crypto import CryptoReader from pandas_datareader.crypto_utils.mapping import Mapping from pandas_datareader.crypto_utils.mapping import extract_mappings -from pandas_datareader.crypto_utils.utilities import yaml_loader, sort_columns +from pandas_datareader.crypto_utils.utilities import ( + yaml_loader, + sort_columns, + replace_list_item, + split_str_to_list, +) from pandas_datareader.exceptions import EmptyResponseError @@ -80,22 +86,6 @@ def test_iterate_requests_until_end(self): # ToDo pass - def test_sort_result_columns(self): - """ Test to sort the columns of the response.""" - - ordered_cols = ["open", "high", "low", "close"] - response = pd.DataFrame( - { - "high": range(0, 5), - "close": range(0, 5), - "open": range(0, 5), - "low": range(0, 5), - } - ) - response = sort_columns(dataframe=response) - - assert all(ordered_cols == response.columns) - def test_ensure_correct_column_names(self): """ Test to ensure specific column names.""" @@ -111,7 +101,7 @@ def test_ensure_correct_column_names(self): assert response.columns == "low" - def test_cut_response_and_set_index(self): + def test_index_and_cut_dataframe(self): """ Test to cut the response to the initially defined start/end dates.""" response = pd.DataFrame( @@ -130,6 +120,15 @@ def test_cut_response_and_set_index(self): assert min(response.index).to_timestamp() == self.CryptoReader.start assert max(response.index).to_timestamp() == self.CryptoReader.end + def test_get_currency_pairs(self): + """ Test to retrieve all listed currency-pairs.""" + + temp_reader = CryptoReader(exchange_name="coinbase") + pairs = temp_reader.get_currency_pairs() + + assert isinstance(pairs, pd.DataFrame) + assert pairs.empty is False + class TestExchange: """ Unit tests for the Exchange class.""" @@ -139,12 +138,6 @@ class TestExchange: symbols = "btc/usd" CryptoReader = CryptoReader(symbols=symbols, exchange_name=exchange_name) - def test_unknown_exchange_name(self): - """ Test for an unsupported exchange.""" - - with pytest.raises(ValueError): - yaml_loader("not_supported_exchange") - def test_correct_symbol_splitter(self): """ Test to check for the correct symbol splitter.""" @@ -1003,3 +996,49 @@ def test_extract_value_dict_containing_list_containing_dict_where_key_is_value( value_list = ["btc", "xrp", "usd", "eth"] result = mapping.extract_value(extract_dict) assert value_list == result + + +class TestUtilities: + """ Test class for the utility functions.""" + + def test_yaml_loader(self): + """ Test the yaml-file loader. """ + + with pytest.raises(ValueError): + # Should except the FileNotFoundError and raise a ValueError instead. + yaml_loader("some_unsupported_exchange") + # Raise a ValueError directly. + yaml_loader() + + def test_replace_list_item(self): + """ Test to replace a specific value form a list.""" + + condition = 5 + replace_list = [1, 5, 6, 7, 8, 9] + new_list = replace_list_item(replace_list, condition, 999) + + assert new_list == [1, 999, 6, 7, 8, 9] + + def test_split_str_to_list(self): + """ Test split a string into a list""" + + string = "btc- usd, btc-usd,btc - usd, btc-u s d , btc-usd" + list_values = split_str_to_list(string) + + assert list_values == list(itertools.repeat("btc-usd", 5)) + + def test_sort_columns(self): + """ Test to sort the columns of the response.""" + + ordered_cols = ["open", "high", "low", "close"] + response = pd.DataFrame( + { + "high": range(0, 5), + "close": range(0, 5), + "open": range(0, 5), + "low": range(0, 5), + } + ) + response = sort_columns(dataframe=response) + + assert all(ordered_cols == response.columns) From 3c94f2087a752cd91592cb8edde50dedb8cd4218 Mon Sep 17 00:00:00 2001 From: Steffen Date: Sat, 25 Dec 2021 17:09:00 +0100 Subject: [PATCH 24/25] -Some small bug fixes -Refactoring --- docs/source/remote_data.rst | 51 ++++++++++++++----- pandas_datareader/crypto.py | 10 ++-- pandas_datareader/crypto_utils/exchange.py | 4 +- pandas_datareader/crypto_utils/mapping.py | 4 +- .../crypto_utils/resources/coingecko.yaml | 4 ++ .../crypto_utils/resources/gemini.yaml | 2 +- pandas_datareader/crypto_utils/utilities.py | 2 +- pandas_datareader/tests/test_cryptoreader.py | 17 ------- 8 files changed, 53 insertions(+), 41 deletions(-) diff --git a/docs/source/remote_data.rst b/docs/source/remote_data.rst index 3569f363..5e6ab3c0 100644 --- a/docs/source/remote_data.rst +++ b/docs/source/remote_data.rst @@ -785,12 +785,10 @@ currency-pairs: 'alterdice', ...] -Or, if an exchange is selected but the supported cryptocurrency pairs are unknwon: +And, if an exchange is selected but the supported cryptocurrency pairs are unknown: .. ipython:: python - from pandas_datareder.crypto import CryptoReader - Reader = CryptoReader(exchange_name="coinbase") Reader.get_currency_pairs() @@ -807,17 +805,33 @@ Or, if an exchange is selected but the supported cryptocurrency pairs are unknwo 402 COINBASE FET USD 403 COINBASE ORN USD -Data can be retrieved with the ``DataReader`` class, which takes the following arguments: +The CryptoReader class takes the following arguments: -* ``name`` - the currency-pair of interest -* ``data_source`` - the name of the exchange or platform +* ``symbols`` - the currency-pair of interest +* ``exchange_name`` - the name of the exchange or platform * ``start`` - start date * ``end`` - end date * ``interval`` - the candle interval (e.g. "minutes", "hours", "days") +* ``**kwargs`` - Additional arguments passes to the parent classes + +There are several ways to retrieve cryptocurrency data, with identical arguments: .. ipython:: python import pandas_datareader.data as web + web.DataReader(...) + + import pandas_datareader as pdr + pdr.get_data_crypto(...) + + from pandas_datareader.crypto import CryptoReader + Reader = CryptoReader(...) + Reader.read() + +.. ipython:: python + + import pandas_datareader.data as web + df = web.DataReader("btc-usd", "coinbase") df.head() open high low close volume @@ -833,13 +847,22 @@ Additionally, the ``CryptoReader`` can be used directly: .. ipython:: python from pandas_datareader.crypto import CryptoReader - reader = CryptoReader("eth-usd", "coinbase", interval="minutes", start="2021-10-01", end="2021-10-05") + + reader = CryptoReader("eth-usd", "coinbase", interval="minutes", start="2021-10-01", end="2021-10-02") df = reader.read() - df.head() - open high low close volume + print(df) + + open high low close volume time - 2021-10-01 00:00:59+00:00 43828.89 43837.30 43802.92 43834.03 7.136981 - 2021-10-01 00:01:59+00:00 43834.88 43884.01 43834.88 43884.01 11.246865 - 2021-10-01 00:02:59+00:00 43884.01 43970.02 43804.29 43970.02 27.248120 - 2021-10-01 00:03:59+00:00 43970.02 43999.36 43918.60 43982.30 13.401548 - 2021-10-01 00:04:59+00:00 43980.72 44000.00 43946.80 43994.93 14.669717 \ No newline at end of file + 2021-10-01 00:00:59+00:00 3001.14 3001.42 2998.49 2999.89 100.564601 + 2021-10-01 00:01:59+00:00 2999.67 3005.99 2999.67 3005.99 91.007463 + 2021-10-01 00:02:59+00:00 3006.00 3015.14 3001.83 3014.67 494.276213 + 2021-10-01 00:03:59+00:00 3015.13 3020.19 3011.47 3020.19 174.329287 + 2021-10-01 00:04:59+00:00 3019.60 3026.60 3015.58 3024.96 131.651872 + ... ... ... ... ... + 2021-10-01 23:55:59+00:00 3305.32 3307.15 3301.70 3306.91 49.974808 + 2021-10-01 23:56:59+00:00 3306.90 3308.94 3306.05 3307.74 24.950854 + 2021-10-01 23:57:59+00:00 3308.18 3309.99 3307.31 3309.66 28.768391 + 2021-10-01 23:58:59+00:00 3309.97 3311.25 3308.18 3311.23 131.851763 + 2021-10-01 23:59:59+00:00 3311.23 3311.72 3308.70 3311.16 72.940978 + [1444 rows x 5 columns] diff --git a/pandas_datareader/crypto.py b/pandas_datareader/crypto.py index 801ca114..21144f53 100644 --- a/pandas_datareader/crypto.py +++ b/pandas_datareader/crypto.py @@ -84,9 +84,10 @@ def read(self, new_symbols: str = None) -> pd.DataFrame: # Check if the provided currency-pair is listed on the exchange. if not self._check_symbols: raise KeyError( - f"The provided currency-pair is not listed on " - f"'{self.name.capitalize()}'. " - f"Call CryptoReader.get_currency_pairs() for an overview." + "The provided currency-pair is not listed on " + "'%s'. " + "Call CryptoReader.get_currency_pairs() for an overview." + % self.name.capitalize() ) result = list() @@ -108,7 +109,8 @@ def read(self, new_symbols: str = None) -> pd.DataFrame: if result == data or all([datapoint in result for datapoint in data]): break - print_timestamp(list(self.symbols.values())[0]) + if self.interval == "minutes": + print_timestamp(list(self.symbols.values())[0]) # Append new data to the result list result = result + data diff --git a/pandas_datareader/crypto_utils/exchange.py b/pandas_datareader/crypto_utils/exchange.py index 0018018f..c9e0d3b9 100644 --- a/pandas_datareader/crypto_utils/exchange.py +++ b/pandas_datareader/crypto_utils/exchange.py @@ -269,8 +269,8 @@ def _type_con(self, val: Any, **kwargs: dict) -> Any: # return {cp: convert_type(param_value[cp], deque(conv_params)) # for cp in currency_pairs} - # ToDo: Check if the above line works. - # The older version needed both if statements below. + # Check if the above line works. + # The older version needed both if statements below. if isinstance(param_value, dict): return { cp: convert_type(param_value[cp], deque(conv_params)) diff --git a/pandas_datareader/crypto_utils/mapping.py b/pandas_datareader/crypto_utils/mapping.py index 6f2ceed9..2f52f6f1 100644 --- a/pandas_datareader/crypto_utils/mapping.py +++ b/pandas_datareader/crypto_utils/mapping.py @@ -202,8 +202,8 @@ def extract_value( return None if not path_queue: - # TODO: after integration tests, look if clause for first - # and second currency can be deleted! + # Check if clause for first + # and second currency can be deleted! if types_queue[0] == "first_currency": return currency_pair_info[0] elif types_queue[0] == "second_currency": diff --git a/pandas_datareader/crypto_utils/resources/coingecko.yaml b/pandas_datareader/crypto_utils/resources/coingecko.yaml index 3bcdbd32..7ea0a9f9 100644 --- a/pandas_datareader/crypto_utils/resources/coingecko.yaml +++ b/pandas_datareader/crypto_utils/resources/coingecko.yaml @@ -51,6 +51,10 @@ requests: days: type: int default: max + interval: + allowed: + days: daily + default: daily response: type: dict diff --git a/pandas_datareader/crypto_utils/resources/gemini.yaml b/pandas_datareader/crypto_utils/resources/gemini.yaml index 612685ea..04d6b9f4 100644 --- a/pandas_datareader/crypto_utils/resources/gemini.yaml +++ b/pandas_datareader/crypto_utils/resources/gemini.yaml @@ -19,7 +19,7 @@ requests: type: list values: # each available currency pair, i.e. "btcusd" type: str - mapping: # TODO: split Methode is not save + mapping: # split Methode is not save - key: currency_pair_first path: - [] diff --git a/pandas_datareader/crypto_utils/utilities.py b/pandas_datareader/crypto_utils/utilities.py index 6fd8c121..cc552e12 100644 --- a/pandas_datareader/crypto_utils/utilities.py +++ b/pandas_datareader/crypto_utils/utilities.py @@ -309,5 +309,5 @@ def print_timestamp(timestamp): @param timestamp: The timestamp """ - stdout.write("Requesting from: \r{}".format(timestamp)) + stdout.write("Requesting from: {}\r".format(timestamp)) stdout.flush() diff --git a/pandas_datareader/tests/test_cryptoreader.py b/pandas_datareader/tests/test_cryptoreader.py index 55d58175..c6ffd7df 100644 --- a/pandas_datareader/tests/test_cryptoreader.py +++ b/pandas_datareader/tests/test_cryptoreader.py @@ -80,12 +80,6 @@ def test_check_wrong_splitting_symbol(self): self.CryptoReader.symbols = {" - ": datetime.datetime.today()} self.CryptoReader.read() - def test_iterate_requests_until_end(self): - """ Tests to iterate the request with updated timestamps until - no more timestamp is collected or start time is reached.""" - # ToDo - pass - def test_ensure_correct_column_names(self): """ Test to ensure specific column names.""" @@ -133,7 +127,6 @@ def test_get_currency_pairs(self): class TestExchange: """ Unit tests for the Exchange class.""" - # ToDo: Create test-exchange yaml file and use it instead for this class. exchange_name = "coinbase" symbols = "btc/usd" CryptoReader = CryptoReader(symbols=symbols, exchange_name=exchange_name) @@ -227,16 +220,6 @@ def test_format_url_and_params(self): assert isinstance(self.CryptoReader.url, str) assert isinstance(self.CryptoReader.params, dict) - def test_all_exchange_apis(self): - """ Test if the API of every exchange is correctly implemented.""" - # ToDo - pass - - def test_extract_values_from_response(self): - """ Tests to correctly extract the values from a specified response.""" - # ToDo - pass - def test_empty_response(self): """ Test the behavior for an valid but empty response.""" resp = [] From 971c76b8f34e62aca94dcac36157fa5d91006a8c Mon Sep 17 00:00:00 2001 From: Steffen Date: Sat, 25 Dec 2021 17:20:37 +0100 Subject: [PATCH 25/25] linting errors fixed for Flake8 --- pandas_datareader/crypto_utils/utilities.py | 26 ++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/pandas_datareader/crypto_utils/utilities.py b/pandas_datareader/crypto_utils/utilities.py index cc552e12..6a3d83ee 100644 --- a/pandas_datareader/crypto_utils/utilities.py +++ b/pandas_datareader/crypto_utils/utilities.py @@ -20,21 +20,21 @@ import pandas_datareader.crypto_utils._paths as _paths TYPE_CONVERSIONS = { - ("float", "from_timestamp"): {"function": TimeHelper.from_timestamp, "params": 1,}, - ("bool", "int"): {"function": int, "params": 0,}, - ("float", "int"): {"function": int, "params": 0,}, - ("int", "bool"): {"function": bool, "params": 0,}, + ("float", "from_timestamp"): {"function": TimeHelper.from_timestamp, "params": 1}, + ("bool", "int"): {"function": int, "params": 0}, + ("float", "int"): {"function": int, "params": 0}, + ("int", "bool"): {"function": bool, "params": 0}, ("int", "div"): { "function": lambda integer, div: integer / (1 * div), "params": 1, }, - ("any", "value"): {"function": lambda number: float(number) > 0, "params": 0,}, + ("any", "value"): {"function": lambda number: float(number) > 0, "params": 0}, ("str", "bool"): { "function": lambda string: string.lower() == "true", "params": 0, }, - ("str", "int"): {"function": int, "params": 0,}, - ("str", "float"): {"function": float, "params": 0,}, + ("str", "int"): {"function": int, "params": 0}, + ("str", "float"): {"function": float, "params": 0}, ("str", "float_absolut"): { "function": lambda string: abs(float(string)), "params": 0, @@ -67,9 +67,9 @@ "function": lambda string, *args: string[args[0] : args[1]], "params": 2, }, - ("str", "upper"): {"function": lambda string: string.upper(), "params": 0,}, - ("str", "lower"): {"function": lambda string: string.lower(), "params": 0,}, - ("str", "dateparser"): {"function": dateutil.parser.parse, "params": 0,}, + ("str", "upper"): {"function": lambda string: string.upper(), "params": 0}, + ("str", "lower"): {"function": lambda string: string.lower(), "params": 0}, + ("str", "dateparser"): {"function": dateutil.parser.parse, "params": 0}, ("datetime", "strftime"): { "function": lambda time, *args: datetime.datetime.strftime(time, args[0]), "params": 1, @@ -111,7 +111,7 @@ "function": lambda *args: args[0], "params": 1, }, - ("none", "range"): {"function": lambda: range(1), "params": 0,}, + ("none", "range"): {"function": lambda: range(1), "params": 0}, ("value", "map"): { # translate into buy/sell. Args: {0: 'buy', 1:'sell'} and arg[0] # is the response value (i.e. 0/1) @@ -190,9 +190,9 @@ } """ Type Conversions used to convert extracted values from the API-Response - into the desired type ("first", "second"). The values are specified in the + into the desired type ("first", "second"). The values are specified in the .yaml-file of each exchange under the "mapping" of each method. - The function is called in the Mapping Class of utilities.py under + The function is called in the Mapping Class of utilities.py under the method convert_types(). "first":