| | |
| | | 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(); |
| | |
| | | |
| | | try { |
| | | |
| | | String contract = "ETH_USDT"; |
| | | String contract = "BTC_USDT"; |
| | | String settle = "usdt"; |
| | | //保证金模式 isolated/cross |
| | | String marginMode = "cross"; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 设置杠杆倍数 |
| | | * 设置杠杆倍数(双向持仓模式专用) |
| | | * 设置合理的杠杆倍数,不能为0 |
| | | */ |
| | | String leverage = "25"; |
| | | futuresApi.updateContractPositionLeverageCall( |
| | | futuresApi.updateDualModePositionLeverageCall( |
| | | settle, |
| | | contract, |
| | | leverage, |
| | | marginMode, |
| | | position_mode, |
| | | 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(); |
| | | } |
| | | } |