Simplify application.properties and small bug fix
This commit is contained in:
parent
1b214ef1a7
commit
19b418a9e6
|
@ -3,8 +3,8 @@ package nl.komtek.gpi.application;
|
|||
import net.sf.ehcache.Cache;
|
||||
import org.apache.catalina.connector.Connector;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
|
||||
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
|
||||
import org.springframework.cache.CacheManager;
|
||||
|
@ -19,6 +19,8 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
|||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.concurrent.ConcurrentTaskScheduler;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
|
@ -42,7 +44,15 @@ public class Application {
|
|||
private boolean doubleBuyProtection;
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
Map<String, Object> props = new HashMap<>();
|
||||
props.put("server.port", 443);
|
||||
props.put("server.ssl.key-store", "classpath:poloniex.keystore");
|
||||
props.put("server.ssl.key-store-password", "poloniex");
|
||||
props.put("server.ssl.key-password", "poloniex");
|
||||
new SpringApplicationBuilder()
|
||||
.sources(Application.class)
|
||||
.properties(props)
|
||||
.run(args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
@ -57,7 +67,6 @@ public class Application {
|
|||
Cache orderBookCache = new Cache("orderBook", 5, false, true, 0, 0);
|
||||
Cache publicTradeHistoryCache = new Cache("publicTradeHistory", 5, false, true, 0, 0);
|
||||
|
||||
|
||||
cacheManager.addCache(tickerCache);
|
||||
cacheManager.addCache(tradeHistoryCache);
|
||||
cacheManager.addCache(openOrdersCache);
|
||||
|
|
|
@ -305,7 +305,7 @@ public class GunbotProxyController {
|
|||
BigDecimal btcValue = BigDecimal.valueOf(element.getAsJsonObject().get("btcValue").getAsDouble());
|
||||
|
||||
if (available.doubleValue() == 0) {
|
||||
continue;
|
||||
filteredObject.add(entry.getKey().toString(), element);
|
||||
}
|
||||
|
||||
double approximatePrice = btcValue.doubleValue() / available.add(onOrders).doubleValue();
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.springframework.core.io.ResourceLoader;
|
|||
import org.springframework.core.io.support.ResourcePatternResolver;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
|
@ -29,7 +30,7 @@ public class MonitoringController {
|
|||
private ResourceLoader resourceLoader;
|
||||
@Autowired
|
||||
private ResourcePatternResolver resourcePatternResolver;
|
||||
@Value("${gunbot.location}")
|
||||
@Value("${gunbot.location:}")
|
||||
private String gunbotLocation;
|
||||
private Gson gson = new Gson();
|
||||
@Autowired
|
||||
|
@ -62,6 +63,7 @@ public class MonitoringController {
|
|||
market = "BTC";
|
||||
}
|
||||
modelMap.put("balance", gunbotProxyService.getBTCBalance(market));
|
||||
modelMap.put("gunbotLocation", !StringUtils.isEmpty(gunbotLocation));
|
||||
return new ModelAndView("index", modelMap);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,51 +7,56 @@
|
|||
<body>
|
||||
Your BTC Balance = ${balance}
|
||||
<br />
|
||||
<br />
|
||||
<table border="1">
|
||||
<thead>
|
||||
<th>Market</th>
|
||||
<th>In BTC</th>
|
||||
<th>Buy/Bought</th>
|
||||
<th>Sell/Sold</th>
|
||||
<th>Last price</th>
|
||||
<th>How's the price?</th>
|
||||
<thead>
|
||||
<#list monitoringDatas as monitoringData>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>${monitoringData.market._pair}</td>
|
||||
<#if !gunbotLocation>
|
||||
You have not setup your gunbot location!
|
||||
<#else>
|
||||
<br />
|
||||
<br />
|
||||
<table border="1">
|
||||
<thead>
|
||||
<th>Market</th>
|
||||
<th>In BTC</th>
|
||||
<th>Buy/Bought</th>
|
||||
<th>Sell/Sold</th>
|
||||
<th>Last price</th>
|
||||
<th>How's the price?</th>
|
||||
<thead>
|
||||
<#list monitoringDatas as monitoringData>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>${monitoringData.market._pair}</td>
|
||||
<#assign altBalance = monitoringData.altcoinBalance!0.0 >
|
||||
<#if altBalance gt 0>
|
||||
<#assign btc=altBalance * monitoringData.lastPrice>
|
||||
<#assign total = total + btc>
|
||||
<td>${btc}</td>
|
||||
<#else>
|
||||
<td>0.00000000</td>
|
||||
</#if>
|
||||
|
||||
<#if monitoringData.altcoinBalance gt 0>
|
||||
<#assign btc=monitoringData.altcoinBalance * monitoringData.lastPrice>
|
||||
<#assign total = total + btc>
|
||||
<td>${btc}</td>
|
||||
<#else>
|
||||
<td>0.00000000</td>
|
||||
</#if>
|
||||
<#if altBalance gt 0>
|
||||
<td>${monitoringData.boughtPrice!0.0}</td>
|
||||
<#else>
|
||||
<td>${monitoringData.priceToBuy!0.0}</td>
|
||||
</#if>
|
||||
|
||||
<#if monitoringData.altcoinBalance gt 0>
|
||||
<td>${monitoringData.boughtPrice!0.0}</td>
|
||||
<#else>
|
||||
<td>${monitoringData.priceToBuy!0.0}</td>
|
||||
</#if>
|
||||
<#if altBalance gt 0>
|
||||
<td>${monitoringData.priceToSell!0.0}</td>
|
||||
<#else>
|
||||
<td>${monitoringData.soldPrice!0.0}</td>
|
||||
</#if>
|
||||
|
||||
<#if monitoringData.altcoinBalance gt 0>
|
||||
<td>${monitoringData.priceToSell!0.0}</td>
|
||||
<#else>
|
||||
<td>${monitoringData.soldPrice!0.0}</td>
|
||||
</#if>
|
||||
|
||||
<td>${monitoringData.lastPrice!0.0}</td>
|
||||
<td>${monitoringData.reason!""}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</#list>
|
||||
<tr>
|
||||
<td>Total</td>
|
||||
<td>${total}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<td>${monitoringData.lastPrice!0.0}</td>
|
||||
<td>${monitoringData.reason!""}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</#list>
|
||||
<tr>
|
||||
<td>Total</td>
|
||||
<td>${total}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</#if>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in New Issue