I initialize a date variable and a now variable. While date is smaller than now the code loops.
import ccxt
import datetime
exchange = ccxt.binance({ 'enableRateLimit': True })
date = 1502928000
now = int(round(datetime.datetime.timestamp(now)))
while date <= now:
ohlcv = exchange.fetch_ohlcv('BTC/USDT', '1d', date, 1)
print(ohlcv)
date += 86400
print(date)
At then end of the loop I update the date with one day, this works because I print the date and confirm the date changed.
But, the date within the request stays the same value. The response is always:
[[1502928000000, 4261.48, 4485.39, 4200.74, 4285.08, 795.150377]]
[[1502928000000, 4261.48, 4485.39, 4200.74, 4285.08, 795.150377]]
[[1502928000000, 4261.48, 4485.39, 4200.74, 4285.08, 795.150377]]
[[1502928000000, 4261.48, 4485.39, 4200.74, 4285.08, 795.150377]]
...
How do I update the date variable within the request?
Thank you