| | |
| | | BigDecimal pos = PositionsWs.getAccountMap(accountName).get("pos"); |
| | | if (BigDecimal.ZERO.compareTo( pos) >= 0) { |
| | | log.error("持仓数量为零,进行初始化订单"); |
| | | return OrderParamEnums.INIT.getValue(); |
| | | return null; |
| | | } |
| | | // 判断是否保证金超标 |
| | | if (PositionsWs.getAccountMap(accountName).get("imr") == null){ |
| | |
| | | return OrderParamEnums.HOLDING.getValue(); |
| | | } |
| | | AscBigDecimal pingCang = queuePingCang.peek(); |
| | | if (pingCang != null && markPx.compareTo(pingCang.getValue()) >= 0 && avgPx.compareTo(pingCang.getValue()) < 0) { |
| | | log.info("开始减仓...平仓队列价格小于当前价格{}<={}", pingCang.getValue(), markPx); |
| | | if (pingCang != null && avgPx.compareTo(pingCang.getValue()) < 0) { |
| | | log.info("开始减仓...平仓队列价格大于当前价格{}<={}", pingCang.getValue(), avgPx); |
| | | // 手续费 |
| | | BigDecimal feeValue = PositionsWs.getAccountMap(accountName).get("fee").multiply(new BigDecimal("2")); |
| | | //未实现收益 |
| | |
| | | BigDecimal pos = PositionsWs.getAccountMap(accountName).get("pos"); |
| | | if (BigDecimal.ZERO.compareTo( pos) >= 0) { |
| | | log.error("持仓数量为零,进行初始化订单"); |
| | | return OrderParamEnums.INIT.getValue(); |
| | | return null; |
| | | } |
| | | // 判断是否保证金超标 |
| | | if (PositionsWs.getAccountMap(accountName).get("imr") == null){ |
| | |
| | | return OrderParamEnums.HOLDING.getValue(); |
| | | } |
| | | DescBigDecimal kaiCang = queueKaiCang.peek(); |
| | | if (kaiCang != null && markPx.compareTo(kaiCang.getValue()) <= 0 && avgPx.compareTo(kaiCang.getValue()) >= 0) { |
| | | log.info("开始减仓...减仓队列价格大于当前价格{}>{}", kaiCang.getValue(), markPx); |
| | | if (kaiCang != null && avgPx.compareTo(kaiCang.getValue()) >= 0) { |
| | | log.info("开始减仓...减仓队列价格小于开仓价格{}>{}", kaiCang.getValue(), avgPx); |
| | | |
| | | // 手续费 |
| | | BigDecimal feeValue = PositionsWs.getAccountMap(accountName).get("fee").multiply(new BigDecimal("2")); |