| | |
| | | if ((depth == null || item.getAdjustmentValue() == null || item.getAdjustmentValue().intValue() == 0) && (item.getMultiple().intValue() == 0 || item.getMultiple().intValue() == 1)) { |
| | | return depth; |
| | | } |
| | | if(CollectionUtil.isNotEmpty(depth.getAsks()) ){ |
| | | List<DepthEntry> asks = depth.getAsks(); |
| | | for (int i = 0; i < asks.size(); i++) { |
| | | DepthEntry depthEntry = asks.get(i); |
| | | |
| | | List<DepthEntry> asks = depth.getAsks(); |
| | | for (int i = 0; i < asks.size(); i++) { |
| | | DepthEntry depthEntry = asks.get(i); |
| | | |
| | | /** |
| | | * 调整交易量倍数和 行情值 |
| | | */ |
| | | if (item.getMultiple().doubleValue() > 0) { |
| | | depthEntry.setAmount(Arith.mul(depthEntry.getAmount(), item.getMultiple().doubleValue())); |
| | | } else { |
| | | depthEntry.setAmount(depthEntry.getAmount()); |
| | | /** |
| | | * 调整交易量倍数和 行情值 |
| | | */ |
| | | if (item.getMultiple().doubleValue() > 0) { |
| | | depthEntry.setAmount(Arith.mul(depthEntry.getAmount(), item.getMultiple().doubleValue())); |
| | | } else { |
| | | depthEntry.setAmount(depthEntry.getAmount()); |
| | | } |
| | | depthEntry.setPrice(Arith.add(depthEntry.getPrice(), item.getAdjustmentValue().doubleValue())); |
| | | } |
| | | depthEntry.setPrice(Arith.add(depthEntry.getPrice(), item.getAdjustmentValue().doubleValue())); |
| | | } |
| | | |
| | | List<DepthEntry> bids = depth.getBids(); |
| | | for (int i = 0; i < bids.size(); i++) { |
| | | DepthEntry depthEntry = bids.get(i); |
| | | /** |
| | | * 调整交易量倍数和 行情值 |
| | | */ |
| | | if (item.getMultiple().doubleValue() > 0) { |
| | | depthEntry.setAmount(Arith.mul(depthEntry.getAmount(), item.getMultiple().doubleValue())); |
| | | } else { |
| | | depthEntry.setAmount(depthEntry.getAmount()); |
| | | if(CollectionUtil.isNotEmpty(depth.getBids())){ |
| | | List<DepthEntry> bids = depth.getBids(); |
| | | for (int i = 0; i < bids.size(); i++) { |
| | | DepthEntry depthEntry = bids.get(i); |
| | | /** |
| | | * 调整交易量倍数和 行情值 |
| | | */ |
| | | if (item.getMultiple().doubleValue() > 0) { |
| | | depthEntry.setAmount(Arith.mul(depthEntry.getAmount(), item.getMultiple().doubleValue())); |
| | | } else { |
| | | depthEntry.setAmount(depthEntry.getAmount()); |
| | | } |
| | | depthEntry.setPrice(Arith.add(depthEntry.getPrice(), item.getAdjustmentValue().doubleValue())); |
| | | } |
| | | depthEntry.setPrice(Arith.add(depthEntry.getPrice(), item.getAdjustmentValue().doubleValue())); |
| | | } |
| | | |
| | | return depth; |
| | | } |
| | | |
| | |
| | | if ((trade == null || item.getAdjustmentValue() == null || item.getAdjustmentValue().doubleValue() == 0) && (item.getMultiple().doubleValue() == 0 || item.getMultiple().doubleValue() == 1)) { |
| | | return trade; |
| | | } |
| | | List<TradeEntry> data = trade.getData(); |
| | | for (int i = 0; i < data.size(); i++) { |
| | | TradeEntry tradeEntry = data.get(i); |
| | | if(CollectionUtil.isNotEmpty(trade.getData())){ |
| | | List<TradeEntry> data = trade.getData(); |
| | | for (int i = 0; i < data.size(); i++) { |
| | | TradeEntry tradeEntry = data.get(i); |
| | | |
| | | /** |
| | | * 调整交易量倍数和 行情值 |
| | | */ |
| | | if (item.getMultiple().doubleValue() > 0) { |
| | | tradeEntry.setAmount(Arith.mul(tradeEntry.getAmount(), item.getMultiple().doubleValue())); |
| | | } else { |
| | | tradeEntry.setAmount(tradeEntry.getAmount()); |
| | | /** |
| | | * 调整交易量倍数和 行情值 |
| | | */ |
| | | if (item.getMultiple().doubleValue() > 0) { |
| | | tradeEntry.setAmount(Arith.mul(tradeEntry.getAmount(), item.getMultiple().doubleValue())); |
| | | } else { |
| | | tradeEntry.setAmount(tradeEntry.getAmount()); |
| | | } |
| | | tradeEntry.setPrice(Arith.add(tradeEntry.getPrice(), item.getAdjustmentValue().doubleValue())); |
| | | } |
| | | tradeEntry.setPrice(Arith.add(tradeEntry.getPrice(), item.getAdjustmentValue().doubleValue())); |
| | | } |
| | | return trade; |
| | | |
| | |
| | | realtime.setSymbol(currency); |
| | | realtime.setName(currency); |
| | | realtime.setTs(realtimeJson.getLong("timestamp")); |
| | | realtime.setOpen(realtimeJson.getBigDecimal("open").setScale(decimal, RoundingMode.HALF_UP)); |
| | | realtime.setClose(realtimeJson.getBigDecimal("mid").setScale(decimal, RoundingMode.HALF_UP)); |
| | | realtime.setHigh(realtimeJson.getBigDecimal("high").setScale(decimal, RoundingMode.HALF_UP)); |
| | | realtime.setLow(realtimeJson.getBigDecimal("low").setScale(decimal, RoundingMode.HALF_UP)); |
| | | realtime.setOpen(realtimeJson.getBigDecimal("open").setScale(decimal, RoundingMode.DOWN)); |
| | | realtime.setClose(realtimeJson.getBigDecimal("mid").setScale(decimal, RoundingMode.DOWN)); |
| | | realtime.setHigh(realtimeJson.getBigDecimal("high").setScale(decimal, RoundingMode.DOWN)); |
| | | realtime.setLow(realtimeJson.getBigDecimal("low").setScale(decimal, RoundingMode.DOWN)); |
| | | realtime.setAmount(BigDecimal.ZERO); |
| | | realtime.setVolume(BigDecimal.ZERO); |
| | | realtime.setAsk(realtimeJson.getBigDecimal("ask").setScale(decimal, RoundingMode.HALF_UP)); |
| | | realtime.setBid(realtimeJson.getBigDecimal("bid").setScale(decimal, RoundingMode.HALF_UP)); |
| | | realtime.setAsk(realtimeJson.getBigDecimal("ask").setScale(decimal, RoundingMode.DOWN)); |
| | | realtime.setBid(realtimeJson.getBigDecimal("bid").setScale(decimal, RoundingMode.DOWN)); |
| | | list.add(realtime); |
| | | } |
| | | } else { |