| | |
| | | return OrderParamEnums.INIT.getValue(); |
| | | } |
| | | //可使用的总保证金 |
| | | String totalOrderUsdtKey = AccountWs.ACCOUNTWS_CHANNEL + ":" + CoinEnums.USDT.getCode() + ":totalOrderUsdt"; |
| | | String totalOrderUsdt = (String) redisUtils.get(totalOrderUsdtKey); |
| | | String cashBalStrKey = AccountWs.ACCOUNTWS_CHANNEL + ":" + CoinEnums.USDT.getCode() + ":cashBalStr"; |
| | | String cashBalStr = (String) redisUtils.get(cashBalStrKey); |
| | | BigDecimal upl = new BigDecimal(uplStr); |
| | | if (BigDecimal.ZERO.compareTo(upl) >= 0){ |
| | | upl = upl.multiply(new BigDecimal("-1")); |
| | | |
| | | if (upl.compareTo(new BigDecimal(totalOrderUsdt)) >= 0) { |
| | | BigDecimal bigDecimal = new BigDecimal(cashBalStr).multiply(new BigDecimal(OrderParamEnums.ZHI_SUN.getValue())); |
| | | if (upl.compareTo(bigDecimal) >= 0) { |
| | | log.error("持仓盈亏超过下单总保证金,止损冷静一天......"); |
| | | return OrderParamEnums.OUT.getValue(); |
| | | } |
| | |
| | | log.info("加仓过程中发现持仓过小 :{}",isAddCang); |
| | | if (isAddCang){ |
| | | log.info("触发加仓......,持仓过小"); |
| | | redisUtils.set(positionsOrderPriceKey, String.valueOf(markPx), 0); |
| | | return OrderParamEnums.BUY.getValue(); |
| | | } |
| | | log.info("未触发加仓......,等待"); |
| | |
| | | log.info("减仓过程中发现持仓过小 :{}",isAddCang); |
| | | if (isAddCang){ |
| | | log.info("触发加仓......,持仓过小"); |
| | | redisUtils.set(positionsOrderPriceKey, String.valueOf(markPx), 0); |
| | | return OrderParamEnums.BUY.getValue(); |
| | | } |
| | | log.info("当前未实现盈亏:{}没有大于预计收益>{},钱在路上了", uplValue, imrValue); |
| | |
| | | log.info("减仓过程中发现持仓过小 :{}",isAddCang); |
| | | if (isAddCang){ |
| | | log.info("触发加仓......,持仓过小"); |
| | | redisUtils.set(positionsOrderPriceKey, String.valueOf(markPx), 0); |
| | | return OrderParamEnums.BUY.getValue(); |
| | | } |
| | | log.info("当前未实现盈亏:{}没有大于预计收益>{},钱在路上了", uplValue, imrValue); |