Skip to content

Latest commit

History

History
1966 lines (1479 loc) · 74 KB

File metadata and controls

1966 lines (1479 loc) · 74 KB

gate_api.OptionsApi

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

MethodHTTP requestDescription
list_options_underlyingsGET /options/underlyingsList all underlying assets
list_options_expirationsGET /options/expirationsList all expiration dates
list_options_contractsGET /options/contractsList all contracts for specified underlying and expiration date
get_options_contractGET /options/contracts/{contract}Query specified contract details
list_options_settlementsGET /options/settlementsList settlement history
get_options_settlementGET /options/settlements/{contract}Get specified contract settlement information
list_my_options_settlementsGET /options/my_settlementsQuery personal settlement records
list_options_order_bookGET /options/order_bookQuery options contract order book
list_options_tickersGET /options/tickersQuery options market ticker information
list_options_underlying_tickersGET /options/underlying/tickers/{underlying}Query underlying ticker information
list_options_candlesticksGET /options/candlesticksOptions contract market candlestick chart
list_options_underlying_candlesticksGET /options/underlying/candlesticksUnderlying index price candlestick chart
list_options_tradesGET /options/tradesMarket trade records
list_options_accountGET /options/accountsQuery account information
list_options_account_bookGET /options/account_bookQuery account change history
list_options_positionsGET /options/positionsList user's positions of specified underlying
get_options_positionGET /options/positions/{contract}Get specified contract position
list_options_position_closeGET /options/position_closeList user's liquidation history of specified underlying
list_options_ordersGET /options/ordersList options orders
create_options_orderPOST /options/ordersCreate an options order
cancel_options_ordersDELETE /options/ordersCancel all orders with 'open' status
get_options_orderGET /options/orders/{order_id}Query single order details
amend_options_orderPUT /options/orders/{order_id}Option Order Modification
cancel_options_orderDELETE /options/orders/{order_id}Cancel single order
countdown_cancel_all_optionsPOST /options/countdown_cancel_allCountdown cancel orders
list_my_options_tradesGET /options/my_tradesQuery personal trading records
get_options_mmpGET /options/mmpMMP Query.
set_options_mmpPOST /options/mmpMMP Settings
reset_options_mmpPOST /options/mmp/resetMMP Reset

list_options_underlyings

list[OptionsUnderlying] list_options_underlyings()

List all underlying assets

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
try:
# List all underlying assetsapi_response=api_instance.list_options_underlyings()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlyings: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

list[OptionsUnderlying]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_expirations

list[int] list_options_expirations(underlying)

List all expiration dates

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)try:
# List all expiration datesapi_response=api_instance.list_options_expirations(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_expirations: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)

Return type

list[int]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List expiration dates for specified underlying-

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

list_options_contracts

list[OptionsContract] list_options_contracts(underlying, expiration=expiration)

List all contracts for specified underlying and expiration date

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)expiration=1636588800# int | Unix timestamp of expiration date (optional)try:
# List all contracts for specified underlying and expiration dateapi_response=api_instance.list_options_contracts(underlying, expiration=expiration)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_contracts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
expirationintUnix timestamp of expiration date[optional]

Return type

list[OptionsContract]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_contract

OptionsContract get_options_contract(contract)

Query specified contract details

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | try:
# Query specified contract detailsapi_response=api_instance.get_options_contract(contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_contract: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr

Return type

OptionsContract

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_settlements

list[OptionsSettlement] list_options_settlements(underlying, limit=limit, offset=offset, _from=_from, to=to)

List settlement history

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# List settlement historyapi_response=api_instance.list_options_settlements(underlying, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsSettlement]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_settlement

OptionsSettlement get_options_settlement(contract, underlying, at)

Get specified contract settlement information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)at=56# int | try:
# Get specified contract settlement informationapi_response=api_instance.get_options_settlement(contract, underlying, at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_settlement: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr
underlyingstrUnderlying (Obtained by listing underlying endpoint)
atint

Return type

OptionsSettlement

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_my_options_settlements

list[OptionsMySettlements] list_my_options_settlements(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)

Query personal settlement records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Query personal settlement recordsapi_response=api_instance.list_my_options_settlements(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_my_options_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsMySettlements]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_order_book

OptionsOrderBook list_options_order_book(contract, interval=interval, limit=limit, with_id=with_id)

Query options contract order book

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

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract nameinterval='0'# str | Price precision for merged depth. 0 means no merging. If not specified, defaults to 0 (optional) (default to '0')limit=10# int | Number of depth levels (optional) (default to 10)with_id=False# bool | Whether to return depth update ID. This ID increments by 1 each time the depth changes (optional) (default to False)try:
# Query options contract order bookapi_response=api_instance.list_options_order_book(contract, interval=interval, limit=limit, with_id=with_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_order_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name
intervalstrPrice precision for merged depth. 0 means no merging. If not specified, defaults to 0[optional] [default to '0']
limitintNumber of depth levels[optional] [default to 10]
with_idboolWhether to return depth update ID. This ID increments by 1 each time the depth changes[optional] [default to False]

Return type

OptionsOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

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

list_options_tickers

list[OptionsTicker] list_options_tickers(underlying)

Query options market ticker information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)try:
# Query options market ticker informationapi_response=api_instance.list_options_tickers(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)

Return type

list[OptionsTicker]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_underlying_tickers

OptionsUnderlyingTicker list_options_underlying_tickers(underlying)

Query underlying ticker information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlyingtry:
# Query underlying ticker informationapi_response=api_instance.list_options_underlying_tickers(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlying_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying

Return type

OptionsUnderlyingTicker

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_candlesticks

list[OptionsCandlestick] list_options_candlesticks(contract, limit=limit, _from=_from, to=to, interval=interval)

Options contract market candlestick chart

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract namelimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)interval='5m'# str | Time interval between data points (optional) (default to '5m')try:
# Options contract market candlestick chartapi_response=api_instance.list_options_candlesticks(contract, limit=limit, _from=_from, to=to, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
intervalstrTime interval between data points[optional] [default to '5m']

Return type

list[OptionsCandlestick]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_underlying_candlesticks

list[OptionsCandlestick] list_options_underlying_candlesticks(underlying, limit=limit, _from=_from, to=to, interval=interval)

Underlying index price candlestick chart

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)interval='5m'# str | Time interval between data points (optional) (default to '5m')try:
# Underlying index price candlestick chartapi_response=api_instance.list_options_underlying_candlesticks(underlying, limit=limit, _from=_from, to=to, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlying_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
intervalstrTime interval between data points[optional] [default to '5m']

Return type

list[OptionsCandlestick]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_trades

list[OptionsTrade] list_options_trades(contract=contract, type=type, limit=limit, offset=offset, _from=_from, to=to)

Market trade records

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)type='1546935600'# str | `C` for call, `P` for put (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Market trade recordsapi_response=api_instance.list_options_trades(contract=contract, type=type, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name[optional]
typestr`C` for call, `P` for put[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsTrade]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_account

OptionsAccount list_options_account()

Query account information

Query account information for classic option account and unified account

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
try:
# Query account informationapi_response=api_instance.list_options_account()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_account: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

OptionsAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_account_book

list[OptionsAccountBook] list_options_account_book(limit=limit, offset=offset, _from=_from, to=to, type=type)

Query account change history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)type='dnw'# str | Change types: - dnw: Deposit & Withdrawal - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: Settlement P&L (optional)try:
# Query account change historyapi_response=api_instance.list_options_account_book(limit=limit, offset=offset, _from=_from, to=to, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_account_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typestrChange types: - dnw: Deposit & Withdrawal - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: Settlement P&L[optional]

Return type

list[OptionsAccountBook]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_positions

list[OptionsPosition] list_options_positions(underlying=underlying)

List user's positions of specified underlying

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (optional)try:
# List user's positions of specified underlyingapi_response=api_instance.list_options_positions(underlying=underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_positions: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying[optional]

Return type

list[OptionsPosition]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_position

OptionsPosition get_options_position(contract)

Get specified contract position

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | try:
# Get specified contract positionapi_response=api_instance.get_options_position(contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_position: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr

Return type

OptionsPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_position_close

list[OptionsPositionClose] list_options_position_close(underlying, contract=contract)

List user's liquidation history of specified underlying

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)try:
# List user's liquidation history of specified underlyingapi_response=api_instance.list_options_position_close(underlying, contract=contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_position_close: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]

Return type

list[OptionsPositionClose]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_orders

list[OptionsOrder] list_options_orders(status, contract=contract, underlying=underlying, limit=limit, offset=offset, _from=_from, to=to)

List options orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
status='open'# str | Query order list based on statuscontract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)underlying='BTC_USDT'# str | Underlying (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# List options ordersapi_response=api_instance.list_options_orders(status, contract=contract, underlying=underlying, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
statusstrQuery order list based on status
contractstrOptions contract name[optional]
underlyingstrUnderlying[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

create_options_order

OptionsOrder create_options_order(options_order)

Create an options order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_order=gate_api.OptionsOrder() # OptionsOrder | try:
# Create an options orderapi_response=api_instance.create_options_order(options_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->create_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_orderOptionsOrder

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order detail-

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

cancel_options_orders

list[OptionsOrder] cancel_options_orders(contract=contract, underlying=underlying, side=side)

Cancel all orders with 'open' status

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)underlying='BTC_USDT'# str | Underlying (optional)side='ask'# str | Specify all bids or all asks, both included if not specified (optional)try:
# Cancel all orders with 'open' statusapi_response=api_instance.cancel_options_orders(contract=contract, underlying=underlying, side=side)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->cancel_options_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name[optional]
underlyingstrUnderlying[optional]
sidestrSpecify all bids or all asks, both included if not specified[optional]

Return type

list[OptionsOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

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

get_options_order

OptionsOrder get_options_order(order_id)

Query single order details

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdtry:
# Query single order detailsapi_response=api_instance.get_options_order(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

amend_options_order

OptionsOrder amend_options_order(order_id, amend_options_order_request)

Option Order Modification

Modify the order price and/or quantity of a specified order; only orders with status 'open' are supported

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdamend_options_order_request=gate_api.AmendOptionsOrderRequest() # AmendOptionsOrderRequest | try:
# Option Order Modificationapi_response=api_instance.amend_options_order(order_id, amend_options_order_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->amend_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created
amend_options_order_requestAmendOptionsOrderRequest

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

cancel_options_order

OptionsOrder cancel_options_order(order_id)

Cancel single order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdtry:
# Cancel single orderapi_response=api_instance.cancel_options_order(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->cancel_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

countdown_cancel_all_options

TriggerTime countdown_cancel_all_options(countdown_cancel_all_options_task)

Countdown cancel orders

Option order heartbeat detection, when the timeout time set by the user is reached, if the existing countdown is not canceled or a new countdown is set, the related option pending order will be automatically canceled. This interface can be called repeatedly to set a new countdown or cancel the countdown. Usage example: Repeat this interface at intervals of 30 seconds, with each countdown timeout set to 30 (seconds). If this interface is not called again within 30 seconds, all pending orders on the underlyingcontract you specified will be automatically cancelled. If underlyingcontract is not specified, user will be automatically cancelled If timeout is set to 0 within 30 seconds, the countdown timer will expire and the automatic order cancellation function will be cancelled.

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
countdown_cancel_all_options_task=gate_api.CountdownCancelAllOptionsTask() # CountdownCancelAllOptionsTask | try:
# Countdown cancel ordersapi_response=api_instance.countdown_cancel_all_options(countdown_cancel_all_options_task)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->countdown_cancel_all_options: %s\n"%e)

Parameters

NameTypeDescriptionNotes
countdown_cancel_all_options_taskCountdownCancelAllOptionsTask

Return type

TriggerTime

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Countdown set successfully-

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

list_my_options_trades

list[OptionsMyTrade] list_my_options_trades(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)

Query personal trading records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Query personal trading recordsapi_response=api_instance.list_my_options_trades(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_my_options_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsMyTrade]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_mmp

list[OptionsMMP] get_options_mmp(underlying=underlying)

MMP Query.

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (optional)try:
# MMP Query.api_response=api_instance.get_options_mmp(underlying=underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying[optional]

Return type

list[OptionsMMP]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

set_options_mmp

OptionsMMP set_options_mmp(options_mmp)

MMP Settings

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_mmp=gate_api.OptionsMMP() # OptionsMMP | try:
# MMP Settingsapi_response=api_instance.set_options_mmp(options_mmp)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->set_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_mmpOptionsMMP

Return type

OptionsMMP

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200MMP Information-

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

reset_options_mmp

OptionsMMP reset_options_mmp(options_mmp_reset)

MMP Reset

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_mmp_reset=gate_api.OptionsMMPReset() # OptionsMMPReset | try:
# MMP Resetapi_response=api_instance.reset_options_mmp(options_mmp_reset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->reset_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_mmp_resetOptionsMMPReset

Return type

OptionsMMP

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200MMP Information-

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

, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
gateapi-python/docs/OptionsApi.md at master · gate/gateapi-python · GitHub
Skip to content

Latest commit

History

History
1966 lines (1479 loc) · 74 KB

File metadata and controls

1966 lines (1479 loc) · 74 KB

gate_api.OptionsApi

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

MethodHTTP requestDescription
list_options_underlyingsGET /options/underlyingsList all underlying assets
list_options_expirationsGET /options/expirationsList all expiration dates
list_options_contractsGET /options/contractsList all contracts for specified underlying and expiration date
get_options_contractGET /options/contracts/{contract}Query specified contract details
list_options_settlementsGET /options/settlementsList settlement history
get_options_settlementGET /options/settlements/{contract}Get specified contract settlement information
list_my_options_settlementsGET /options/my_settlementsQuery personal settlement records
list_options_order_bookGET /options/order_bookQuery options contract order book
list_options_tickersGET /options/tickersQuery options market ticker information
list_options_underlying_tickersGET /options/underlying/tickers/{underlying}Query underlying ticker information
list_options_candlesticksGET /options/candlesticksOptions contract market candlestick chart
list_options_underlying_candlesticksGET /options/underlying/candlesticksUnderlying index price candlestick chart
list_options_tradesGET /options/tradesMarket trade records
list_options_accountGET /options/accountsQuery account information
list_options_account_bookGET /options/account_bookQuery account change history
list_options_positionsGET /options/positionsList user's positions of specified underlying
get_options_positionGET /options/positions/{contract}Get specified contract position
list_options_position_closeGET /options/position_closeList user's liquidation history of specified underlying
list_options_ordersGET /options/ordersList options orders
create_options_orderPOST /options/ordersCreate an options order
cancel_options_ordersDELETE /options/ordersCancel all orders with 'open' status
get_options_orderGET /options/orders/{order_id}Query single order details
amend_options_orderPUT /options/orders/{order_id}Option Order Modification
cancel_options_orderDELETE /options/orders/{order_id}Cancel single order
countdown_cancel_all_optionsPOST /options/countdown_cancel_allCountdown cancel orders
list_my_options_tradesGET /options/my_tradesQuery personal trading records
get_options_mmpGET /options/mmpMMP Query.
set_options_mmpPOST /options/mmpMMP Settings
reset_options_mmpPOST /options/mmp/resetMMP Reset

list_options_underlyings

list[OptionsUnderlying] list_options_underlyings()

List all underlying assets

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
try:
# List all underlying assetsapi_response=api_instance.list_options_underlyings()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlyings: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

list[OptionsUnderlying]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_expirations

list[int] list_options_expirations(underlying)

List all expiration dates

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)try:
# List all expiration datesapi_response=api_instance.list_options_expirations(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_expirations: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)

