MCPcopy Create free account
hub / github.com/ccxt/ccxt / fetch_ohlcv

Method fetch_ohlcv

python/ccxt/kucoin.py:3169–3195  ·  view source on GitHub ↗

fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market https://www.kucoin.com/docs-new/rest/spot-trading/market-data/get-klines https://www.kucoin.com/docs-new/rest/futures-trading/market-data/get-klines https

(self, symbol: str, timeframe: str = '1m', since: Int = None, limit: Int = None, params={})

Source from the content-addressed store, hash-verified

3167 ]
3168
3169 def fetch_ohlcv(self, symbol: str, timeframe: str = '1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
3170 """
3171 fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
3172
3173 https://www.kucoin.com/docs-new/rest/spot-trading/market-data/get-klines
3174 https://www.kucoin.com/docs-new/rest/futures-trading/market-data/get-klines
3175 https://www.kucoin.com/docs-new/rest/ua/get-klines
3176
3177 :param str symbol: unified symbol of the market to fetch OHLCV data for
3178 :param str timeframe: the length of time each candle represents
3179 :param int [since]: timestamp in ms of the earliest candle to fetch
3180 :param int [limit]: the maximum amount of candles to fetch
3181 :param dict [params]: extra parameters specific to the exchange API endpoint
3182 :param boolean [params.uta]: set to True for the unified trading account(uta), defaults to False
3183 :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)
3184 :returns int[][]: A list of candles ordered, open, high, low, close, volume
3185 """
3186 self.load_markets()
3187 market = self.market(symbol)
3188 uta = False
3189 uta, params = self.handle_option_and_params(params, 'fetchOHLCV', 'uta', uta)
3190 if uta:
3191 return self.fetch_utaohlcv(symbol, timeframe, since, limit, params)
3192 elif market['contract']:
3193 return self.fetch_contract_ohlcv(symbol, timeframe, since, limit, params)
3194 else:
3195 return self.fetch_spot_ohlcv(symbol, timeframe, since, limit, params)
3196
3197 def fetch_utaohlcv(self, symbol: str, timeframe: str = '1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
3198 """

Callers

nothing calls this directly

Calls 6

fetch_utaohlcvMethod · 0.95
fetch_contract_ohlcvMethod · 0.95
fetch_spot_ohlcvMethod · 0.95
load_marketsMethod · 0.45
marketMethod · 0.45

Tested by

no test coverage detected