APIv4 provides spot, margin and 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: 4.6.1
- Package version: 4.6.1
- Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit https://www.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/gateio/gateapi-python.git
(you may need to run pip
with root permission: sudo pip install git+https://github.com/gateio/gateapi-python.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_api
Please 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_futures_order(order_id)
print(api_response)
except ApiException as e:
print("Exception when calling FuturesApi->cancel_futures_order: %s\n" % e)
All URIs are relative to https://api.gateio.ws/api/v4
Class | Method | HTTP request | Description |
---|---|---|---|
FuturesApi | cancel_futures_order | DELETE /futures/orders/{order_id} | Cancel a single order |
FuturesApi | cancel_futures_orders | DELETE /futures/orders | Cancel all `open` orders matched |
FuturesApi | cancel_price_triggered_order | DELETE /futures/price_orders/{order_id} | Cancel a single order |
FuturesApi | cancel_price_triggered_order_list | DELETE /futures/price_orders | Cancel all open orders |
FuturesApi | create_futures_order | POST /futures/orders | Create a futures order |
FuturesApi | create_price_triggered_order | POST /futures/price_orders | Create a price-triggered order |
FuturesApi | get_futures_contract | GET /futures/contracts/{contract} | Get a single contract |
FuturesApi | get_futures_order | GET /futures/orders/{order_id} | Get a single order |
FuturesApi | get_my_trades | GET /futures/my_trades | List personal trading history |
FuturesApi | get_position | GET /futures/positions/{contract} | Get single position |
FuturesApi | get_price_triggered_order | GET /futures/price_orders/{order_id} | Get a single order |
FuturesApi | list_futures_account_book | GET /futures/account_book | Query account book |
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_orders | GET /futures/orders | List futures orders |
FuturesApi | list_futures_tickers | GET /futures/tickers | List futures tickers |
FuturesApi | list_futures_trades | GET /futures/trades | Futures trading history |
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 | list_price_triggered_orders | GET /futures/price_orders | List all auto orders |
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 |
MarginApi | cancel_loan | DELETE /margin/loans/{loan_id} | Cancel lending loan |
MarginApi | create_loan | POST /margin/loans | Lend or borrow |
MarginApi | get_loan | GET /margin/loans/{loan_id} | Retrieve one single loan detail |
MarginApi | get_loan_record | GET /margin/loan_records/{loan_record_id} | Get one single loan record |
MarginApi | list_funding_accounts | GET /margin/funding_accounts | Funding account list |
MarginApi | list_funding_book | GET /margin/funding_book | Order book of lending loans |
MarginApi | list_loan_records | GET /margin/loan_records | List repayment records of specified loan |
MarginApi | list_loan_repayments | GET /margin/loans/{loan_id}/repayment | List loan repayment records |
MarginApi | list_loans | GET /margin/loans | List all loans |
MarginApi | list_margin_accounts | GET /margin/accounts | Margin account list |
MarginApi | list_margin_currency_pairs | GET /margin/currency_pairs | List all supported currency pairs supported in margin trading |
MarginApi | merge_loans | POST /margin/merged_loans | Merge multiple lending loans |
MarginApi | repay_loan | POST /margin/loans/{loan_id}/repayment | Repay a loan |
MarginApi | update_loan | PATCH /margin/loans/{loan_id} | Modify a loan |
MarginApi | update_loan_record | PATCH /margin/loan_records/{loan_record_id} | Modify a loan record |
SpotApi | cancel_order | DELETE /spot/orders/{order_id} | Cancel a single order |
SpotApi | cancel_orders | DELETE /spot/orders | Cancel all `open` orders in specified currency pair |
SpotApi | create_order | POST /spot/orders | Create an order |
SpotApi | get_currency_pair | GET /spot/currency_pairs/{currency_pair} | Get detail of one single order |
SpotApi | get_order | GET /spot/orders/{order_id} | Get a single order |
SpotApi | list_candlesticks | GET /spot/candlesticks | Market candlesticks |
SpotApi | list_currency_pairs | GET /spot/currency_pairs | List all currency pairs supported |
SpotApi | list_my_trades | GET /spot/my_trades | List personal trading history |
SpotApi | list_order_book | GET /spot/order_book | Retrieve order book |
SpotApi | list_orders | GET /spot/orders | List futures orders |
SpotApi | list_spot_accounts | GET /spot/accounts | List spot accounts |
SpotApi | list_tickers | GET /spot/tickers | Retrieve ticker information |
SpotApi | list_trades | GET /spot/trades | Retrieve market trades |
- Contract
- CurrencyPair
- FundingAccount
- FundingBookItem
- FundingRateRecord
- FuturesAccount
- FuturesAccountBook
- FuturesCandlestick
- FuturesInitialOrder
- FuturesOrder
- FuturesOrderBook
- FuturesOrderBookItem
- FuturesPriceTrigger
- FuturesPriceTriggeredOrder
- FuturesTicker
- FuturesTrade
- InsuranceRecord
- Loan
- LoanPatch
- LoanRecord
- MarginAccount
- MarginAccountCurrency
- MarginCurrencyPair
- MyFuturesTrade
- Order
- OrderBook
- Position
- PositionClose
- PositionCloseOrder
- RepayRequest
- Repayment
- SpotAccount
- Ticker
- Trade
- TriggerOrderResponse