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 |
\GateApi\Model\OptionsUnderlying[] listOptionsUnderlyings()
List all underlyings
<?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;
}
?>
This endpoint does not need any parameter.
\GateApi\Model\OptionsUnderlying[]
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
int[] listOptionsExpirations($underlying)
List all expiration times
<?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;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
underlying | string | Underlying |
int[]
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\OptionsContract[] listOptionsContracts($underlying, $expiration)
List all the contracts with specified underlying and expiration time
<?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;
}
?>
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] |
\GateApi\Model\OptionsContract[]
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\OptionsContract getOptionsContract($contract)
Query specified contract detail
<?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;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
contract | string |
\GateApi\Model\OptionsContract
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\OptionsSettlement[] listOptionsSettlements($underlying, $limit, $offset, $from, $to)
List settlement history
<?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;
}
?>
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] |
\GateApi\Model\OptionsSettlement[]
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\OptionsSettlement getOptionsSettlement($contract, $underlying, $at)
Get specified contract's settlement
<?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;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
contract | string | ||
underlying | string | Underlying | |
at | int |
\GateApi\Model\OptionsSettlement
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\OptionsMySettlements[] listMyOptionsSettlements($underlying, $contract, $limit, $offset, $from, $to)
List my options settlements
<?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;
}
?>
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] |
\GateApi\Model\OptionsMySettlements[]
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\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
<?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;
}
?>
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] |
\GateApi\Model\FuturesOrderBook
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\OptionsTicker[] listOptionsTickers($underlying)
List tickers of options contracts
<?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;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
underlying | string | Underlying |
\GateApi\Model\OptionsTicker[]
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\OptionsUnderlyingTicker listOptionsUnderlyingTickers($underlying)
Get underlying ticker
<?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;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
underlying | string | Underlying |
\GateApi\Model\OptionsUnderlyingTicker
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\FuturesCandlestick[] listOptionsCandlesticks($contract, $limit, $from, $to, $interval)
Get futures candlesticks
<?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;
}
?>
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'] |
\GateApi\Model\FuturesCandlestick[]
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\FuturesCandlestick[] listOptionsUnderlyingCandlesticks($underlying, $limit, $from, $to, $interval)
Mark price candlesticks of an underlying
<?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;
}
?>
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'] |
\GateApi\Model\FuturesCandlestick[]
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\FuturesTrade[] listOptionsTrades($contract, $type, $limit, $offset, $from, $to)
Options trade history
<?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;
}
?>
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] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\OptionsAccount listOptionsAccount()
List options account
<?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;
}
?>
This endpoint does not need any parameter.
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\OptionsAccountBook[] listOptionsAccountBook($limit, $offset, $from, $to, $type)
List account changing history
<?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;
}
?>
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] |
\GateApi\Model\OptionsAccountBook[]
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\OptionsPosition[] listOptionsPositions($underlying)
List user's positions of specified underlying
<?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;
}
?>
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] |
\GateApi\Model\OptionsPosition[]
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\OptionsPosition getOptionsPosition($contract)
Get specified contract position
<?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;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
contract | string |
\GateApi\Model\OptionsPosition
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\OptionsPositionClose[] listOptionsPositionClose($underlying, $contract)
List user's liquidation history of specified underlying
<?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;
}
?>
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] |
\GateApi\Model\OptionsPositionClose[]
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\OptionsOrder[] listOptionsOrders($status, $contract, $underlying, $limit, $offset, $from, $to)
List futures orders
<?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;
}
?>
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] |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\OptionsOrder createOptionsOrder($options_order)
Create an options order
<?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;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
options_order | \GateApi\Model\OptionsOrder |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\OptionsOrder[] cancelOptionsOrders($contract, $underlying, $side)
Cancel all open
orders matched
<?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;
}
?>
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] |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\OptionsOrder getOptionsOrder($order_id)
Get a single order
<?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;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
order_id | int | Order ID returned on successful order creation |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\OptionsOrder cancelOptionsOrder($order_id)
Cancel a single order
<?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;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
order_id | int | Order ID returned on successful order creation |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\OptionsMyTrade[] listMyOptionsTrades($underlying, $contract, $limit, $offset, $from, $to)
List personal trading history
<?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;
}
?>
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] |
\GateApi\Model\OptionsMyTrade[]
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]