Skip to content

Latest commit

 

History

History
1533 lines (1051 loc) · 47.7 KB

OptionsApi.md

File metadata and controls

1533 lines (1051 loc) · 47.7 KB

GateApi\OptionsApi

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

Method HTTP request Description
listOptionsUnderlyings GET /options/underlyings List all underlyings
listOptionsExpirations GET /options/expirations List all expiration times
listOptionsContracts GET /options/contracts List all the contracts with specified underlying and expiration time
getOptionsContract GET /options/contracts/{contract} Query specified contract detail
listOptionsSettlements GET /options/settlements List settlement history
getOptionsSettlement GET /options/settlements/{contract} Get specified contract's settlement
listMyOptionsSettlements GET /options/my_settlements List my options settlements
listOptionsOrderBook GET /options/order_book Futures order book
listOptionsTickers GET /options/tickers List tickers of options contracts
listOptionsUnderlyingTickers GET /options/underlying/tickers/{underlying} Get underlying ticker
listOptionsCandlesticks GET /options/candlesticks Get futures candlesticks
listOptionsUnderlyingCandlesticks GET /options/underlying/candlesticks Mark price candlesticks of an underlying
listOptionsTrades GET /options/trades Options trade history
listOptionsAccount GET /options/accounts List options account
listOptionsAccountBook GET /options/account_book List account changing history
listOptionsPositions GET /options/positions List user's positions of specified underlying
getOptionsPosition GET /options/positions/{contract} Get specified contract position
listOptionsPositionClose GET /options/position_close List user's liquidation history of specified underlying
listOptionsOrders GET /options/orders List futures orders
createOptionsOrder POST /options/orders Create an options order
cancelOptionsOrders DELETE /options/orders Cancel all `open` orders matched
getOptionsOrder GET /options/orders/{order_id} Get a single order
cancelOptionsOrder DELETE /options/orders/{order_id} Cancel a single order
listMyOptionsTrades GET /options/my_trades List personal trading history

listOptionsUnderlyings

\GateApi\Model\OptionsUnderlying[] listOptionsUnderlyings()

List all underlyings

Example

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


$apiInstance = new GateApi\Api\OptionsApi(
    // 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->listOptionsUnderlyings();
    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 OptionsApi->listOptionsUnderlyings: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

This endpoint does not need any parameter.

Return type

\GateApi\Model\OptionsUnderlying[]

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]

listOptionsExpirations

int[] listOptionsExpirations($underlying)

List all expiration times

Example

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


$apiInstance = new GateApi\Api\OptionsApi(
    // 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()
);
$underlying = 'BTC_USDT'; // string | Underlying

try {
    $result = $apiInstance->listOptionsExpirations($underlying);
    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 OptionsApi->listOptionsExpirations: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
underlying string Underlying

Return type

int[]

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]

listOptionsContracts

\GateApi\Model\OptionsContract[] listOptionsContracts($underlying, $expiration)

List all the contracts with specified underlying and expiration time

Example

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


$apiInstance = new GateApi\Api\OptionsApi(
    // 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()
);
$associate_array['underlying'] = 'BTC_USDT'; // string | Underlying
$associate_array['expiration'] = 1636588800; // int | Unix timestamp of the expiration time

