| | |
| | | } |
| | | |
| | | try { |
| | | InstrumentsWs.handleEvent(redisUtils); |
| | | InstrumentsWs.handleEvent(); |
| | | wangGeService.initWangGe(); |
| | | SSLConfig.configureSSL(); |
| | | System.setProperty("https.protocols", "TLSv1.2,TLSv1.3"); |
| | |
| | | * @param response 包含价格数据的 JSON 对象 |
| | | */ |
| | | private void processPushData(JSONObject response) { |
| | | String op = response.getString("op"); |
| | | if (op != null){ |
| | | if (TradeOrderWs.ORDERWS_CHANNEL.equals(op)) { |
| | | // 直接使用Object类型接收,避免强制类型转换 |
| | | Object data = response.get("data"); |
| | | log.info("收到下单推送结果: {}", JSON.toJSONString(data)); |
| | | return; |
| | | } |
| | | } |
| | | JSONObject arg = response.getJSONObject("arg"); |
| | | if (arg == null) { |
| | | log.warn("无效的推送数据,缺少 'arg' 字段"); |
| | | log.warn("无效的推送数据,缺少 'arg' 字段 :{}",response); |
| | | return; |
| | | } |
| | | |
| | | String channel = arg.getString("channel"); |
| | | if (channel == null) { |
| | | log.warn("无效的推送数据,缺少 'channel' 字段"); |
| | | log.warn("无效的推送数据,缺少 'channel' 字段{}",response); |
| | | return; |
| | | } |
| | | |
| | | if (OrderInfoWs.ORDERINFOWS_CHANNEL.equals(channel)) { |
| | | OrderInfoWs.handleEvent(response, redisUtils); |
| | | }else if (AccountWs.ACCOUNTWS_CHANNEL.equals(channel)) { |
| | | AccountWs.handleEvent(response, redisUtils); |
| | | AccountWs.handleEvent(response); |
| | | String side = caoZuoService.caoZuo(); |
| | | TradeOrderWs.orderEvent(webSocketClient, redisUtils, side); |
| | | TradeOrderWs.orderEvent(webSocketClient, side); |
| | | } else if (PositionsWs.POSITIONSWS_CHANNEL.equals(channel)) { |
| | | PositionsWs.handleEvent(response, redisUtils); |
| | | PositionsWs.handleEvent(response); |
| | | } else if (BalanceAndPositionWs.CHANNEL_NAME.equals(channel)) { |
| | | BalanceAndPositionWs.handleEvent(response); |
| | | } |