Jump to content

Recommended Posts

When you trade via API on multi exchanges, how do you protect yourself from random 520 (Kraken for instance) or related errors?

Is there a method to check whether the status of the exchange server (hosted by cloudfare for many) is operational or not before you request the execution of a trade?

Peace

Share this post


Link to post
Share on other sites
11 hours ago, Lumpy said:

When you trade via API on multi exchanges, how do you protect yourself from random 520 (Kraken for instance) or related errors?

Is there a method to check whether the status of the exchange server (hosted by cloudfare for many) is operational or not before you request the execution of a trade?

Peace

The method is to avoid crap exchanges with crap API ;).

Share this post


Link to post
Share on other sites
On 7/5/2019 at 1:38 PM, Lumpy said:

When you trade via API on multi exchanges, how do you protect yourself from random 520 (Kraken for instance) or related errors?

Is there a method to check whether the status of the exchange server (hosted by cloudfare for many) is operational or not before you request the execution of a trade?

Peace

This is unfortunately an unsolvable kind of chicken and egg problem.  If there was such a status-checking service, there would then likely be times when the exchange you're checking is actually fully operational and working fine, but the service that provides the status check is down, or reporting incorrectly.  Thus, you'd then need another one to check on that status reporter, and so on.  There are "is it down?" websites intended for verifying large-scale, long-term outages of mainstream websites (usually with comments where users can discuss the state of things in their own locale etc), and you can also use many of these to check any exchange is up.  But, the results are less useful than if you simply sent an API call to the exchange yourself, as that's all the service does from its own physical location.  As such, this kind of website is less accurate from your point of view as it's not necessarily checking from the same physical location your code would be, and any result will be returned later as it involves an extra network call from the point of view of your code.

It's also a tough problem to consider in general - how long is an outage considered an outage before updating the status?  For example if the status service does a check every five seconds, and it takes 10ms to make the check, it could report its results every five seconds. But then, these results would only technically be "accurate" for the 10ms it took to make the check, ie, 1/500th of the time. What if the outages of the website in question are happening every 5 seconds, for 4 seconds duration, and happen to be in continual sync with the check?  The service would consistently report the website as "up" when in reality an API user would have a 4/5 chance of getting 520'd.

Share this post


Link to post
Share on other sites

It also depends on the causes of the outage.

If I remember correctly Kraken wasn't announcing any mainteinance so you'd get random errors without any prior info when they put the servers down. Some more serious exchanges send a dedicated message on the socket when the API is unavailable.

Of course if the outage is not due to the exchange and it is not predictable all those mechanics are useless, but you can have a continuous check. Usually the "lost" websocket stream is a good info that the server is gone.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...