Skip to content

Latest commit

 

History

History
850 lines (676 loc) · 39.7 KB

File metadata and controls

850 lines (676 loc) · 39.7 KB

BotApi

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

getAIHubStrategyRecommend

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

discover 域唯一正式接口。 支持场景: - `top1` - `bundle` - `filter` - `refresh` 约束: - 主动推荐池仅包含 `spot_grid`、`futures_grid`、`spot_martingale` - 可返回但不主动推荐 `infinite_grid`、`margin_grid` - 不得返回 `contract_martingale`、`smart-position`、`spot-future-arbitrage` - `scene=filter` 时只允许按 `market`、`backtest_apr_gte`、`max_drawdown_lte` 过滤 - `scene=refresh` 通过 `refresh_recommendation_id` 承接刷新上下文;正式最小格式只要求 `strategy_type|market` - 若上游直接透传上一条推荐的 `recommendation_id`,其中第三段 `backtest_id` 当前会被忽略

Example

// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.BotApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.gateio.ws/api/v4");
        
        // Configure APIv4 authorization: apiv4
        defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

        BotApi apiInstance = new BotApi(defaultClient);
        String market = "market_example"; // String | Trading pair, such as `BTC_USDT`
        String strategyType = "strategyType_example"; // String | Recommended target policy type; `contract_martingale` not allowed
        String direction = "direction_example"; // String | Market direction
        String investAmount = "investAmount_example"; // String | Investment amount, string transparent transmission
        String scene = "scene_example"; // String | Recommended scenario; when empty, bot-service can automatically infer according to the implementation logic.
        String refreshRecommendationId = "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.
        Integer limit = 56; // Integer | Return quantity; when `scene=filter` is used, the actual results are up to 10
        String maxDrawdownLte = "maxDrawdownLte_example"; // String | Maximum drawdown limit
        String backtestAprGte = "backtestAprGte_example"; // String | Backtest annualized lower limit
        String xGateServiceId = "xGateServiceId_example"; // String | Call source identifier; injected by APIv4 if necessary
        String xGateAppLang = "xGateAppLang_example"; // String | Language context, such as `zh-CN` / `en-US`
        String xRequestId = "xRequestId_example"; // String | Request link ID; caller can transmit transparently
        String xTraceId = "xTraceId_example"; // String | trace header; can be generated uniformly by APIv4
        try {
            AIHubDiscoverSuccessResponse result = 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 (GateApiException e) {
            System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
            e.printStackTrace();
        } catch (ApiException e) {
            System.err.println("Exception when calling BotApi#getAIHubStrategyRecommend");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

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]

Return type

AIHubDiscoverSuccessResponse

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Unified business response -

postAIHubSpotGridCreate

AIHubCreateSuccessResponse postAIHubSpotGridCreate(spotGridCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId)

Create spot grid

Create a spot grid strategy based on the incoming parameters.

Example

// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.BotApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.gateio.ws/api/v4");
        
        // Configure APIv4 authorization: apiv4
        defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

        BotApi apiInstance = new BotApi(defaultClient);
        SpotGridCreateRequest spotGridCreateRequest = new SpotGridCreateRequest(); // SpotGridCreateRequest | 
        String xGateServiceId = "xGateServiceId_example"; // String | Call source identifier; injected by APIv4 if necessary
        String xGateAppLang = "xGateAppLang_example"; // String | Language context, such as `zh-CN` / `en-US`
        String xRequestId = "xRequestId_example"; // String | Request link ID; caller can transmit transparently
        String xTraceId = "xTraceId_example"; // String | trace header; can be generated uniformly by APIv4
        try {
            AIHubCreateSuccessResponse result = apiInstance.postAIHubSpotGridCreate(spotGridCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId);
            System.out.println(result);
        } catch (GateApiException e) {
            System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
            e.printStackTrace();
        } catch (ApiException e) {
            System.err.println("Exception when calling BotApi#postAIHubSpotGridCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

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]

Return type

AIHubCreateSuccessResponse

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Unified business response -

postAIHubMarginGridCreate

AIHubCreateSuccessResponse postAIHubMarginGridCreate(marginGridCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId)

Create a lever grid

Create a leverage grid strategy based on the passed parameters.

Example

// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.BotApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.gateio.ws/api/v4");
        
        // Configure APIv4 authorization: apiv4
        defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

        BotApi apiInstance = new BotApi(defaultClient);
        MarginGridCreateRequest marginGridCreateRequest = new MarginGridCreateRequest(); // MarginGridCreateRequest | 
        String xGateServiceId = "xGateServiceId_example"; // String | Call source identifier; injected by APIv4 if necessary
        String xGateAppLang = "xGateAppLang_example"; // String | Language context, such as `zh-CN` / `en-US`
        String xRequestId = "xRequestId_example"; // String | Request link ID; caller can transmit transparently
        String xTraceId = "xTraceId_example"; // String | trace header; can be generated uniformly by APIv4
        try {
            AIHubCreateSuccessResponse result = apiInstance.postAIHubMarginGridCreate(marginGridCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId);
            System.out.println(result);
        } catch (GateApiException e) {
            System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
            e.printStackTrace();
        } catch (ApiException e) {
            System.err.println("Exception when calling BotApi#postAIHubMarginGridCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

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]

Return type

AIHubCreateSuccessResponse

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Unified business response -

postAIHubInfiniteGridCreate

AIHubCreateSuccessResponse postAIHubInfiniteGridCreate(infiniteGridCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId)

Create infinite grid

Create an infinite grid strategy based on passed parameters.

Example

// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.BotApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.gateio.ws/api/v4");
        
        // Configure APIv4 authorization: apiv4
        defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

        BotApi apiInstance = new BotApi(defaultClient);
        InfiniteGridCreateRequest infiniteGridCreateRequest = new InfiniteGridCreateRequest(); // InfiniteGridCreateRequest | 
        String xGateServiceId = "xGateServiceId_example"; // String | Call source identifier; injected by APIv4 if necessary
        String xGateAppLang = "xGateAppLang_example"; // String | Language context, such as `zh-CN` / `en-US`
        String xRequestId = "xRequestId_example"; // String | Request link ID; caller can transmit transparently
        String xTraceId = "xTraceId_example"; // String | trace header; can be generated uniformly by APIv4
        try {
            AIHubCreateSuccessResponse result = apiInstance.postAIHubInfiniteGridCreate(infiniteGridCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId);
            System.out.println(result);
        } catch (GateApiException e) {
            System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
            e.printStackTrace();
        } catch (ApiException e) {
            System.err.println("Exception when calling BotApi#postAIHubInfiniteGridCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

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]

Return type

AIHubCreateSuccessResponse

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Unified business response -

postAIHubFuturesGridCreate

AIHubCreateSuccessResponse postAIHubFuturesGridCreate(futuresGridCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId)

Create a contract grid

Create a contract grid strategy based on the incoming parameters.

Example

// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.BotApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.gateio.ws/api/v4");
        
        // Configure APIv4 authorization: apiv4
        defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

        BotApi apiInstance = new BotApi(defaultClient);
        FuturesGridCreateRequest futuresGridCreateRequest = new FuturesGridCreateRequest(); // FuturesGridCreateRequest | 
        String xGateServiceId = "xGateServiceId_example"; // String | Call source identifier; injected by APIv4 if necessary
        String xGateAppLang = "xGateAppLang_example"; // String | Language context, such as `zh-CN` / `en-US`
        String xRequestId = "xRequestId_example"; // String | Request link ID; caller can transmit transparently
        String xTraceId = "xTraceId_example"; // String | trace header; can be generated uniformly by APIv4
        try {
            AIHubCreateSuccessResponse result = apiInstance.postAIHubFuturesGridCreate(futuresGridCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId);
            System.out.println(result);
        } catch (GateApiException e) {
            System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
            e.printStackTrace();
        } catch (ApiException e) {
            System.err.println("Exception when calling BotApi#postAIHubFuturesGridCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

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]

Return type

AIHubCreateSuccessResponse

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Unified business response -

postAIHubSpotMartingaleCreate

AIHubCreateSuccessResponse postAIHubSpotMartingaleCreate(spotMartingaleCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId)

Create Spot Martin

Create a spot Martin strategy based on the passed parameters.

Example

// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.BotApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.gateio.ws/api/v4");
        
        // Configure APIv4 authorization: apiv4
        defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

        BotApi apiInstance = new BotApi(defaultClient);
        SpotMartingaleCreateRequest spotMartingaleCreateRequest = new SpotMartingaleCreateRequest(); // SpotMartingaleCreateRequest | 
        String xGateServiceId = "xGateServiceId_example"; // String | Call source identifier; injected by APIv4 if necessary
        String xGateAppLang = "xGateAppLang_example"; // String | Language context, such as `zh-CN` / `en-US`
        String xRequestId = "xRequestId_example"; // String | Request link ID; caller can transmit transparently
        String xTraceId = "xTraceId_example"; // String | trace header; can be generated uniformly by APIv4
        try {
            AIHubCreateSuccessResponse result = apiInstance.postAIHubSpotMartingaleCreate(spotMartingaleCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId);
            System.out.println(result);
        } catch (GateApiException e) {
            System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
            e.printStackTrace();
        } catch (ApiException e) {
            System.err.println("Exception when calling BotApi#postAIHubSpotMartingaleCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

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]

Return type

AIHubCreateSuccessResponse

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Unified business response -

postAIHubContractMartingaleCreate

AIHubCreateSuccessResponse postAIHubContractMartingaleCreate(contractMartingaleCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId)

Create contract martin

Create a contract Martin strategy based on the input parameters.

Example

// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.BotApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.gateio.ws/api/v4");
        
        // Configure APIv4 authorization: apiv4
        defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

        BotApi apiInstance = new BotApi(defaultClient);
        ContractMartingaleCreateRequest contractMartingaleCreateRequest = new ContractMartingaleCreateRequest(); // ContractMartingaleCreateRequest | 
        String xGateServiceId = "xGateServiceId_example"; // String | Call source identifier; injected by APIv4 if necessary
        String xGateAppLang = "xGateAppLang_example"; // String | Language context, such as `zh-CN` / `en-US`
        String xRequestId = "xRequestId_example"; // String | Request link ID; caller can transmit transparently
        String xTraceId = "xTraceId_example"; // String | trace header; can be generated uniformly by APIv4
        try {
            AIHubCreateSuccessResponse result = apiInstance.postAIHubContractMartingaleCreate(contractMartingaleCreateRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId);
            System.out.println(result);
        } catch (GateApiException e) {
            System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
            e.printStackTrace();
        } catch (ApiException e) {
            System.err.println("Exception when calling BotApi#postAIHubContractMartingaleCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

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]

Return type

AIHubCreateSuccessResponse

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Unified business response -

getAIHubPortfolioRunning

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.

Example

// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.BotApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.gateio.ws/api/v4");
        
        // Configure APIv4 authorization: apiv4
        defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

        BotApi apiInstance = new BotApi(defaultClient);
        String strategyType = "strategyType_example"; // String | Filter by policy type
        String market = "market_example"; // String | Filter by trading pair
        Integer page = 1; // Integer | Page number, default 1
        Integer pageSize = 20; // Integer | Paging size, default 20, maximum 50
        String xGateServiceId = "xGateServiceId_example"; // String | Call source identifier; injected by APIv4 if necessary
        String xGateAppLang = "xGateAppLang_example"; // String | Language context, such as `zh-CN` / `en-US`
        String xRequestId = "xRequestId_example"; // String | Request link ID; caller can transmit transparently
        String xTraceId = "xTraceId_example"; // String | trace header; can be generated uniformly by APIv4
        try {
            AIHubPortfolioRunningSuccessResponse result = apiInstance.getAIHubPortfolioRunning()
                        .strategyType(strategyType)
                        .market(market)
                        .page(page)
                        .pageSize(pageSize)
                        .xGateServiceId(xGateServiceId)
                        .xGateAppLang(xGateAppLang)
                        .xRequestId(xRequestId)
                        .xTraceId(xTraceId)
                        .execute();
            System.out.println(result);
        } catch (GateApiException e) {
            System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
            e.printStackTrace();
        } catch (ApiException e) {
            System.err.println("Exception when calling BotApi#getAIHubPortfolioRunning");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

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]

Return type

AIHubPortfolioRunningSuccessResponse

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Unified business response -

getAIHubPortfolioDetail

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.

Example

// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.BotApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.gateio.ws/api/v4");
        
        // Configure APIv4 authorization: apiv4
        defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

        BotApi apiInstance = new BotApi(defaultClient);
        String strategyId = "strategyId_example"; // String | Policy ID
        String strategyType = "strategyType_example"; // String | Policy type; used for underlying detail distribution
        String xGateServiceId = "xGateServiceId_example"; // String | Call source identifier; injected by APIv4 if necessary
        String xGateAppLang = "xGateAppLang_example"; // String | Language context, such as `zh-CN` / `en-US`
        String xRequestId = "xRequestId_example"; // String | Request link ID; caller can transmit transparently
        String xTraceId = "xTraceId_example"; // String | trace header; can be generated uniformly by APIv4
        try {
            AIHubPortfolioDetailSuccessResponse result = apiInstance.getAIHubPortfolioDetail(strategyId, strategyType)
                        .xGateServiceId(xGateServiceId)
                        .xGateAppLang(xGateAppLang)
                        .xRequestId(xRequestId)
                        .xTraceId(xTraceId)
                        .execute();
            System.out.println(result);
        } catch (GateApiException e) {
            System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
            e.printStackTrace();
        } catch (ApiException e) {
            System.err.println("Exception when calling BotApi#getAIHubPortfolioDetail");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

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]

Return type

AIHubPortfolioDetailSuccessResponse

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Unified business response -

postAIHubPortfolioStop

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.

Example

// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.BotApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.gateio.ws/api/v4");
        
        // Configure APIv4 authorization: apiv4
        defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

        BotApi apiInstance = new BotApi(defaultClient);
        AIHubPortfolioStopRequest aiHubPortfolioStopRequest = new AIHubPortfolioStopRequest(); // AIHubPortfolioStopRequest | 
        String xGateServiceId = "xGateServiceId_example"; // String | Call source identifier; injected by APIv4 if necessary
        String xGateAppLang = "xGateAppLang_example"; // String | Language context, such as `zh-CN` / `en-US`
        String xRequestId = "xRequestId_example"; // String | Request link ID; caller can transmit transparently
        String xTraceId = "xTraceId_example"; // String | trace header; can be generated uniformly by APIv4
        try {
            AIHubPortfolioStopSuccessResponse result = apiInstance.postAIHubPortfolioStop(aiHubPortfolioStopRequest, xGateServiceId, xGateAppLang, xRequestId, xTraceId);
            System.out.println(result);
        } catch (GateApiException e) {
            System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
            e.printStackTrace();
        } catch (ApiException e) {
            System.err.println("Exception when calling BotApi#postAIHubPortfolioStop");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

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]

Return type

AIHubPortfolioStopSuccessResponse

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Unified business response -