| | |
| | | private void subscribePositionsChannels() { |
| | | JSONObject subscribeMsg = new JSONObject(); |
| | | long timeSec = System.currentTimeMillis() / 1000; |
| | | subscribeMsg.put("id", timeSec * 1000000 + (System.currentTimeMillis() % 1000)); |
| | | subscribeMsg.put("time", timeSec); |
| | | subscribeMsg.put("channel", POSITIONS_CHANNEL); |
| | | subscribeMsg.put("event", "subscribe"); |
| | | |
| | | String uid = gridTradeService != null && gridTradeService.getUserId() != null |
| | | ? String.valueOf(gridTradeService.getUserId()) : ""; |
| | | |
| | | JSONArray payload = new JSONArray(); |
| | | payload.add("user_id"); |
| | | payload.add(uid); |
| | | payload.add(GATE_CONTRACT); |
| | | subscribeMsg.put("payload", payload); |
| | | |
| | |
| | | subscribeMsg.put("auth", auth); |
| | | |
| | | webSocketClient.send(subscribeMsg.toJSONString()); |
| | | log.info("已发送仓位频道订阅请求(含认证),合约: {}", GATE_CONTRACT); |
| | | log.info("已发送仓位频道订阅请求(含认证),userId:{}, 合约: {}", uid, GATE_CONTRACT); |
| | | } |
| | | |
| | | /** |