From 85e1673c4683f4699106afe79405877903ce4eb5 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Tue, 02 Jun 2026 11:20:14 +0800
Subject: [PATCH] fix(okx): 修复账户余额获取和API请求处理问题
---
src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxTradeExecutor.java | 19 ++++++++-----------
1 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxTradeExecutor.java b/src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxTradeExecutor.java
index d96dd44..5f8ca15 100644
--- a/src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxTradeExecutor.java
+++ b/src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxTradeExecutor.java
@@ -86,7 +86,7 @@
* @param onFailure 失败回调
*/
public void openLong(String quantity, Consumer<String> onSuccess, Runnable onFailure) {
- submitOrder("buy", "long", quantity, "market", null, false, "t-okx-grid-long", onSuccess, onFailure);
+ submitOrder("buy", "long", quantity, "market", null, false, "tGridLong", onSuccess, onFailure);
}
/**
@@ -97,7 +97,7 @@
* @param onFailure 失败回调
*/
public void openShort(String quantity, Consumer<String> onSuccess, Runnable onFailure) {
- submitOrder("sell", "short", quantity, "market", null, false, "t-okx-grid-short", onSuccess, onFailure);
+ submitOrder("sell", "short", quantity, "market", null, false, "tGridShort", onSuccess, onFailure);
}
/**
@@ -219,11 +219,9 @@
}
executor.execute(() -> {
try {
- LinkedHashMap<String, Object> params = new LinkedHashMap<>();
- params.put("instId", instId);
- params.put("algoId", algoId);
- String resp = okxAccount.requestHandler.sendSignedRequest(
- okxAccount.baseUrl, "/api/v5/trade/cancel-algos", params, HttpMethod.POST, okxAccount.isSimluate());
+ String body = "[{\"instId\":\"" + instId + "\",\"algoId\":\"" + algoId + "\"}]";
+ String resp = okxAccount.requestHandler.sendSignedRequestRaw(
+ okxAccount.baseUrl, "/api/v5/trade/cancel-algos", body, HttpMethod.POST, okxAccount.isSimluate());
log.info("[OkxExec] 条件单已取消, algoId:{}", algoId);
if (onSuccess != null) {
onSuccess.accept(algoId);
@@ -240,10 +238,9 @@
public void cancelAllAlgoOrders() {
executor.execute(() -> {
try {
- LinkedHashMap<String, Object> params = new LinkedHashMap<>();
- params.put("instId", instId);
- String resp = okxAccount.requestHandler.sendSignedRequest(
- okxAccount.baseUrl, "/api/v5/trade/cancel-algos", params, HttpMethod.POST, okxAccount.isSimluate());
+ String body = "[{\"instId\":\"" + instId + "\",\"instType\":\"SWAP\"}]";
+ String resp = okxAccount.requestHandler.sendSignedRequestRaw(
+ okxAccount.baseUrl, "/api/v5/trade/cancel-algos", body, HttpMethod.POST, okxAccount.isSimluate());
log.info("[OkxExec] 已尝试清除条件单, resp:{}", resp);
} catch (Exception e) {
log.error("[OkxExec] 清除条件单失败", e);
--
Gitblit v1.9.1