Helius
2020-06-02 1140c35b81161c3e85ff036176f39f58e35f731e
src/main/java/com/xcong/excoin/rabbit/pricequeue/WebsocketPriceService.java
@@ -34,10 +34,8 @@
        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());
@@ -61,11 +59,9 @@
        // 找到比当前价格还大的就是需要操作的 开多止损
        // 即最大的币当前价大 那么需要开多止损
        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());
@@ -86,20 +82,16 @@
            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));
                if (orderMap.containsKey(key)) {
                    orderModelList.addAll(orderMap.get(key));
                    orderMap.remove(key);
                }
            }
            log.info("{}", orderModelList);
            if (CollectionUtils.isEmpty(orderModelList)) {
                return;
            }
@@ -131,7 +123,7 @@
                        kkzsList.add(model);
                        break;
                    default:
                        log.info("#price-service unknow type#");
                        log.info("#price-service unknown type#");
                        break;
                }
@@ -161,13 +153,10 @@
            // 根据不同类型发送不同消息  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));
                if (orderMap.containsKey(key)) {
                    orderModelList.addAll(orderMap.get(key));
                    orderMap.remove(key);
@@ -175,7 +164,6 @@
            }
            log.info("{}", orderModelList);
            if (CollectionUtils.isEmpty(orderModelList)) {
                return;
            }