Return type

list[int]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List expiration dates for specified underlying-

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

list_options_contracts

list[OptionsContract] list_options_contracts(underlying, expiration=expiration)

List all contracts for specified underlying and expiration date

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)expiration=1636588800# int | Unix timestamp of expiration date (optional)try:
# List all contracts for specified underlying and expiration dateapi_response=api_instance.list_options_contracts(underlying, expiration=expiration)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_contracts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
expirationintUnix timestamp of expiration date[optional]

Return type

list[OptionsContract]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_contract

OptionsContract get_options_contract(contract)

Query specified contract details

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | try:
# Query specified contract detailsapi_response=api_instance.get_options_contract(contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_contract: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr

Return type

OptionsContract

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_settlements

list[OptionsSettlement] list_options_settlements(underlying, limit=limit, offset=offset, _from=_from, to=to)

List settlement history

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# List settlement historyapi_response=api_instance.list_options_settlements(underlying, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsSettlement]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_settlement

OptionsSettlement get_options_settlement(contract, underlying, at)

Get specified contract settlement information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)at=56# int | try:
# Get specified contract settlement informationapi_response=api_instance.get_options_settlement(contract, underlying, at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_settlement: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr
underlyingstrUnderlying (Obtained by listing underlying endpoint)
atint

Return type

OptionsSettlement

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_my_options_settlements

list[OptionsMySettlements] list_my_options_settlements(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)

Query personal settlement records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Query personal settlement recordsapi_response=api_instance.list_my_options_settlements(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_my_options_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsMySettlements]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_order_book

OptionsOrderBook list_options_order_book(contract, interval=interval, limit=limit, with_id=with_id)

Query options contract order book

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

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract nameinterval='0'# str | Price precision for merged depth. 0 means no merging. If not specified, defaults to 0 (optional) (default to '0')limit=10# int | Number of depth levels (optional) (default to 10)with_id=False# bool | Whether to return depth update ID. This ID increments by 1 each time the depth changes (optional) (default to False)try:
# Query options contract order bookapi_response=api_instance.list_options_order_book(contract, interval=interval, limit=limit, with_id=with_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_order_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name
intervalstrPrice precision for merged depth. 0 means no merging. If not specified, defaults to 0[optional] [default to '0']
limitintNumber of depth levels[optional] [default to 10]
with_idboolWhether to return depth update ID. This ID increments by 1 each time the depth changes[optional] [default to False]

Return type

OptionsOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

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

list_options_tickers

list[OptionsTicker] list_options_tickers(underlying)

Query options market ticker information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)try:
# Query options market ticker informationapi_response=api_instance.list_options_tickers(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)

Return type

list[OptionsTicker]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_underlying_tickers

OptionsUnderlyingTicker list_options_underlying_tickers(underlying)

Query underlying ticker information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlyingtry:
# Query underlying ticker informationapi_response=api_instance.list_options_underlying_tickers(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlying_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying

Return type

OptionsUnderlyingTicker

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_candlesticks

list[OptionsCandlestick] list_options_candlesticks(contract, limit=limit, _from=_from, to=to, interval=interval)

Options contract market candlestick chart

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract namelimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)interval='5m'# str | Time interval between data points (optional) (default to '5m')try:
# Options contract market candlestick chartapi_response=api_instance.list_options_candlesticks(contract, limit=limit, _from=_from, to=to, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
intervalstrTime interval between data points[optional] [default to '5m']

Return type

list[OptionsCandlestick]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_underlying_candlesticks

list[OptionsCandlestick] list_options_underlying_candlesticks(underlying, limit=limit, _from=_from, to=to, interval=interval)

Underlying index price candlestick chart

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)interval='5m'# str | Time interval between data points (optional) (default to '5m')try:
# Underlying index price candlestick chartapi_response=api_instance.list_options_underlying_candlesticks(underlying, limit=limit, _from=_from, to=to, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlying_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
intervalstrTime interval between data points[optional] [default to '5m']

Return type

list[OptionsCandlestick]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_trades

list[OptionsTrade] list_options_trades(contract=contract, type=type, limit=limit, offset=offset, _from=_from, to=to)

Market trade records

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)type='1546935600'# str | `C` for call, `P` for put (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Market trade recordsapi_response=api_instance.list_options_trades(contract=contract, type=type, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name[optional]
typestr`C` for call, `P` for put[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsTrade]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_account

OptionsAccount list_options_account()

Query account information

Query account information for classic option account and unified account

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
try:
# Query account informationapi_response=api_instance.list_options_account()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_account: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

OptionsAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_account_book

list[OptionsAccountBook] list_options_account_book(limit=limit, offset=offset, _from=_from, to=to, type=type)

Query account change history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)type='dnw'# str | Change types: - dnw: Deposit & Withdrawal - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: Settlement P&L (optional)try:
# Query account change historyapi_response=api_instance.list_options_account_book(limit=limit, offset=offset, _from=_from, to=to, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_account_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typestrChange types: - dnw: Deposit & Withdrawal - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: Settlement P&L[optional]

Return type

list[OptionsAccountBook]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_positions

list[OptionsPosition] list_options_positions(underlying=underlying)

List user's positions of specified underlying

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (optional)try:
# List user's positions of specified underlyingapi_response=api_instance.list_options_positions(underlying=underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_positions: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying[optional]

Return type

list[OptionsPosition]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_position

OptionsPosition get_options_position(contract)

Get specified contract position

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | try:
# Get specified contract positionapi_response=api_instance.get_options_position(contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_position: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr

Return type

OptionsPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_position_close

list[OptionsPositionClose] list_options_position_close(underlying, contract=contract)

List user's liquidation history of specified underlying

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)try:
# List user's liquidation history of specified underlyingapi_response=api_instance.list_options_position_close(underlying, contract=contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_position_close: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]

Return type

list[OptionsPositionClose]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_orders

list[OptionsOrder] list_options_orders(status, contract=contract, underlying=underlying, limit=limit, offset=offset, _from=_from, to=to)

List options orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
status='open'# str | Query order list based on statuscontract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)underlying='BTC_USDT'# str | Underlying (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# List options ordersapi_response=api_instance.list_options_orders(status, contract=contract, underlying=underlying, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
statusstrQuery order list based on status
contractstrOptions contract name[optional]
underlyingstrUnderlying[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

create_options_order

OptionsOrder create_options_order(options_order)

Create an options order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_order=gate_api.OptionsOrder() # OptionsOrder | try:
# Create an options orderapi_response=api_instance.create_options_order(options_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->create_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_orderOptionsOrder

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order detail-

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

cancel_options_orders

list[OptionsOrder] cancel_options_orders(contract=contract, underlying=underlying, side=side)

Cancel all orders with 'open' status

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)underlying='BTC_USDT'# str | Underlying (optional)side='ask'# str | Specify all bids or all asks, both included if not specified (optional)try:
# Cancel all orders with 'open' statusapi_response=api_instance.cancel_options_orders(contract=contract, underlying=underlying, side=side)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->cancel_options_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name[optional]
underlyingstrUnderlying[optional]
sidestrSpecify all bids or all asks, both included if not specified[optional]

Return type

list[OptionsOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

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

get_options_order

OptionsOrder get_options_order(order_id)

Query single order details

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdtry:
# Query single order detailsapi_response=api_instance.get_options_order(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

amend_options_order

OptionsOrder amend_options_order(order_id, amend_options_order_request)

Option Order Modification

Modify the order price and/or quantity of a specified order; only orders with status 'open' are supported

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdamend_options_order_request=gate_api.AmendOptionsOrderRequest() # AmendOptionsOrderRequest | try:
# Option Order Modificationapi_response=api_instance.amend_options_order(order_id, amend_options_order_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->amend_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created
amend_options_order_requestAmendOptionsOrderRequest

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

cancel_options_order

OptionsOrder cancel_options_order(order_id)

Cancel single order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdtry:
# Cancel single orderapi_response=api_instance.cancel_options_order(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->cancel_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

countdown_cancel_all_options

TriggerTime countdown_cancel_all_options(countdown_cancel_all_options_task)

Countdown cancel orders

Option order heartbeat detection, when the timeout time set by the user is reached, if the existing countdown is not canceled or a new countdown is set, the related option pending order will be automatically canceled. This interface can be called repeatedly to set a new countdown or cancel the countdown. Usage example: Repeat this interface at intervals of 30 seconds, with each countdown timeout set to 30 (seconds). If this interface is not called again within 30 seconds, all pending orders on the underlyingcontract you specified will be automatically cancelled. If underlyingcontract is not specified, user will be automatically cancelled If timeout is set to 0 within 30 seconds, the countdown timer will expire and the automatic order cancellation function will be cancelled.

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
countdown_cancel_all_options_task=gate_api.CountdownCancelAllOptionsTask() # CountdownCancelAllOptionsTask | try:
# Countdown cancel ordersapi_response=api_instance.countdown_cancel_all_options(countdown_cancel_all_options_task)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->countdown_cancel_all_options: %s\n"%e)

Parameters

NameTypeDescriptionNotes
countdown_cancel_all_options_taskCountdownCancelAllOptionsTask

Return type

TriggerTime

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Countdown set successfully-

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

list_my_options_trades

list[OptionsMyTrade] list_my_options_trades(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)

Query personal trading records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Query personal trading recordsapi_response=api_instance.list_my_options_trades(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_my_options_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsMyTrade]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_mmp

list[OptionsMMP] get_options_mmp(underlying=underlying)

MMP Query.

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (optional)try:
# MMP Query.api_response=api_instance.get_options_mmp(underlying=underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying[optional]

Return type

list[OptionsMMP]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

set_options_mmp

OptionsMMP set_options_mmp(options_mmp)

MMP Settings

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_mmp=gate_api.OptionsMMP() # OptionsMMP | try:
# MMP Settingsapi_response=api_instance.set_options_mmp(options_mmp)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->set_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_mmpOptionsMMP

Return type

OptionsMMP

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200MMP Information-

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

reset_options_mmp

OptionsMMP reset_options_mmp(options_mmp_reset)

MMP Reset

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_mmp_reset=gate_api.OptionsMMPReset() # OptionsMMPReset | try:
# MMP Resetapi_response=api_instance.reset_options_mmp(options_mmp_reset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->reset_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_mmp_resetOptionsMMPReset

Return type

OptionsMMP

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200MMP Information-

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

, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' gateapi-python/docs/OptionsApi.md at master · gate/gateapi-python · GitHub
Skip to content

Latest commit

History

History
1966 lines (1479 loc) · 74 KB

File metadata and controls

1966 lines (1479 loc) · 74 KB

gate_api.OptionsApi

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

MethodHTTP requestDescription
list_options_underlyingsGET /options/underlyingsList all underlying assets
list_options_expirationsGET /options/expirationsList all expiration dates
list_options_contractsGET /options/contractsList all contracts for specified underlying and expiration date
get_options_contractGET /options/contracts/{contract}Query specified contract details
list_options_settlementsGET /options/settlementsList settlement history
get_options_settlementGET /options/settlements/{contract}Get specified contract settlement information
list_my_options_settlementsGET /options/my_settlementsQuery personal settlement records
list_options_order_bookGET /options/order_bookQuery options contract order book
list_options_tickersGET /options/tickersQuery options market ticker information
list_options_underlying_tickersGET /options/underlying/tickers/{underlying}Query underlying ticker information
list_options_candlesticksGET /options/candlesticksOptions contract market candlestick chart
list_options_underlying_candlesticksGET /options/underlying/candlesticksUnderlying index price candlestick chart
list_options_tradesGET /options/tradesMarket trade records
list_options_accountGET /options/accountsQuery account information
list_options_account_bookGET /options/account_bookQuery account change history
list_options_positionsGET /options/positionsList user's positions of specified underlying
get_options_positionGET /options/positions/{contract}Get specified contract position
list_options_position_closeGET /options/position_closeList user's liquidation history of specified underlying
list_options_ordersGET /options/ordersList options orders
create_options_orderPOST /options/ordersCreate an options order
cancel_options_ordersDELETE /options/ordersCancel all orders with 'open' status
get_options_orderGET /options/orders/{order_id}Query single order details
amend_options_orderPUT /options/orders/{order_id}Option Order Modification
cancel_options_orderDELETE /options/orders/{order_id}Cancel single order
countdown_cancel_all_optionsPOST /options/countdown_cancel_allCountdown cancel orders
list_my_options_tradesGET /options/my_tradesQuery personal trading records
get_options_mmpGET /options/mmpMMP Query.
set_options_mmpPOST /options/mmpMMP Settings
reset_options_mmpPOST /options/mmp/resetMMP Reset

list_options_underlyings

list[OptionsUnderlying] list_options_underlyings()

List all underlying assets

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
try:
# List all underlying assetsapi_response=api_instance.list_options_underlyings()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlyings: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

list[OptionsUnderlying]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_expirations

list[int] list_options_expirations(underlying)

List all expiration dates

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)try:
# List all expiration datesapi_response=api_instance.list_options_expirations(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_expirations: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)

