Helius
2020-08-26 e772e9373d2dc03b1bba1da13a8cbeb46d111a94
modify
3 files modified
32 ■■■■ changed files
src/main/java/com/xcong/excoin/rabbit/pricequeue/OrderOperatePriceService.java 12 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/rabbit/pricequeue/PricePriorityQueue.java 14 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/rabbit/pricequeue/WebsocketPriceService.java 6 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/rabbit/pricequeue/OrderOperatePriceService.java
@@ -51,9 +51,9 @@
        Long orderId = order.getOrderId();
        queue.add(new DescBigDecimal(price));
        log.info("原有:{}", JSONObject.toJSONString(orderMap));
//        log.info("原有:{}", JSONObject.toJSONString(orderMap));
        removeExistOrder(type, orderId, orderMap);
        log.info("删除后:{}", JSONObject.toJSONString(orderMap));
//        log.info("删除后:{}", JSONObject.toJSONString(orderMap));
        if (orderMap.containsKey(price)) {
            // 有这个价的key
            List<OrderModel> list = orderMap.get(price);
@@ -69,7 +69,7 @@
            list.add(orderModel);
            orderMap.put(price, list);
        }
        log.info("调整后:{}", JSONObject.toJSONString(orderMap));
//        log.info("调整后:{}", JSONObject.toJSONString(orderMap));
    }
@@ -85,10 +85,10 @@
        int type = order.getType();
        Long orderId = order.getOrderId();
        queue.add(new AscBigDecimal(price));
        log.info("原有:{}", JSONObject.toJSONString(orderMap));
//        log.info("原有:{}", JSONObject.toJSONString(orderMap));
        // 需要找到这个订单的原始的单进行处理
        removeExistOrder(type, orderId, orderMap);
        log.info("删除后:{}", JSONObject.toJSONString(orderMap));
//        log.info("删除后:{}", JSONObject.toJSONString(orderMap));
        if (orderMap.containsKey(price)) {
            // 有这个价的key
            List<OrderModel> list = orderMap.get(price);
@@ -104,7 +104,7 @@
            list.add(orderModel);
            orderMap.put(price, list);
        }
        log.info("调整后:{}", JSONObject.toJSONString(orderMap));
//        log.info("调整后:{}", JSONObject.toJSONString(orderMap));
    }
    private static void removeExistOrder(Integer type, Long orderId, Map<String, List<OrderModel>> orderMap) {
src/main/java/com/xcong/excoin/rabbit/pricequeue/PricePriorityQueue.java
@@ -208,7 +208,7 @@
    public static Map<String,List<OrderModel>> getOrderMap(String symbol, int type) {
        switch (symbol) {
            case "BTC/USDT": // 开空止损 开多止盈 开空爆仓 限价开空
                if (type == 12 || type == 9 || type == 7 || type == 3) {
                if (type == 12 || type == 9 || type == 7 || type == 3 || type == 4) {
                    if (BTC_MAP_ASC == null) {
                        BTC_MAP_ASC = new ConcurrentHashMap<String,List<OrderModel>>();
                    }
@@ -220,7 +220,7 @@
                    return BTC_MAP_DESC;
                }
            case "ETH/USDT": // 开多止损 开空止盈 开多爆仓 限价开多
                if (type == 12 || type == 9 || type == 7 || type == 3) {
                if (type == 12 || type == 9 || type == 7 || type == 3 || type == 4) {
                    if (ETH_MAP_ASC == null) {
                        ETH_MAP_ASC = new ConcurrentHashMap<String,List<OrderModel>>();
                    }
@@ -232,7 +232,7 @@
                    return ETH_MAP_DESC;
                }
            case "XRP/USDT": // 开多止损 开空止盈 开多爆仓 限价开多
                if (type == 12 || type == 9 || type == 7 || type == 3) {
                if (type == 12 || type == 9 || type == 7 || type == 3 || type == 4) {
                    if (XRP_MAP_ASC == null) {
                        XRP_MAP_ASC = new ConcurrentHashMap<String,List<OrderModel>>();
                    }
@@ -244,7 +244,7 @@
                    return XRP_MAP_DESC;
                }
            case "LTC/USDT": // 开多止损 开空止盈 开多爆仓 限价开多
                if (type == 12 || type == 9 || type == 7 || type == 3) {
                if (type == 12 || type == 9 || type == 7 || type == 3 || type == 4) {
                    if (LTC_MAP_ASC == null) {
                        LTC_MAP_ASC = new ConcurrentHashMap<String,List<OrderModel>>();
                    }
@@ -256,7 +256,7 @@
                    return LTC_MAP_DESC;
                }
            case "BCH/USDT": // 开多止损 开空止盈 开多爆仓 限价开多
                if (type == 12 || type == 9 || type == 7 || type == 3) {
                if (type == 12 || type == 9 || type == 7 || type == 3 || type == 4) {
                    if (BCH_MAP_ASC == null) {
                        BCH_MAP_ASC = new ConcurrentHashMap<String,List<OrderModel>>();
                    }
@@ -268,7 +268,7 @@
                    return BCH_MAP_DESC;
                }
            case "EOS/USDT": // 开多止损 开空止盈 开多爆仓 限价开多
                if (type == 12 || type == 9 || type == 7 || type == 3) {
                if (type == 12 || type == 9 || type == 7 || type == 3 || type == 4) {
                    if (EOS_MAP_ASC == null) {
                        EOS_MAP_ASC =  new ConcurrentHashMap<String,List<OrderModel>>();
                    }
@@ -280,7 +280,7 @@
                    return EOS_MAP_DESC;
                }
            case "ETC/USDT": // 开多止损 开空止盈 开多爆仓 限价开多
                if (type == 12 || type == 9 || type == 7 || type == 3) {
                if (type == 12 || type == 9 || type == 7 || type == 3 || type == 4) {
                    if (ETC_MAP_ASC == null) {
                        ETC_MAP_ASC = new ConcurrentHashMap<String,List<OrderModel>>();
                    }
src/main/java/com/xcong/excoin/rabbit/pricequeue/WebsocketPriceService.java
@@ -97,8 +97,7 @@
            if (CollectionUtils.isEmpty(orderModelList)) {
                return;
            }
            System.out.println("本次执行的列表ASC");
            System.out.println(JSONObject.toJSONString(orderModelList));
            log.info("本次执行的列表ASC");
            // 根据订单的类型发送消息
            // 3:开空  7:爆仓平空
            // 9:止盈平多 12:止损平空
@@ -178,8 +177,7 @@
            if (CollectionUtils.isEmpty(orderModelList)) {
                return;
            }
            System.out.println("本次执行的列表Desc");
            System.out.println(JSONObject.toJSONString(orderModelList));
            log.info("本次执行的列表Desc");
            // 根据订单的类型发送消息
            // 2:开多6:爆仓平多
            // 10:止盈平空11:止损平多