Open azlax opened 6 years ago
Maybe I dont see your point but can't you catch the error and do something with it?
Eservice: unavailable is caught by ExchangeException.
The only exceptions that are difficult to handle on Kraken are the real HTTP errors 502/504/520 etc. which leaves you in an "unknown" state and you have to perform checks for consistency (is my order actually performed or not.
try {
<whatever you need to do with the order>
} catch (SocketException e) {
System.out.println("Socket exception...");
System.out.println(e.getMessage());
} catch (NonceException e) {
System.out.println("Nonce exception...");
System.out.println(e.getMessage());
} catch (ExchangeException e) {
System.out.println("Exchange exception...");
System.out.println(e.getMessage());
} catch (IOException e) {
System.out.println("ok we have an issue...");
System.out.println(e.getMessage());
} catch (Exception e) {
System.out.println("oh oh...");
System.out.println(e.getMessage());
}
See the GDAX implementation for correct handling or exchange exceptions. This may need to be implemented for Kraken (and a lot of other exchanges in the project).
protected R checkResult(KrakenResult krakenResult)
in
public KrakenOrderResponse placeKrakenOrder(KrakenStandardOrder krakenStandardOrder) throws IOException
should return the krakenResult and not krakenResult.getResult();
So that we can programatically act upon different error codes are error messages from the Kraken API, instead of just a null krakenResult.
for example: API status 200 {"error":["EService:Unavailable"]} -> retry.