Return type

list[int]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List expiration dates for specified underlying-

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

list_options_contracts

list[OptionsContract] list_options_contracts(underlying, expiration=expiration)

List all contracts for specified underlying and expiration date

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)expiration=1636588800# int | Unix timestamp of expiration date (optional)try:
# List all contracts for specified underlying and expiration dateapi_response=api_instance.list_options_contracts(underlying, expiration=expiration)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_contracts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
expirationintUnix timestamp of expiration date[optional]

Return type

list[OptionsContract]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_contract

OptionsContract get_options_contract(contract)

Query specified contract details

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | try:
# Query specified contract detailsapi_response=api_instance.get_options_contract(contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_contract: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr

Return type

OptionsContract

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_settlements

list[OptionsSettlement] list_options_settlements(underlying, limit=limit, offset=offset, _from=_from, to=to)

List settlement history

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# List settlement historyapi_response=api_instance.list_options_settlements(underlying, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsSettlement]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_settlement

OptionsSettlement get_options_settlement(contract, underlying, at)

Get specified contract settlement information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)at=56# int | try:
# Get specified contract settlement informationapi_response=api_instance.get_options_settlement(contract, underlying, at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_settlement: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr
underlyingstrUnderlying (Obtained by listing underlying endpoint)
atint

Return type

OptionsSettlement

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_my_options_settlements

list[OptionsMySettlements] list_my_options_settlements(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)

Query personal settlement records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Query personal settlement recordsapi_response=api_instance.list_my_options_settlements(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_my_options_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsMySettlements]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_order_book

OptionsOrderBook list_options_order_book(contract, interval=interval, limit=limit, with_id=with_id)

Query options contract order book

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

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract nameinterval='0'# str | Price precision for merged depth. 0 means no merging. If not specified, defaults to 0 (optional) (default to '0')limit=10# int | Number of depth levels (optional) (default to 10)with_id=False# bool | Whether to return depth update ID. This ID increments by 1 each time the depth changes (optional) (default to False)try:
# Query options contract order bookapi_response=api_instance.list_options_order_book(contract, interval=interval, limit=limit, with_id=with_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_order_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name
intervalstrPrice precision for merged depth. 0 means no merging. If not specified, defaults to 0[optional] [default to '0']
limitintNumber of depth levels[optional] [default to 10]
with_idboolWhether to return depth update ID. This ID increments by 1 each time the depth changes[optional] [default to False]

Return type

OptionsOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

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

list_options_tickers

list[OptionsTicker] list_options_tickers(underlying)

Query options market ticker information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)try:
# Query options market ticker informationapi_response=api_instance.list_options_tickers(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)

Return type

list[OptionsTicker]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_underlying_tickers

OptionsUnderlyingTicker list_options_underlying_tickers(underlying)

Query underlying ticker information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlyingtry:
# Query underlying ticker informationapi_response=api_instance.list_options_underlying_tickers(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlying_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying

Return type

OptionsUnderlyingTicker

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_candlesticks

list[OptionsCandlestick] list_options_candlesticks(contract, limit=limit, _from=_from, to=to, interval=interval)

Options contract market candlestick chart

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract namelimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)interval='5m'# str | Time interval between data points (optional) (default to '5m')try:
# Options contract market candlestick chartapi_response=api_instance.list_options_candlesticks(contract, limit=limit, _from=_from, to=to, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
intervalstrTime interval between data points[optional] [default to '5m']

Return type

list[OptionsCandlestick]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_underlying_candlesticks

list[OptionsCandlestick] list_options_underlying_candlesticks(underlying, limit=limit, _from=_from, to=to, interval=interval)

Underlying index price candlestick chart

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)interval='5m'# str | Time interval between data points (optional) (default to '5m')try:
# Underlying index price candlestick chartapi_response=api_instance.list_options_underlying_candlesticks(underlying, limit=limit, _from=_from, to=to, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlying_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
intervalstrTime interval between data points[optional] [default to '5m']

Return type

list[OptionsCandlestick]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_trades

list[OptionsTrade] list_options_trades(contract=contract, type=type, limit=limit, offset=offset, _from=_from, to=to)

Market trade records

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)type='1546935600'# str | `C` for call, `P` for put (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Market trade recordsapi_response=api_instance.list_options_trades(contract=contract, type=type, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name[optional]
typestr`C` for call, `P` for put[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsTrade]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_account

OptionsAccount list_options_account()

Query account information

Query account information for classic option account and unified account

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
try:
# Query account informationapi_response=api_instance.list_options_account()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_account: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

OptionsAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_account_book

list[OptionsAccountBook] list_options_account_book(limit=limit, offset=offset, _from=_from, to=to, type=type)

Query account change history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)type='dnw'# str | Change types: - dnw: Deposit & Withdrawal - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: Settlement P&L (optional)try:
# Query account change historyapi_response=api_instance.list_options_account_book(limit=limit, offset=offset, _from=_from, to=to, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_account_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typestrChange types: - dnw: Deposit & Withdrawal - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: Settlement P&L[optional]

Return type

list[OptionsAccountBook]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_positions

list[OptionsPosition] list_options_positions(underlying=underlying)

List user's positions of specified underlying

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (optional)try:
# List user's positions of specified underlyingapi_response=api_instance.list_options_positions(underlying=underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_positions: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying[optional]

Return type

list[OptionsPosition]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_position

OptionsPosition get_options_position(contract)

Get specified contract position

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | try:
# Get specified contract positionapi_response=api_instance.get_options_position(contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_position: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr

Return type

OptionsPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_position_close

list[OptionsPositionClose] list_options_position_close(underlying, contract=contract)

List user's liquidation history of specified underlying

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)try:
# List user's liquidation history of specified underlyingapi_response=api_instance.list_options_position_close(underlying, contract=contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_position_close: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]

Return type

list[OptionsPositionClose]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_orders

list[OptionsOrder] list_options_orders(status, contract=contract, underlying=underlying, limit=limit, offset=offset, _from=_from, to=to)

List options orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
status='open'# str | Query order list based on statuscontract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)underlying='BTC_USDT'# str | Underlying (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# List options ordersapi_response=api_instance.list_options_orders(status, contract=contract, underlying=underlying, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
statusstrQuery order list based on status
contractstrOptions contract name[optional]
underlyingstrUnderlying[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

create_options_order

OptionsOrder create_options_order(options_order)

Create an options order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_order=gate_api.OptionsOrder() # OptionsOrder | try:
# Create an options orderapi_response=api_instance.create_options_order(options_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->create_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_orderOptionsOrder

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order detail-

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

cancel_options_orders

list[OptionsOrder] cancel_options_orders(contract=contract, underlying=underlying, side=side)

Cancel all orders with 'open' status

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)underlying='BTC_USDT'# str | Underlying (optional)side='ask'# str | Specify all bids or all asks, both included if not specified (optional)try:
# Cancel all orders with 'open' statusapi_response=api_instance.cancel_options_orders(contract=contract, underlying=underlying, side=side)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->cancel_options_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name[optional]
underlyingstrUnderlying[optional]
sidestrSpecify all bids or all asks, both included if not specified[optional]

Return type

list[OptionsOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

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

get_options_order

OptionsOrder get_options_order(order_id)

Query single order details

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdtry:
# Query single order detailsapi_response=api_instance.get_options_order(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

amend_options_order

OptionsOrder amend_options_order(order_id, amend_options_order_request)

Option Order Modification

Modify the order price and/or quantity of a specified order; only orders with status 'open' are supported

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdamend_options_order_request=gate_api.AmendOptionsOrderRequest() # AmendOptionsOrderRequest | try:
# Option Order Modificationapi_response=api_instance.amend_options_order(order_id, amend_options_order_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->amend_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created
amend_options_order_requestAmendOptionsOrderRequest

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

cancel_options_order

OptionsOrder cancel_options_order(order_id)

Cancel single order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdtry:
# Cancel single orderapi_response=api_instance.cancel_options_order(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->cancel_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

countdown_cancel_all_options

TriggerTime countdown_cancel_all_options(countdown_cancel_all_options_task)

Countdown cancel orders

Option order heartbeat detection, when the timeout time set by the user is reached, if the existing countdown is not canceled or a new countdown is set, the related option pending order will be automatically canceled. This interface can be called repeatedly to set a new countdown or cancel the countdown. Usage example: Repeat this interface at intervals of 30 seconds, with each countdown timeout set to 30 (seconds). If this interface is not called again within 30 seconds, all pending orders on the underlyingcontract you specified will be automatically cancelled. If underlyingcontract is not specified, user will be automatically cancelled If timeout is set to 0 within 30 seconds, the countdown timer will expire and the automatic order cancellation function will be cancelled.

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
countdown_cancel_all_options_task=gate_api.CountdownCancelAllOptionsTask() # CountdownCancelAllOptionsTask | try:
# Countdown cancel ordersapi_response=api_instance.countdown_cancel_all_options(countdown_cancel_all_options_task)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->countdown_cancel_all_options: %s\n"%e)

Parameters

NameTypeDescriptionNotes
countdown_cancel_all_options_taskCountdownCancelAllOptionsTask

Return type

TriggerTime

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Countdown set successfully-

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

list_my_options_trades

list[OptionsMyTrade] list_my_options_trades(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)

Query personal trading records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Query personal trading recordsapi_response=api_instance.list_my_options_trades(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_my_options_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsMyTrade]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_mmp

list[OptionsMMP] get_options_mmp(underlying=underlying)

MMP Query.

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (optional)try:
# MMP Query.api_response=api_instance.get_options_mmp(underlying=underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying[optional]

Return type

list[OptionsMMP]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

set_options_mmp

OptionsMMP set_options_mmp(options_mmp)

MMP Settings

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_mmp=gate_api.OptionsMMP() # OptionsMMP | try:
# MMP Settingsapi_response=api_instance.set_options_mmp(options_mmp)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->set_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_mmpOptionsMMP

Return type

OptionsMMP

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200MMP Information-

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

reset_options_mmp

OptionsMMP reset_options_mmp(options_mmp_reset)

MMP Reset

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_mmp_reset=gate_api.OptionsMMPReset() # OptionsMMPReset | try:
# MMP Resetapi_response=api_instance.reset_options_mmp(options_mmp_reset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->reset_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_mmp_resetOptionsMMPReset

Return type

OptionsMMP

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200MMP Information-

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

, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' gateapi-python/docs/OptionsApi.md at master · gate/gateapi-python · GitHub
Skip to content

Latest commit

History

History
1966 lines (1479 loc) · 74 KB

File metadata and controls

1966 lines (1479 loc) · 74 KB

gate_api.OptionsApi

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

MethodHTTP requestDescription
list_options_underlyingsGET /options/underlyingsList all underlying assets
list_options_expirationsGET /options/expirationsList all expiration dates
list_options_contractsGET /options/contractsList all contracts for specified underlying and expiration date
get_options_contractGET /options/contracts/{contract}Query specified contract details
list_options_settlementsGET /options/settlementsList settlement history
get_options_settlementGET /options/settlements/{contract}Get specified contract settlement information
list_my_options_settlementsGET /options/my_settlementsQuery personal settlement records
list_options_order_bookGET /options/order_bookQuery options contract order book
list_options_tickersGET /options/tickersQuery options market ticker information
list_options_underlying_tickersGET /options/underlying/tickers/{underlying}Query underlying ticker information
list_options_candlesticksGET /options/candlesticksOptions contract market candlestick chart
list_options_underlying_candlesticksGET /options/underlying/candlesticksUnderlying index price candlestick chart
list_options_tradesGET /options/tradesMarket trade records
list_options_accountGET /options/accountsQuery account information
list_options_account_bookGET /options/account_bookQuery account change history
list_options_positionsGET /options/positionsList user's positions of specified underlying
get_options_positionGET /options/positions/{contract}Get specified contract position
list_options_position_closeGET /options/position_closeList user's liquidation history of specified underlying
list_options_ordersGET /options/ordersList options orders
create_options_orderPOST /options/ordersCreate an options order
cancel_options_ordersDELETE /options/ordersCancel all orders with 'open' status
get_options_orderGET /options/orders/{order_id}Query single order details
amend_options_orderPUT /options/orders/{order_id}Option Order Modification
cancel_options_orderDELETE /options/orders/{order_id}Cancel single order
countdown_cancel_all_optionsPOST /options/countdown_cancel_allCountdown cancel orders
list_my_options_tradesGET /options/my_tradesQuery personal trading records
get_options_mmpGET /options/mmpMMP Query.
set_options_mmpPOST /options/mmpMMP Settings
reset_options_mmpPOST /options/mmp/resetMMP Reset

list_options_underlyings

list[OptionsUnderlying] list_options_underlyings()

List all underlying assets

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
try:
# List all underlying assetsapi_response=api_instance.list_options_underlyings()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlyings: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

list[OptionsUnderlying]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_expirations

list[int] list_options_expirations(underlying)

List all expiration dates

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)try:
# List all expiration datesapi_response=api_instance.list_options_expirations(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_expirations: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)

