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

Method parse_ohlcv

python/ccxt/bitmart.py:1997–2057  ·  view source on GitHub ↗
(self, ohlcv, market: Market = None)

Source from the content-addressed store, hash-verified

1995 return self.parse_trades(data, market, since, limit)
1996
1997 def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
1998 #
1999 # spot
2000 # [
2001 # "1699512060", # timestamp
2002 # "36746.49", # open
2003 # "36758.71", # high
2004 # "36736.13", # low
2005 # "36755.99", # close
2006 # "2.83965", # base volume
2007 # "104353.57" # quote volume
2008 # ]
2009 #
2010 # swap
2011 # {
2012 # "low_price": "20090.3",
2013 # "high_price": "20095.5",
2014 # "open_price": "20092.6",
2015 # "close_price": "20091.4",
2016 # "volume": "8748",
2017 # "timestamp": 1665002281
2018 # }
2019 #
2020 # ws
2021 # [
2022 # 1631056350, # timestamp
2023 # "46532.83", # open
2024 # "46555.71", # high
2025 # "46511.41", # low
2026 # "46555.71", # close
2027 # "0.25", # volume
2028 # ]
2029 #
2030 # ws swap
2031 # {
2032 # "symbol":"BTCUSDT",
2033 # "o":"146.24",
2034 # "h":"146.24",
2035 # "l":"146.24",
2036 # "c":"146.24",
2037 # "v":"146"
2038 # }
2039 #
2040 if isinstance(ohlcv, list):
2041 return [
2042 self.safe_timestamp(ohlcv, 0),
2043 self.safe_number(ohlcv, 1),
2044 self.safe_number(ohlcv, 2),
2045 self.safe_number(ohlcv, 3),
2046 self.safe_number(ohlcv, 4),
2047 self.safe_number(ohlcv, 5),
2048 ]
2049 else:
2050 return [
2051 self.safe_timestamp_2(ohlcv, 'timestamp', 'ts'),
2052 self.safe_number_2(ohlcv, 'open_price', 'o'),
2053 self.safe_number_2(ohlcv, 'high_price', 'h'),
2054 self.safe_number_2(ohlcv, 'low_price', 'l'),

Callers

nothing calls this directly

Calls 4

safe_timestampMethod · 0.80
safe_numberMethod · 0.80
safe_timestamp_2Method · 0.80
safe_number_2Method · 0.80

Tested by

no test coverage detected