-
Notifications
You must be signed in to change notification settings - Fork 219
[Kraken] KrakenStreamingService possible bug on switch loop #502
Comments
No this missing break would not have created the issue (but it can fixed for clarity). I saw the error few times while developing the private channel code, but not recently. With Kraken, I have noticed that the rate limits apply to the API Key, not the connection, so if you have 2 connections open, the rate limit is halved. I am not excatly sure why the socket gets rate limited, since it only ever subscribes to the two private channels, unless there are a lot of orderbook subscriptions? |
|
So this is a rate limit issue? The thing is that i have multiply orderbooks but on userTrades i have every subscription with different API keys. |
Can i create a PR adding this break? |
Hello again, i have put the break and rerun the websocket. Now i am getting a different error: 2020-01-20 20:50:07 ERROR WebSocketClientHandler:67 - WebSocket Client failed to connect. Invalid handshake response getStatus: 502 Bad Gateway [id: 0x1e8ff6cf, L:/192.168.1.3:38692 - R:ws.kraken.com/104.16.215.191:443] And the Unknown message prints to infinity until i close it. Maybe this has to do with the custom kraken handler KrakenWebSocketClientHandler.class. I believe that this error has nothing to do with rate limiting from Kraken. I will check further and i will post what i have found. Does anyone encounter the same issue? Thanks P.S: This error doesn't happen when i subscribe for the first time. It happens at random times when the websocket is running. |
Hi guys, As far as I know there is some limit of message-per-second on the Kraken side.
If you have the N currency pairs subscriptions then it cause N hits of the Kraken limiter at the same time! As example we can implement this like beforeConnectionHandler in ConnectableService:
We can allow to specify beforeSendingHandler and call one before sending.
These are my thoughts regarding this issue. P.S. |
@pchertalev Thank you so much for your input and the information that you have shared! |
I'm too busy at the moment, but I can do this some time later If nobody implement it at the time :) |
That ties up with my experiences too |
I have contact with Kraken support, they told me that even if they rate
limit the websocket when a volume spike happens they will not drop the
connection and they will send messages again when the rate limit expires.
So this is not a major issue but it is still an issue that we could solve.
…On Fri, 24 Jan 2020, 18:51 Marc Deveaux, ***@***.***> wrote:
That ties up with my experiences too
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#502?email_source=notifications&email_token=AHIWQ74H6AW5EW4SE4JFBB3Q7MMALA5CNFSM4KIJMG2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ3MYNA#issuecomment-578210868>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHIWQ7ZNFXUONVEFPAIWFU3Q7MMALANCNFSM4KIJMG2A>
.
|
Let me describe why this issue is very serios.
|
@pchertalev Thank you for your input! So even if we have subscribed to the first 15, kraken will not send messages to none of them because they have ban our API key? Is this correct? |
Also, Kraken support told me that in times of very high amount of requests, they limit the 15 request threshold even more. So it is possible that we will get ban for less than 15 requests |
In case rejecting subscription request by Kraken rate limiter we will never get any messages regarding this channel. I asked Kraken support many many times the follwoing questions:
But I did any get any feedback. Looks like they don't know answers :) |
I asked them also. They don't tell for security reasons.
…On Fri, 31 Jan 2020, 13:29 Pavel Chertalev, ***@***.***> wrote:
In case rejecting subscription request by limit Kraken will not push any
messages regarding this channel.
Error limit error does not have any information about what message was
rejected by rate limitter - it is big problem because you don't know what
channels are really subscribed.
I see only one method to understand not worked channels: pereodical
checking that request has been confirmed.
E.g. we can check that map are empty:
info/bitrich/xchangestream/kraken/KrakenStreamingService.java:36
private final Map<Integer, String> subscriptionRequestMap = new
ConcurrentHashMap<>();
If not we can send request message again.
I asked Kraken support many many times the follwoing questions:
- is how many subscription requests Kraken allows in one
sec/minute/hour?
- what is block period?
- what is block entity: IP address, Socket, Auth Token?
But I did any get any feedback. Looks like they don't know answers :)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#502?email_source=notifications&email_token=AHIWQ74YYEQP7XP5OUIW4YTRAQDQPA5CNFSM4KIJMG2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKOLZKY#issuecomment-580697259>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHIWQ73JZMGFZFBF6LLEZ63RAQDQPANCNFSM4KIJMG2A>
.
|
They told me to send one message for many orderbooks(currencypairs) they
support that. The difficult part is too implement this to the library.
…On Fri, 31 Jan 2020, 18:14 makarid, ***@***.***> wrote:
I asked them also. They don't tell for security reasons.
On Fri, 31 Jan 2020, 13:29 Pavel Chertalev, ***@***.***>
wrote:
> In case rejecting subscription request by limit Kraken will not push any
> messages regarding this channel.
> Error limit error does not have any information about what message was
> rejected by rate limitter - it is big problem because you don't know what
> channels are really subscribed.
> I see only one method to understand not worked channels: pereodical
> checking that request has been confirmed.
> E.g. we can check that map are empty:
> info/bitrich/xchangestream/kraken/KrakenStreamingService.java:36
> private final Map<Integer, String> subscriptionRequestMap = new
> ConcurrentHashMap<>();
> If not we can send request message again.
>
> I asked Kraken support many many times the follwoing questions:
>
> - is how many subscription requests Kraken allows in one
> sec/minute/hour?
> - what is block period?
> - what is block entity: IP address, Socket, Auth Token?
>
> But I did any get any feedback. Looks like they don't know answers :)
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#502?email_source=notifications&email_token=AHIWQ74YYEQP7XP5OUIW4YTRAQDQPA5CNFSM4KIJMG2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKOLZKY#issuecomment-580697259>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AHIWQ73JZMGFZFBF6LLEZ63RAQDQPANCNFSM4KIJMG2A>
> .
>
|
LOL) security reason) All exchanges provide limits info: bitfinex, bitstamp, binnance... etc |
Lol :).
…On Fri, 31 Jan 2020, 18:49 Pavel Chertalev, ***@***.***> wrote:
LOL) security reason) All exchanges provide limits info: bitfinex,
bitstamp, binnance... etc
You should be oraculum if would like to use Kraken API.
They should hide all methods signature for total securirty )
YOU SHELL NO PASS!!! (C) Gandalf
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#502?email_source=notifications&email_token=AHIWQ76GJFO2T3YGRAFJ3I3RARJB5A5CNFSM4KIJMG2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKPINCI#issuecomment-580814473>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHIWQ744OENPI2PL7N5JRWTRARJB5ANCNFSM4KIJMG2A>
.
|
What are the WebSocket API rate limits? The trading rate limits across all order entry mediums (web site, Kraken Pro, REST and WebSocket APIs) remain the same, and are explained in detail on our rate limits support page. The rate limit of a single WebSocket API connection will vary depending upon the load on the system. WebSocket API clients will receive the error message {"Error": "Exceeded msg rate"} when the rate limit is exceeded. link to limits https://support.kraken.com/hc/en-us/articles/206548367 |
The WebSocket API allows multiple feed subscriptions via a single WebSocket connection (such as subscribing to all available market data for the XBT/USD currency pair via a single connection), so it is possible to stream all available market data for all currency pairs without reaching the WebSocket connection limits. |
Yes,this is doable.But does this creates any "burden" to the connection because we are talking about the updates of at least 50 orderbooks or more? We will of course filter the output to only the orderbook that we want via currencypair filtering. Is it OK to do it based on the performance? Will we have any performance reduction? |
It really depends on the requirements of your app. It is probably not a great thing to do for the library, but you free to fork the code, and tailor it to your needs. If it can be done in a generic way, for instance by using a ExchangeSpecification parameter, that might something worth checking back in. |
Ok,
But it is not supported by core bitrich and need to be implemented.
So we need to have specific resubscribeChannels() method which will generate only 3 subscription messages (ticker, book and trades) with all required currency pairs inside. |
we see confirms an errors without a channel designation. @makarid I believe you were asking about this
Guys, do you have any progress on this?
I'm using a similar approach, using a timeout after a subscription message has been created. After 2 seconds (perhaps could be adjusted/adjustable) check the See #550 for the changes and a test that shows how it works. It depends on #549, because otherwise the new subscriber does not receive any events. |
guys I have implemented batch resubscribing for kraken implementation |
Hello, yesterday i had an error on the websocket with a message:
2020-01-16 11:48:54 ERROR WebSocketClientHandler:112 - WebSocket client encountered exception (IOException - Invalid argument). Closing
Searching the logs i found that the last log before a connection was this:
2020-01-16 12:11:50 ERROR KrakenStreamingService:93 - Channel null has been failed: ESession:Invalid session
Then the channel send this message to infinity until i finally saw the error and close the application:
2020-01-16 12:12:20 ERROR KrakenStreamingService:107 - Unknown message: {"Error":"Exceeded msg rate"}
I search in the KrakenStreamingService and i saw that in the switch loop, there isn't any break keyword under the line 93 which is the last log that i have found.
I have code my application in order to retry to infinity until the connection succeeded, but this time the retry did not triggered indicating that no error message was thrown to the stream.
Is it possible that this missing break created the issue? It is the only one that is missing. Thanks
The text was updated successfully, but these errors were encountered: