| | |
| | | // 处理订单价格在队列中的情况 |
| | | String orderPrice = OrderInfoWs.ORDERINFOWSMAP.get("orderPrice"); |
| | | handleOrderPriceInQueues(orderPrice, queueKaiCang, queuePingCang); |
| | | WsMapBuild.saveStringToMap(OrderInfoWs.ORDERINFOWSMAP, "orderPrice", String.valueOf(markPx)); |
| | | // 判断是加仓还是减仓 |
| | | if (avgPx.compareTo(markPx) > 0) { |
| | | log.info("开始加仓..."); |
| | |
| | | DescBigDecimal kaiCang = queueKaiCang.peek(); |
| | | if (kaiCang != null && markPx.compareTo(kaiCang.getValue()) <= 0 && avgPx.compareTo(kaiCang.getValue()) >= 0) { |
| | | log.info("开始加仓...开仓队列价格大于当前价格{}>{}", kaiCang.getValue(), markPx); |
| | | WsMapBuild.saveStringToMap(OrderInfoWs.ORDERINFOWSMAP, "orderPrice", String.valueOf(markPx)); |
| | | boolean buyCntTimeFlag = buyCntTimeEvent(avgPx, markPx); |
| | | if (buyCntTimeFlag){ |
| | | log.info("加仓参数准备成功......"); |
| | |
| | | BigDecimal realizedPnlValueZheng = realizedPnlValue.multiply(new BigDecimal("-1")); |
| | | if (uplValue.compareTo(realizedPnlValue) > 0 && uplValue.compareTo(imrValue.add(realizedPnlValueZheng)) >= 0) { |
| | | log.info("当前未实现盈亏:{}大于预计收益>{},赚钱咯", uplValue, imrValue); |
| | | WsMapBuild.saveStringToMap(OrderInfoWs.ORDERINFOWSMAP, "orderPrice", String.valueOf(markPx)); |
| | | return OrderParamEnums.SELL.getValue(); |
| | | }else{ |
| | | log.info("当前未实现盈亏:{}没有大于预计收益>{},钱在路上了", uplValue, imrValue); |
| | |
| | | } |
| | | }else { |
| | | if (uplValue.compareTo(imrValue) >= 0) { |
| | | WsMapBuild.saveStringToMap(OrderInfoWs.ORDERINFOWSMAP, "orderPrice", String.valueOf(markPx)); |
| | | log.info("当前未实现盈亏:{}大于预计收益>{},赚钱咯", uplValue, imrValue); |
| | | return OrderParamEnums.SELL.getValue(); |
| | | }else{ |