1 year ago

#275066

test-img

Nguyễn Anh Mười

fetch info of bars by ccxt lib in python return timestamp in time zone incorrect

i fetch_ohlcv and return the data, and in data contains timestamp, and I don't understand why timestamp is in the 0th timezone, while I'm in the 7th timezone

i use testnet environment

exchange = ccxt.binance({
    "apiKey": config.BINANCE_API_KEY,
    "secret": config.BINANCE_SECRET_KEY,
    'options': { 'adjustForTimeDifference': True }
})
exchange.set_sandbox_mode(True)  

bars = exchange.fetch_ohlcv(SYMBOL, timeframe=TIME_FRAME, limit=LIMIT)

df = pd.DataFrame(bars[:-1], columns=['timestamp', 'open', 'high', 'low', 'close', 'volume'])
df['timestamp'] = pd.to_datetime(df['timestamp'], unit='ms')

python

fetch

ccxt

ohlcv

0 Answers

Your Answer

Accepted video resources