-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
Cryptopia OHLCV candletimestamp incoherencies with other exchanges #3034
Comments
This is partially explained here: #2805 In short, we don't merge sparse timestamps for now due to differences in business days across various countries and timezones. So, you will have to adjust the timestamps according to your purposes. All timestamps are now in UTC, so aligning to 1h-boundaries or 2h-boundaries with basic arithmetic should not be very difficult. This is currently a responsibility of the user. https://github.com/ccxt/ccxt/blob/master/examples/py/normalize-sparse-candle-timestamps.py # -*- coding: utf-8 -*-
import os
import sys
import datetime
from pprint import pprint
import ccxt
exchange = ccxt.cryptopia({ 'enableRateLimit': True })
symbol = 'ETH/BTC'
timeframe = '1h'
candles = exchange.fetch_ohlcv(symbol, timeframe)
# timeframe duration in seconds
duration = exchange.parse_timeframe (timeframe)
# timeframe duration in milliseconds
duration *= 1000
pprint([[
exchange.iso8601 (int(round(candle[0] / duration)) * duration),
candle[1], # o
candle[2], # h
candle[3], # l
candle[4], # c
candle[5] # v
] for candle in candles]) Hope this answers your question. |
@kroitor , I am not sure to get it. From you code I understand that if:
So these candles can be considered and timestamped as the candles of ranges
Thanks to clarify (cause my fear was that were approximately candles from11h10 to 12h09, from12h10 to 13h09...etc..) |
Hi @kroitor , After testing, In my picture,exch_timestamp is the timestamp sent by Cryptopia and fetch_Stamp the time when the http call is done... |
The Structure of OHLCV returned by CCXT is :
Lets say it is now Monday, June 4, 2018 12:30:00 AM
Usually OHLCV returned from exchanges by CCXT on a timeframe 1h will be of type ....Monday, June 4, 2018 11:00:00 AM,.... Monday, June 4, 2018 12:00:00 AM, ....whatever the time it is fetched.
But some Exchanges as Cryptopia will return for example: time 1528115400305 which is Monday, June 4, 2018 12:30:41.305 AM, Monday, June 4, 2018 12:30:41.305 AM...
which corresponds to the time of fetching on Cryptopia server minus 1h, 2h ... depending of candle.
What is the range of such candle (beginning?end time?) ? Can we format the result as other exchanges i.e array of result at 11:00:00, 12:00:00...?
The text was updated successfully, but these errors were encountered: