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

Adding the 'since: 0' parameter to the query_public function doesn't give any additional data #44

Closed
yenicelik opened this issue Aug 10, 2017 · 6 comments

Comments

@yenicelik
Copy link

yenicelik commented Aug 10, 2017

Versions

OS:  Mac OS 10.12.6 Sierra
Python:   3.6.2
krakenex: 0.1.4

What are you trying to achieve?

I am trying to pull the entire historic data of all OHCL using the query_public keyword, to get all the trades from the beginning of time:

# code sample
tmp = self.apiKraken.query_public("OHLC", 
			{
			    "pair": "XETHXXBT",
			    "since": "100"
			})

What do you expect to happen?

I expect to get the entire OHCL data from the beginning of time.

What happens instead?

I get the same OHCL data as if I would not try to add the 'since' parameter. In short, the result is equivalent to

tmp = self.apiKraken.query_public("OHLC", 
			{
			    "pair": "XETHXXBT",
			})

such that only a frame of the newest 700 samples is returned

# error message
I don't get an error message - This is a semantic error; From kraken's side, this should usually work.
@veox veox changed the title Adding the 'since: 0' parameter toe the query_public function doesn't give any additional data Adding the 'since: 0' parameter to the query_public function doesn't give any additional data Aug 10, 2017
@jacob-roth
Copy link

jacob-roth commented Aug 15, 2017

Does the since field take a timestamp string, a datetime object, a date string, or...?

Update: From what I've seen, Kraken's since field takes a local timezone timestamp, and all of the time fields it returns in OHLC are in local time, not UTC time

@veox
Copy link
Owner

veox commented Aug 16, 2017

Does the since field take a timestamp string, a datetime object, a date string, or...?

Kraken's API docs on OHLC states that, for the request input data:

since = return committed OHLC data since given id (optional.  exclusive)

And in the result there'll be:

last = id to be used as since when polling for new, committed OHLC data

The documentation explicitly references the since value as an "id", not a "timestamp". Any interpretation as a timestamp would be user-implied.

EDIT: The only "sane" way to use since that I see is to feed it the value of last "id" from a previous OHLC query.

@veox
Copy link
Owner

veox commented Aug 16, 2017

As to the original issue:

I expect to get the entire OHCL data from the beginning of time.

Have you estimated the size of that response?.. With the default one-minute interval, and considering that the ETH/XBT pair was opened on 2015-08-08 (about two years ago), that'd be around 2*365*24*60 == 1051200 entries.

With an (optimistic) size of 100 bytes per entry, that's about 100.25 MiB of response data.

@veox
Copy link
Owner

veox commented Aug 16, 2017

See examples/log-ohlc.py for a (primitive, dirty) example of using OHLC.

Edit the since to something sane, following the comment there, if you'd like to use it as-is.

@veox veox added invalid and removed help wanted labels Aug 16, 2017
@jacob-roth
Copy link

Based on a initial testing, the 'since' with 'timestamp' has worked for me. What I've found weird is that the timestamp must be in local timezone, and the 'time'
field returned by Kraken is local too...

@yenicelik
Copy link
Author

Thanks guys, that was a great help! I did not understand that it has to be a local timezone in the Unix timestamp. Also, thx @veox for the example! :)

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

No branches or pull requests

3 participants