Fix bug in tradeHistoryFilter
This commit is contained in:
parent
e86965139f
commit
d3069bbcf5
|
@ -52,7 +52,7 @@ public class GunbotProxyController {
|
||||||
|
|
||||||
String result = gunbotProxyService.getChartData(currencyPair, period);
|
String result = gunbotProxyService.getChartData(currencyPair, period);
|
||||||
|
|
||||||
return filterChartDataByDate(start,result);
|
return filterChartDataByDate(start, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/public/**", params = "command=returnTicker")
|
@RequestMapping(value = "/public/**", params = "command=returnTicker")
|
||||||
|
@ -164,13 +164,13 @@ public class GunbotProxyController {
|
||||||
JsonElement jElement = jsonParser.parse(result);
|
JsonElement jElement = jsonParser.parse(result);
|
||||||
JsonObject jObject = jElement.getAsJsonObject();
|
JsonObject jObject = jElement.getAsJsonObject();
|
||||||
JsonObject filteredjObject = new JsonObject();
|
JsonObject filteredjObject = new JsonObject();
|
||||||
JsonArray filteredjArray = new JsonArray();
|
|
||||||
for (Map.Entry entry : jObject.entrySet()) {
|
for (Map.Entry entry : jObject.entrySet()) {
|
||||||
if (!currency.equalsIgnoreCase("all") && !currency.equalsIgnoreCase(entry.getKey().toString())) {
|
if (!currency.equalsIgnoreCase("all") && !currency.equalsIgnoreCase(entry.getKey().toString())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
List<PoloniexTradeHistory> tradeHistory = mapper.mapTradeHistory(entry.getValue().toString());
|
|
||||||
|
|
||||||
|
List<PoloniexTradeHistory> tradeHistory = mapper.mapTradeHistory(entry.getValue().toString());
|
||||||
|
JsonArray filteredjArray = new JsonArray();
|
||||||
tradeHistory.stream()
|
tradeHistory.stream()
|
||||||
.filter(e -> e.date.toEpochSecond(ZoneOffset.UTC) >= startLong)
|
.filter(e -> e.date.toEpochSecond(ZoneOffset.UTC) >= startLong)
|
||||||
.map(e -> jsonParser.parse(e.toString()))
|
.map(e -> jsonParser.parse(e.toString()))
|
||||||
|
@ -182,7 +182,7 @@ public class GunbotProxyController {
|
||||||
if (currency.equals("all")) {
|
if (currency.equals("all")) {
|
||||||
return (filteredjObject.entrySet().size() == 0) ? "[]" : filteredjObject.toString();
|
return (filteredjObject.entrySet().size() == 0) ? "[]" : filteredjObject.toString();
|
||||||
} else {
|
} else {
|
||||||
return (filteredjArray.size() == 0) ? "[]" : filteredjArray.toString();
|
return (filteredjObject.entrySet().size() == 0) ? "[]" : filteredjObject.getAsJsonArray(currency).toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue