| | |
| | | List<AscBigDecimal> list = new ArrayList<AscBigDecimal>(); |
| | | // 找到所有比当前价格大的 是需要操作的 |
| | | if (b != null && b.compareTo(now) <= 0) { |
| | | log.info("--->{}", b.getValue()); |
| | | // 可以操作 |
| | | System.out.println("当前价格:" + price + "---正序---" + "队列价格:" + b.getValue().toPlainString() + " time:" + new Date()); |
| | | log.info("--->>>>{}", queue.peek().getValue()); |
| | | while (queue.peek() != null && queue.peek().compareTo(now) <= 0) { |
| | | // 可以发送消息操作 |
| | | list.add(queue.remove()); |
| | |
| | | // 找到比当前价格还大的就是需要操作的 开多止损 |
| | | // 即最大的币当前价大 那么需要开多止损 |
| | | if (b != null && b.compareTo(now) <= 0) { |
| | | log.info("--->{}", b.getValue()); |
| | | // 可以操作 |
| | | System.out.println("当前价格:" + price + "---倒序操作---" + "队列:" + b.getValue().toPlainString() + " time:" + new Date()); |
| | | |
| | | log.info("--->>>>{}", queue.peek().getValue()); |
| | | while (queue.peek() != null && queue.peek().compareTo(now) <= 0) { |
| | | // 可以发送消息操作 |
| | | list.add(queue.remove()); |
| | |
| | | List<OrderModel> orderModelList = new ArrayList<OrderModel>(); |
| | | // 3 正序 |
| | | Map<String, List<OrderModel>> orderMap = PricePriorityQueue.getOrderMap(symbol, 3); |
| | | log.info("--->{}", JSONObject.toJSONString(orderMap)); |
| | | // 根据价格查询到对应的订单 |
| | | for (AscBigDecimal asc : list) { |
| | | String key = asc.getValue().toPlainString(); |
| | | log.info("------>>>>>{}", key); |
| | | assert orderMap != null; |
| | | log.info("======={}", orderMap.containsKey(key)); |
| | | log.info("----->->{}, --> {}", JSONObject.toJSONString(orderMap), key); |
| | | if (orderMap.containsKey(key)) { |
| | | orderModelList.addAll(orderMap.get(key)); |
| | | orderMap.remove(key); |
| | | } |
| | | |
| | | } |
| | | log.info("{}", orderModelList); |
| | | log.info("------>{}", JSONObject.toJSONString(orderModelList)); |
| | | if (CollectionUtils.isEmpty(orderModelList)) { |
| | | return; |
| | | } |
| | |
| | | kkzsList.add(model); |
| | | break; |
| | | default: |
| | | log.info("#price-service unknow type#"); |
| | | log.info("#price-service unknown type#"); |
| | | break; |
| | | } |
| | | |
| | |
| | | // 根据不同类型发送不同消息 1 倒序 2 正序 |
| | | List<OrderModel> orderModelList = new ArrayList<OrderModel>(); |
| | | Map<String, List<OrderModel>> orderMap = PricePriorityQueue.getOrderMap(symbol, 2); |
| | | log.info("--->{}", JSONObject.toJSONString(orderMap)); |
| | | // 根据价格查询到对应的订单 |
| | | for (DescBigDecimal desc : list) { |
| | | String key = desc.getValue().toPlainString(); |
| | | log.info("------>>>>>{}", key); |
| | | assert orderMap != null; |
| | | log.info("======={}", orderMap.containsKey(key)); |
| | | log.info("----->->{}, --> {}", JSONObject.toJSONString(orderMap), key); |
| | | if (orderMap.containsKey(key)) { |
| | | orderModelList.addAll(orderMap.get(key)); |
| | | orderMap.remove(key); |
| | |
| | | |
| | | } |
| | | |
| | | log.info("{}", orderModelList); |
| | | if (CollectionUtils.isEmpty(orderModelList)) { |
| | | return; |
| | | } |