You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Every 5 seconds I retrieve the ticker of HNT-USDT. It seems the times returned from the request are off and also jump back and forth. Here is the code:
importtimeimportdatetimefromkucoin.clientimportClientkucoin_client=Client('', '', '')
whileTrue:
start=time.time() # now in secondskucoin_ticker=kucoin_client.get_ticker('IOTA-USDT')
kucoin_time=float(kucoin_ticker['time'])
time_system=datetime.datetime.fromtimestamp( start )
time_ticker=datetime.datetime.fromtimestamp( kucoin_ticker['time'] /1000 )
print(f'time of now: {time_system}')
print(f'time ticker: {time_ticker}')
print()
# break conditionwait=5- (time.time() -start) # wait 5 seconds minus execution time of iterationtime.sleep(wait)
The code results in an output like so:
time of now: 2022-01-07 09:50:20
time ticker : 2022-01-07 09:50:12
time of now: 2022-01-07 09:50:25
time ticker : 2022-01-07 09:50:12
time of now: 2022-01-07 09:50:30
time ticker : 2022-01-07 09:50:12
time of now: 2022-01-07 09:50:35
time ticker : 2022-01-07 09:50:32
time of now: 2022-01-07 09:50:40
time ticker : 2022-01-07 09:50:40
time of now: 2022-01-07 09:50:45
time ticker : 2022-01-07 09:50:35
The "time of now" behaves as expected (increasing by 5 s) but "time ticker" jumps back and forth for which I seeno explanation. For assets with high volatility (e.g. BTC, ETH) this problem does not occur. I therefore suspect it's related to the last price made, still that wouldn't explain why the ticker times can jump also backwards in time when it shouldn't (see last two ticker times). Any idea / explanation why this is observed? Thanks!
The text was updated successfully, but these errors were encountered:
Every 5 seconds I retrieve the ticker of HNT-USDT. It seems the times returned from the request are off and also jump back and forth. Here is the code:
The code results in an output like so:
The "time of now" behaves as expected (increasing by 5 s) but "time ticker" jumps back and forth for which I seeno explanation. For assets with high volatility (e.g. BTC, ETH) this problem does not occur. I therefore suspect it's related to the last price made, still that wouldn't explain why the ticker times can jump also backwards in time when it shouldn't (see last two ticker times). Any idea / explanation why this is observed? Thanks!
The text was updated successfully, but these errors were encountered: