| | |
| | | DescBigDecimal b = queue.peek(); |
| | | // 当前价格 |
| | | DescBigDecimal now = new DescBigDecimal(price); |
| | | log.info("--->{}", JSONObject.toJSONString(b)); |
| | | log.info("--->{}", JSONObject.toJSONString(now)); |
| | | List<DescBigDecimal> list = new ArrayList<DescBigDecimal>(); |
| | | // 找到比当前价格还大的就是需要操作的 开多止损 |
| | | // 即最大的币当前价大 那么需要开多止损 |
| | |
| | | for (AscBigDecimal asc : list) { |
| | | String key = asc.getValue().toPlainString(); |
| | | assert orderMap != null; |
| | | log.info("----->->{}, --> {}", JSONObject.toJSONString(orderMap), key); |
| | | if (orderMap.containsKey(key)) { |
| | | orderModelList.addAll(orderMap.get(key)); |
| | | orderMap.remove(key); |
| | | } |
| | | |
| | | } |
| | | log.info("------>{}", JSONObject.toJSONString(orderModelList)); |
| | | if (CollectionUtils.isEmpty(orderModelList)) { |
| | | return; |
| | | } |
| | | System.out.println("本次执行的列表ASC"); |
| | | System.out.println(JSONObject.toJSONString(orderModelList)); |
| | | log.info("本次执行的列表ASC"); |
| | | // 根据订单的类型发送消息 |
| | | // 3:开空 7:爆仓平空 |
| | | // 9:止盈平多 12:止损平空 |
| | |
| | | List<OrderModel> bcList = new ArrayList<OrderModel>(); |
| | | // 开空 |
| | | List<OrderModel> wtkkList = new ArrayList<OrderModel>(); |
| | | // 委托平多 |
| | | List<OrderModel> wtpdList = new ArrayList<>(); |
| | | switch (model.getType()) { |
| | | case 3: |
| | | wtkkList.add(model); |
| | | break; |
| | | case 4: |
| | | wtpdList.add(model); |
| | | break; |
| | | case 7: |
| | | bcList.add(model); |
| | |
| | | if (CollectionUtils.isNotEmpty(wtkkList)) { |
| | | orderProducer.sendLimit(JSONObject.toJSONString(wtkkList)); |
| | | } |
| | | if (CollectionUtils.isNotEmpty(wtpdList)) { |
| | | orderProducer.sendLimitClose(JSONObject.toJSONString(wtpdList)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | for (DescBigDecimal desc : list) { |
| | | String key = desc.getValue().toPlainString(); |
| | | assert orderMap != null; |
| | | log.info("----->->{}, --> {}", JSONObject.toJSONString(orderMap), key); |
| | | if (orderMap.containsKey(key)) { |
| | | orderModelList.addAll(orderMap.get(key)); |
| | | orderMap.remove(key); |
| | |
| | | if (CollectionUtils.isEmpty(orderModelList)) { |
| | | return; |
| | | } |
| | | System.out.println("本次执行的列表Desc"); |
| | | System.out.println(JSONObject.toJSONString(orderModelList)); |
| | | log.info("本次执行的列表Desc"); |
| | | // 根据订单的类型发送消息 |
| | | // 2:开多6:爆仓平多 |
| | | // 10:止盈平空11:止损平多 |
| | |
| | | List<OrderModel> bcList = new ArrayList<OrderModel>(); |
| | | // 开多委托 |
| | | List<OrderModel> wtkdList = new ArrayList<OrderModel>(); |
| | | // 委托平空 |
| | | List<OrderModel> wtpkList = new ArrayList<>(); |
| | | switch (model.getType()) { |
| | | case 2: |
| | | wtkdList.add(model); |
| | | break; |
| | | case 5: |
| | | wtpkList.add(model); |
| | | break; |
| | | case 6: |
| | | bcList.add(model); |
| | |
| | | } |
| | | if (CollectionUtils.isNotEmpty(wtkdList)) { |
| | | orderProducer.sendLimit(JSONObject.toJSONString(wtkdList)); |
| | | |
| | | } |
| | | if (CollectionUtils.isNotEmpty(wtpkList)) { |
| | | orderProducer.sendLimitClose(JSONObject.toJSONString(wtpkList)); |
| | | } |
| | | } |
| | | } |