Do not retry if the answer is a error result
This commit is contained in:
parent
b7e4e41e74
commit
3a4b59de07
|
@ -83,6 +83,7 @@ public class GunbotProxyService {
|
|||
|
||||
retryPolicy = new RetryPolicy()
|
||||
.retryOn(failure -> failure instanceof Exception)
|
||||
.abortOn(failure -> failure.getMessage().startsWith("error:"))
|
||||
.withDelay(500, TimeUnit.MILLISECONDS)
|
||||
.withMaxRetries(maxRetries);
|
||||
}
|
||||
|
@ -274,7 +275,7 @@ public class GunbotProxyService {
|
|||
String result = Failsafe.with(retryPolicy)
|
||||
.onFailedAttempt(this::handleException)
|
||||
.get(() -> analyzeResult(tradingAPIClient.buy(currencyPair, buyPrice, amount, false, false, false)));
|
||||
logger.info("Buy order" + result);
|
||||
logger.info(String.format("Buy order for %s -- %s", currencyPair, result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -292,7 +293,7 @@ public class GunbotProxyService {
|
|||
String result = Failsafe.with(retryPolicy)
|
||||
.onFailedAttempt(this::handleException)
|
||||
.get(() -> analyzeResult(tradingAPIClient.buy(currencyPair, buyPrice, amount, false, false, false)));
|
||||
logger.info("Buy order" + result);
|
||||
logger.info(String.format("Buy order for %s -- %s", currencyPair, result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -309,7 +310,7 @@ public class GunbotProxyService {
|
|||
String result = Failsafe.with(retryPolicy)
|
||||
.onFailedAttempt(this::handleException)
|
||||
.get(() -> analyzeResult(tradingAPIClient.sell(currencyPair, buyPrice, amount, false, true, false)));
|
||||
logger.info("Sell order" + result);
|
||||
logger.info(String.format("Sell order for %s -- %s", currencyPair, result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -342,7 +343,7 @@ public class GunbotProxyService {
|
|||
throw new ProxyHandledException("No value was returned");
|
||||
} else if (result.contains("Nonce")) {
|
||||
throw new ProxyHandledException("nonce error: " + result);
|
||||
} else if (result.contains("error")) {
|
||||
} else if (result.contains("error:")) {
|
||||
throw new RuntimeException(result);
|
||||
}
|
||||
return result;
|
||||
|
@ -393,9 +394,8 @@ public class GunbotProxyService {
|
|||
|
||||
public String checkTradingKey(String apiKey) {
|
||||
PoloniexTradingAPIClient tradingAPIClient = poloniexTradingAPIClients.get(apiKey);
|
||||
String result = Failsafe.with(retryPolicy)
|
||||
return Failsafe.with(retryPolicy)
|
||||
.onFailedAttempt(this::handleException)
|
||||
.get(() -> analyzeResult(tradingAPIClient.returnOpenOrders("ALL")));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,5 +15,7 @@ REM This apiKey will do the buying and selling and orders canceling stuff. You c
|
|||
set a=--apiKey1=another apiKey
|
||||
set as=--apiSecret1=your secret
|
||||
|
||||
java -jar GunbotProxyCommunity-0.9.7.jar %sp% %sks% %sksp% %skp% %da% %ds% %a% %as% %lnl%
|
||||
set dbp=--doubleBuyProtectionSeconds=60
|
||||
|
||||
java -jar GunbotProxyCommunity-0.9.7.jar %sp% %sks% %sksp% %skp% %da% %ds% %a% %as% %lnl% %dbp%
|
||||
pause
|
||||
|
|
Loading…
Reference in New Issue