fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-candlestick :param str symbol: unified symbol of the market to fetch OHLCV data for
(self, symbol: str, timeframe: str = '1m', since: Int = None, limit: Int = None, params={})
| 1071 | return self.parse_trades(trades, market, since, limit) |
| 1072 | |
| 1073 | async def fetch_ohlcv(self, symbol: str, timeframe: str = '1m', since: Int = None, limit: Int = None, params={}) -> List[list]: |
| 1074 | """ |
| 1075 | fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market |
| 1076 | |
| 1077 | https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-candlestick |
| 1078 | |
| 1079 | :param str symbol: unified symbol of the market to fetch OHLCV data for |
| 1080 | :param str timeframe: the length of time each candle represents |
| 1081 | :param int [since]: timestamp in ms of the earliest candle to fetch |
| 1082 | :param int [limit]: the maximum amount of candles to fetch |
| 1083 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 1084 | :param int [params.until]: timestamp in ms for the ending date filter, default is the current time |
| 1085 | :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) |
| 1086 | :returns int[][]: A list of candles ordered, open, high, low, close, volume |
| 1087 | """ |
| 1088 | await self.load_markets() |
| 1089 | paginate = False |
| 1090 | paginate, params = self.handle_option_and_params(params, 'fetchOHLCV', 'paginate', False) |
| 1091 | if paginate: |
| 1092 | return await self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 300) |
| 1093 | market = self.market(symbol) |
| 1094 | request = { |
| 1095 | 'instrument_name': market['id'], |
| 1096 | 'timeframe': self.safe_string(self.timeframes, timeframe, timeframe), |
| 1097 | } |
| 1098 | if limit is not None: |
| 1099 | if limit > 300: |
| 1100 | limit = 300 |
| 1101 | request['count'] = limit |
| 1102 | now = self.microseconds() |
| 1103 | duration = self.parse_timeframe(timeframe) |
| 1104 | until = self.safe_integer(params, 'until', now) |
| 1105 | params = self.omit(params, ['until']) |
| 1106 | if since is not None: |
| 1107 | request['start_ts'] = since - duration * 1000 |
| 1108 | if limit is not None: |
| 1109 | request['end_ts'] = self.sum(since, duration * limit * 1000) |
| 1110 | else: |
| 1111 | request['end_ts'] = until |
| 1112 | else: |
| 1113 | request['end_ts'] = until |
| 1114 | response = await self.v1PublicGetPublicGetCandlestick(self.extend(request, params)) |
| 1115 | # |
| 1116 | # { |
| 1117 | # "id": -1, |
| 1118 | # "method": "public/get-candlestick", |
| 1119 | # "code": 0, |
| 1120 | # "result": { |
| 1121 | # "interval": "1m", |
| 1122 | # "data": [ |
| 1123 | # { |
| 1124 | # "o": "26949.89", |
| 1125 | # "h": "26957.64", |
| 1126 | # "l": "26948.24", |
| 1127 | # "c": "26950.00", |
| 1128 | # "v": "0.0670", |
| 1129 | # "t": 1687237080000 |
| 1130 | # }, |
nothing calls this directly
no test coverage detected