-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
binance fetch ohlcv closing time 2
github-actions[bot] edited this page Jun 11, 2026
·
2 revisions
# -*- coding: utf-8 -*-
import os
import sys
import asciichart
import ccxt # noqa: E402
class MyBinance(ccxt.binance):
def parse_ohlcv(self, ohlcv, market=None):
#
# [
# 1591478520000,
# "0.02501300",
# "0.02501800",
# "0.02500000",
# "0.02500000",
# "22.19000000",
# 1591478579999,
# "0.55490906",
# 40,
# "10.92900000",
# "0.27336462",
# "0"
# ]
#
return [
self.safe_integer(ohlcv, 6),
self.safe_number(ohlcv, 1),
self.safe_number(ohlcv, 2),
self.safe_number(ohlcv, 3),
self.safe_number(ohlcv, 4),
self.safe_number(ohlcv, 5),
]
exchange = MyBinance()
symbol = 'BTC/USDT'
timeframe = '1h'
ohlcvs = exchange.fetch_ohlcv(symbol, timeframe)
for ohlcv in ohlcvs:
print([exchange.iso8601(ohlcv[0])] + ohlcv[1:])(If the page is not being rendered for you, you can refer to the mirror at https://docs.ccxt.com/)
- Install
- Examples
- Manual
- CCXT Pro
- Contributing
- Supported Exchanges
- Exchanges By Country
- API Spec By Method
- FAQ
- Changelog
- Awesome
- API Spec by Exchange
- fetchCurrencies
- alpaca
- apex
- ascendex
- aster
- backpack
- bigone
- binance
- bingx
- bit2c
- bitbank
- bitbns
- bitfinex
- bitflyer
- bitget
- bithumb
- bitmart
- bitmex
- bitopro
- bitrue
- bitso
- bitstamp
- bitteam
- bittrade
- bitvavo
- blockchaincom
- blofin
- btcbox
- btcmarkets
- btcturk
- bullish
- bybit
- bydfi
- cex
- coinbase
- coinbaseexchange
- coinbaseinternational
- coincheck
- coinex
- coinmate
- coinmetro
- coinone
- coinsph
- coinspot
- cryptocom
- cryptomus
- deepcoin
- delta
- deribit
- derive
- digifinex
- dydx
- exmo
- extended
- foxbit
- gate
- gemini
- grvt
- hashkey
- hibachi
- hitbtc
- hollaex
- htx
- hyperliquid
- independentreserve
- indodax
- kraken
- krakenfutures
- kucoin
- fetchBidsAsks
- latoken
- lbank
- lighter
- luno
- mercado
- mexc
- modetrade
- ndax
- novadax
- okx
- onetrading
- p2b
- pacifica
- paradex
- paymium
- phemex
- poloniex
- tokocrypto
- toobit
- upbit
- weex
- whitebit
- woo
- woofipro
- xt
- zaif
- fetchStatus