try {
    $result = $apiInstance->listOptionsContracts($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 OptionsApi->listOptionsContracts: ', $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
underlying string Underlying
expiration int Unix timestamp of the expiration time [optional]

Return type

\GateApi\Model\OptionsContract[]

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]

getOptionsContract

\GateApi\Model\OptionsContract getOptionsContract($contract)

Query specified contract detail

Example

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


$apiInstance = new GateApi\Api\OptionsApi(
    // 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()
);
$contract = 'BTC_USDT-20211130-65000-C'; // string | 

try {
    $result = $apiInstance->getOptionsContract($contract);
    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 OptionsApi->getOptionsContract: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
contract string

Return type

\GateApi\Model\OptionsContract

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]

listOptionsSettlements

\GateApi\Model\OptionsSettlement[] listOptionsSettlements($underlying, $limit, $offset, $from, $to)

List settlement history

Example

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


$apiInstance = new GateApi\Api\OptionsApi(
    // 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()
);
$associate_array['underlying'] = 'BTC_USDT'; // string | Underlying
$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list
$associate_array['offset'] = 0; // int | List offset, starting from 0
$associate_array['from'] = 1547706332; // int | Start timestamp
$associate_array['to'] = 1547706332; // int | End timestamp

try {
    $result = $apiInstance->listOptionsSettlements($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 OptionsApi->listOptionsSettlements: ', $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
underlying string Underlying
limit int Maximum number of records to be returned in a single list [optional] [default to 100]
offset int List offset, starting from 0 [optional] [default to 0]
from int Start timestamp [optional]
to int End timestamp [optional]

Return type

\GateApi\Model\OptionsSettlement[]

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]

getOptionsSettlement

\GateApi\Model\OptionsSettlement getOptionsSettlement($contract, $underlying, $at)

Get specified contract's settlement

Example

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


$apiInstance = new GateApi\Api\OptionsApi(
    // 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()
);
$contract = 'BTC_USDT-20211130-65000-C'; // string | 
$underlying = 'BTC_USDT'; // string | Underlying
$at = 56; // int | 

try {
    $result = $apiInstance->getOptionsSettlement($contract, $underlying, $at);
    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 OptionsApi->getOptionsSettlement: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
contract string
underlying string Underlying
at int

Return type

\GateApi\Model\OptionsSettlement

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]

listMyOptionsSettlements

\GateApi\Model\OptionsMySettlements[] listMyOptionsSettlements($underlying, $contract, $limit, $offset, $from, $to)

List my options settlements

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\OptionsApi(
    // 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['underlying'] = 'BTC_USDT'; // string | Underlying
$associate_array['contract'] = 'BTC_USDT-20210916-5000-C'; // string | Contract name
$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list
$associate_array['offset'] = 0; // int | List offset, starting from 0
$associate_array['from'] = 1547706332; // int | Start timestamp
$associate_array['to'] = 1547706332; // int | End timestamp

try {
    $result = $apiInstance->listMyOptionsSettlements($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 OptionsApi->listMyOptionsSettlements: ', $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
underlying string Underlying
contract string Contract name [optional]
limit int Maximum number of records to be returned in a single list [optional] [default to 100]
offset int List offset, starting from 0 [optional] [default to 0]
from int Start timestamp [optional]
to int End timestamp [optional]

Return type

\GateApi\Model\OptionsMySettlements[]

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]

listOptionsOrderBook

\GateApi\Model\FuturesOrderBook listOptionsOrderBook($contract, $interval, $limit, $with_id)

Futures order book

Bids will be sorted by price from high to low, while asks sorted reversely

Example

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


$apiInstance = new GateApi\Api\OptionsApi(
    // 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()
);
$associate_array['contract'] = 'BTC_USDT'; // string | Futures contract
$associate_array['interval'] = '0'; // string | Order depth. 0 means no aggregation is applied. default to 0
$associate_array['limit'] = 10; // int | Maximum number of order depth data in asks or bids
$associate_array['with_id'] = false; // bool | Whether the order book update ID will be returned. This ID increases by 1 on every order book update

try {
    $result = $apiInstance->listOptionsOrderBook($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 OptionsApi->listOptionsOrderBook: ', $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
contract string Futures contract
interval string Order depth. 0 means no aggregation is applied. default to 0 [optional] [default to '0']
limit int Maximum number of order depth data in asks or bids [optional] [default to 10]
with_id bool Whether the order book update ID will be returned. This ID increases by 1 on every order book update [optional] [default to false]

Return type

\GateApi\Model\FuturesOrderBook

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]

listOptionsTickers

\GateApi\Model\OptionsTicker[] listOptionsTickers($underlying)

List tickers of options contracts

Example

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


$apiInstance = new GateApi\Api\OptionsApi(
    // 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()
);
$underlying = 'BTC_USDT'; // string | Underlying

try {
    $result = $apiInstance->listOptionsTickers($underlying);
    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 OptionsApi->listOptionsTickers: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
underlying string Underlying

Return type

\GateApi\Model\OptionsTicker[]

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]

listOptionsUnderlyingTickers

\GateApi\Model\OptionsUnderlyingTicker listOptionsUnderlyingTickers($underlying)

Get underlying ticker

Example

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


$apiInstance = new GateApi\Api\OptionsApi(
    // 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()
);
$underlying = 'BTC_USDT'; // string | Underlying

try {
    $result = $apiInstance->listOptionsUnderlyingTickers($underlying);
    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 OptionsApi->listOptionsUnderlyingTickers: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
underlying string Underlying

Return type

\GateApi\Model\OptionsUnderlyingTicker

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]

listOptionsCandlesticks

\GateApi\Model\FuturesCandlestick[] listOptionsCandlesticks($contract, $limit, $from, $to, $interval)

Get futures candlesticks

Example

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


$apiInstance = new GateApi\Api\OptionsApi(
    // 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()
);
$associate_array['contract'] = 'BTC_USDT'; // string | Futures contract
$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list
$associate_array['from'] = 1547706332; // int | Start timestamp
$associate_array['to'] = 1547706332; // int | End timestamp
$associate_array['interval'] = '5m'; // string | Interval time between data points

try {
    $result = $apiInstance->listOptionsCandlesticks($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 OptionsApi->listOptionsCandlesticks: ', $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
contract string Futures contract
limit int Maximum number of records to be returned in a single list [optional] [default to 100]
from int Start timestamp [optional]
to int End timestamp [optional]
interval string Interval time between data points [optional] [default to '5m']

Return type

\GateApi\Model\FuturesCandlestick[]

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]

listOptionsUnderlyingCandlesticks

\GateApi\Model\FuturesCandlestick[] listOptionsUnderlyingCandlesticks($underlying, $limit, $from, $to, $interval)

Mark price candlesticks of an underlying

Example

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


$apiInstance = new GateApi\Api\OptionsApi(
    // 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()
);
$associate_array['underlying'] = 'BTC_USDT'; // string | Underlying
$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list
$associate_array['from'] = 1547706332; // int | Start timestamp
$associate_array['to'] = 1547706332; // int | End timestamp
$associate_array['interval'] = '5m'; // string | Interval time between data points

try {
    $result = $apiInstance->listOptionsUnderlyingCandlesticks($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 OptionsApi->listOptionsUnderlyingCandlesticks: ', $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
underlying string Underlying
limit int Maximum number of records to be returned in a single list [optional] [default to 100]
from int Start timestamp [optional]
to int End timestamp [optional]
interval string Interval time between data points [optional] [default to '5m']

Return type

\GateApi\Model\FuturesCandlestick[]

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]

listOptionsTrades

\GateApi\Model\FuturesTrade[] listOptionsTrades($contract, $type, $limit, $offset, $from, $to)

Options trade history

Example

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


$apiInstance = new GateApi\Api\OptionsApi(
    // 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()
);
$associate_array['contract'] = 'BTC_USDT-20210916-5000-C'; // string | Contract name
$associate_array['type'] = '1546935600'; // string | `C` is call, while `P` is put
$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list
$associate_array['offset'] = 0; // int | List offset, starting from 0
$associate_array['from'] = 1547706332; // int | Start timestamp
$associate_array['to'] = 1547706332; // int | End timestamp

try {
    $result = $apiInstance->listOptionsTrades($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 OptionsApi->listOptionsTrades: ', $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
contract string Contract name [optional]
type string `C` is call, while `P` is put [optional]
limit int Maximum number of records to be returned in a single list [optional] [default to 100]
offset int List offset, starting from 0 [optional] [default to 0]
from int Start timestamp [optional]
to int End timestamp [optional]

Return type

\GateApi\Model\FuturesTrade[]

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]

listOptionsAccount

\GateApi\Model\OptionsAccount listOptionsAccount()

List options account

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\OptionsApi(
    // 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
);

try {
    $result = $apiInstance->listOptionsAccount();
    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 OptionsApi->listOptionsAccount: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

This endpoint does not need any parameter.

Return type

\GateApi\Model\OptionsAccount

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]

listOptionsAccountBook

\GateApi\Model\OptionsAccountBook[] listOptionsAccountBook($limit, $offset, $from, $to, $type)

List account changing history

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\OptionsApi(
    // 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['limit'] = 100; // int | Maximum number of records to be returned in a single list
$associate_array['offset'] = 0; // int | List offset, starting from 0
$associate_array['from'] = 1547706332; // int | Start timestamp
$associate_array['to'] = 1547706332; // int | End timestamp
$associate_array['type'] = 'dnw'; // string | Changing Type: - dnw: Deposit & Withdraw - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: settlement PNL

try {
    $result = $apiInstance->listOptionsAccountBook($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 OptionsApi->listOptionsAccountBook: ', $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
limit int Maximum number of records to be returned in a single list [optional] [default to 100]
offset int List offset, starting from 0 [optional] [default to 0]
from int Start timestamp [optional]
to int End timestamp [optional]
type string Changing Type: - dnw: Deposit & Withdraw - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: settlement PNL [optional]

Return type

\GateApi\Model\OptionsAccountBook[]

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]

listOptionsPositions

\GateApi\Model\OptionsPosition[] listOptionsPositions($underlying)

List user's positions of specified underlying

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\OptionsApi(
    // 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['underlying'] = 'BTC_USDT'; // string | Underlying

try {
    $result = $apiInstance->listOptionsPositions($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 OptionsApi->listOptionsPositions: ', $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
underlying string Underlying [optional]

Return type

\GateApi\Model\OptionsPosition[]

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]

getOptionsPosition

\GateApi\Model\OptionsPosition getOptionsPosition($contract)

Get specified contract position

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\OptionsApi(
    // 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
);
$contract = 'BTC_USDT-20211130-65000-C'; // string | 

try {
    $result = $apiInstance->getOptionsPosition($contract);
    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 OptionsApi->getOptionsPosition: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
contract string

Return type

\GateApi\Model\OptionsPosition

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]

listOptionsPositionClose

\GateApi\Model\OptionsPositionClose[] listOptionsPositionClose($underlying, $contract)

List user's liquidation history of specified underlying

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\OptionsApi(
    // 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['underlying'] = 'BTC_USDT'; // string | Underlying
$associate_array['contract'] = 'BTC_USDT-20210916-5000-C'; // string | Contract name

try {
    $result = $apiInstance->listOptionsPositionClose($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 OptionsApi->listOptionsPositionClose: ', $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
underlying string Underlying
contract string Contract name [optional]

Return type

\GateApi\Model\OptionsPositionClose[]

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]

listOptionsOrders

\GateApi\Model\OptionsOrder[] listOptionsOrders($status, $contract, $underlying, $limit, $offset, $from, $to)

List futures 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\OptionsApi(
    // 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'] = 'open'; // string | Only list the orders with this status
$associate_array['contract'] = 'BTC_USDT-20210916-5000-C'; // string | Contract name
$associate_array['underlying'] = 'BTC_USDT'; // string | Underlying
$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list
$associate_array['offset'] = 0; // int | List offset, starting from 0
$associate_array['from'] = 1547706332; // int | Start timestamp
$associate_array['to'] = 1547706332; // int | End timestamp

try {
    $result = $apiInstance->listOptionsOrders($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 OptionsApi->listOptionsOrders: ', $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 string Only list the orders with this status
contract string Contract name [optional]
underlying string Underlying [optional]
limit int Maximum number of records to be returned in a single list [optional] [default to 100]
offset int List offset, starting from 0 [optional] [default to 0]
from int Start timestamp [optional]
to int End timestamp [optional]

Return type

\GateApi\Model\OptionsOrder[]

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]

createOptionsOrder

\GateApi\Model\OptionsOrder createOptionsOrder($options_order)

Create an options order

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\OptionsApi(
    // 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
);
$options_order = new \GateApi\Model\OptionsOrder(); // \GateApi\Model\OptionsOrder | 

try {
    $result = $apiInstance->createOptionsOrder($options_order);
    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 OptionsApi->createOptionsOrder: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
options_order \GateApi\Model\OptionsOrder

Return type

\GateApi\Model\OptionsOrder

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]

cancelOptionsOrders

\GateApi\Model\OptionsOrder[] cancelOptionsOrders($contract, $underlying, $side)

Cancel all open orders matched

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\OptionsApi(
    // 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
);
$contract = 'BTC_USDT-20210916-5000-C'; // string | Contract name
$underlying = 'BTC_USDT'; // string | Underlying
$side = 'ask'; // string | All bids or asks. Both included if not specified

try {
    $result = $apiInstance->cancelOptionsOrders($contract, $underlying, $side);
    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 OptionsApi->cancelOptionsOrders: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
contract string Contract name [optional]
underlying string Underlying [optional]
side string All bids or asks. Both included if not specified [optional]

Return type

\GateApi\Model\OptionsOrder[]

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]

getOptionsOrder

\GateApi\Model\OptionsOrder getOptionsOrder($order_id)

Get a single order

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\OptionsApi(
    // 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 = 12345; // int | Order ID returned on successful order creation

try {
    $result = $apiInstance->getOptionsOrder($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 OptionsApi->getOptionsOrder: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
order_id int Order ID returned on successful order creation

Return type

\GateApi\Model\OptionsOrder

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]

cancelOptionsOrder

\GateApi\Model\OptionsOrder cancelOptionsOrder($order_id)

Cancel a single order

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\OptionsApi(
    // 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 = 12345; // int | Order ID returned on successful order creation

try {
    $result = $apiInstance->cancelOptionsOrder($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 OptionsApi->cancelOptionsOrder: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
order_id int Order ID returned on successful order creation

Return type

\GateApi\Model\OptionsOrder

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]

listMyOptionsTrades

\GateApi\Model\OptionsMyTrade[] listMyOptionsTrades($underlying, $contract, $limit, $offset, $from, $to)

List personal trading history

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\OptionsApi(
    // 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['underlying'] = 'BTC_USDT'; // string | Underlying
$associate_array['contract'] = 'BTC_USDT-20210916-5000-C'; // string | Contract name
$associate_array['limit'] = 100; // int | Maximum number of records to be returned in a single list
$associate_array['offset'] = 0; // int | List offset, starting from 0
$associate_array['from'] = 1547706332; // int | Start timestamp
$associate_array['to'] = 1547706332; // int | End timestamp

try {
    $result = $apiInstance->listMyOptionsTrades($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 OptionsApi->listMyOptionsTrades: ', $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
underlying string Underlying
contract string Contract name [optional]
limit int Maximum number of records to be returned in a single list [optional] [default to 100]
offset int List offset, starting from 0 [optional] [default to 0]
from int Start timestamp [optional]
to int End timestamp [optional]

Return type

\GateApi\Model\OptionsMyTrade[]

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]