| | |
| | | } |
| | | 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); |
| | |
| | | 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); |