From 8bd17219604732859e0df2b5a2882a76f4915813 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Sat, 09 May 2026 17:54:25 +0800
Subject: [PATCH] refactor(gateApi): 优化 Gate API 调用和异常处理
---
src/main/java/com/xcong/excoin/modules/gateApi/Example.java | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/modules/gateApi/Example.java b/src/main/java/com/xcong/excoin/modules/gateApi/Example.java
index 30e7bad..5839cf6 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/Example.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/Example.java
@@ -10,6 +10,8 @@
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.AccountApi;
+import java.io.IOException;
+
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
@@ -21,7 +23,7 @@
try {
- String contract = "ETH_USDT";
+ String contract = "BTC_USDT";
String settle = "usdt";
//保证金模式 isolated/cross
String marginMode = "cross";
@@ -60,14 +62,12 @@
contract,
leverage,
marginMode,
- null);
+ null).execute();
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
- } catch (ApiException e) {
+ } catch (ApiException | IOException e) {
System.err.println("Exception when calling AccountApi#getAccountDetail");
- System.err.println("Status code: " + e.getCode());
- System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
--
Gitblit v1.9.1