| | |
| | | } else if (PositionsWs.POSITIONSWS_CHANNEL.equals(channel)) { |
| | | PositionsWs.handleEvent(response, redisUtils); |
| | | |
| | | String avgPxKey = PositionsWs.POSITIONSWS_CHANNEL + ":" + CoinEnums.HE_YUE.getCode() + ":avgPx"; |
| | | String avgPx = (String) redisUtils.get(avgPxKey); |
| | | if (StrUtil.isBlank(avgPx)) { |
| | | log.error("未获取到持仓均价"); |
| | | String posKey = PositionsWs.POSITIONSWS_CHANNEL + ":" + CoinEnums.HE_YUE.getCode() + ":pos"; |
| | | String pos = (String) redisUtils.get(posKey); |
| | | if (StrUtil.isBlank(pos)) { |
| | | log.error("未获取到持仓数量"); |
| | | TradeOrderWs.orderEvent(webSocketClient, redisUtils, OrderParamEnums.INIT.getValue()); |
| | | return; |
| | | } |
| | |
| | | } |
| | | |
| | | String side = caoZuoService.caoZuo(); |
| | | if (StrUtil.isNotBlank(avgPx)) { |
| | | if (StrUtil.isNotBlank(pos)) { |
| | | TradeOrderWs.orderEvent(webSocketClient, redisUtils, side); |
| | | } |
| | | } else if (BalanceAndPositionWs.CHANNEL_NAME.equals(channel)) { |