| | |
| | | if (data == null || data.isEmpty()) return true; |
| | | for (int i = 0; i < data.size(); i++) { |
| | | JSONObject pos = data.getJSONObject(i); |
| | | if (!instId.equals(pos.getString("instId"))) continue; |
| | | String posInstId = pos.getString("instId"); |
| | | if (posInstId == null || !instId.equals(posInstId)) continue; |
| | | |
| | | String posSide = pos.getString("posSide"); |
| | | BigDecimal posSize = new BigDecimal(pos.getString("pos")); |
| | | BigDecimal avgPx = new BigDecimal(pos.getString("avgPx")); |
| | | String posStr = pos.getString("pos"); |
| | | String avgPxStr = pos.getString("avgPx"); |
| | | if (posStr == null || posStr.isEmpty() || avgPxStr == null || avgPxStr.isEmpty()) continue; |
| | | |
| | | BigDecimal posSize = new BigDecimal(posStr); |
| | | BigDecimal avgPx = new BigDecimal(avgPxStr); |
| | | log.info("[OKX-WS] 持仓更新, instId:{}, posSide:{}, pos:{}, avgPx:{}", |
| | | instId, posSide, posSize, avgPx); |
| | | |