Implement hide orders.
Allows you to put a sell order for your bags and hide the order so GB can continue trading
This commit is contained in:
parent
739b71f9e8
commit
d7916946fa
|
@ -1 +0,0 @@
|
||||||
sellOnlyMode=true
|
|
|
@ -84,7 +84,7 @@ public class Application {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public TaskScheduler taskScheduler() {
|
public TaskScheduler taskScheduler() {
|
||||||
return new ConcurrentTaskScheduler(Executors.newScheduledThreadPool(2));
|
return new ConcurrentTaskScheduler(Executors.newScheduledThreadPool(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
|
@ -23,6 +23,8 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -101,7 +103,7 @@ public class GunbotProxyController {
|
||||||
|
|
||||||
JsonElement jElement = new JsonParser().parse(result);
|
JsonElement jElement = new JsonParser().parse(result);
|
||||||
JsonObject jObject = jElement.getAsJsonObject();
|
JsonObject jObject = jElement.getAsJsonObject();
|
||||||
JsonArray jArray = jObject.getAsJsonArray(currencyPair);
|
JsonArray jArray = hideOpenOrders(jObject.getAsJsonArray(currencyPair));
|
||||||
return jArray != null ? jArray.toString() : "[]";
|
return jArray != null ? jArray.toString() : "[]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,6 +218,10 @@ public class GunbotProxyController {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (result.contains("error")) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
List<PoloniexChartData> chartData = mapper.mapChartData(result);
|
List<PoloniexChartData> chartData = mapper.mapChartData(result);
|
||||||
|
|
||||||
JsonParser jsonParser = new JsonParser();
|
JsonParser jsonParser = new JsonParser();
|
||||||
|
@ -227,4 +233,18 @@ public class GunbotProxyController {
|
||||||
|
|
||||||
return filteredjArray.toString();
|
return filteredjArray.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private JsonArray hideOpenOrders(JsonArray jsonArray){
|
||||||
|
|
||||||
|
for (Iterator<JsonElement> it = jsonArray.iterator(); it.hasNext(); ) {
|
||||||
|
JsonElement element = it.next();
|
||||||
|
JsonObject jsonObject = element.getAsJsonObject();
|
||||||
|
String orderNumber = jsonObject.get("orderNumber").getAsString();
|
||||||
|
String[] orderNumbersToHide = util.getConfigurationProperty("hideOrders","").split(",");
|
||||||
|
if (Arrays.asList(orderNumbersToHide).contains(orderNumber)){
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return jsonArray;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -343,7 +343,7 @@ public class GunbotProxyService {
|
||||||
} else if (result.contains("Nonce")) {
|
} else if (result.contains("Nonce")) {
|
||||||
throw new ProxyHandledException("nonce error: " + result);
|
throw new ProxyHandledException("nonce error: " + result);
|
||||||
} else if (result.contains("Connection timed out")) {
|
} else if (result.contains("Connection timed out")) {
|
||||||
throw new RuntimeException(result);
|
throw new ProxyHandledException(result);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,16 @@ public class Util {
|
||||||
return StringUtils.replace(value, "\"", "");
|
return StringUtils.replace(value, "\"", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getEnvProperty(String key, String defaultValue) {
|
||||||
|
String value = getEnvProperty(key);
|
||||||
|
return (value == null) ? defaultValue : value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConfigurationProperty(String key, String defaultValue) {
|
||||||
|
String value = getConfigurationProperty(key);
|
||||||
|
return (value == null) ? defaultValue : value;
|
||||||
|
}
|
||||||
|
|
||||||
public String getConfigurationProperty(String key) {
|
public String getConfigurationProperty(String key) {
|
||||||
CaseLessProperties prop = new CaseLessProperties();
|
CaseLessProperties prop = new CaseLessProperties();
|
||||||
String value = null;
|
String value = null;
|
||||||
|
|
Loading…
Reference in New Issue