Skip to content

Latest commit

 

History

History
281 lines (187 loc) · 9.74 KB

FlashSwapApi.md

File metadata and controls

281 lines (187 loc) · 9.74 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

Promise<{ response: http.IncomingMessage; body: Array; }> listFlashSwapCurrencies()

List All Supported Currencies In Flash Swap (deprecated)

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"

const api = new GateApi.FlashSwapApi(client);
api.listFlashSwapCurrencies()
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

This endpoint does not need any parameter.

Return type

Promise<{ response: AxiosResponse; body: Array; }> FlashSwapCurrency

Authorization

No authorization required

HTTP request headers

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

listFlashSwapCurrencyPair

Promise<{ response: http.IncomingMessage; body: Array; }> listFlashSwapCurrencyPair(opts)

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

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"

const api = new GateApi.FlashSwapApi(client);
const opts = {
  'currency': "BTC" // string | Retrieve data of the specified currency
};
api.listFlashSwapCurrencyPair(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
currency string Retrieve data of the specified currency [optional] [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: Array; }> FlashSwapCurrencyPair

Authorization

No authorization required

HTTP request headers

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

listFlashSwapOrders

Promise<{ response: http.IncomingMessage; body: Array; }> listFlashSwapOrders(opts)

List all flash swap orders

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.FlashSwapApi(client);
const opts = {
  'status': 1, // number | Flash swap order status  `1` - success `2` - failure
  'sellCurrency': "BTC", // string | Currency to sell which can be retrieved from supported currency list API `GET /flash_swap/currencies`
  'buyCurrency': "BTC", // string | Currency to buy which can be retrieved from supported currency list API `GET /flash_swap/currencies`
  '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)
  'limit': 100, // number | Maximum number of records to be returned in a single list
  'page': 1 // number | Page number
};
api.listFlashSwapOrders(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
status number Flash swap order status `1` - success `2` - failure [optional] [default to undefined]
sellCurrency string Currency to sell which can be retrieved from supported currency list API `GET /flash_swap/currencies` [optional] [default to undefined]
buyCurrency string Currency to buy which can be retrieved from supported currency list API `GET /flash_swap/currencies` [optional] [default to undefined]
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] [default to undefined]
limit number Maximum number of records to be returned in a single list [optional] [default to 100]
page number Page number [optional] [default to 1]

Return type

Promise<{ response: AxiosResponse; body: Array; }> FlashSwapOrder

Authorization

apiv4

HTTP request headers

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

createFlashSwapOrder

Promise<{ response: http.IncomingMessage; body: FlashSwapOrder; }> createFlashSwapOrder(flashSwapOrderRequest)

Create a flash swap order

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

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.FlashSwapApi(client);
const flashSwapOrderRequest = new FlashSwapOrderRequest(); // FlashSwapOrderRequest | 
api.createFlashSwapOrder(flashSwapOrderRequest)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
flashSwapOrderRequest FlashSwapOrderRequest

Return type

Promise<{ response: AxiosResponse; body: FlashSwapOrder; }> FlashSwapOrder

Authorization

apiv4

HTTP request headers

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

getFlashSwapOrder

Promise<{ response: http.IncomingMessage; body: FlashSwapOrder; }> getFlashSwapOrder(orderId)

Get a single flash swap order&#39;s detail

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.FlashSwapApi(client);
const orderId = 1; // number | Flash swap order ID
api.getFlashSwapOrder(orderId)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
orderId number Flash swap order ID [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: FlashSwapOrder; }> FlashSwapOrder

Authorization

apiv4

HTTP request headers

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

previewFlashSwapOrder

Promise<{ response: http.IncomingMessage; body: FlashSwapOrderPreview; }> previewFlashSwapOrder(flashSwapPreviewRequest)

Initiate a flash swap order preview

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.FlashSwapApi(client);
const flashSwapPreviewRequest = new FlashSwapPreviewRequest(); // FlashSwapPreviewRequest | 
api.previewFlashSwapOrder(flashSwapPreviewRequest)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
flashSwapPreviewRequest FlashSwapPreviewRequest

Return type

Promise<{ response: AxiosResponse; body: FlashSwapOrderPreview; }> FlashSwapOrderPreview

Authorization

apiv4

HTTP request headers

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