Return type

list[int]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List expiration dates for specified underlying-

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

list_options_contracts

list[OptionsContract] list_options_contracts(underlying, expiration=expiration)

List all contracts for specified underlying and expiration date

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)expiration=1636588800# int | Unix timestamp of expiration date (optional)try:
# List all contracts for specified underlying and expiration dateapi_response=api_instance.list_options_contracts(underlying, expiration=expiration)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_contracts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
expirationintUnix timestamp of expiration date[optional]

Return type

list[OptionsContract]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_contract

OptionsContract get_options_contract(contract)

Query specified contract details

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | try:
# Query specified contract detailsapi_response=api_instance.get_options_contract(contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_contract: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr

Return type

OptionsContract

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_settlements

list[OptionsSettlement] list_options_settlements(underlying, limit=limit, offset=offset, _from=_from, to=to)

List settlement history

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# List settlement historyapi_response=api_instance.list_options_settlements(underlying, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsSettlement]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_settlement

OptionsSettlement get_options_settlement(contract, underlying, at)

Get specified contract settlement information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)at=56# int | try:
# Get specified contract settlement informationapi_response=api_instance.get_options_settlement(contract, underlying, at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_settlement: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr
underlyingstrUnderlying (Obtained by listing underlying endpoint)
atint

Return type

OptionsSettlement

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_my_options_settlements

list[OptionsMySettlements] list_my_options_settlements(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)

Query personal settlement records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Query personal settlement recordsapi_response=api_instance.list_my_options_settlements(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_my_options_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsMySettlements]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_order_book

OptionsOrderBook list_options_order_book(contract, interval=interval, limit=limit, with_id=with_id)

Query options contract order book

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

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract nameinterval='0'# str | Price precision for merged depth. 0 means no merging. If not specified, defaults to 0 (optional) (default to '0')limit=10# int | Number of depth levels (optional) (default to 10)with_id=False# bool | Whether to return depth update ID. This ID increments by 1 each time the depth changes (optional) (default to False)try:
# Query options contract order bookapi_response=api_instance.list_options_order_book(contract, interval=interval, limit=limit, with_id=with_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_order_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name
intervalstrPrice precision for merged depth. 0 means no merging. If not specified, defaults to 0[optional] [default to '0']
limitintNumber of depth levels[optional] [default to 10]
with_idboolWhether to return depth update ID. This ID increments by 1 each time the depth changes[optional] [default to False]

Return type

OptionsOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

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

list_options_tickers

list[OptionsTicker] list_options_tickers(underlying)

Query options market ticker information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)try:
# Query options market ticker informationapi_response=api_instance.list_options_tickers(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)

Return type

list[OptionsTicker]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_underlying_tickers

OptionsUnderlyingTicker list_options_underlying_tickers(underlying)

Query underlying ticker information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlyingtry:
# Query underlying ticker informationapi_response=api_instance.list_options_underlying_tickers(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlying_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying

Return type

OptionsUnderlyingTicker

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_candlesticks

list[OptionsCandlestick] list_options_candlesticks(contract, limit=limit, _from=_from, to=to, interval=interval)

Options contract market candlestick chart

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract namelimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)interval='5m'# str | Time interval between data points (optional) (default to '5m')try:
# Options contract market candlestick chartapi_response=api_instance.list_options_candlesticks(contract, limit=limit, _from=_from, to=to, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
intervalstrTime interval between data points[optional] [default to '5m']

Return type

list[OptionsCandlestick]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_underlying_candlesticks

list[OptionsCandlestick] list_options_underlying_candlesticks(underlying, limit=limit, _from=_from, to=to, interval=interval)

Underlying index price candlestick chart

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)interval='5m'# str | Time interval between data points (optional) (default to '5m')try:
# Underlying index price candlestick chartapi_response=api_instance.list_options_underlying_candlesticks(underlying, limit=limit, _from=_from, to=to, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlying_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
intervalstrTime interval between data points[optional] [default to '5m']

Return type

list[OptionsCandlestick]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_trades

list[OptionsTrade] list_options_trades(contract=contract, type=type, limit=limit, offset=offset, _from=_from, to=to)

Market trade records

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)type='1546935600'# str | `C` for call, `P` for put (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Market trade recordsapi_response=api_instance.list_options_trades(contract=contract, type=type, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name[optional]
typestr`C` for call, `P` for put[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsTrade]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_account

OptionsAccount list_options_account()

Query account information

Query account information for classic option account and unified account

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
try:
# Query account informationapi_response=api_instance.list_options_account()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_account: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

OptionsAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_account_book

list[OptionsAccountBook] list_options_account_book(limit=limit, offset=offset, _from=_from, to=to, type=type)

Query account change history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)type='dnw'# str | Change types: - dnw: Deposit & Withdrawal - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: Settlement P&L (optional)try:
# Query account change historyapi_response=api_instance.list_options_account_book(limit=limit, offset=offset, _from=_from, to=to, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_account_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typestrChange types: - dnw: Deposit & Withdrawal - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: Settlement P&L[optional]

Return type

list[OptionsAccountBook]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_positions

list[OptionsPosition] list_options_positions(underlying=underlying)

List user's positions of specified underlying

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (optional)try:
# List user's positions of specified underlyingapi_response=api_instance.list_options_positions(underlying=underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_positions: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying[optional]

Return type

list[OptionsPosition]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_position

OptionsPosition get_options_position(contract)

Get specified contract position

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | try:
# Get specified contract positionapi_response=api_instance.get_options_position(contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_position: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr

Return type

OptionsPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_position_close

list[OptionsPositionClose] list_options_position_close(underlying, contract=contract)

List user's liquidation history of specified underlying

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)try:
# List user's liquidation history of specified underlyingapi_response=api_instance.list_options_position_close(underlying, contract=contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_position_close: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]

Return type

list[OptionsPositionClose]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_orders

list[OptionsOrder] list_options_orders(status, contract=contract, underlying=underlying, limit=limit, offset=offset, _from=_from, to=to)

List options orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
status='open'# str | Query order list based on statuscontract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)underlying='BTC_USDT'# str | Underlying (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# List options ordersapi_response=api_instance.list_options_orders(status, contract=contract, underlying=underlying, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
statusstrQuery order list based on status
contractstrOptions contract name[optional]
underlyingstrUnderlying[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

create_options_order

OptionsOrder create_options_order(options_order)

Create an options order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_order=gate_api.OptionsOrder() # OptionsOrder | try:
# Create an options orderapi_response=api_instance.create_options_order(options_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->create_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_orderOptionsOrder

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order detail-

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

cancel_options_orders

list[OptionsOrder] cancel_options_orders(contract=contract, underlying=underlying, side=side)

Cancel all orders with 'open' status

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)underlying='BTC_USDT'# str | Underlying (optional)side='ask'# str | Specify all bids or all asks, both included if not specified (optional)try:
# Cancel all orders with 'open' statusapi_response=api_instance.cancel_options_orders(contract=contract, underlying=underlying, side=side)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->cancel_options_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name[optional]
underlyingstrUnderlying[optional]
sidestrSpecify all bids or all asks, both included if not specified[optional]

Return type

list[OptionsOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

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

get_options_order

OptionsOrder get_options_order(order_id)

Query single order details

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdtry:
# Query single order detailsapi_response=api_instance.get_options_order(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

amend_options_order

OptionsOrder amend_options_order(order_id, amend_options_order_request)

Option Order Modification

Modify the order price and/or quantity of a specified order; only orders with status 'open' are supported

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdamend_options_order_request=gate_api.AmendOptionsOrderRequest() # AmendOptionsOrderRequest | try:
# Option Order Modificationapi_response=api_instance.amend_options_order(order_id, amend_options_order_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->amend_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created
amend_options_order_requestAmendOptionsOrderRequest

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

cancel_options_order

OptionsOrder cancel_options_order(order_id)

Cancel single order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdtry:
# Cancel single orderapi_response=api_instance.cancel_options_order(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->cancel_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

countdown_cancel_all_options

TriggerTime countdown_cancel_all_options(countdown_cancel_all_options_task)

Countdown cancel orders

Option order heartbeat detection, when the timeout time set by the user is reached, if the existing countdown is not canceled or a new countdown is set, the related option pending order will be automatically canceled. This interface can be called repeatedly to set a new countdown or cancel the countdown. Usage example: Repeat this interface at intervals of 30 seconds, with each countdown timeout set to 30 (seconds). If this interface is not called again within 30 seconds, all pending orders on the underlyingcontract you specified will be automatically cancelled. If underlyingcontract is not specified, user will be automatically cancelled If timeout is set to 0 within 30 seconds, the countdown timer will expire and the automatic order cancellation function will be cancelled.

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
countdown_cancel_all_options_task=gate_api.CountdownCancelAllOptionsTask() # CountdownCancelAllOptionsTask | try:
# Countdown cancel ordersapi_response=api_instance.countdown_cancel_all_options(countdown_cancel_all_options_task)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->countdown_cancel_all_options: %s\n"%e)

Parameters

NameTypeDescriptionNotes
countdown_cancel_all_options_taskCountdownCancelAllOptionsTask

Return type

TriggerTime

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Countdown set successfully-

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

list_my_options_trades

list[OptionsMyTrade] list_my_options_trades(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)

Query personal trading records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Query personal trading recordsapi_response=api_instance.list_my_options_trades(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_my_options_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsMyTrade]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_mmp

list[OptionsMMP] get_options_mmp(underlying=underlying)

MMP Query.

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (optional)try:
# MMP Query.api_response=api_instance.get_options_mmp(underlying=underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying[optional]

Return type

list[OptionsMMP]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

set_options_mmp

OptionsMMP set_options_mmp(options_mmp)

MMP Settings

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_mmp=gate_api.OptionsMMP() # OptionsMMP | try:
# MMP Settingsapi_response=api_instance.set_options_mmp(options_mmp)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->set_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_mmpOptionsMMP

Return type

OptionsMMP

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200MMP Information-

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

reset_options_mmp

OptionsMMP reset_options_mmp(options_mmp_reset)

MMP Reset

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_mmp_reset=gate_api.OptionsMMPReset() # OptionsMMPReset | try:
# MMP Resetapi_response=api_instance.reset_options_mmp(options_mmp_reset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->reset_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_mmp_resetOptionsMMPReset

Return type

OptionsMMP

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200MMP Information-

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

, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' gateapi-python/docs/OptionsApi.md at master · gate/gateapi-python · GitHub
Skip to content

Latest commit

History

History
1966 lines (1479 loc) · 74 KB

File metadata and controls

1966 lines (1479 loc) · 74 KB

gate_api.OptionsApi

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

MethodHTTP requestDescription
list_options_underlyingsGET /options/underlyingsList all underlying assets
list_options_expirationsGET /options/expirationsList all expiration dates
list_options_contractsGET /options/contractsList all contracts for specified underlying and expiration date
get_options_contractGET /options/contracts/{contract}Query specified contract details
list_options_settlementsGET /options/settlementsList settlement history
get_options_settlementGET /options/settlements/{contract}Get specified contract settlement information
list_my_options_settlementsGET /options/my_settlementsQuery personal settlement records
list_options_order_bookGET /options/order_bookQuery options contract order book
list_options_tickersGET /options/tickersQuery options market ticker information
list_options_underlying_tickersGET /options/underlying/tickers/{underlying}Query underlying ticker information
list_options_candlesticksGET /options/candlesticksOptions contract market candlestick chart
list_options_underlying_candlesticksGET /options/underlying/candlesticksUnderlying index price candlestick chart
list_options_tradesGET /options/tradesMarket trade records
list_options_accountGET /options/accountsQuery account information
list_options_account_bookGET /options/account_bookQuery account change history
list_options_positionsGET /options/positionsList user's positions of specified underlying
get_options_positionGET /options/positions/{contract}Get specified contract position
list_options_position_closeGET /options/position_closeList user's liquidation history of specified underlying
list_options_ordersGET /options/ordersList options orders
create_options_orderPOST /options/ordersCreate an options order
cancel_options_ordersDELETE /options/ordersCancel all orders with 'open' status
get_options_orderGET /options/orders/{order_id}Query single order details
amend_options_orderPUT /options/orders/{order_id}Option Order Modification
cancel_options_orderDELETE /options/orders/{order_id}Cancel single order
countdown_cancel_all_optionsPOST /options/countdown_cancel_allCountdown cancel orders
list_my_options_tradesGET /options/my_tradesQuery personal trading records
get_options_mmpGET /options/mmpMMP Query.
set_options_mmpPOST /options/mmpMMP Settings
reset_options_mmpPOST /options/mmp/resetMMP Reset

list_options_underlyings

list[OptionsUnderlying] list_options_underlyings()

List all underlying assets

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
try:
# List all underlying assetsapi_response=api_instance.list_options_underlyings()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlyings: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

list[OptionsUnderlying]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_expirations

list[int] list_options_expirations(underlying)

List all expiration dates

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)try:
# List all expiration datesapi_response=api_instance.list_options_expirations(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_expirations: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)

