APIv4 futures provides all sorts of futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf.
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 1.1.0
- Package version: 1.1.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit https://gate.io/page/contacts
Python 2.7 and 3.4+
If the python package is hosted on Github, you can install directly from Github
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)
Then import the package:
import gate_api Install via Setuptools.
python setup.py install --user(or sudo python setup.py install to install the package for all users)
Then import the package:
import gate_apiPlease follow the installation procedure and then run the following:
from __future__ import print_function
import gate_api
from gate_api.rest import ApiException
configuration = gate_api.Configuration()
configuration.key = 'YOUR_API_KEY'
configuration.secret = 'YOUR_API_SECRET'
# uncomment the next line if using the API with another host
configuration.host = 'https://some-other-host'
# create an instance of the API class
api_instance = gate_api.FuturesApi(gate_api.ApiClient(configuration))
order_id = '12345' # str | ID returned on order successfully being created
try:
# Cancel a single order
api_response = api_instance.cancel_order(order_id)
print(api_response)
except ApiException as e:
print("Exception when calling FuturesApi->cancel_order: %s\n" % e)All URIs are relative to https://fx-api.gateio.io/api/v4
| Class | Method | HTTP request | Description |
|---|---|---|---|
| FuturesApi | cancel_order | DELETE /futures/orders/{order_id} | Cancel a single order |
| FuturesApi | cancel_orders | DELETE /futures/orders | Cancel all `open` orders matched |
| FuturesApi | create_order | POST /futures/orders | Create a futures order |
| FuturesApi | get_my_trades | GET /futures/my_trades | List personal trading history |
| FuturesApi | get_order | GET /futures/orders/{order_id} | Get a single order |
| FuturesApi | list_futures_accounts | GET /futures/accounts | Query futures account |
| FuturesApi | list_futures_candlesticks | GET /futures/candlesticks | Get futures candlesticks |
| FuturesApi | list_futures_contracts | GET /futures/contracts | List all futures contracts |
| FuturesApi | list_futures_funding_rate_history | GET /futures/funding_rate | Funding rate history |
| FuturesApi | list_futures_insurance_ledger | GET /futures/insurance | Futures insurance balance history |
| FuturesApi | list_futures_order_book | GET /futures/order_book | Futures order book |
| FuturesApi | list_futures_tickers | GET /futures/tickers | List futures tickers |
| FuturesApi | list_futures_trades | GET /futures/trades | Futures trading history |
| FuturesApi | list_orders | GET /futures/orders | List futures orders |
| FuturesApi | list_position_close | GET /futures/position_close | List position close history |
| FuturesApi | list_positions | GET /futures/positions | List all positions of a user |
| FuturesApi | update_position_leverage | POST /futures/positions/{contract}/leverage | Update position leverage |
| FuturesApi | update_position_margin | POST /futures/positions/{contract}/margin | Update position margin |
| FuturesApi | update_position_risk_limit | POST /futures/positions/{contract}/risk_limit | Update position risk limit |