| | |
| | | import com.xcong.excoin.modules.okxNewPrice.okxWs.wanggeList.WangGeListQueue; |
| | | import com.xcong.excoin.modules.okxNewPrice.okxWs.wanggeList.WangGeListService; |
| | | import com.xcong.excoin.modules.okxNewPrice.utils.WsMapBuild; |
| | | import com.xcong.excoin.modules.okxNewPrice.wangge.WangGeQueue; |
| | | import com.xcong.excoin.modules.okxNewPrice.wangge.WangGeService; |
| | | import com.xcong.excoin.rabbit.pricequeue.AscBigDecimal; |
| | | import com.xcong.excoin.rabbit.pricequeue.DescBigDecimal; |
| | | import com.xcong.excoin.utils.RedisUtils; |
| | |
| | | @RequiredArgsConstructor |
| | | public class CaoZuoServiceImpl implements CaoZuoService { |
| | | |
| | | private final WangGeService wangGeService; |
| | | private final WangGeListService wangGeListService; |
| | | private final RedisUtils redisUtils; |
| | | |
| | |
| | | ? BigDecimal.ZERO : PositionsWs.getAccountMap(positionAccountName).get(CoinEnums.READY_STATE.name()); |
| | | if (WsMapBuild.parseBigDecimalSafe(CoinEnums.READY_STATE_YES.getCode()).compareTo(positionsReadyState) != 0) { |
| | | log.info("仓位{}通道未就绪,取消发送",positionAccountName); |
| | | return null; |
| | | // 判断是否保证金超标 |
| | | if (PositionsWs.getAccountMap(positionAccountName).get("imr") == null){ |
| | | log.error("没有获取到持仓信息,等待初始化......"); |
| | | return null; |
| | | } |
| | | BigDecimal ordFrozImr = PositionsWs.getAccountMap(positionAccountName).get("imr"); |
| | | BigDecimal totalOrderUsdt = WsMapBuild.parseBigDecimalSafe(AccountWs.getAccountMap(accountName).get(CoinEnums.TOTAL_ORDER_USDT.name())); |
| | | if (ordFrozImr.compareTo(totalOrderUsdt) >= 0){ |
| | | log.error("已满仓......"); |
| | | return OrderParamEnums.HOLDING.getValue(); |
| | | } |
| | | if (PositionsWs.getAccountMap(positionAccountName).get("pos") == null){ |
| | | log.error("没有获取到持仓信息,等待初始化......"); |
| | | return null; |
| | | } |
| | | BigDecimal pos = PositionsWs.getAccountMap(positionAccountName).get("pos"); |
| | | if (BigDecimal.ZERO.compareTo( pos) >= 0) { |
| | | log.error("持仓数量为零,进行初始化订单"); |
| | | return OrderParamEnums.INIT.getValue(); |
| | | }else{ |
| | | log.error("仓位有持仓,等待持仓更新"); |
| | | return null; |
| | | } |
| | | } |
| | | // 系统设置的开关,等于冷静中,则代表不开仓 |
| | | String outStr = InstrumentsWs.getAccountMap(accountName).get(CoinEnums.OUT.name()); |