[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
433 lines (334 loc) · 15.7 KB

FlashSwapApi.md

File metadata and controls

433 lines (334 loc) · 15.7 KB

FlashSwapApi

All URIs are relative to https://api.gateio.ws/api/v4

Method HTTP request Description
listFlashSwapCurrencies GET /flash_swap/currencies List All Supported Currencies In Flash Swap (deprecated)
listFlashSwapCurrencyPair GET /flash_swap/currency_pairs List All Supported Currency Pairs In Flash Swap
listFlashSwapOrders GET /flash_swap/orders List all flash swap orders
createFlashSwapOrder POST /flash_swap/orders Create a flash swap order
getFlashSwapOrder GET /flash_swap/orders/{order_id} Get a single flash swap order's detail
previewFlashSwapOrder POST /flash_swap/orders/preview Initiate a flash swap order preview

listFlashSwapCurrencies

List<FlashSwapCurrency> listFlashSwapCurrencies()

List All Supported Currencies In Flash Swap (deprecated)

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.models.*;
import io.gate.gateapi.api.FlashSwapApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.gateio.ws/api/v4");

        FlashSwapApi apiInstance = new FlashSwapApi(defaultClient);
        try {
            List<FlashSwapCurrency> result = apiInstance.listFlashSwapCurrencies();
            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 FlashSwapApi#listFlashSwapCurrencies");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

This endpoint does not need any parameter.

Return type

List<FlashSwapCurrency>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Successfully retrieved -

listFlashSwapCurrencyPair

List<FlashSwapCurrencyPair> listFlashSwapCurrencyPair().currency(currency).execute();

List All Supported Currency Pairs In Flash Swap

`BTC_GT` represents selling BTC and buying GT. The limits for each currency may vary across different currency pairs. It is not necessary that two currencies that can be swapped instantaneously can be exchanged with each other. For example, it is possible to sell BTC and buy GT, but it does not necessarily mean that GT can be sold to buy BTC.

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.models.*;
import io.gate.gateapi.api.FlashSwapApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.gateio.ws/api/v4");

        FlashSwapApi apiInstance = new FlashSwapApi(defaultClient);
        String currency = "BTC"; // String | Retrieve data of the specified currency
        try {
            List<FlashSwapCurrencyPair> result = apiInstance.listFlashSwapCurrencyPair()
                        .currency(currency)
                        .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 FlashSwapApi#listFlashSwapCurrencyPair");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
currency String Retrieve data of the specified currency [optional]

Return type

List<FlashSwapCurrencyPair>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Successfully retrieved -

listFlashSwapOrders

List<FlashSwapOrder> listFlashSwapOrders().status(status).sellCurrency(sellCurrency).buyCurrency(buyCurrency).reverse(reverse).limit(limit).page(page).execute();

List all flash swap orders

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.FlashSwapApi;

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

        FlashSwapApi apiInstance = new FlashSwapApi(defaultClient);
        Integer status = 1; // Integer | Flash swap order status  `1` - success `2` - failure
        String sellCurrency = "BTC"; // String | Currency to sell which can be retrieved from supported currency list API `GET /flash_swap/currencies`
        String buyCurrency = "BTC"; // String | Currency to buy which can be retrieved from supported currency list API `GET /flash_swap/currencies`
        Boolean reverse = true; // Boolean | If results are sorted by id in reverse order. Default to `true`  - `true`: sort by id in descending order(recent first) - `false`: sort by id in ascending order(oldest first)
        Integer limit = 100; // Integer | Maximum number of records to be returned in a single list
        Integer page = 1; // Integer | Page number
        try {
            List<FlashSwapOrder> result = apiInstance.listFlashSwapOrders()
                        .status(status)
                        .sellCurrency(sellCurrency)
                        .buyCurrency(buyCurrency)
                        .reverse(reverse)
                        .limit(limit)
                        .page(page)
                        .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 FlashSwapApi#listFlashSwapOrders");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
status Integer Flash swap order status `1` - success `2` - failure [optional]
sellCurrency String Currency to sell which can be retrieved from supported currency list API `GET /flash_swap/currencies` [optional]
buyCurrency String Currency to buy which can be retrieved from supported currency list API `GET /flash_swap/currencies` [optional]
reverse Boolean If results are sorted by id in reverse order. Default to `true` - `true`: sort by id in descending order(recent first) - `false`: sort by id in ascending order(oldest first) [optional]
limit Integer Maximum number of records to be returned in a single list [optional] [default to 100]
page Integer Page number [optional] [default to 1]

Return type

List<FlashSwapOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 List retrieved -

createFlashSwapOrder

FlashSwapOrder createFlashSwapOrder(flashSwapOrderRequest)

Create a flash swap order

Initiate a flash swap preview in advance because order creation requires a preview result

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.FlashSwapApi;

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

        FlashSwapApi apiInstance = new FlashSwapApi(defaultClient);
        FlashSwapOrderRequest flashSwapOrderRequest = new FlashSwapOrderRequest(); // FlashSwapOrderRequest | 
        try {
            FlashSwapOrder result = apiInstance.createFlashSwapOrder(flashSwapOrderRequest);
            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 FlashSwapApi#createFlashSwapOrder");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
flashSwapOrderRequest FlashSwapOrderRequest

Return type

FlashSwapOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
201 The flash swap order is created successfully -

getFlashSwapOrder

FlashSwapOrder getFlashSwapOrder(orderId)

Get a single flash swap order's detail

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.FlashSwapApi;

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

        FlashSwapApi apiInstance = new FlashSwapApi(defaultClient);
        Integer orderId = 1; // Integer | Flash swap order ID
        try {
            FlashSwapOrder result = apiInstance.getFlashSwapOrder(orderId);
            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 FlashSwapApi#getFlashSwapOrder");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
orderId Integer Flash swap order ID

Return type

FlashSwapOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Successfully retrieved -

previewFlashSwapOrder

FlashSwapOrderPreview previewFlashSwapOrder(flashSwapPreviewRequest)

Initiate a flash swap order preview

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.FlashSwapApi;

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

        FlashSwapApi apiInstance = new FlashSwapApi(defaultClient);
        FlashSwapPreviewRequest flashSwapPreviewRequest = new FlashSwapPreviewRequest(); // FlashSwapPreviewRequest | 
        try {
            FlashSwapOrderPreview result = apiInstance.previewFlashSwapOrder(flashSwapPreviewRequest);
            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 FlashSwapApi#previewFlashSwapOrder");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
flashSwapPreviewRequest FlashSwapPreviewRequest

Return type

FlashSwapOrderPreview

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 The flash swap order successfully previewed -