| | |
| | | private static final String CHANNEL_OPEN_INTEREST = "open-interest"; |
| | | |
| | | private static final String[] INST_IDS = { |
| | | "EOS-USDT","BTC-USDT", "ETH-USDT", "XRP-USDT", "LTC-USDT", "BCH-USDT", "ETC-USDT" |
| | | "BTC-USDT", "ETH-USDT", "XRP-USDT", "LTC-USDT", "BCH-USDT", "ETC-USDT" |
| | | }; |
| | | //BTC-USDT-SWAP |
| | | private static final String[] INST_IDS_INTEREST = { |
| | | "BTC-USDT-SWAP", "ETH-USDT-SWAP", "XRP-USDT-SWAP", "LTC-USDT-SWAP", "BCH-USDT-SWAP", "ETC-USDT-SWAP" |
| | | }; |
| | | |
| | | // 心跳超时时间(秒),小于30秒 |
| | |
| | | subscribeMsg.put("op", "subscribe"); |
| | | |
| | | JSONArray argsArray = new JSONArray(); |
| | | for (String instId : INST_IDS) { |
| | | for (String instId : INST_IDS_INTEREST) { |
| | | JSONObject arg = new JSONObject(); |
| | | arg.put("channel", CHANNEL_OPEN_INTEREST); |
| | | arg.put("instId", instId); |
| | |
| | | |
| | | String redisKey = "volume:" + buildRedisKey(instId); |
| | | redisUtils.set(redisKey, oiUsd); |
| | | |
| | | String symbol = CoinTypeConvert.okxConvert(instId); |
| | | if (symbol != null) { |
| | | redisUtils.set(CoinTypeConvert.convertToVolumeKey(symbol), oiUsd); |
| | | } |
| | | |
| | | log.debug("更新持仓量: {} = {}, 时间: {}", redisKey, oiUsd, ts); |
| | | } catch (Exception innerEx) { |