Administrator
5 days ago 008adf30f3de561c01c595666fdd645b47dc1f25
src/main/java/com/xcong/excoin/modules/okxApi/OkxTradeExecutor.java
@@ -392,13 +392,17 @@
        executor.execute(() -> {
            try {
                String side = isLong ? "buy" : "sell";
                String posSide = isLong ? "long" : "short";
                // OKX sz 必须为正数,strategy 层传入的负数需转正
                String absSz = size.startsWith("-") ? size.substring(1) : size;
                JSONObject body = new JSONObject();
                body.put("instId", contract);
                body.put("tdMode", "cross");
                body.put("side", side);
                body.put("posSide", posSide);            // 双向持仓模式必须指定
                body.put("ordType", "trigger");          // 计划委托 = 触发后开仓
                body.put("sz", size);
                body.put("sz", absSz);
                body.put("triggerPx", triggerPrice.stripTrailingZeros().toPlainString());
                body.put("triggerPxType", "last");
                body.put("orderPx", "-1");               // OKX 使用 orderPx,非 ordPx