From 25d88a2244fbf6916eac14a7ac43f0c7dea5e6d0 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Fri, 28 Aug 2020 14:49:51 +0800
Subject: [PATCH] modify
---
src/main/java/com/xcong/excoin/rabbit/pricequeue/OrderOperatePriceService.java | 78 +++++++++++++++++++-------------------
1 files changed, 39 insertions(+), 39 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/rabbit/pricequeue/OrderOperatePriceService.java b/src/main/java/com/xcong/excoin/rabbit/pricequeue/OrderOperatePriceService.java
index 3e7ebea..2428c7b 100644
--- a/src/main/java/com/xcong/excoin/rabbit/pricequeue/OrderOperatePriceService.java
+++ b/src/main/java/com/xcong/excoin/rabbit/pricequeue/OrderOperatePriceService.java
@@ -26,7 +26,7 @@
// 【1:买入委托2:开多3:开空4:平多5:平空6:爆仓平多7:爆仓平空8:撤单9:止盈平多10:止盈平空11:止损平多12:止损平空】
int type = orderModel.getType();
Map<String, List<OrderModel>> orderMap = PricePriorityQueue.getOrderMap(orderModel.getSymbol(), type);
- if (type == 12 || type == 9 || type == 7 || type == 3) {
+ if (type == 12 || type == 9 || type == 7 || type == 3 || type == 4) {
// 需要价格涨的
PriorityBlockingQueue<AscBigDecimal> queue = PricePriorityQueue.getQueueAsc(orderModel.getSymbol());
dealPriceAsc(orderModel, orderMap, queue);
@@ -51,44 +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));
- if (orderMap.containsKey(price)) {
- // 有这个价的key
- List<OrderModel> list = orderMap.get(price);
- // 判断这个单的这个类型是否有
- if (CollectionUtils.isNotEmpty(list)) {
- // 新增
- OrderModel orderModel = new OrderModel(orderId, type, price, null,order.getOperateNo());
- list.add(orderModel);
- }
- } else {
- List<OrderModel> list = new ArrayList<OrderModel>();
- OrderModel orderModel = new OrderModel(orderId, type, price, null,order.getOperateNo());
- list.add(orderModel);
- orderMap.put(price, list);
- }
- log.info("调整后:{}", JSONObject.toJSONString(orderMap));
- }
-
-
- /**
- * 正序的添加价格和订单
- *
- * @param orderMap
- * @param queue
- */
- public static void dealPriceAsc(OrderModel order, Map<String, List<OrderModel>> orderMap, PriorityBlockingQueue<AscBigDecimal> queue) {
- // 添加币种的价格和价格订单信息
- String price = order.getPrice();
- int type = order.getType();
- Long orderId = order.getOrderId();
- queue.add(new AscBigDecimal(price));
- 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 +69,42 @@
list.add(orderModel);
orderMap.put(price, list);
}
- log.info("调整后:{}", JSONObject.toJSONString(orderMap));
+// log.info("调整后:{}", JSONObject.toJSONString(orderMap));
+ }
+
+
+ /**
+ * 正序的添加价格和订单
+ *
+ * @param orderMap
+ * @param queue
+ */
+ public static void dealPriceAsc(OrderModel order, Map<String, List<OrderModel>> orderMap, PriorityBlockingQueue<AscBigDecimal> queue) {
+ // 添加币种的价格和价格订单信息
+ String price = order.getPrice();
+ int type = order.getType();
+ Long orderId = order.getOrderId();
+ queue.add(new AscBigDecimal(price));
+// log.info("原有:{}", JSONObject.toJSONString(orderMap));
+ // 需要找到这个订单的原始的单进行处理
+ removeExistOrder(type, orderId, orderMap);
+// log.info("删除后:{}", JSONObject.toJSONString(orderMap));
+ if (orderMap.containsKey(price)) {
+ // 有这个价的key
+ List<OrderModel> list = orderMap.get(price);
+ // 判断这个单的这个类型是否有
+// if (CollectionUtils.isNotEmpty(list)) {
+ // 新增
+ OrderModel orderModel = new OrderModel(orderId, type, price, null,order.getOperateNo());
+ list.add(orderModel);
+// }
+ } else {
+ List<OrderModel> list = new ArrayList<OrderModel>();
+ OrderModel orderModel = new OrderModel(orderId, type, price, null,order.getOperateNo());
+ list.add(orderModel);
+ orderMap.put(price, list);
+ }
+// log.info("调整后:{}", JSONObject.toJSONString(orderMap));
}
private static void removeExistOrder(Integer type, Long orderId, Map<String, List<OrderModel>> orderMap) {
--
Gitblit v1.9.1