All URIs are relative to https://api.gateio.ws/api/v4
| Method | HTTP request | Description |
|---|---|---|
| getAIHubStrategyRecommend | GET /bot/strategy/recommend | Get AIHub strategy recommendations |
| postAIHubSpotGridCreate | POST /bot/spot-grid/create | Create spot grid |
| postAIHubMarginGridCreate | POST /bot/margin-grid/create | Create a lever grid |
| postAIHubInfiniteGridCreate | POST /bot/infinite-grid/create | Create infinite grid |
| postAIHubFuturesGridCreate | POST /bot/futures-grid/create | Create a contract grid |
| postAIHubSpotMartingaleCreate | POST /bot/spot-martingale/create | Create Spot Martin |
| postAIHubContractMartingaleCreate | POST /bot/contract-martingale/create | Create contract martin |
| getAIHubPortfolioRunning | GET /bot/portfolio/running | Query the list of running policies |
| getAIHubPortfolioDetail | GET /bot/portfolio/detail | Query order policy details |
| postAIHubPortfolioStop | POST /bot/portfolio/stop | Terminate a single running policy |
AIHubDiscoverSuccessResponse getAIHubStrategyRecommend().market(market).strategyType(strategyType).direction(direction).investAmount(investAmount).scene(scene).refreshRecommendationId(refreshRecommendationId).limit(limit).maxDrawdownLte(maxDrawdownLte).backtestAprGte(backtestAprGte).xGateServiceId(xGateServiceId).xGateAppLang(xGateAppLang).xRequestId(xRequestId).xTraceId(xTraceId).execute();
Get AIHub strategy recommendations
The only formal interface for the discover domain. Support scenarios: - `top1` - `bundle` - `filter` - `refresh` Constraints: - The active recommendation pool only contains `spot_grid`, `futures_grid`, `spot_martingale` - Can return but do not actively recommend `infinite_grid`, `margin_grid` - `contract_martingale`, `smart-position`, `spot-future-arbitrage` must not be returned - When `scene=filter` is used, only filtering by `market`, `backtest_apr_gte`, `max_drawdown_lte` is allowed - `scene=refresh` inherits the refresh context through `refresh_recommendation_id`; the official minimum format only requires `strategy_type|market` - If the upstream directly transmits the previous recommendation `recommendation_id`, the third paragraph `backtest_id` will currently be ignored.
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.BotApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
BotApiapiInstance = newBotApi(defaultClient);
Stringmarket = "market_example"; // String | Trading pair, such as `BTC_USDT`StringstrategyType = "strategyType_example"; // String | Recommended target policy type; `contract_martingale` not allowedStringdirection = "direction_example"; // String | Market directionStringinvestAmount = "investAmount_example"; // String | Investment amount, string transparent transmissionStringscene = "scene_example"; // String | Recommended scenario; when empty, bot-service can automatically infer according to the implementation logic.StringrefreshRecommendationId = "refreshRecommendationId_example"; // String | It is recommended to refresh the context. Used when `scene=refresh` is used; when `scene` is empty but the field exists, bot-service will also automatically determine as `refresh`. The official minimum format is `strategy_type|market`; if the `recommendation_id` of the previous recommendation is directly passed through, the third paragraph `backtest_id` will be ignored.Integerlimit = 56; // Integer | Return quantity; when `scene=filter` is used, the actual results are up to 10StringmaxDrawdownLte = "maxDrawdownLte_example"; // String | Maximum drawdown limitStringbacktestAprGte = "backtestAprGte_example"; // String | Backtest annualized lower limitStringxGateServiceId = "xGateServiceId_example"; // String | Call source identifier; injected by APIv4 if necessaryStringxGateAppLang = "xGateAppLang_example"; // String | Language context, such as `zh-CN` / `en-US`StringxRequestId = "xRequestId_example"; // String | Request link ID; caller can transmit transparentlyStringxTraceId = "xTraceId_example"; // String | trace header; can be generated uniformly by APIv4try {
AIHubDiscoverSuccessResponseresult = apiInstance.getAIHubStrategyRecommend()
.market(market)
.strategyType(strategyType)
.direction(direction)
.investAmount(investAmount)
.scene(scene)
.refreshRecommendationId(refreshRecommendationId)
.limit(limit)
.maxDrawdownLte(maxDrawdownLte)
.backtestAprGte(backtestAprGte)
.xGateServiceId(xGateServiceId)
.xGateAppLang(xGateAppLang)
.xRequestId(xRequestId)
.xTraceId(xTraceId)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling BotApi#getAIHubStrategyRecommend");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| market | String | Trading pair, such as `BTC_USDT` | [optional] |
| strategyType | String | Recommended target policy type; `contract_martingale` not allowed | [optional] [enum: spot_grid, margin_grid, infinite_grid, futures_grid, spot_martingale] |
| direction | String | Market direction | [optional] [enum: buy, sell, neutral] |
| investAmount | String | Investment amount, string transparent transmission | [optional] |
| scene | String | Recommended scenario; when empty, bot-service can automatically infer according to the implementation logic. | [optional] [enum: top1, bundle, filter, refresh] |
| refreshRecommendationId | String | It is recommended to refresh the context. Used when `scene=refresh` is used; when `scene` is empty but the field exists, bot-service will also automatically determine as `refresh`. The official minimum format is `strategy_type | market`; if the `recommendation_id` of the previous recommendation is directly passed through, the third paragraph `backtest_id` will be ignored. |
| limit | Integer | Return quantity; when `scene=filter` is used, the actual results are up to 10 | [optional] |
| maxDrawdownLte | String | Maximum drawdown limit | [optional] |
| backtestAprGte | String | Backtest annualized lower limit | [optional] |
| xGateServiceId | String | Call source identifier; injected by APIv4 if necessary | [optional] |
| xGateAppLang | String | Language context, such as `zh-CN` / `en-US` | [optional] |
| xRequestId | String | Request link ID; caller can transmit transparently | [optional] |
| xTraceId | String | trace header; can be generated uniformly by APIv4 | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Unified business response | - |
AIHubCreateSuccessResponse postAIHubSpotGridCreate(spotGridCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId)
Create spot grid
Create a spot grid strategy based on the incoming parameters.
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.BotApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
BotApiapiInstance = newBotApi(defaultClient);
SpotGridCreateRequestspotGridCreateRequest = newSpotGridCreateRequest(); // SpotGridCreateRequest | StringxGateServiceId = "xGateServiceId_example"; // String | Call source identifier; injected by APIv4 if necessaryStringxGateAppLang = "xGateAppLang_example"; // String | Language context, such as `zh-CN` / `en-US`StringxRequestId = "xRequestId_example"; // String | Request link ID; caller can transmit transparentlyStringxTraceId = "xTraceId_example"; // String | trace header; can be generated uniformly by APIv4try {
AIHubCreateSuccessResponseresult = apiInstance.postAIHubSpotGridCreate(spotGridCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling BotApi#postAIHubSpotGridCreate");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| spotGridCreateRequest | SpotGridCreateRequest | ||
| xGateServiceId | String | Call source identifier; injected by APIv4 if necessary | [optional] |
| xGateAppLang | String | Language context, such as `zh-CN` / `en-US` | [optional] |
| xRequestId | String | Request link ID; caller can transmit transparently | [optional] |
| xTraceId | String | trace header; can be generated uniformly by APIv4 | [optional] |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Unified business response | - |
AIHubCreateSuccessResponse postAIHubMarginGridCreate(marginGridCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId)
Create a lever grid
Create a leverage grid strategy based on the passed parameters.
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.BotApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
BotApiapiInstance = newBotApi(defaultClient);
MarginGridCreateRequestmarginGridCreateRequest = newMarginGridCreateRequest(); // MarginGridCreateRequest | StringxGateServiceId = "xGateServiceId_example"; // String | Call source identifier; injected by APIv4 if necessaryStringxGateAppLang = "xGateAppLang_example"; // String | Language context, such as `zh-CN` / `en-US`StringxRequestId = "xRequestId_example"; // String | Request link ID; caller can transmit transparentlyStringxTraceId = "xTraceId_example"; // String | trace header; can be generated uniformly by APIv4try {
AIHubCreateSuccessResponseresult = apiInstance.postAIHubMarginGridCreate(marginGridCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling BotApi#postAIHubMarginGridCreate");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| marginGridCreateRequest | MarginGridCreateRequest | ||
| xGateServiceId | String | Call source identifier; injected by APIv4 if necessary | [optional] |
| xGateAppLang | String | Language context, such as `zh-CN` / `en-US` | [optional] |
| xRequestId | String | Request link ID; caller can transmit transparently | [optional] |
| xTraceId | String | trace header; can be generated uniformly by APIv4 | [optional] |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Unified business response | - |
AIHubCreateSuccessResponse postAIHubInfiniteGridCreate(infiniteGridCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId)
Create infinite grid
Create an infinite grid strategy based on passed parameters.
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.BotApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
BotApiapiInstance = newBotApi(defaultClient);
InfiniteGridCreateRequestinfiniteGridCreateRequest = newInfiniteGridCreateRequest(); // InfiniteGridCreateRequest | StringxGateServiceId = "xGateServiceId_example"; // String | Call source identifier; injected by APIv4 if necessaryStringxGateAppLang = "xGateAppLang_example"; // String | Language context, such as `zh-CN` / `en-US`StringxRequestId = "xRequestId_example"; // String | Request link ID; caller can transmit transparentlyStringxTraceId = "xTraceId_example"; // String | trace header; can be generated uniformly by APIv4try {
AIHubCreateSuccessResponseresult = apiInstance.postAIHubInfiniteGridCreate(infiniteGridCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling BotApi#postAIHubInfiniteGridCreate");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| infiniteGridCreateRequest | InfiniteGridCreateRequest | ||
| xGateServiceId | String | Call source identifier; injected by APIv4 if necessary | [optional] |
| xGateAppLang | String | Language context, such as `zh-CN` / `en-US` | [optional] |
| xRequestId | String | Request link ID; caller can transmit transparently | [optional] |
| xTraceId | String | trace header; can be generated uniformly by APIv4 | [optional] |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Unified business response | - |
AIHubCreateSuccessResponse postAIHubFuturesGridCreate(futuresGridCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId)
Create a contract grid
Create a contract grid strategy based on the incoming parameters.
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.BotApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
BotApiapiInstance = newBotApi(defaultClient);
FuturesGridCreateRequestfuturesGridCreateRequest = newFuturesGridCreateRequest(); // FuturesGridCreateRequest | StringxGateServiceId = "xGateServiceId_example"; // String | Call source identifier; injected by APIv4 if necessaryStringxGateAppLang = "xGateAppLang_example"; // String | Language context, such as `zh-CN` / `en-US`StringxRequestId = "xRequestId_example"; // String | Request link ID; caller can transmit transparentlyStringxTraceId = "xTraceId_example"; // String | trace header; can be generated uniformly by APIv4try {
AIHubCreateSuccessResponseresult = apiInstance.postAIHubFuturesGridCreate(futuresGridCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling BotApi#postAIHubFuturesGridCreate");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| futuresGridCreateRequest | FuturesGridCreateRequest | ||
| xGateServiceId | String | Call source identifier; injected by APIv4 if necessary | [optional] |
| xGateAppLang | String | Language context, such as `zh-CN` / `en-US` | [optional] |
| xRequestId | String | Request link ID; caller can transmit transparently | [optional] |
| xTraceId | String | trace header; can be generated uniformly by APIv4 | [optional] |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Unified business response | - |
AIHubCreateSuccessResponse postAIHubSpotMartingaleCreate(spotMartingaleCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId)
Create Spot Martin
Create a spot martingale strategy from the given parameters. Stop-loss semantics match the app / `MartingaleBot`: - Use `create_params.stop_loss_per_cycle` (ratio per round as a decimal string) for creation-side stop-loss; do not use `stop_loss_price` for creation logic. - Stop-loss prices shown on detail pages are computed per round by the engine; creation accepts optional `create_params.trigger_price` (trigger price).
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.BotApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
BotApiapiInstance = newBotApi(defaultClient);
SpotMartingaleCreateRequestspotMartingaleCreateRequest = newSpotMartingaleCreateRequest(); // SpotMartingaleCreateRequest | StringxGateServiceId = "xGateServiceId_example"; // String | Call source identifier; injected by APIv4 if necessaryStringxGateAppLang = "xGateAppLang_example"; // String | Language context, such as `zh-CN` / `en-US`StringxRequestId = "xRequestId_example"; // String | Request link ID; caller can transmit transparentlyStringxTraceId = "xTraceId_example"; // String | trace header; can be generated uniformly by APIv4try {
AIHubCreateSuccessResponseresult = apiInstance.postAIHubSpotMartingaleCreate(spotMartingaleCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling BotApi#postAIHubSpotMartingaleCreate");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| spotMartingaleCreateRequest | SpotMartingaleCreateRequest | ||
| xGateServiceId | String | Call source identifier; injected by APIv4 if necessary | [optional] |
| xGateAppLang | String | Language context, such as `zh-CN` / `en-US` | [optional] |
| xRequestId | String | Request link ID; caller can transmit transparently | [optional] |
| xTraceId | String | trace header; can be generated uniformly by APIv4 | [optional] |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Unified business response | - |
AIHubCreateSuccessResponse postAIHubContractMartingaleCreate(contractMartingaleCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId)
Create contract martin
Create a contract Martin strategy based on the input parameters.
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.BotApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
BotApiapiInstance = newBotApi(defaultClient);
ContractMartingaleCreateRequestcontractMartingaleCreateRequest = newContractMartingaleCreateRequest(); // ContractMartingaleCreateRequest | StringxGateServiceId = "xGateServiceId_example"; // String | Call source identifier; injected by APIv4 if necessaryStringxGateAppLang = "xGateAppLang_example"; // String | Language context, such as `zh-CN` / `en-US`StringxRequestId = "xRequestId_example"; // String | Request link ID; caller can transmit transparentlyStringxTraceId = "xTraceId_example"; // String | trace header; can be generated uniformly by APIv4try {
AIHubCreateSuccessResponseresult = apiInstance.postAIHubContractMartingaleCreate(contractMartingaleCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling BotApi#postAIHubContractMartingaleCreate");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| contractMartingaleCreateRequest | ContractMartingaleCreateRequest | ||
| xGateServiceId | String | Call source identifier; injected by APIv4 if necessary | [optional] |
| xGateAppLang | String | Language context, such as `zh-CN` / `en-US` | [optional] |
| xRequestId | String | Request link ID; caller can transmit transparently | [optional] |
| xTraceId | String | trace header; can be generated uniformly by APIv4 | [optional] |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Unified business response | - |
AIHubPortfolioRunningSuccessResponse getAIHubPortfolioRunning().strategyType(strategyType).market(market).page(page).pageSize(pageSize).xGateServiceId(xGateServiceId).xGateAppLang(xGateAppLang).xRequestId(xRequestId).xTraceId(xTraceId).execute();
Query the list of running policies
Query the list of AIHub strategies currently running by the user, and support filtering by strategy type, trading pair and paging conditions.
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.BotApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
BotApiapiInstance = newBotApi(defaultClient);
StringstrategyType = "strategyType_example"; // String | Filter by policy typeStringmarket = "market_example"; // String | Filter by trading pairIntegerpage = 1; // Integer | Page number, default 1IntegerpageSize = 20; // Integer | Paging size, default 20, maximum 50StringxGateServiceId = "xGateServiceId_example"; // String | Call source identifier; injected by APIv4 if necessaryStringxGateAppLang = "xGateAppLang_example"; // String | Language context, such as `zh-CN` / `en-US`StringxRequestId = "xRequestId_example"; // String | Request link ID; caller can transmit transparentlyStringxTraceId = "xTraceId_example"; // String | trace header; can be generated uniformly by APIv4try {
AIHubPortfolioRunningSuccessResponseresult = apiInstance.getAIHubPortfolioRunning()
.strategyType(strategyType)
.market(market)
.page(page)
.pageSize(pageSize)
.xGateServiceId(xGateServiceId)
.xGateAppLang(xGateAppLang)
.xRequestId(xRequestId)
.xTraceId(xTraceId)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling BotApi#getAIHubPortfolioRunning");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| strategyType | String | Filter by policy type | [optional] [enum: spot_grid, margin_grid, infinite_grid, futures_grid, spot_martingale, contract_martingale] |
| market | String | Filter by trading pair | [optional] |
| page | Integer | Page number, default 1 | [optional] [default to 1] |
| pageSize | Integer | Paging size, default 20, maximum 50 | [optional] [default to 20] |
| xGateServiceId | String | Call source identifier; injected by APIv4 if necessary | [optional] |
| xGateAppLang | String | Language context, such as `zh-CN` / `en-US` | [optional] |
| xRequestId | String | Request link ID; caller can transmit transparently | [optional] |
| xTraceId | String | trace header; can be generated uniformly by APIv4 | [optional] |
AIHubPortfolioRunningSuccessResponse
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Unified business response | - |
AIHubPortfolioDetailSuccessResponse getAIHubPortfolioDetail(strategyId, strategyType).xGateServiceId(xGateServiceId).xGateAppLang(xGateAppLang).xRequestId(xRequestId).xTraceId(xTraceId).execute();
Query order policy details
Both `strategy_id` and `strategy_type` must be passed in the request, where `strategy_type` is used to distribute to the underlying detailed implementation by strategy type.
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.BotApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
BotApiapiInstance = newBotApi(defaultClient);
StringstrategyId = "strategyId_example"; // String | Policy IDStringstrategyType = "strategyType_example"; // String | Policy type; used for underlying detail distributionStringxGateServiceId = "xGateServiceId_example"; // String | Call source identifier; injected by APIv4 if necessaryStringxGateAppLang = "xGateAppLang_example"; // String | Language context, such as `zh-CN` / `en-US`StringxRequestId = "xRequestId_example"; // String | Request link ID; caller can transmit transparentlyStringxTraceId = "xTraceId_example"; // String | trace header; can be generated uniformly by APIv4try {
AIHubPortfolioDetailSuccessResponseresult = apiInstance.getAIHubPortfolioDetail(strategyId, strategyType)
.xGateServiceId(xGateServiceId)
.xGateAppLang(xGateAppLang)
.xRequestId(xRequestId)
.xTraceId(xTraceId)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling BotApi#getAIHubPortfolioDetail");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| strategyId | String | Policy ID | |
| strategyType | String | Policy type; used for underlying detail distribution | [enum: spot_grid, margin_grid, infinite_grid, futures_grid, spot_martingale, contract_martingale] |
| xGateServiceId | String | Call source identifier; injected by APIv4 if necessary | [optional] |
| xGateAppLang | String | Language context, such as `zh-CN` / `en-US` | [optional] |
| xRequestId | String | Request link ID; caller can transmit transparently | [optional] |
| xTraceId | String | trace header; can be generated uniformly by APIv4 | [optional] |
AIHubPortfolioDetailSuccessResponse
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Unified business response | - |
AIHubPortfolioStopSuccessResponse postAIHubPortfolioStop(aiHubPortfolioStopRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId)
Terminate a single running policy
Only one policy is allowed to be terminated per request. Risk warning and secondary confirmation are borne by the upper layer of OpenClaw; this interface is only responsible for executing stop.
// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.BotApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
BotApiapiInstance = newBotApi(defaultClient);
AIHubPortfolioStopRequestaiHubPortfolioStopRequest = newAIHubPortfolioStopRequest(); // AIHubPortfolioStopRequest | StringxGateServiceId = "xGateServiceId_example"; // String | Call source identifier; injected by APIv4 if necessaryStringxGateAppLang = "xGateAppLang_example"; // String | Language context, such as `zh-CN` / `en-US`StringxRequestId = "xRequestId_example"; // String | Request link ID; caller can transmit transparentlyStringxTraceId = "xTraceId_example"; // String | trace header; can be generated uniformly by APIv4try {
AIHubPortfolioStopSuccessResponseresult = apiInstance.postAIHubPortfolioStop(aiHubPortfolioStopRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling BotApi#postAIHubPortfolioStop");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| aiHubPortfolioStopRequest | AIHubPortfolioStopRequest | ||
| xGateServiceId | String | Call source identifier; injected by APIv4 if necessary | [optional] |
| xGateAppLang | String | Language context, such as `zh-CN` / `en-US` | [optional] |
| xRequestId | String | Request link ID; caller can transmit transparently | [optional] |
| xTraceId | String | trace header; can be generated uniformly by APIv4 | [optional] |
AIHubPortfolioStopSuccessResponse
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Unified business response | - |