Return type

list[int]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List expiration dates for specified underlying-

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

list_options_contracts

list[OptionsContract] list_options_contracts(underlying, expiration=expiration)

List all contracts for specified underlying and expiration date

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)expiration=1636588800# int | Unix timestamp of expiration date (optional)try:
# List all contracts for specified underlying and expiration dateapi_response=api_instance.list_options_contracts(underlying, expiration=expiration)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_contracts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
expirationintUnix timestamp of expiration date[optional]

Return type

list[OptionsContract]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_contract

OptionsContract get_options_contract(contract)

Query specified contract details

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | try:
# Query specified contract detailsapi_response=api_instance.get_options_contract(contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_contract: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr

Return type

OptionsContract

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_settlements

list[OptionsSettlement] list_options_settlements(underlying, limit=limit, offset=offset, _from=_from, to=to)

List settlement history

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# List settlement historyapi_response=api_instance.list_options_settlements(underlying, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsSettlement]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_settlement

OptionsSettlement get_options_settlement(contract, underlying, at)

Get specified contract settlement information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)at=56# int | try:
# Get specified contract settlement informationapi_response=api_instance.get_options_settlement(contract, underlying, at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_settlement: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr
underlyingstrUnderlying (Obtained by listing underlying endpoint)
atint

Return type

OptionsSettlement

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_my_options_settlements

list[OptionsMySettlements] list_my_options_settlements(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)

Query personal settlement records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Query personal settlement recordsapi_response=api_instance.list_my_options_settlements(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_my_options_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsMySettlements]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_order_book

OptionsOrderBook list_options_order_book(contract, interval=interval, limit=limit, with_id=with_id)

Query options contract order book

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

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract nameinterval='0'# str | Price precision for merged depth. 0 means no merging. If not specified, defaults to 0 (optional) (default to '0')limit=10# int | Number of depth levels (optional) (default to 10)with_id=False# bool | Whether to return depth update ID. This ID increments by 1 each time the depth changes (optional) (default to False)try:
# Query options contract order bookapi_response=api_instance.list_options_order_book(contract, interval=interval, limit=limit, with_id=with_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_order_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name
intervalstrPrice precision for merged depth. 0 means no merging. If not specified, defaults to 0[optional] [default to '0']
limitintNumber of depth levels[optional] [default to 10]
with_idboolWhether to return depth update ID. This ID increments by 1 each time the depth changes[optional] [default to False]

Return type

OptionsOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

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

list_options_tickers

list[OptionsTicker] list_options_tickers(underlying)

Query options market ticker information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)try:
# Query options market ticker informationapi_response=api_instance.list_options_tickers(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)

Return type

list[OptionsTicker]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_underlying_tickers

OptionsUnderlyingTicker list_options_underlying_tickers(underlying)

Query underlying ticker information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlyingtry:
# Query underlying ticker informationapi_response=api_instance.list_options_underlying_tickers(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlying_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying

Return type

OptionsUnderlyingTicker

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_candlesticks

list[OptionsCandlestick] list_options_candlesticks(contract, limit=limit, _from=_from, to=to, interval=interval)

Options contract market candlestick chart

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract namelimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)interval='5m'# str | Time interval between data points (optional) (default to '5m')try:
# Options contract market candlestick chartapi_response=api_instance.list_options_candlesticks(contract, limit=limit, _from=_from, to=to, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
intervalstrTime interval between data points[optional] [default to '5m']

Return type

list[OptionsCandlestick]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_underlying_candlesticks

list[OptionsCandlestick] list_options_underlying_candlesticks(underlying, limit=limit, _from=_from, to=to, interval=interval)

Underlying index price candlestick chart

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)interval='5m'# str | Time interval between data points (optional) (default to '5m')try:
# Underlying index price candlestick chartapi_response=api_instance.list_options_underlying_candlesticks(underlying, limit=limit, _from=_from, to=to, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlying_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
intervalstrTime interval between data points[optional] [default to '5m']

Return type

list[OptionsCandlestick]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_trades

list[OptionsTrade] list_options_trades(contract=contract, type=type, limit=limit, offset=offset, _from=_from, to=to)

Market trade records

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)type='1546935600'# str | `C` for call, `P` for put (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Market trade recordsapi_response=api_instance.list_options_trades(contract=contract, type=type, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name[optional]
typestr`C` for call, `P` for put[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsTrade]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_account

OptionsAccount list_options_account()

Query account information

Query account information for classic option account and unified account

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
try:
# Query account informationapi_response=api_instance.list_options_account()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_account: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

OptionsAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_account_book

list[OptionsAccountBook] list_options_account_book(limit=limit, offset=offset, _from=_from, to=to, type=type)

Query account change history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)type='dnw'# str | Change types: - dnw: Deposit & Withdrawal - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: Settlement P&L (optional)try:
# Query account change historyapi_response=api_instance.list_options_account_book(limit=limit, offset=offset, _from=_from, to=to, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_account_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typestrChange types: - dnw: Deposit & Withdrawal - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: Settlement P&L[optional]

Return type

list[OptionsAccountBook]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_positions

list[OptionsPosition] list_options_positions(underlying=underlying)

List user's positions of specified underlying

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (optional)try:
# List user's positions of specified underlyingapi_response=api_instance.list_options_positions(underlying=underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_positions: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying[optional]

Return type

list[OptionsPosition]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_position

OptionsPosition get_options_position(contract)

Get specified contract position

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | try:
# Get specified contract positionapi_response=api_instance.get_options_position(contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_position: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr

Return type

OptionsPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_position_close

list[OptionsPositionClose] list_options_position_close(underlying, contract=contract)

List user's liquidation history of specified underlying

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)try:
# List user's liquidation history of specified underlyingapi_response=api_instance.list_options_position_close(underlying, contract=contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_position_close: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]

Return type

list[OptionsPositionClose]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_orders

list[OptionsOrder] list_options_orders(status, contract=contract, underlying=underlying, limit=limit, offset=offset, _from=_from, to=to)

List options orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
status='open'# str | Query order list based on statuscontract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)underlying='BTC_USDT'# str | Underlying (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# List options ordersapi_response=api_instance.list_options_orders(status, contract=contract, underlying=underlying, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
statusstrQuery order list based on status
contractstrOptions contract name[optional]
underlyingstrUnderlying[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

create_options_order

OptionsOrder create_options_order(options_order)

Create an options order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_order=gate_api.OptionsOrder() # OptionsOrder | try:
# Create an options orderapi_response=api_instance.create_options_order(options_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->create_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_orderOptionsOrder

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order detail-

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

cancel_options_orders

list[OptionsOrder] cancel_options_orders(contract=contract, underlying=underlying, side=side)

Cancel all orders with 'open' status

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)underlying='BTC_USDT'# str | Underlying (optional)side='ask'# str | Specify all bids or all asks, both included if not specified (optional)try:
# Cancel all orders with 'open' statusapi_response=api_instance.cancel_options_orders(contract=contract, underlying=underlying, side=side)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->cancel_options_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name[optional]
underlyingstrUnderlying[optional]
sidestrSpecify all bids or all asks, both included if not specified[optional]

Return type

list[OptionsOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

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

get_options_order

OptionsOrder get_options_order(order_id)

Query single order details

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdtry:
# Query single order detailsapi_response=api_instance.get_options_order(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

amend_options_order

OptionsOrder amend_options_order(order_id, amend_options_order_request)

Option Order Modification

Modify the order price and/or quantity of a specified order; only orders with status 'open' are supported

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdamend_options_order_request=gate_api.AmendOptionsOrderRequest() # AmendOptionsOrderRequest | try:
# Option Order Modificationapi_response=api_instance.amend_options_order(order_id, amend_options_order_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->amend_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created
amend_options_order_requestAmendOptionsOrderRequest

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

cancel_options_order

OptionsOrder cancel_options_order(order_id)

Cancel single order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdtry:
# Cancel single orderapi_response=api_instance.cancel_options_order(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->cancel_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

countdown_cancel_all_options

TriggerTime countdown_cancel_all_options(countdown_cancel_all_options_task)

Countdown cancel orders

Option order heartbeat detection, when the timeout time set by the user is reached, if the existing countdown is not canceled or a new countdown is set, the related option pending order will be automatically canceled. This interface can be called repeatedly to set a new countdown or cancel the countdown. Usage example: Repeat this interface at intervals of 30 seconds, with each countdown timeout set to 30 (seconds). If this interface is not called again within 30 seconds, all pending orders on the underlyingcontract you specified will be automatically cancelled. If underlyingcontract is not specified, user will be automatically cancelled If timeout is set to 0 within 30 seconds, the countdown timer will expire and the automatic order cancellation function will be cancelled.

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
countdown_cancel_all_options_task=gate_api.CountdownCancelAllOptionsTask() # CountdownCancelAllOptionsTask | try:
# Countdown cancel ordersapi_response=api_instance.countdown_cancel_all_options(countdown_cancel_all_options_task)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->countdown_cancel_all_options: %s\n"%e)

Parameters

NameTypeDescriptionNotes
countdown_cancel_all_options_taskCountdownCancelAllOptionsTask

Return type

TriggerTime

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Countdown set successfully-

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

list_my_options_trades

list[OptionsMyTrade] list_my_options_trades(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)

Query personal trading records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Query personal trading recordsapi_response=api_instance.list_my_options_trades(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_my_options_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsMyTrade]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_mmp

list[OptionsMMP] get_options_mmp(underlying=underlying)

MMP Query.

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (optional)try:
# MMP Query.api_response=api_instance.get_options_mmp(underlying=underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying[optional]

Return type

list[OptionsMMP]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

set_options_mmp

OptionsMMP set_options_mmp(options_mmp)

MMP Settings

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_mmp=gate_api.OptionsMMP() # OptionsMMP | try:
# MMP Settingsapi_response=api_instance.set_options_mmp(options_mmp)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->set_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_mmpOptionsMMP

Return type

OptionsMMP

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200MMP Information-

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

reset_options_mmp

OptionsMMP reset_options_mmp(options_mmp_reset)

MMP Reset

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_mmp_reset=gate_api.OptionsMMPReset() # OptionsMMPReset | try:
# MMP Resetapi_response=api_instance.reset_options_mmp(options_mmp_reset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->reset_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_mmp_resetOptionsMMPReset

Return type

OptionsMMP

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200MMP Information-

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

, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' gateapi-python/docs/OptionsApi.md at master · gate/gateapi-python · GitHub
Skip to content

Latest commit

History

History
1966 lines (1479 loc) · 74 KB

File metadata and controls

1966 lines (1479 loc) · 74 KB

gate_api.OptionsApi

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

MethodHTTP requestDescription
list_options_underlyingsGET /options/underlyingsList all underlying assets
list_options_expirationsGET /options/expirationsList all expiration dates
list_options_contractsGET /options/contractsList all contracts for specified underlying and expiration date
get_options_contractGET /options/contracts/{contract}Query specified contract details
list_options_settlementsGET /options/settlementsList settlement history
get_options_settlementGET /options/settlements/{contract}Get specified contract settlement information
list_my_options_settlementsGET /options/my_settlementsQuery personal settlement records
list_options_order_bookGET /options/order_bookQuery options contract order book
list_options_tickersGET /options/tickersQuery options market ticker information
list_options_underlying_tickersGET /options/underlying/tickers/{underlying}Query underlying ticker information
list_options_candlesticksGET /options/candlesticksOptions contract market candlestick chart
list_options_underlying_candlesticksGET /options/underlying/candlesticksUnderlying index price candlestick chart
list_options_tradesGET /options/tradesMarket trade records
list_options_accountGET /options/accountsQuery account information
list_options_account_bookGET /options/account_bookQuery account change history
list_options_positionsGET /options/positionsList user's positions of specified underlying
get_options_positionGET /options/positions/{contract}Get specified contract position
list_options_position_closeGET /options/position_closeList user's liquidation history of specified underlying
list_options_ordersGET /options/ordersList options orders
create_options_orderPOST /options/ordersCreate an options order
cancel_options_ordersDELETE /options/ordersCancel all orders with 'open' status
get_options_orderGET /options/orders/{order_id}Query single order details
amend_options_orderPUT /options/orders/{order_id}Option Order Modification
cancel_options_orderDELETE /options/orders/{order_id}Cancel single order
countdown_cancel_all_optionsPOST /options/countdown_cancel_allCountdown cancel orders
list_my_options_tradesGET /options/my_tradesQuery personal trading records
get_options_mmpGET /options/mmpMMP Query.
set_options_mmpPOST /options/mmpMMP Settings
reset_options_mmpPOST /options/mmp/resetMMP Reset

list_options_underlyings

list[OptionsUnderlying] list_options_underlyings()

List all underlying assets

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
try:
# List all underlying assetsapi_response=api_instance.list_options_underlyings()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlyings: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

list[OptionsUnderlying]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_expirations

list[int] list_options_expirations(underlying)

List all expiration dates

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)try:
# List all expiration datesapi_response=api_instance.list_options_expirations(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_expirations: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)

Return type

list[int]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List expiration dates for specified underlying-

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

list_options_contracts

list[OptionsContract] list_options_contracts(underlying, expiration=expiration)

List all contracts for specified underlying and expiration date

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)expiration=1636588800# int | Unix timestamp of expiration date (optional)try:
# List all contracts for specified underlying and expiration dateapi_response=api_instance.list_options_contracts(underlying, expiration=expiration)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_contracts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
expirationintUnix timestamp of expiration date[optional]

Return type

list[OptionsContract]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_contract

OptionsContract get_options_contract(contract)

Query specified contract details

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | try:
# Query specified contract detailsapi_response=api_instance.get_options_contract(contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_contract: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr

Return type

OptionsContract

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_settlements

list[OptionsSettlement] list_options_settlements(underlying, limit=limit, offset=offset, _from=_from, to=to)

List settlement history

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# List settlement historyapi_response=api_instance.list_options_settlements(underlying, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsSettlement]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_settlement

OptionsSettlement get_options_settlement(contract, underlying, at)

Get specified contract settlement information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)at=56# int | try:
# Get specified contract settlement informationapi_response=api_instance.get_options_settlement(contract, underlying, at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_settlement: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr
underlyingstrUnderlying (Obtained by listing underlying endpoint)
atint

Return type

OptionsSettlement

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_my_options_settlements

list[OptionsMySettlements] list_my_options_settlements(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)

Query personal settlement records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Query personal settlement recordsapi_response=api_instance.list_my_options_settlements(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_my_options_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsMySettlements]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_order_book

OptionsOrderBook list_options_order_book(contract, interval=interval, limit=limit, with_id=with_id)

Query options contract order book

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

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract nameinterval='0'# str | Price precision for merged depth. 0 means no merging. If not specified, defaults to 0 (optional) (default to '0')limit=10# int | Number of depth levels (optional) (default to 10)with_id=False# bool | Whether to return depth update ID. This ID increments by 1 each time the depth changes (optional) (default to False)try:
# Query options contract order bookapi_response=api_instance.list_options_order_book(contract, interval=interval, limit=limit, with_id=with_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_order_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name
intervalstrPrice precision for merged depth. 0 means no merging. If not specified, defaults to 0[optional] [default to '0']
limitintNumber of depth levels[optional] [default to 10]
with_idboolWhether to return depth update ID. This ID increments by 1 each time the depth changes[optional] [default to False]

Return type

OptionsOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

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

list_options_tickers

list[OptionsTicker] list_options_tickers(underlying)

Query options market ticker information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)try:
# Query options market ticker informationapi_response=api_instance.list_options_tickers(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)

Return type

list[OptionsTicker]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_underlying_tickers

OptionsUnderlyingTicker list_options_underlying_tickers(underlying)

Query underlying ticker information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlyingtry:
# Query underlying ticker informationapi_response=api_instance.list_options_underlying_tickers(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlying_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying

Return type

OptionsUnderlyingTicker

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_candlesticks

list[OptionsCandlestick] list_options_candlesticks(contract, limit=limit, _from=_from, to=to, interval=interval)

Options contract market candlestick chart

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract namelimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)interval='5m'# str | Time interval between data points (optional) (default to '5m')try:
# Options contract market candlestick chartapi_response=api_instance.list_options_candlesticks(contract, limit=limit, _from=_from, to=to, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
intervalstrTime interval between data points[optional] [default to '5m']

Return type

list[OptionsCandlestick]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_underlying_candlesticks

list[OptionsCandlestick] list_options_underlying_candlesticks(underlying, limit=limit, _from=_from, to=to, interval=interval)

Underlying index price candlestick chart

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)interval='5m'# str | Time interval between data points (optional) (default to '5m')try:
# Underlying index price candlestick chartapi_response=api_instance.list_options_underlying_candlesticks(underlying, limit=limit, _from=_from, to=to, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlying_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
intervalstrTime interval between data points[optional] [default to '5m']

Return type

list[OptionsCandlestick]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_trades

list[OptionsTrade] list_options_trades(contract=contract, type=type, limit=limit, offset=offset, _from=_from, to=to)

Market trade records

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)type='1546935600'# str | `C` for call, `P` for put (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Market trade recordsapi_response=api_instance.list_options_trades(contract=contract, type=type, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name[optional]
typestr`C` for call, `P` for put[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsTrade]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_account

OptionsAccount list_options_account()

Query account information

Query account information for classic option account and unified account

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
try:
# Query account informationapi_response=api_instance.list_options_account()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_account: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

OptionsAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_account_book

list[OptionsAccountBook] list_options_account_book(limit=limit, offset=offset, _from=_from, to=to, type=type)

Query account change history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)type='dnw'# str | Change types: - dnw: Deposit & Withdrawal - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: Settlement P&L (optional)try:
# Query account change historyapi_response=api_instance.list_options_account_book(limit=limit, offset=offset, _from=_from, to=to, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_account_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typestrChange types: - dnw: Deposit & Withdrawal - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: Settlement P&L[optional]

Return type

list[OptionsAccountBook]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_positions

list[OptionsPosition] list_options_positions(underlying=underlying)

List user's positions of specified underlying

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (optional)try:
# List user's positions of specified underlyingapi_response=api_instance.list_options_positions(underlying=underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_positions: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying[optional]

Return type

list[OptionsPosition]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_position

OptionsPosition get_options_position(contract)

Get specified contract position

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | try:
# Get specified contract positionapi_response=api_instance.get_options_position(contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_position: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr

Return type

OptionsPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_position_close

list[OptionsPositionClose] list_options_position_close(underlying, contract=contract)

List user's liquidation history of specified underlying

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)try:
# List user's liquidation history of specified underlyingapi_response=api_instance.list_options_position_close(underlying, contract=contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_position_close: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]

Return type

list[OptionsPositionClose]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_orders

list[OptionsOrder] list_options_orders(status, contract=contract, underlying=underlying, limit=limit, offset=offset, _from=_from, to=to)

List options orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
status='open'# str | Query order list based on statuscontract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)underlying='BTC_USDT'# str | Underlying (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# List options ordersapi_response=api_instance.list_options_orders(status, contract=contract, underlying=underlying, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
statusstrQuery order list based on status
contractstrOptions contract name[optional]
underlyingstrUnderlying[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

create_options_order

OptionsOrder create_options_order(options_order)

Create an options order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_order=gate_api.OptionsOrder() # OptionsOrder | try:
# Create an options orderapi_response=api_instance.create_options_order(options_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->create_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_orderOptionsOrder

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order detail-

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

cancel_options_orders

list[OptionsOrder] cancel_options_orders(contract=contract, underlying=underlying, side=side)

Cancel all orders with 'open' status

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)underlying='BTC_USDT'# str | Underlying (optional)side='ask'# str | Specify all bids or all asks, both included if not specified (optional)try:
# Cancel all orders with 'open' statusapi_response=api_instance.cancel_options_orders(contract=contract, underlying=underlying, side=side)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->cancel_options_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name[optional]
underlyingstrUnderlying[optional]
sidestrSpecify all bids or all asks, both included if not specified[optional]

Return type

list[OptionsOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

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

get_options_order

OptionsOrder get_options_order(order_id)

Query single order details

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdtry:
# Query single order detailsapi_response=api_instance.get_options_order(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

amend_options_order

OptionsOrder amend_options_order(order_id, amend_options_order_request)

Option Order Modification

Modify the order price and/or quantity of a specified order; only orders with status 'open' are supported

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdamend_options_order_request=gate_api.AmendOptionsOrderRequest() # AmendOptionsOrderRequest | try:
# Option Order Modificationapi_response=api_instance.amend_options_order(order_id, amend_options_order_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->amend_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created
amend_options_order_requestAmendOptionsOrderRequest

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

cancel_options_order

OptionsOrder cancel_options_order(order_id)

Cancel single order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdtry:
# Cancel single orderapi_response=api_instance.cancel_options_order(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->cancel_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

countdown_cancel_all_options

TriggerTime countdown_cancel_all_options(countdown_cancel_all_options_task)

Countdown cancel orders

Option order heartbeat detection, when the timeout time set by the user is reached, if the existing countdown is not canceled or a new countdown is set, the related option pending order will be automatically canceled. This interface can be called repeatedly to set a new countdown or cancel the countdown. Usage example: Repeat this interface at intervals of 30 seconds, with each countdown timeout set to 30 (seconds). If this interface is not called again within 30 seconds, all pending orders on the underlyingcontract you specified will be automatically cancelled. If underlyingcontract is not specified, user will be automatically cancelled If timeout is set to 0 within 30 seconds, the countdown timer will expire and the automatic order cancellation function will be cancelled.

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
countdown_cancel_all_options_task=gate_api.CountdownCancelAllOptionsTask() # CountdownCancelAllOptionsTask | try:
# Countdown cancel ordersapi_response=api_instance.countdown_cancel_all_options(countdown_cancel_all_options_task)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->countdown_cancel_all_options: %s\n"%e)

Parameters

NameTypeDescriptionNotes
countdown_cancel_all_options_taskCountdownCancelAllOptionsTask

Return type

TriggerTime

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Countdown set successfully-

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

list_my_options_trades

list[OptionsMyTrade] list_my_options_trades(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)

Query personal trading records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Query personal trading recordsapi_response=api_instance.list_my_options_trades(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_my_options_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsMyTrade]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_mmp

list[OptionsMMP] get_options_mmp(underlying=underlying)

MMP Query.

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (optional)try:
# MMP Query.api_response=api_instance.get_options_mmp(underlying=underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying[optional]

Return type

list[OptionsMMP]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

set_options_mmp

OptionsMMP set_options_mmp(options_mmp)

MMP Settings

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_mmp=gate_api.OptionsMMP() # OptionsMMP | try:
# MMP Settingsapi_response=api_instance.set_options_mmp(options_mmp)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->set_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_mmpOptionsMMP

Return type

OptionsMMP

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200MMP Information-

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

reset_options_mmp

OptionsMMP reset_options_mmp(options_mmp_reset)

MMP Reset

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_mmp_reset=gate_api.OptionsMMPReset() # OptionsMMPReset | try:
# MMP Resetapi_response=api_instance.reset_options_mmp(options_mmp_reset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->reset_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_mmp_resetOptionsMMPReset

Return type

OptionsMMP

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200MMP Information-

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

, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' gateapi-python/docs/OptionsApi.md at master · gate/gateapi-python · GitHub
Skip to content

Latest commit

History

History
1966 lines (1479 loc) · 74 KB

File metadata and controls

1966 lines (1479 loc) · 74 KB

gate_api.OptionsApi

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

MethodHTTP requestDescription
list_options_underlyingsGET /options/underlyingsList all underlying assets
list_options_expirationsGET /options/expirationsList all expiration dates
list_options_contractsGET /options/contractsList all contracts for specified underlying and expiration date
get_options_contractGET /options/contracts/{contract}Query specified contract details
list_options_settlementsGET /options/settlementsList settlement history
get_options_settlementGET /options/settlements/{contract}Get specified contract settlement information
list_my_options_settlementsGET /options/my_settlementsQuery personal settlement records
list_options_order_bookGET /options/order_bookQuery options contract order book
list_options_tickersGET /options/tickersQuery options market ticker information
list_options_underlying_tickersGET /options/underlying/tickers/{underlying}Query underlying ticker information
list_options_candlesticksGET /options/candlesticksOptions contract market candlestick chart
list_options_underlying_candlesticksGET /options/underlying/candlesticksUnderlying index price candlestick chart
list_options_tradesGET /options/tradesMarket trade records
list_options_accountGET /options/accountsQuery account information
list_options_account_bookGET /options/account_bookQuery account change history
list_options_positionsGET /options/positionsList user's positions of specified underlying
get_options_positionGET /options/positions/{contract}Get specified contract position
list_options_position_closeGET /options/position_closeList user's liquidation history of specified underlying
list_options_ordersGET /options/ordersList options orders
create_options_orderPOST /options/ordersCreate an options order
cancel_options_ordersDELETE /options/ordersCancel all orders with 'open' status
get_options_orderGET /options/orders/{order_id}Query single order details
amend_options_orderPUT /options/orders/{order_id}Option Order Modification
cancel_options_orderDELETE /options/orders/{order_id}Cancel single order
countdown_cancel_all_optionsPOST /options/countdown_cancel_allCountdown cancel orders
list_my_options_tradesGET /options/my_tradesQuery personal trading records
get_options_mmpGET /options/mmpMMP Query.
set_options_mmpPOST /options/mmpMMP Settings
reset_options_mmpPOST /options/mmp/resetMMP Reset

list_options_underlyings

list[OptionsUnderlying] list_options_underlyings()

List all underlying assets

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
try:
# List all underlying assetsapi_response=api_instance.list_options_underlyings()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlyings: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

list[OptionsUnderlying]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_expirations

list[int] list_options_expirations(underlying)

List all expiration dates

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)try:
# List all expiration datesapi_response=api_instance.list_options_expirations(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_expirations: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)

