diff --git a/pom.xml b/pom.xml
index e514ea6..cc4978d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
nl.komtek
GunbotProxyCommunity
- 0.9.4
+ 0.9.5
jar
GunbotProxyCommunity
diff --git a/src/main/java/nl/komtek/gpi/controllers/MonitoringController.java b/src/main/java/nl/komtek/gpi/controllers/MonitoringController.java
index d486f35..c7f5bfa 100644
--- a/src/main/java/nl/komtek/gpi/controllers/MonitoringController.java
+++ b/src/main/java/nl/komtek/gpi/controllers/MonitoringController.java
@@ -43,21 +43,25 @@ public class MonitoringController {
Resource[] logResources = resourcePatternResolver.getResources(logFilePatern);
List logPaths = new ArrayList<>();
- for (Resource resource : logResources){
+ for (Resource resource : logResources) {
logPaths.add(resource.getFilename().replace("-log.txt", ""));
}
List monitoringDatas = new ArrayList<>();
for (Resource resource : saveResources) {
- String tmpName = resource.getFilename().replace("-save.json","");
- if (!logPaths.contains(tmpName)){
+ String tmpName = resource.getFilename().replace("-save.json", "");
+ if (!logPaths.contains(tmpName)) {
continue;
}
byte[] data = Files.readAllBytes(resource.getFile().toPath());
monitoringDatas.add(gson.fromJson(new String(data), MonitoringData.class));
}
modelMap.put("monitoringDatas", monitoringDatas);
- modelMap.put("balance", gunbotProxyService.getBTCBalance("default"));
- return new ModelAndView("index",modelMap);
+ String market = "default";
+ if (gunbotProxyService.isUsingMultipleMarkets()) {
+ market = "BTC";
+ }
+ modelMap.put("balance", gunbotProxyService.getBTCBalance(market));
+ return new ModelAndView("index", modelMap);
}
}
diff --git a/src/main/java/nl/komtek/gpi/services/GunbotProxyService.java b/src/main/java/nl/komtek/gpi/services/GunbotProxyService.java
index 4a50d91..f464f13 100644
--- a/src/main/java/nl/komtek/gpi/services/GunbotProxyService.java
+++ b/src/main/java/nl/komtek/gpi/services/GunbotProxyService.java
@@ -187,7 +187,7 @@ public class GunbotProxyService {
.onFailedAttempt(this::handleException)
.get(() -> analyzeResult(publicClient.returnTicker()));
- if (logger.getLevel().isLessSpecificThan(Level.DEBUG)) {
+ if (logger.getLevel().isMoreSpecificThan(Level.INFO)) {
logger.info("ticker updated");
} else {
logger.info("ticker: " + result);
@@ -215,14 +215,6 @@ public class GunbotProxyService {
return getCompleteBalancesScheduled(market);
}
- @Cacheable(value = "balances", key = "#market")
- public double getBTCBalance(String market) {
- String result = getBalancesScheduled(market);
- JsonElement jsonElement = new JsonParser().parse(result);
- JsonObject jsonObject = jsonElement.getAsJsonObject();
- return jsonObject.get("BTC").getAsDouble();
- }
-
@CachePut(value = "completeBalances", key = "#market")
public String getCompleteBalancesScheduled(String market) {
PoloniexTradingAPIClient tradingAPIClient = getMarketDefaultTradingClient(market);
@@ -233,14 +225,22 @@ public class GunbotProxyService {
return result;
}
- @CachePut(value = "balances", key = "market")
- public String getBalancesScheduled(String market) {
+ @Cacheable(value = "balances", key = "#market")
+ public double getBTCBalance(String market) {
+ return getBalancesScheduled(market);
+
+ }
+
+ @CachePut(value = "balances", key = "#market")
+ public double getBalancesScheduled(String market) {
PoloniexTradingAPIClient tradingAPIClient = getMarketDefaultTradingClient(market);
String result = Failsafe.with(retryPolicy)
.onFailedAttempt(this::handleException)
.get(() -> analyzeResult(tradingAPIClient.returnBalances()));
logger.debug("balances" + result);
- return result;
+ JsonElement jsonElement = new JsonParser().parse(result);
+ JsonObject jsonObject = jsonElement.getAsJsonObject();
+ return jsonObject.get("BTC").getAsDouble();
}
@Cacheable(value = "openOrders", key = "#market", sync = true)
diff --git a/src/main/java/nl/komtek/gpi/utils/ScheduledTasks.java b/src/main/java/nl/komtek/gpi/utils/ScheduledTasks.java
index de7def2..d14f86d 100644
--- a/src/main/java/nl/komtek/gpi/utils/ScheduledTasks.java
+++ b/src/main/java/nl/komtek/gpi/utils/ScheduledTasks.java
@@ -121,4 +121,12 @@ public class ScheduledTasks {
}
}
+ @Scheduled(fixedDelay = 10000)
+ public void updateBalances() {
+ String market = "default";
+ if (gunbotProxyService.isUsingMultipleMarkets()) {
+ market = "BTC";
+ }
+ gunbotProxyService.getBalancesScheduled(market);
+ }
}
diff --git a/src/main/resources/ehcache.xml b/src/main/resources/ehcache.xml
index 473ffee..b99eedf 100644
--- a/src/main/resources/ehcache.xml
+++ b/src/main/resources/ehcache.xml
@@ -2,7 +2,7 @@
+
+
\ No newline at end of file
diff --git a/start-application.bat b/start-application.bat
index 15e54f7..b320f96 100644
--- a/start-application.bat
+++ b/start-application.bat
@@ -2,7 +2,7 @@ set sp=--server.port=443
set sks=--server.ssl.key-store=classpath:poloniex.keystore
set sksp=--server.ssl.key-store-password=poloniex
set skp=--server.ssl.key-password=poloniex
-set gbl=--gunbot.location=file://C:/Users/Elroy/OneDrive/Documents/GUNBOT_v3.3.2
+set gbl=--gunbot.location=file://C:/Users/Elroy/Documents/GUNBOT_v3.3.2
set lnl=--logging.level.nl.komtek=DEBUG
@@ -14,5 +14,5 @@ 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.2.jar %sp% %sks% %sksp% %skp% %da% %ds% %a% %as% %lnl%
+java -jar GunbotProxyCommunity-0.9.5.jar %sp% %sks% %sksp% %skp% %da% %ds% %a% %as% %lnl%
pause