-1

I'm trying to write a Python bot (using CCXT Library and Exchange: Bitget), but I cannot get latest values of ETH/USDT. It seems I have a delay of couple hours.

I'm using the Library CCTX with the following code:

bars = bitget.fetch_ohlcv('ETH/USDT', timeframe='1m', since=startDate, limit=1000)

What can't I retrive the current values but I got values updated 2 hours ago?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
Phablo
  • 1
  • 1
    Please provide enough code so others can better understand or reproduce the problem. – Community Apr 22 '23 at 13:47
  • symbol="ETH/USDT" startDate = "2023-04-23 17:00:00+00:00" startDate = datetime.strptime(startDate, "%Y-%m-%d %H:%M:%S%z") startDate = datetime.timestamp(startDate) startDate = int(startDate) * 1000 bars=bitget.fetch_ohlcv(symbol,timeframe='1m',since=startDate,limit=1000) df=pd.DataFrame(bars[:-1],columns=['timestamp','open','high','low','close','volume']) df['timestamp']=pd.to_datetime(df['timestamp'],unit='ms') print(df) – Phablo Apr 23 '23 at 18:46

1 Answers1

-1
def dowloadPrice():
# below the code run at 08:19 PM
import datetime
import ccxt
import pandas as pd
import time
from datetime import datetime
symbol = "ETH/USDT"
startDate = "2023-04-23 17:00:00+00:00"
startDate = datetime.strptime(startDate, "%Y-%m-%d %H:%M:%S%z")
startDate = datetime.timestamp(startDate)
startDate = int(startDate) * 1000
bars = bitget.fetch_ohlcv(symbol, timeframe='1m', since=startDate, limit=1000)
df = pd.DataFrame(bars[:-1], columns=['timestamp', 'open', 'high', 'low', 'close', 'volume'])
df['timestamp'] = pd.to_datetime(df['timestamp'], unit='ms')
print(df)
Phablo
  • 1
  • Is this supposed to be an answer, or an update to your question? In the first case, please [edit] to clarify. In the second case, please delete this and edit your question instead. In either case, please fix the indentation. The code shown here will generate an `IndentationError`. – ChrisGPT was on strike Apr 25 '23 at 13:19