fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market https://api.docs.extended.exchange/#get-candles-history :param str symbol: unified symbol of the market to fetch OHLCV data for :param str timeframe: the
(self, symbol: str, timeframe: str = '1m', since: Int = None, limit: Int = None, params={})
| 1171 | }, market) |
| 1172 | |
| 1173 | def fetch_ohlcv(self, symbol: str, timeframe: str = '1m', since: Int = None, limit: Int = None, params={}) -> List[list]: |
| 1174 | """ |
| 1175 | fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market |
| 1176 | |
| 1177 | https://api.docs.extended.exchange/#get-candles-history |
| 1178 | |
| 1179 | :param str symbol: unified symbol of the market to fetch OHLCV data for |
| 1180 | :param str timeframe: the length of time each candle represents |
| 1181 | :param int [since]: timestamp in ms of the earliest candle to fetch |
| 1182 | :param int [limit]: the maximum amount of candles to fetch, default 100 |
| 1183 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 1184 | :param str [params.candleType]: candle type: 'trades'(default), 'mark-prices', or 'index-prices' |
| 1185 | :param str [params.price]: *ignored if params.candleType is set* 'mark' or 'index' for mark price and index price candles |
| 1186 | :param int [params.until]: end timestamp in ms for the requested period |
| 1187 | :returns int[][]: A list of candles ordered, open, high, low, close, volume |
| 1188 | """ |
| 1189 | self.load_markets() |
| 1190 | market = self.market(symbol) |
| 1191 | price = self.safe_string(params, 'price') |
| 1192 | candleType = self.safe_string(params, 'candleType') |
| 1193 | if candleType is None: |
| 1194 | if price == 'mark': |
| 1195 | candleType = 'mark-prices' |
| 1196 | elif price == 'index': |
| 1197 | candleType = 'index-prices' |
| 1198 | else: |
| 1199 | candleType = 'trades' |
| 1200 | until = self.safe_integer(params, 'until') |
| 1201 | params = self.omit(params, ['candleType', 'price', 'until']) |
| 1202 | request = { |
| 1203 | 'market': market['id'], |
| 1204 | 'candleType': candleType, |
| 1205 | 'interval': self.safe_string(self.timeframes, timeframe, timeframe), |
| 1206 | 'limit': limit if (limit is not None) else 100, |
| 1207 | } |
| 1208 | if until is not None: |
| 1209 | request['endTime'] = until |
| 1210 | response = self.v1PublicGetInfoCandlesMarketCandleType(self.extend(request, params)) |
| 1211 | # |
| 1212 | # { |
| 1213 | # "status": "OK", |
| 1214 | # "data": [ |
| 1215 | # { |
| 1216 | # "o": "75657.5", |
| 1217 | # "l": "75657.5", |
| 1218 | # "h": "75657.5", |
| 1219 | # "c": "75657.5", |
| 1220 | # "v": "0", |
| 1221 | # "T": 1777517880000 |
| 1222 | # } |
| 1223 | # ] |
| 1224 | # } |
| 1225 | # |
| 1226 | data = self.safe_list(response, 'data', []) |
| 1227 | return self.parse_ohlcvs(data, market, timeframe, since, limit) |
| 1228 | |
| 1229 | def parse_ohlcv(self, ohlcv, market: Market = None) -> list: |
| 1230 | # |
nothing calls this directly
no test coverage detected