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

Inconsistent historical Spread #119

Open
dverney opened this issue Apr 8, 2020 · 2 comments
Open

Inconsistent historical Spread #119

dverney opened this issue Apr 8, 2020 · 2 comments
Labels

Comments

@dverney
Copy link

dverney commented Apr 8, 2020

Versions

OS: Amazon Linux (lambda)
Python: 3.6.9
krakenex: None

What are you trying to achieve?

I get Kraken data directly from their APIs (without using Krakenex).

What do you expect to happen?

My environments are on an identical infrastructure (lambda and S3), and have an identical application code too. I therefore expect that the data recovered by my two environments will be identical.

What happens instead?

I just realized that there are differences at least on the data of 'XXBTZUSD' Spread (Bitcoin in $).
After checking my code, I conclude that there must be an inconsistency in the data returned by the Kraken API.
To verify this, I just made 2 calls spaced about 7 seconds apart (https://api.kraken.com/0/public/Spread?pair=XXBTZUSD&since=0).

Here are the results :
Capture d’écran 2020-04-08 à 21 37 07

The data returned by each call is incomplete.
The cells in red correspond to the missing data, in yellow a difference in timestamp (or can be 2 separate records... I don't know).

What is your question?

  • Have you noticed this inconsistency in the Spread data (using Krakenex or not)?
  • Does Krakenex take this lack of reliability into account in Kraken Spread data?
  • If the cells in yellow correspond in fact to two separate records, would it be interesting to do a concatenation of several API calls to try to have the exhaustiveness of the data?

Thanks in advance for your help, and thank you for Krakenex which I just found out !

@veox
Copy link
Owner

veox commented Apr 9, 2020

Have you noticed this inconsistency in the Spread data (using Krakenex or not)?

Yes, this is a known behaviour of upstream. See #112 (comment) for details.

Does Krakenex take this lack of reliability into account in Kraken Spread data?

No. krakenex is intentionally feature-scarce; making conclusions/decisions based on the data is entirely out of scope for the package. ;)

If the cells in yellow correspond in fact to two separate records, would it be interesting to do a concatenation of several API calls to try to have the exhaustiveness of the data?

Perhaps, people have been mentioning this for years (see previous link, or search something like kraken inconsistent), so I'm sure such attempts have been made.

@dverney
Copy link
Author

dverney commented Apr 10, 2020

Thanks for your answer @veox .

For information, here is the response I received from Kraken support on this subject...

[API SPREAD] Some missing values

Annabelle (Kraken Support)
Apr 9, 23:48 PDT

Hello,

Thank you for contacting us regarding the Kraken API. My apologies for the delayed reply.

The REST API Spread endpoint only returns a limited amount of data (such as the past few minutes), so any changes in the bid/ask spread that occur between subsequent calls could cause a difference in the results. In addition, the spread data is stored separately by each source (such as different instances of the API servers), so any discrepancies between instances (such as timing differences, temporary networking issues for one instance, and so on) could cause different spread data to be stored (and then returned via the Spread endpoint).
You might find that the WebSocket API spread feed is more suited to your requirements, as this would provide a real time live stream of the current bid/ask spread, rather than relying on historical spread data that was susceptible to differences. Note that the WebSocket API spread feed also provides additional data that is not available via the REST API Spread endpoint, namely a higher resolution timestamp, and the best bid/ask volumes, as shown in the following comparison:

REST Spread Entry:
[1586500838,"6975.50000","6978.00000"]
WebSocket Spread Entry:
[230,["6969.20000","6973.70000","1586500873.386375","1.32895484","0.30600000"],"spread","XBT/USD"]

The WebSocket API spread feed would send a new message for any changes to the best bid/ask, including both price changes and volume changes, hence the accuracy of the spread data would be the best available (better than the ticker feed, for example).I hope that this answers your question successfully. Please let us know if you need any further assistance.

Have a great day.

Sincerely,

Annabelle
Kraken Client Engagement

[API SPREAD] Some missing values

me
Apr 10, 14:10 PDT

Hello Annabelle,

I understand that there can be network problems. There may also be at each layer of the OSI model.
For each problem there is a solution, and I can understand that some is difficult to set up, but I find it regrettable to notice it myself while it's been months that I get the data from this API for construction of a trading model.

Can you at least indicate in the Kraken API documentation this problem so that users are aware of it?

Regards,

[API SPREAD] Some missing values

Annabelle (Kraken Support)
Apr 10, 05:47 PDT

Hello,

Can you at least indicate in the Kraken API documentation this problem so that users are aware of it?

Thank you for your reply, and for your comments. I will forward your suggestion to our API developers for their consideration. We are planning some significant updates to our API documentation, so lots of additional information (such as advantages/disadvantages of each endpoint) would then be included.

Sincerely,

Annabelle
Kraken Client Engagement

@veox veox removed the duplicate label Jan 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants