Skip to content

Latest commit

 

History

History
462 lines (361 loc) · 16.6 KB

FlashSwapApi.md

File metadata and controls

462 lines (361 loc) · 16.6 KB

Io.Gate.GateApi.Api.FlashSwapApi

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

Method HTTP request Description
ListFlashSwapCurrencyPair GET /flash_swap/currency_pairs List All Supported Currency Pairs In Flash Swap
ListFlashSwapOrders GET /flash_swap/orders Query flash swap order list
CreateFlashSwapOrder POST /flash_swap/orders Create a flash swap order
GetFlashSwapOrder GET /flash_swap/orders/{order_id} Query single flash swap order
PreviewFlashSwapOrder POST /flash_swap/orders/preview Flash swap order preview
ListFlashSwapCurrencyPairV1 GET /flash-swap/v1/currency-pair List Flash Swap currency pairs

ListFlashSwapCurrencyPair

List<FlashSwapCurrencyPair> ListFlashSwapCurrencyPair (string currency = null, int? page = null, int? limit = null)

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

using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;

namespace Example
{
    public class ListFlashSwapCurrencyPairExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            var apiInstance = new FlashSwapApi(config);
            var currency = "BTC";  // string | Query by specified currency name (optional) 
            var page = 1;  // int? | Page number (optional)  (default to 1)
            var limit = 1000;  // int? | Maximum number of items returned. Default: 1000, minimum: 1, maximum: 1000 (optional)  (default to 1000)

            try
            {
                // List All Supported Currency Pairs In Flash Swap
                List<FlashSwapCurrencyPair> result = apiInstance.ListFlashSwapCurrencyPair(currency, page, limit);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FlashSwapApi.ListFlashSwapCurrencyPair: " + e.Message);
                Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
currency string Query by specified currency name [optional]
page int? Page number [optional] [default to 1]
limit int? Maximum number of items returned. Default: 1000, minimum: 1, maximum: 1000 [optional] [default to 1000]

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 Query successful -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListFlashSwapOrders

List<FlashSwapOrder> ListFlashSwapOrders (int? status = null, string sellCurrency = null, string buyCurrency = null, bool? reverse = null, int? limit = null, int? page = null)

Query flash swap order list

Example

using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;

namespace Example
{
    public class ListFlashSwapOrdersExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");

            var apiInstance = new FlashSwapApi(config);
            var status = 1;  // int? | Flash swap order status  `1` - success `2` - failed (optional) 
            var sellCurrency = "BTC";  // string | Asset name to sell - Retrieved from API `GET /flash_swap/currencies` for supported flash swap currencies (optional) 
            var buyCurrency = "BTC";  // string | Asset name to buy - Retrieved from API `GET /flash_swap/currencies` for supported flash swap currencies (optional) 
            var reverse = true;  // bool? | Sort by ID in ascending or descending order, default `true` - `true`: ID descending order (most recent data first) - `false`: ID ascending order (oldest data first) (optional) 
            var limit = 100;  // int? | Maximum number of records returned in a single list (optional)  (default to 100)
            var page = 1;  // int? | Page number (optional)  (default to 1)

            try
            {
                // Query flash swap order list
                List<FlashSwapOrder> result = apiInstance.ListFlashSwapOrders(status, sellCurrency, buyCurrency, reverse, limit, page);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FlashSwapApi.ListFlashSwapOrders: " + e.Message);
                Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
status int? Flash swap order status `1` - success `2` - failed [optional]
sellCurrency string Asset name to sell - Retrieved from API `GET /flash_swap/currencies` for supported flash swap currencies [optional]
buyCurrency string Asset name to buy - Retrieved from API `GET /flash_swap/currencies` for supported flash swap currencies [optional]
reverse bool? Sort by ID in ascending or descending order, default `true` - `true`: ID descending order (most recent data first) - `false`: ID ascending order (oldest data first) [optional]
limit int? Maximum number of records returned in a single list [optional] [default to 100]
page int? 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 successfully -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CreateFlashSwapOrder

FlashSwapOrder CreateFlashSwapOrder (FlashSwapOrderRequest flashSwapOrderRequest)

Create a flash swap order

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

Example

using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;

namespace Example
{
    public class CreateFlashSwapOrderExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");

            var apiInstance = new FlashSwapApi(config);
            var flashSwapOrderRequest = new FlashSwapOrderRequest(); // FlashSwapOrderRequest | 

            try
            {
                // Create a flash swap order
                FlashSwapOrder result = apiInstance.CreateFlashSwapOrder(flashSwapOrderRequest);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FlashSwapApi.CreateFlashSwapOrder: " + e.Message);
                Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

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 Flash swap order created successfully -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetFlashSwapOrder

FlashSwapOrder GetFlashSwapOrder (int orderId)

Query single flash swap order

Example

using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;

namespace Example
{
    public class GetFlashSwapOrderExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");

            var apiInstance = new FlashSwapApi(config);
            var orderId = 1;  // int | Flash swap order ID

            try
            {
                // Query single flash swap order
                FlashSwapOrder result = apiInstance.GetFlashSwapOrder(orderId);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FlashSwapApi.GetFlashSwapOrder: " + e.Message);
                Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
orderId int 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 Query successful -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PreviewFlashSwapOrder

FlashSwapOrderPreview PreviewFlashSwapOrder (FlashSwapPreviewRequest flashSwapPreviewRequest)

Flash swap order preview

Example

using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;

namespace Example
{
    public class PreviewFlashSwapOrderExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");

            var apiInstance = new FlashSwapApi(config);
            var flashSwapPreviewRequest = new FlashSwapPreviewRequest(); // FlashSwapPreviewRequest | 

            try
            {
                // Flash swap order preview
                FlashSwapOrderPreview result = apiInstance.PreviewFlashSwapOrder(flashSwapPreviewRequest);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FlashSwapApi.PreviewFlashSwapOrder: " + e.Message);
                Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

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 Flash swap order preview successful -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListFlashSwapCurrencyPairV1

FlashSwapV1CurrencyPairListResp ListFlashSwapCurrencyPairV1 (string assetName, int side, string xGateRegion = null)

List Flash Swap currency pairs

List available Flash Swap currency pairs and buy/sell amount limits for the specified currency and trading side

Example

using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;

namespace Example
{
    public class ListFlashSwapCurrencyPairV1Example
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            var apiInstance = new FlashSwapApi(config);
            var assetName = "BTC";  // string | Currency name
            var side = 1;  // int | Trading side - `1`: Sell - `2`: Buy
            var xGateRegion = "xGateRegion_example";  // string | User region (optional) 

            try
            {
                // List Flash Swap currency pairs
                FlashSwapV1CurrencyPairListResp result = apiInstance.ListFlashSwapCurrencyPairV1(assetName, side, xGateRegion);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FlashSwapApi.ListFlashSwapCurrencyPairV1: " + e.Message);
                Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
assetName string Currency name
side int Trading side - `1`: Sell - `2`: Buy
xGateRegion string User region [optional]

Return type

FlashSwapV1CurrencyPairListResp

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Successful response -
400 Invalid parameters -
404 Record does not exist -

[Back to top] [Back to API list] [Back to Model list] [Back to README]