Skip to content
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

get_ohloc_data method and the since argument #53

Open
clcarver1130 opened this issue May 15, 2021 · 2 comments
Open

get_ohloc_data method and the since argument #53

clcarver1130 opened this issue May 15, 2021 · 2 comments

Comments

@clcarver1130
Copy link

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 the last 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 the get_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-

@clcarver1130
Copy link
Author

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

@dominiktraxl
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants