| | |
| | | } |
| | | } |
| | | |
| | | public static void initEvent(JSONObject response) { |
| | | log.info("订阅成功,数据初始化: {}", response.getJSONObject("arg")); |
| | | JSONObject arg = response.getJSONObject("arg"); |
| | | initParam(arg); |
| | | } |
| | | |
| | | public static void handleEvent(JSONObject response) { |
| | | |
| | | |
| | |
| | | if (dataArray == null || dataArray.isEmpty()) { |
| | | log.info("账户持仓频道数据为空,已当前价买入,并且初始化网格"); |
| | | JSONObject posData = new JSONObject(); |
| | | processPositionData(posData); |
| | | initParam(posData); |
| | | return; |
| | | } |
| | | |
| | |
| | | markPx |
| | | ); |
| | | |
| | | processPositionData(posData); |
| | | initParam(posData); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | } |
| | | } |
| | | |
| | | private static void processPositionData(JSONObject posData) { |
| | | private static void initParam(JSONObject posData) { |
| | | WsMapBuild.saveBigDecimalToMap(POSITIONSWSMAP, "avgPx", WsMapBuild.parseBigDecimalSafe(posData.getString("avgPx"))); |
| | | WsMapBuild.saveBigDecimalToMap(POSITIONSWSMAP, "pos", WsMapBuild.parseBigDecimalSafe(posData.getString("pos"))); |
| | | WsMapBuild.saveBigDecimalToMap(POSITIONSWSMAP, "upl", WsMapBuild.parseBigDecimalSafe(posData.getString("upl"))); |
| | |
| | | WsMapBuild.saveBigDecimalToMap(POSITIONSWSMAP, "bePx", WsMapBuild.parseBigDecimalSafe(posData.getString("bePx"))); |
| | | WsMapBuild.saveBigDecimalToMap(POSITIONSWSMAP, "realizedPnl", WsMapBuild.parseBigDecimalSafe(posData.getString("realizedPnl"))); |
| | | |
| | | WsMapBuild.saveBigDecimalToMap(POSITIONSWSMAP, CoinEnums.READY_STATE.name(), WsMapBuild.parseBigDecimalSafe(CoinEnums.READY_STATE_YES.getCode())); |
| | | } |
| | | } |