Open clcarver1130 opened 3 years ago
For reference a modified code snippet and the results are shown below:
Code:
start = '2020-01-01'
unix_start = api.datetime_to_unixtime(datetime.strptime(start, '%Y-%m-%d'))
print(f'Expected start date: {start}')
print(f'Expected start unix: {unix_start}')
df, last = api.get_ohlc_data(pair='XETHZUSD', interval=240, since=unix_start)
print(df.info())
Output:
Expected start date: 2020-01-01
Expected start unix: 1577836800
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 720 entries, 2021-05-15 16:00:00 to 2021-01-15 20:00:00
Data columns (total 8 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 time 720 non-null int64
1 open 720 non-null float64
2 high 720 non-null float64
3 low 720 non-null float64
4 close 720 non-null float64
5 vwap 720 non-null float64
6 volume 720 non-null float64
7 count 720 non-null int64
dtypes: float64(6), int64(2)
memory usage: 50.6 KB
None
This has worked for me before, but my attempt just now also showed no effect when changing the since
argument. The issue seems to be on the Kraken Rest API side. If you try different values for since
using the API directly (e.g.
https://api.kraken.com/0/public/OHLC?pair=XBTUSD&since=1621320840
https://api.kraken.com/0/public/OHLC?pair=XBTUSD&since=0)
they don't seem to have an effect either.
I am trying to pull OHLC data beyond the 720-period limit for a backtesting engine. The Kraken API explains that this can be done by setting the
since
argument to the earliest datetime and using thelast
parameter that is returned to make subsequent calls to the REST API. However, the current behavior returns the most recent 720 periods *regardless of what unixtime value I call. Is this a known issue with the Kraken Rest API itself or an issue here with theget_ohlc_data
method? Thanks for the help!Documentation Links: https://docs.kraken.com/rest/#operation/getOHLCData https://support.kraken.com/hc/en-us/articles/218198197-How-to-retrieve-historical-time-and-sales-trading-history-using-the-REST-API-Trades-endpoint-