-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fetchTrades returns GMT as localized timestamp in JS #325
Comments
Hi, @D-Nice! What's your programming language version of ccxt? |
Please note, that all timestamps and datetimes are UTC! import ccxt
poloniex = ccxt.poloniex()
trades = poloniex.fetchTrades('BTC/USDT')
print('Current UTC time:', poloniex.iso8601(poloniex.milliseconds()))
print('Last trade was on UTC time:', trades[0]['datetime']) The little python test above should show your system's UTC datetime, and will show the UTC datetime of the last trade on Poloniex, so those two datetime values should be very close to each other.
|
I'm using node. I did try your test, but the python version appears to have issues working at all. Regardless, node is my personal preference anyways. I've cloned your test script for node 8+: const ccxt = require('ccxt')
const polo = new ccxt['poloniex']()
console.log(polo.iso8601(polo.milliseconds()))
;(async() => {
console.log((await polo.fetchTrades('BTC/USDT'))[0].datetime)
})() here's the output
And the issue I am talking about. Thanks for your time and help! |
@D-Nice thx a lot for the snippet! Can you please try the same for Bitfinex now? const ccxt = require('ccxt')
const ex = new ccxt.bitfinex()
console.log(ex.iso8601(ex.milliseconds()))
;(async() => { console.log(ex.id, (await ex.fetchTrades('BTC/USD'))[0].datetime) })() Looks like a Polo issue to me... A difference of 3 hours, where the same functions return no difference for Bitfinex UTC time... For Kraken it seems to be 1 hour. If that is the case, we will have to add some corrections for that. Should be UTC, really. Or there may be a bug inside the library, will test for that as well.
If you could post an error log or something, it would be awesome. I tried that test by copying it and pasting into launched python interpreter shell inside the library directory and it worked for me. If it doesn't work for you, then, maybe we should do some debugging on that as well, we would appreciate your help. |
Ok, never mind, I did a few more tests and it looks like a bug in parse8601 implementation in JS, but I'll fix it quickly. Thx for your report! |
Ok, this issue has been fixed as of CCXT version 1.9.156+. Thx for your feedback once again! Let us know if you find any other inconsistencies! Cheers! |
Bybit :: implementation
Only tested with Poloniex and fetchTrades, but the converted timestamp is wrong. The library appears to assume that the time Poloniex is returning is my local timezone, and not GMT. The time fetched (which is already GMT) is converted to GMT, and makes orders appear as though they happened in the future.
The text was updated successfully, but these errors were encountered: