Skip to content

Latest commit

 

History

History
318 lines (215 loc) · 10.5 KB

FlashSwapApi.md

File metadata and controls

318 lines (215 loc) · 10.5 KB

GateApi\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
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

\GateApi\Model\FlashSwapCurrency[] listFlashSwapCurrencies()

List all supported currencies in flash swap

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


$apiInstance = new GateApi\Api\FlashSwapApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);

try {
    $result = $apiInstance->listFlashSwapCurrencies();
    print_r($result);
} catch (GateApi\GateApiException $e) {
    echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL;
} catch (Exception $e) {
    echo 'Exception when calling FlashSwapApi->listFlashSwapCurrencies: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

This endpoint does not need any parameter.

Return type

\GateApi\Model\FlashSwapCurrency[]

Authorization

No authorization required

HTTP request headers

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

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

listFlashSwapOrders

\GateApi\Model\FlashSwapOrder[] listFlashSwapOrders($status, $sell_currency, $buy_currency, $reverse, $limit, $page)

List all flash swap orders

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure Gate APIv4 authorization: apiv4
$config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET');


$apiInstance = new GateApi\Api\FlashSwapApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$associate_array['status'] = 1; // int | Flash swap order status  `1` - success `2` - failure
$associate_array['sell_currency'] = 'BTC'; // string | Currency to sell which can be retrieved from supported currency list API `GET /flash_swap/currencies`
$associate_array['buy_currency'] = 'BTC'; // string | Currency to buy which can be retrieved from supported currency list API `GET /flash_swap/currencies`
$associate_array['reverse'] = true; // bool | 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)
$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list
$associate_array['page'] = 1; // int | Page number

try {
    $result = $apiInstance->listFlashSwapOrders($associate_array);
    print_r($result);
} catch (GateApi\GateApiException $e) {
    echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL;
} catch (Exception $e) {
    echo 'Exception when calling FlashSwapApi->listFlashSwapOrders: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Note: the input parameter is an associative array with the keys listed as the parameter name below.

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

Return type

\GateApi\Model\FlashSwapOrder[]

Authorization

apiv4

HTTP request headers

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

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

createFlashSwapOrder

\GateApi\Model\FlashSwapOrder createFlashSwapOrder($flash_swap_order_request)

Create a flash swap order

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

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure Gate APIv4 authorization: apiv4
$config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET');


$apiInstance = new GateApi\Api\FlashSwapApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$flash_swap_order_request = new \GateApi\Model\FlashSwapOrderRequest(); // \GateApi\Model\FlashSwapOrderRequest | 

try {
    $result = $apiInstance->createFlashSwapOrder($flash_swap_order_request);
    print_r($result);
} catch (GateApi\GateApiException $e) {
    echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL;
} catch (Exception $e) {
    echo 'Exception when calling FlashSwapApi->createFlashSwapOrder: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
flash_swap_order_request \GateApi\Model\FlashSwapOrderRequest

Return type

\GateApi\Model\FlashSwapOrder

Authorization

apiv4

HTTP request headers

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

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

getFlashSwapOrder

\GateApi\Model\FlashSwapOrder getFlashSwapOrder($order_id)

Get a single flash swap order's detail

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure Gate APIv4 authorization: apiv4
$config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET');


$apiInstance = new GateApi\Api\FlashSwapApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$order_id = 1; // int | Flash swap order ID

try {
    $result = $apiInstance->getFlashSwapOrder($order_id);
    print_r($result);
} catch (GateApi\GateApiException $e) {
    echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL;
} catch (Exception $e) {
    echo 'Exception when calling FlashSwapApi->getFlashSwapOrder: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
order_id int Flash swap order ID

Return type

\GateApi\Model\FlashSwapOrder

Authorization

apiv4

HTTP request headers

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

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

previewFlashSwapOrder

\GateApi\Model\FlashSwapOrderPreview previewFlashSwapOrder($flash_swap_order_request)

Initiate a flash swap order preview

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure Gate APIv4 authorization: apiv4
$config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET');


$apiInstance = new GateApi\Api\FlashSwapApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$flash_swap_order_request = new \GateApi\Model\FlashSwapOrderRequest(); // \GateApi\Model\FlashSwapOrderRequest | 

try {
    $result = $apiInstance->previewFlashSwapOrder($flash_swap_order_request);
    print_r($result);
} catch (GateApi\GateApiException $e) {
    echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL;
} catch (Exception $e) {
    echo 'Exception when calling FlashSwapApi->previewFlashSwapOrder: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
flash_swap_order_request \GateApi\Model\FlashSwapOrderRequest

Return type

\GateApi\Model\FlashSwapOrderPreview

Authorization

apiv4

HTTP request headers

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

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