| | |
| | | String connId = MallUtils.getOrderNum(POSITIONSWS_CHANNEL); |
| | | JSONObject jsonObject = WsParamBuild.buildJsonObject(connId, option, argsArray); |
| | | webSocketClient.send(jsonObject.toJSONString()); |
| | | // log.info("发送持仓频道频道:{}", option); |
| | | log.info("发送持仓频道频道:{}", option); |
| | | } catch (Exception e) { |
| | | log.error("订阅持仓频道频道构建失败", e); |
| | | } |
| | |
| | | } |
| | | |
| | | public static void initEvent(JSONObject response, String accountName) { |
| | | // log.info("订阅成功,数据初始化: {}", response.getJSONObject("arg")); |
| | | log.info("订阅成功,数据初始化: {}", response.getJSONObject("arg")); |
| | | JSONObject arg = response.getJSONObject("arg"); |
| | | initParam(arg, accountName,CoinEnums.POSSIDE_LONG.getCode()); |
| | | initParam(arg, accountName,CoinEnums.POSSIDE_SHORT.getCode()); |
| | |
| | | public static void handleEvent(JSONObject response, String accountName) { |
| | | |
| | | |
| | | // log.info("开始执行PositionsWs......"); |
| | | log.info("开始执行PositionsWs......"); |
| | | try { |
| | | JSONArray dataArray = response.getJSONArray("data"); |
| | | if (dataArray == null || dataArray.isEmpty()) { |
| | | // log.info("账户持仓频道数据为空,已当前价买入,并且初始化网格"); |
| | | log.info("账户持仓频道数据为空,已当前价买入,并且初始化网格"); |
| | | JSONObject posData = new JSONObject(); |
| | | initParam(posData, accountName,CoinEnums.POSSIDE_LONG.getCode()); |
| | | initParam(posData, accountName,CoinEnums.POSSIDE_SHORT.getCode()); |
| | |
| | | JSONObject posData = dataArray.getJSONObject(i); |
| | | String instId = posData.getString("instId"); |
| | | if (CoinEnums.HE_YUE.getCode().equals(instId)) { |
| | | // log.info("查询到账户{}持仓数据",CoinEnums.HE_YUE.getCode()); |
| | | log.info("查询到账户{}持仓数据",CoinEnums.HE_YUE.getCode()); |
| | | String mgnMode = posData.getString("mgnMode"); |
| | | String posSide = posData.getString("posSide"); |
| | | String pos = posData.getString("pos"); |