Return type

list[int]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List expiration dates for specified underlying-

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

list_options_contracts

list[OptionsContract] list_options_contracts(underlying, expiration=expiration)

List all contracts for specified underlying and expiration date

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)expiration=1636588800# int | Unix timestamp of expiration date (optional)try:
# List all contracts for specified underlying and expiration dateapi_response=api_instance.list_options_contracts(underlying, expiration=expiration)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_contracts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
expirationintUnix timestamp of expiration date[optional]

Return type

list[OptionsContract]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_contract

OptionsContract get_options_contract(contract)

Query specified contract details

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | try:
# Query specified contract detailsapi_response=api_instance.get_options_contract(contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_contract: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr

Return type

OptionsContract

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_settlements

list[OptionsSettlement] list_options_settlements(underlying, limit=limit, offset=offset, _from=_from, to=to)

List settlement history

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# List settlement historyapi_response=api_instance.list_options_settlements(underlying, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsSettlement]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_settlement

OptionsSettlement get_options_settlement(contract, underlying, at)

Get specified contract settlement information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)at=56# int | try:
# Get specified contract settlement informationapi_response=api_instance.get_options_settlement(contract, underlying, at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_settlement: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr
underlyingstrUnderlying (Obtained by listing underlying endpoint)
atint

Return type

OptionsSettlement

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_my_options_settlements

list[OptionsMySettlements] list_my_options_settlements(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)

Query personal settlement records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Query personal settlement recordsapi_response=api_instance.list_my_options_settlements(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_my_options_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsMySettlements]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_order_book

OptionsOrderBook list_options_order_book(contract, interval=interval, limit=limit, with_id=with_id)

Query options contract order book

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

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract nameinterval='0'# str | Price precision for merged depth. 0 means no merging. If not specified, defaults to 0 (optional) (default to '0')limit=10# int | Number of depth levels (optional) (default to 10)with_id=False# bool | Whether to return depth update ID. This ID increments by 1 each time the depth changes (optional) (default to False)try:
# Query options contract order bookapi_response=api_instance.list_options_order_book(contract, interval=interval, limit=limit, with_id=with_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_order_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name
intervalstrPrice precision for merged depth. 0 means no merging. If not specified, defaults to 0[optional] [default to '0']
limitintNumber of depth levels[optional] [default to 10]
with_idboolWhether to return depth update ID. This ID increments by 1 each time the depth changes[optional] [default to False]

Return type

OptionsOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

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

list_options_tickers

list[OptionsTicker] list_options_tickers(underlying)

Query options market ticker information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)try:
# Query options market ticker informationapi_response=api_instance.list_options_tickers(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)

Return type

list[OptionsTicker]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_underlying_tickers

OptionsUnderlyingTicker list_options_underlying_tickers(underlying)

Query underlying ticker information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlyingtry:
# Query underlying ticker informationapi_response=api_instance.list_options_underlying_tickers(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlying_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying

Return type

OptionsUnderlyingTicker

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_candlesticks

list[OptionsCandlestick] list_options_candlesticks(contract, limit=limit, _from=_from, to=to, interval=interval)

Options contract market candlestick chart

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract namelimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)interval='5m'# str | Time interval between data points (optional) (default to '5m')try:
# Options contract market candlestick chartapi_response=api_instance.list_options_candlesticks(contract, limit=limit, _from=_from, to=to, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
intervalstrTime interval between data points[optional] [default to '5m']

Return type

list[OptionsCandlestick]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_underlying_candlesticks

list[OptionsCandlestick] list_options_underlying_candlesticks(underlying, limit=limit, _from=_from, to=to, interval=interval)

Underlying index price candlestick chart

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)interval='5m'# str | Time interval between data points (optional) (default to '5m')try:
# Underlying index price candlestick chartapi_response=api_instance.list_options_underlying_candlesticks(underlying, limit=limit, _from=_from, to=to, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlying_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
intervalstrTime interval between data points[optional] [default to '5m']

Return type

list[OptionsCandlestick]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_trades

list[OptionsTrade] list_options_trades(contract=contract, type=type, limit=limit, offset=offset, _from=_from, to=to)

Market trade records

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)type='1546935600'# str | `C` for call, `P` for put (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Market trade recordsapi_response=api_instance.list_options_trades(contract=contract, type=type, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name[optional]
typestr`C` for call, `P` for put[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsTrade]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_account

OptionsAccount list_options_account()

Query account information

Query account information for classic option account and unified account

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
try:
# Query account informationapi_response=api_instance.list_options_account()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_account: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

OptionsAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_account_book

list[OptionsAccountBook] list_options_account_book(limit=limit, offset=offset, _from=_from, to=to, type=type)

Query account change history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)type='dnw'# str | Change types: - dnw: Deposit & Withdrawal - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: Settlement P&L (optional)try:
# Query account change historyapi_response=api_instance.list_options_account_book(limit=limit, offset=offset, _from=_from, to=to, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_account_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typestrChange types: - dnw: Deposit & Withdrawal - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: Settlement P&L[optional]

Return type

list[OptionsAccountBook]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_positions

list[OptionsPosition] list_options_positions(underlying=underlying)

List user's positions of specified underlying

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (optional)try:
# List user's positions of specified underlyingapi_response=api_instance.list_options_positions(underlying=underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_positions: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying[optional]

Return type

list[OptionsPosition]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_position

OptionsPosition get_options_position(contract)

Get specified contract position

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | try:
# Get specified contract positionapi_response=api_instance.get_options_position(contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_position: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr

Return type

OptionsPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_position_close

list[OptionsPositionClose] list_options_position_close(underlying, contract=contract)

List user's liquidation history of specified underlying

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)try:
# List user's liquidation history of specified underlyingapi_response=api_instance.list_options_position_close(underlying, contract=contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_position_close: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]

Return type

list[OptionsPositionClose]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_orders

list[OptionsOrder] list_options_orders(status, contract=contract, underlying=underlying, limit=limit, offset=offset, _from=_from, to=to)

List options orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
status='open'# str | Query order list based on statuscontract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)underlying='BTC_USDT'# str | Underlying (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# List options ordersapi_response=api_instance.list_options_orders(status, contract=contract, underlying=underlying, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
statusstrQuery order list based on status
contractstrOptions contract name[optional]
underlyingstrUnderlying[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

create_options_order

OptionsOrder create_options_order(options_order)

Create an options order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_order=gate_api.OptionsOrder() # OptionsOrder | try:
# Create an options orderapi_response=api_instance.create_options_order(options_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->create_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_orderOptionsOrder

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order detail-

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

cancel_options_orders

list[OptionsOrder] cancel_options_orders(contract=contract, underlying=underlying, side=side)

Cancel all orders with 'open' status

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)underlying='BTC_USDT'# str | Underlying (optional)side='ask'# str | Specify all bids or all asks, both included if not specified (optional)try:
# Cancel all orders with 'open' statusapi_response=api_instance.cancel_options_orders(contract=contract, underlying=underlying, side=side)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->cancel_options_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name[optional]
underlyingstrUnderlying[optional]
sidestrSpecify all bids or all asks, both included if not specified[optional]

Return type

list[OptionsOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

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

get_options_order

OptionsOrder get_options_order(order_id)

Query single order details

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdtry:
# Query single order detailsapi_response=api_instance.get_options_order(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

amend_options_order

OptionsOrder amend_options_order(order_id, amend_options_order_request)

Option Order Modification

Modify the order price and/or quantity of a specified order; only orders with status 'open' are supported

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdamend_options_order_request=gate_api.AmendOptionsOrderRequest() # AmendOptionsOrderRequest | try:
# Option Order Modificationapi_response=api_instance.amend_options_order(order_id, amend_options_order_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->amend_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created
amend_options_order_requestAmendOptionsOrderRequest

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

cancel_options_order

OptionsOrder cancel_options_order(order_id)

Cancel single order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdtry:
# Cancel single orderapi_response=api_instance.cancel_options_order(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->cancel_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

countdown_cancel_all_options

TriggerTime countdown_cancel_all_options(countdown_cancel_all_options_task)

Countdown cancel orders

Option order heartbeat detection, when the timeout time set by the user is reached, if the existing countdown is not canceled or a new countdown is set, the related option pending order will be automatically canceled. This interface can be called repeatedly to set a new countdown or cancel the countdown. Usage example: Repeat this interface at intervals of 30 seconds, with each countdown timeout set to 30 (seconds). If this interface is not called again within 30 seconds, all pending orders on the underlyingcontract you specified will be automatically cancelled. If underlyingcontract is not specified, user will be automatically cancelled If timeout is set to 0 within 30 seconds, the countdown timer will expire and the automatic order cancellation function will be cancelled.

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
countdown_cancel_all_options_task=gate_api.CountdownCancelAllOptionsTask() # CountdownCancelAllOptionsTask | try:
# Countdown cancel ordersapi_response=api_instance.countdown_cancel_all_options(countdown_cancel_all_options_task)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->countdown_cancel_all_options: %s\n"%e)

Parameters

NameTypeDescriptionNotes
countdown_cancel_all_options_taskCountdownCancelAllOptionsTask

Return type

TriggerTime

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Countdown set successfully-

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

list_my_options_trades

list[OptionsMyTrade] list_my_options_trades(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)

Query personal trading records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Query personal trading recordsapi_response=api_instance.list_my_options_trades(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_my_options_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsMyTrade]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_mmp

list[OptionsMMP] get_options_mmp(underlying=underlying)

MMP Query.

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (optional)try:
# MMP Query.api_response=api_instance.get_options_mmp(underlying=underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying[optional]

Return type

list[OptionsMMP]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

set_options_mmp

OptionsMMP set_options_mmp(options_mmp)

MMP Settings

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_mmp=gate_api.OptionsMMP() # OptionsMMP | try:
# MMP Settingsapi_response=api_instance.set_options_mmp(options_mmp)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->set_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_mmpOptionsMMP

Return type

OptionsMMP

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200MMP Information-

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

reset_options_mmp

OptionsMMP reset_options_mmp(options_mmp_reset)

MMP Reset

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_mmp_reset=gate_api.OptionsMMPReset() # OptionsMMPReset | try:
# MMP Resetapi_response=api_instance.reset_options_mmp(options_mmp_reset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->reset_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_mmp_resetOptionsMMPReset

Return type

OptionsMMP

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200MMP Information-

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

, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); gateapi-python/docs/OptionsApi.md at master · gate/gateapi-python · GitHub
Skip to content

Latest commit

History

History
1966 lines (1479 loc) · 74 KB

File metadata and controls

1966 lines (1479 loc) · 74 KB

gate_api.OptionsApi

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

MethodHTTP requestDescription
list_options_underlyingsGET /options/underlyingsList all underlying assets
list_options_expirationsGET /options/expirationsList all expiration dates
list_options_contractsGET /options/contractsList all contracts for specified underlying and expiration date
get_options_contractGET /options/contracts/{contract}Query specified contract details
list_options_settlementsGET /options/settlementsList settlement history
get_options_settlementGET /options/settlements/{contract}Get specified contract settlement information
list_my_options_settlementsGET /options/my_settlementsQuery personal settlement records
list_options_order_bookGET /options/order_bookQuery options contract order book
list_options_tickersGET /options/tickersQuery options market ticker information
list_options_underlying_tickersGET /options/underlying/tickers/{underlying}Query underlying ticker information
list_options_candlesticksGET /options/candlesticksOptions contract market candlestick chart
list_options_underlying_candlesticksGET /options/underlying/candlesticksUnderlying index price candlestick chart
list_options_tradesGET /options/tradesMarket trade records
list_options_accountGET /options/accountsQuery account information
list_options_account_bookGET /options/account_bookQuery account change history
list_options_positionsGET /options/positionsList user's positions of specified underlying
get_options_positionGET /options/positions/{contract}Get specified contract position
list_options_position_closeGET /options/position_closeList user's liquidation history of specified underlying
list_options_ordersGET /options/ordersList options orders
create_options_orderPOST /options/ordersCreate an options order
cancel_options_ordersDELETE /options/ordersCancel all orders with 'open' status
get_options_orderGET /options/orders/{order_id}Query single order details
amend_options_orderPUT /options/orders/{order_id}Option Order Modification
cancel_options_orderDELETE /options/orders/{order_id}Cancel single order
countdown_cancel_all_optionsPOST /options/countdown_cancel_allCountdown cancel orders
list_my_options_tradesGET /options/my_tradesQuery personal trading records
get_options_mmpGET /options/mmpMMP Query.
set_options_mmpPOST /options/mmpMMP Settings
reset_options_mmpPOST /options/mmp/resetMMP Reset

list_options_underlyings

list[OptionsUnderlying] list_options_underlyings()

List all underlying assets

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
try:
# List all underlying assetsapi_response=api_instance.list_options_underlyings()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlyings: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

list[OptionsUnderlying]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_expirations

list[int] list_options_expirations(underlying)

List all expiration dates

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)try:
# List all expiration datesapi_response=api_instance.list_options_expirations(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_expirations: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)

Return type

list[int]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List expiration dates for specified underlying-

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

list_options_contracts

list[OptionsContract] list_options_contracts(underlying, expiration=expiration)

List all contracts for specified underlying and expiration date

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)expiration=1636588800# int | Unix timestamp of expiration date (optional)try:
# List all contracts for specified underlying and expiration dateapi_response=api_instance.list_options_contracts(underlying, expiration=expiration)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_contracts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
expirationintUnix timestamp of expiration date[optional]

Return type

list[OptionsContract]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_contract

OptionsContract get_options_contract(contract)

Query specified contract details

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | try:
# Query specified contract detailsapi_response=api_instance.get_options_contract(contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_contract: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr

Return type

OptionsContract

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_settlements

list[OptionsSettlement] list_options_settlements(underlying, limit=limit, offset=offset, _from=_from, to=to)

List settlement history

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# List settlement historyapi_response=api_instance.list_options_settlements(underlying, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsSettlement]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_settlement

OptionsSettlement get_options_settlement(contract, underlying, at)

Get specified contract settlement information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)at=56# int | try:
# Get specified contract settlement informationapi_response=api_instance.get_options_settlement(contract, underlying, at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_settlement: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr
underlyingstrUnderlying (Obtained by listing underlying endpoint)
atint

Return type

OptionsSettlement

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_my_options_settlements

list[OptionsMySettlements] list_my_options_settlements(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)

Query personal settlement records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Query personal settlement recordsapi_response=api_instance.list_my_options_settlements(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_my_options_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsMySettlements]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_order_book

OptionsOrderBook list_options_order_book(contract, interval=interval, limit=limit, with_id=with_id)

Query options contract order book

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

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract nameinterval='0'# str | Price precision for merged depth. 0 means no merging. If not specified, defaults to 0 (optional) (default to '0')limit=10# int | Number of depth levels (optional) (default to 10)with_id=False# bool | Whether to return depth update ID. This ID increments by 1 each time the depth changes (optional) (default to False)try:
# Query options contract order bookapi_response=api_instance.list_options_order_book(contract, interval=interval, limit=limit, with_id=with_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_order_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name
intervalstrPrice precision for merged depth. 0 means no merging. If not specified, defaults to 0[optional] [default to '0']
limitintNumber of depth levels[optional] [default to 10]
with_idboolWhether to return depth update ID. This ID increments by 1 each time the depth changes[optional] [default to False]

Return type

OptionsOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

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

list_options_tickers

list[OptionsTicker] list_options_tickers(underlying)

Query options market ticker information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)try:
# Query options market ticker informationapi_response=api_instance.list_options_tickers(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)

Return type

list[OptionsTicker]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_underlying_tickers

OptionsUnderlyingTicker list_options_underlying_tickers(underlying)

Query underlying ticker information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlyingtry:
# Query underlying ticker informationapi_response=api_instance.list_options_underlying_tickers(underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlying_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying

Return type

OptionsUnderlyingTicker

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_candlesticks

list[OptionsCandlestick] list_options_candlesticks(contract, limit=limit, _from=_from, to=to, interval=interval)

Options contract market candlestick chart

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract namelimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)interval='5m'# str | Time interval between data points (optional) (default to '5m')try:
# Options contract market candlestick chartapi_response=api_instance.list_options_candlesticks(contract, limit=limit, _from=_from, to=to, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
intervalstrTime interval between data points[optional] [default to '5m']

Return type

list[OptionsCandlestick]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_underlying_candlesticks

list[OptionsCandlestick] list_options_underlying_candlesticks(underlying, limit=limit, _from=_from, to=to, interval=interval)

Underlying index price candlestick chart

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)interval='5m'# str | Time interval between data points (optional) (default to '5m')try:
# Underlying index price candlestick chartapi_response=api_instance.list_options_underlying_candlesticks(underlying, limit=limit, _from=_from, to=to, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_underlying_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
intervalstrTime interval between data points[optional] [default to '5m']

Return type

list[OptionsCandlestick]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_trades

list[OptionsTrade] list_options_trades(contract=contract, type=type, limit=limit, offset=offset, _from=_from, to=to)

Market trade records

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)type='1546935600'# str | `C` for call, `P` for put (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Market trade recordsapi_response=api_instance.list_options_trades(contract=contract, type=type, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name[optional]
typestr`C` for call, `P` for put[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsTrade]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_account

OptionsAccount list_options_account()

Query account information

Query account information for classic option account and unified account

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
try:
# Query account informationapi_response=api_instance.list_options_account()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_account: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

OptionsAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_account_book

list[OptionsAccountBook] list_options_account_book(limit=limit, offset=offset, _from=_from, to=to, type=type)

Query account change history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)type='dnw'# str | Change types: - dnw: Deposit & Withdrawal - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: Settlement P&L (optional)try:
# Query account change historyapi_response=api_instance.list_options_account_book(limit=limit, offset=offset, _from=_from, to=to, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_account_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typestrChange types: - dnw: Deposit & Withdrawal - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: Settlement P&L[optional]

Return type

list[OptionsAccountBook]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_positions

list[OptionsPosition] list_options_positions(underlying=underlying)

List user's positions of specified underlying

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (optional)try:
# List user's positions of specified underlyingapi_response=api_instance.list_options_positions(underlying=underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_positions: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying[optional]

Return type

list[OptionsPosition]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_position

OptionsPosition get_options_position(contract)

Get specified contract position

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20211130-65000-C'# str | try:
# Get specified contract positionapi_response=api_instance.get_options_position(contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_position: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstr

Return type

OptionsPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_options_position_close

list[OptionsPositionClose] list_options_position_close(underlying, contract=contract)

List user's liquidation history of specified underlying

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)try:
# List user's liquidation history of specified underlyingapi_response=api_instance.list_options_position_close(underlying, contract=contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_position_close: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]

Return type

list[OptionsPositionClose]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_options_orders

list[OptionsOrder] list_options_orders(status, contract=contract, underlying=underlying, limit=limit, offset=offset, _from=_from, to=to)

List options orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
status='open'# str | Query order list based on statuscontract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)underlying='BTC_USDT'# str | Underlying (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# List options ordersapi_response=api_instance.list_options_orders(status, contract=contract, underlying=underlying, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_options_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
statusstrQuery order list based on status
contractstrOptions contract name[optional]
underlyingstrUnderlying[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

create_options_order

OptionsOrder create_options_order(options_order)

Create an options order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_order=gate_api.OptionsOrder() # OptionsOrder | try:
# Create an options orderapi_response=api_instance.create_options_order(options_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->create_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_orderOptionsOrder

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order detail-

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

cancel_options_orders

list[OptionsOrder] cancel_options_orders(contract=contract, underlying=underlying, side=side)

Cancel all orders with 'open' status

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)underlying='BTC_USDT'# str | Underlying (optional)side='ask'# str | Specify all bids or all asks, both included if not specified (optional)try:
# Cancel all orders with 'open' statusapi_response=api_instance.cancel_options_orders(contract=contract, underlying=underlying, side=side)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->cancel_options_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
contractstrOptions contract name[optional]
underlyingstrUnderlying[optional]
sidestrSpecify all bids or all asks, both included if not specified[optional]

Return type

list[OptionsOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

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

get_options_order

OptionsOrder get_options_order(order_id)

Query single order details

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdtry:
# Query single order detailsapi_response=api_instance.get_options_order(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

amend_options_order

OptionsOrder amend_options_order(order_id, amend_options_order_request)

Option Order Modification

Modify the order price and/or quantity of a specified order; only orders with status 'open' are supported

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdamend_options_order_request=gate_api.AmendOptionsOrderRequest() # AmendOptionsOrderRequest | try:
# Option Order Modificationapi_response=api_instance.amend_options_order(order_id, amend_options_order_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->amend_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created
amend_options_order_requestAmendOptionsOrderRequest

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

cancel_options_order

OptionsOrder cancel_options_order(order_id)

Cancel single order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
order_id=12345# int | Order ID returned when order is successfully createdtry:
# Cancel single orderapi_response=api_instance.cancel_options_order(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->cancel_options_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idintOrder ID returned when order is successfully created

Return type

OptionsOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order detail-

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

countdown_cancel_all_options

TriggerTime countdown_cancel_all_options(countdown_cancel_all_options_task)

Countdown cancel orders

Option order heartbeat detection, when the timeout time set by the user is reached, if the existing countdown is not canceled or a new countdown is set, the related option pending order will be automatically canceled. This interface can be called repeatedly to set a new countdown or cancel the countdown. Usage example: Repeat this interface at intervals of 30 seconds, with each countdown timeout set to 30 (seconds). If this interface is not called again within 30 seconds, all pending orders on the underlyingcontract you specified will be automatically cancelled. If underlyingcontract is not specified, user will be automatically cancelled If timeout is set to 0 within 30 seconds, the countdown timer will expire and the automatic order cancellation function will be cancelled.

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
countdown_cancel_all_options_task=gate_api.CountdownCancelAllOptionsTask() # CountdownCancelAllOptionsTask | try:
# Countdown cancel ordersapi_response=api_instance.countdown_cancel_all_options(countdown_cancel_all_options_task)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->countdown_cancel_all_options: %s\n"%e)

Parameters

NameTypeDescriptionNotes
countdown_cancel_all_options_taskCountdownCancelAllOptionsTask

Return type

TriggerTime

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Countdown set successfully-

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

list_my_options_trades

list[OptionsMyTrade] list_my_options_trades(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)

Query personal trading records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (Obtained by listing underlying endpoint)contract='BTC_USDT-20210916-5000-C'# str | Options contract name (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)_from=1547706332# int | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)try:
# Query personal trading recordsapi_response=api_instance.list_my_options_trades(underlying, contract=contract, limit=limit, offset=offset, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->list_my_options_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying (Obtained by listing underlying endpoint)
contractstrOptions contract name[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
_fromintStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]

Return type

list[OptionsMyTrade]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_options_mmp

list[OptionsMMP] get_options_mmp(underlying=underlying)

MMP Query.

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
underlying='BTC_USDT'# str | Underlying (optional)try:
# MMP Query.api_response=api_instance.get_options_mmp(underlying=underlying)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->get_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
underlyingstrUnderlying[optional]

Return type

list[OptionsMMP]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

set_options_mmp

OptionsMMP set_options_mmp(options_mmp)

MMP Settings

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_mmp=gate_api.OptionsMMP() # OptionsMMP | try:
# MMP Settingsapi_response=api_instance.set_options_mmp(options_mmp)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->set_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_mmpOptionsMMP

Return type

OptionsMMP

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200MMP Information-

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

reset_options_mmp

OptionsMMP reset_options_mmp(options_mmp_reset)

MMP Reset

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.OptionsApi(api_client)
options_mmp_reset=gate_api.OptionsMMPReset() # OptionsMMPReset | try:
# MMP Resetapi_response=api_instance.reset_options_mmp(options_mmp_reset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling OptionsApi->reset_options_mmp: %s\n"%e)

Parameters

NameTypeDescriptionNotes
options_mmp_resetOptionsMMPReset

Return type

OptionsMMP

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200MMP Information-

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