ga
gate-api
pypi i gate-api
ga

gate-api

Gate API v4

by gate.io

4.26.0 (see all)License:Apache License 2.0
pypi i gate-api
Readme

gate-api

Welcome to Gate.io API

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.26.0
  • Package version: 4.26.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit https://www.gate.io/page/contacts

Versioning

Trying our best to follow the semantic versioning, while enjoying recent features provided by programming language and libraries, from 4.15.2, one major versioning difference will be introduced:

If extra code rewrite is required when you upgrade the SDK, such as:

  • some outdated programming language version support is dropped
  • API method signature has breaking changes.

the MAJOR version will be incremented, but the MINOR and PATCH version are still following REST API's instead of resetting to 0, so that you can recognize it has some breaking changes, but still getting the idea of from which REST API version the change is introduced.

For example, the previous REST API and SDK version are both 4.14.0. But if we decide to introduce some breaking changes in SDK along with REST API 4.15.2 upgrade, then the version of next SDK release will be 5.15.2(the MAJOR version is incremented to denote breaking changes, but the MINOR and PATCH version are identical to REST API's instead of resetting them to 0)

If MAJOR version is incremented, make sure you read the release note on Releases page

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

You can install directly using:

pip install --user gate-api

Then import the package:

import gate_api

Setuptools

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

Getting Started

Please follow the installation procedure and then run the following:

from __future__ import print_function

import gate_api
from gate_api.exceptions import ApiException, 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 class
api_instance = gate_api.DeliveryApi(api_client)
settle = 'usdt' # str | Settle currency

try:
    # List all futures contracts
    api_response = api_instance.list_delivery_contracts(settle)
    print(api_response)
except GateApiException as ex:
    print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
    print("Exception when calling DeliveryApi->list_delivery_contracts: %s\n" % e)

For a more complete API usage example, refer to the demo application in example directory

Documentation for API Endpoints

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

ClassMethodHTTP requestDescription
DeliveryApilist_delivery_contractsGET /delivery/{settle}/contractsList all futures contracts
DeliveryApiget_delivery_contractGET /delivery/{settle}/contracts/{contract}Get a single contract
DeliveryApilist_delivery_order_bookGET /delivery/{settle}/order_bookFutures order book
DeliveryApilist_delivery_tradesGET /delivery/{settle}/tradesFutures trading history
DeliveryApilist_delivery_candlesticksGET /delivery/{settle}/candlesticksGet futures candlesticks
DeliveryApilist_delivery_tickersGET /delivery/{settle}/tickersList futures tickers
DeliveryApilist_delivery_insurance_ledgerGET /delivery/{settle}/insuranceFutures insurance balance history
DeliveryApilist_delivery_accountsGET /delivery/{settle}/accountsQuery futures account
DeliveryApilist_delivery_account_bookGET /delivery/{settle}/account_bookQuery account book
DeliveryApilist_delivery_positionsGET /delivery/{settle}/positionsList all positions of a user
DeliveryApiget_delivery_positionGET /delivery/{settle}/positions/{contract}Get single position
DeliveryApiupdate_delivery_position_marginPOST /delivery/{settle}/positions/{contract}/marginUpdate position margin
DeliveryApiupdate_delivery_position_leveragePOST /delivery/{settle}/positions/{contract}/leverageUpdate position leverage
DeliveryApiupdate_delivery_position_risk_limitPOST /delivery/{settle}/positions/{contract}/risk_limitUpdate position risk limit
DeliveryApilist_delivery_ordersGET /delivery/{settle}/ordersList futures orders
DeliveryApicreate_delivery_orderPOST /delivery/{settle}/ordersCreate a futures order
DeliveryApicancel_delivery_ordersDELETE /delivery/{settle}/ordersCancel all `open` orders matched
DeliveryApiget_delivery_orderGET /delivery/{settle}/orders/{order_id}Get a single order
DeliveryApicancel_delivery_orderDELETE /delivery/{settle}/orders/{order_id}Cancel a single order
DeliveryApiget_my_delivery_tradesGET /delivery/{settle}/my_tradesList personal trading history
DeliveryApilist_delivery_position_closeGET /delivery/{settle}/position_closeList position close history
DeliveryApilist_delivery_liquidatesGET /delivery/{settle}/liquidatesList liquidation history
DeliveryApilist_delivery_settlementsGET /delivery/{settle}/settlementsList settlement history
DeliveryApilist_price_triggered_delivery_ordersGET /delivery/{settle}/price_ordersList all auto orders
DeliveryApicreate_price_triggered_delivery_orderPOST /delivery/{settle}/price_ordersCreate a price-triggered order
DeliveryApicancel_price_triggered_delivery_order_listDELETE /delivery/{settle}/price_ordersCancel all open orders
DeliveryApiget_price_triggered_delivery_orderGET /delivery/{settle}/price_orders/{order_id}Get a single order
DeliveryApicancel_price_triggered_delivery_orderDELETE /delivery/{settle}/price_orders/{order_id}cancel a price-triggered order
FlashSwapApilist_flash_swap_currenciesGET /flash_swap/currenciesList all supported currencies in flash swap
FlashSwapApilist_flash_swap_ordersGET /flash_swap/ordersList all flash swap orders
FlashSwapApicreate_flash_swap_orderPOST /flash_swap/ordersCreate a flash swap order
FlashSwapApiget_flash_swap_orderGET /flash_swap/orders/{order_id}Get a single flash swap order's detail
FlashSwapApipreview_flash_swap_orderPOST /flash_swap/orders/previewInitiate a flash swap order preview
FuturesApilist_futures_contractsGET /futures/{settle}/contractsList all futures contracts
FuturesApiget_futures_contractGET /futures/{settle}/contracts/{contract}Get a single contract
FuturesApilist_futures_order_bookGET /futures/{settle}/order_bookFutures order book
FuturesApilist_futures_tradesGET /futures/{settle}/tradesFutures trading history
FuturesApilist_futures_candlesticksGET /futures/{settle}/candlesticksGet futures candlesticks
FuturesApilist_futures_tickersGET /futures/{settle}/tickersList futures tickers
FuturesApilist_futures_funding_rate_historyGET /futures/{settle}/funding_rateFunding rate history
FuturesApilist_futures_insurance_ledgerGET /futures/{settle}/insuranceFutures insurance balance history
FuturesApilist_contract_statsGET /futures/{settle}/contract_statsFutures stats
FuturesApiget_index_constituentsGET /futures/{settle}/index_constituents/{index}Get index constituents
FuturesApilist_liquidated_ordersGET /futures/{settle}/liq_ordersRetrieve liquidation history
FuturesApilist_futures_accountsGET /futures/{settle}/accountsQuery futures account
FuturesApilist_futures_account_bookGET /futures/{settle}/account_bookQuery account book
FuturesApilist_positionsGET /futures/{settle}/positionsList all positions of a user
FuturesApiget_positionGET /futures/{settle}/positions/{contract}Get single position
FuturesApiupdate_position_marginPOST /futures/{settle}/positions/{contract}/marginUpdate position margin
FuturesApiupdate_position_leveragePOST /futures/{settle}/positions/{contract}/leverageUpdate position leverage
FuturesApiupdate_position_risk_limitPOST /futures/{settle}/positions/{contract}/risk_limitUpdate position risk limit
FuturesApiset_dual_modePOST /futures/{settle}/dual_modeEnable or disable dual mode
FuturesApiget_dual_mode_positionGET /futures/{settle}/dual_comp/positions/{contract}Retrieve position detail in dual mode
FuturesApiupdate_dual_mode_position_marginPOST /futures/{settle}/dual_comp/positions/{contract}/marginUpdate position margin in dual mode
FuturesApiupdate_dual_mode_position_leveragePOST /futures/{settle}/dual_comp/positions/{contract}/leverageUpdate position leverage in dual mode
FuturesApiupdate_dual_mode_position_risk_limitPOST /futures/{settle}/dual_comp/positions/{contract}/risk_limitUpdate position risk limit in dual mode
FuturesApilist_futures_ordersGET /futures/{settle}/ordersList futures orders
FuturesApicreate_futures_orderPOST /futures/{settle}/ordersCreate a futures order
FuturesApicancel_futures_ordersDELETE /futures/{settle}/ordersCancel all `open` orders matched
FuturesApiget_futures_orderGET /futures/{settle}/orders/{order_id}Get a single order
FuturesApiamend_futures_orderPUT /futures/{settle}/orders/{order_id}Amend an order
FuturesApicancel_futures_orderDELETE /futures/{settle}/orders/{order_id}Cancel a single order
FuturesApiget_my_tradesGET /futures/{settle}/my_tradesList personal trading history
FuturesApilist_position_closeGET /futures/{settle}/position_closeList position close history
FuturesApilist_liquidatesGET /futures/{settle}/liquidatesList liquidation history
FuturesApilist_price_triggered_ordersGET /futures/{settle}/price_ordersList all auto orders
FuturesApicreate_price_triggered_orderPOST /futures/{settle}/price_ordersCreate a price-triggered order
FuturesApicancel_price_triggered_order_listDELETE /futures/{settle}/price_ordersCancel all open orders
FuturesApiget_price_triggered_orderGET /futures/{settle}/price_orders/{order_id}Get a single order
FuturesApicancel_price_triggered_orderDELETE /futures/{settle}/price_orders/{order_id}cancel a price-triggered order
MarginApilist_margin_currency_pairsGET /margin/currency_pairsList all supported currency pairs supported in margin trading
MarginApiget_margin_currency_pairGET /margin/currency_pairs/{currency_pair}Query one single margin currency pair
MarginApilist_funding_bookGET /margin/funding_bookOrder book of lending loans
MarginApilist_margin_accountsGET /margin/accountsMargin account list
MarginApilist_margin_account_bookGET /margin/account_bookList margin account balance change history
MarginApilist_funding_accountsGET /margin/funding_accountsFunding account list
MarginApilist_loansGET /margin/loansList all loans
MarginApicreate_loanPOST /margin/loansLend or borrow
MarginApimerge_loansPOST /margin/merged_loansMerge multiple lending loans
MarginApiget_loanGET /margin/loans/{loan_id}Retrieve one single loan detail
MarginApicancel_loanDELETE /margin/loans/{loan_id}Cancel lending loan
MarginApiupdate_loanPATCH /margin/loans/{loan_id}Modify a loan
MarginApilist_loan_repaymentsGET /margin/loans/{loan_id}/repaymentList loan repayment records
MarginApirepay_loanPOST /margin/loans/{loan_id}/repaymentRepay a loan
MarginApilist_loan_recordsGET /margin/loan_recordsList repayment records of a specific loan
MarginApiget_loan_recordGET /margin/loan_records/{loan_record_id}Get one single loan record
MarginApiupdate_loan_recordPATCH /margin/loan_records/{loan_record_id}Modify a loan record
MarginApiget_auto_repay_statusGET /margin/auto_repayRetrieve user auto repayment setting
MarginApiset_auto_repayPOST /margin/auto_repayUpdate user's auto repayment setting
MarginApiget_margin_transferableGET /margin/transferableGet the max transferable amount for a specific margin currency
MarginApiget_margin_borrowableGET /margin/borrowableGet the max borrowable amount for a specific margin currency
MarginApilist_cross_margin_currenciesGET /margin/cross/currenciesCurrencies supported by cross margin.
MarginApiget_cross_margin_currencyGET /margin/cross/currencies/{currency}Retrieve detail of one single currency supported by cross margin
MarginApiget_cross_margin_accountGET /margin/cross/accountsRetrieve cross margin account
MarginApilist_cross_margin_account_bookGET /margin/cross/account_bookRetrieve cross margin account change history
MarginApilist_cross_margin_loansGET /margin/cross/loansList cross margin borrow history
MarginApicreate_cross_margin_loanPOST /margin/cross/loansCreate a cross margin borrow loan
MarginApiget_cross_margin_loanGET /margin/cross/loans/{loan_id}Retrieve single borrow loan detail
MarginApilist_cross_margin_repaymentsGET /margin/cross/repaymentsRetrieve cross margin repayments
MarginApirepay_cross_margin_loanPOST /margin/cross/repaymentsWhen the liquidity of the currency is insufficient and the transaction risk is high, the currency will be disabled, and funds cannot be transferred.When the available balance of cross-margin is insufficient, the balance of the spot account can be used for repayment. Please ensure that the balance of the spot account is sufficient, and system uses cross-margin account for repayment first
MarginApiget_cross_margin_transferableGET /margin/cross/transferableGet the max transferable amount for a specific cross margin currency
MarginApiget_cross_margin_borrowableGET /margin/cross/borrowableGet the max borrowable amount for a specific cross margin currency
OptionsApilist_options_underlyingsGET /options/underlyingsList all underlyings
OptionsApilist_options_expirationsGET /options/expirationsList all expiration times
OptionsApilist_options_contractsGET /options/contractsList all the contracts with specified underlying and expiration time
OptionsApiget_options_contractGET /options/contracts/{contract}Query specified contract detail
OptionsApilist_options_settlementsGET /options/settlementsList settlement history
OptionsApiget_options_settlementGET /options/settlements/{contract}Get specified contract's settlement
OptionsApilist_my_options_settlementsGET /options/my_settlementsList my options settlements
OptionsApilist_options_order_bookGET /options/order_bookFutures order book
OptionsApilist_options_tickersGET /options/tickersList tickers of options contracts
OptionsApilist_options_underlying_tickersGET /options/underlying/tickers/{underlying}Get underlying ticker
OptionsApilist_options_candlesticksGET /options/candlesticksGet futures candlesticks
OptionsApilist_options_underlying_candlesticksGET /options/underlying/candlesticksMark price candlesticks of an underlying
OptionsApilist_options_tradesGET /options/tradesOptions trade history
OptionsApilist_options_accountGET /options/accountsList options account
OptionsApilist_options_account_bookGET /options/account_bookList account changing history
OptionsApilist_options_positionsGET /options/positionsList user's positions of specified underlying
OptionsApiget_options_positionGET /options/positions/{contract}Get specified contract position
OptionsApilist_options_position_closeGET /options/position_closeList user's liquidation history of specified underlying
OptionsApilist_options_ordersGET /options/ordersList futures orders
OptionsApicreate_options_orderPOST /options/ordersCreate an options order
OptionsApicancel_options_ordersDELETE /options/ordersCancel all `open` orders matched
OptionsApiget_options_orderGET /options/orders/{order_id}Get a single order
OptionsApicancel_options_orderDELETE /options/orders/{order_id}Cancel a single order
OptionsApilist_my_options_tradesGET /options/my_tradesList personal trading history
SpotApilist_currenciesGET /spot/currenciesList all currencies' details
SpotApiget_currencyGET /spot/currencies/{currency}Get details of a specific currency
SpotApilist_currency_pairsGET /spot/currency_pairsList all currency pairs supported
SpotApiget_currency_pairGET /spot/currency_pairs/{currency_pair}Get details of a specifc order
SpotApilist_tickersGET /spot/tickersRetrieve ticker information
SpotApilist_order_bookGET /spot/order_bookRetrieve order book
SpotApilist_tradesGET /spot/tradesRetrieve market trades
SpotApilist_candlesticksGET /spot/candlesticksMarket candlesticks
SpotApiget_feeGET /spot/feeQuery user trading fee rates
SpotApilist_spot_accountsGET /spot/accountsList spot accounts
SpotApicreate_batch_ordersPOST /spot/batch_ordersCreate a batch of orders
SpotApilist_all_open_ordersGET /spot/open_ordersList all open orders
SpotApicreate_cross_liquidate_orderPOST /spot/cross_liquidate_ordersclose position when cross-currency is disabled
SpotApilist_ordersGET /spot/ordersList orders
SpotApicreate_orderPOST /spot/ordersCreate an order
SpotApicancel_ordersDELETE /spot/ordersCancel all `open` orders in specified currency pair
SpotApicancel_batch_ordersPOST /spot/cancel_batch_ordersCancel a batch of orders with an ID list
SpotApiget_orderGET /spot/orders/{order_id}Get a single order
SpotApicancel_orderDELETE /spot/orders/{order_id}Cancel a single order
SpotApilist_my_tradesGET /spot/my_tradesList personal trading history
SpotApiget_system_timeGET /spot/timeGet server current time
SpotApilist_spot_price_triggered_ordersGET /spot/price_ordersRetrieve running auto order list
SpotApicreate_spot_price_triggered_orderPOST /spot/price_ordersCreate a price-triggered order
SpotApicancel_spot_price_triggered_order_listDELETE /spot/price_ordersCancel all open orders
SpotApiget_spot_price_triggered_orderGET /spot/price_orders/{order_id}Get a single order
SpotApicancel_spot_price_triggered_orderDELETE /spot/price_orders/{order_id}cancel a price-triggered order
WalletApilist_currency_chainsGET /wallet/currency_chainsList chains supported for specified currency
WalletApiget_deposit_addressGET /wallet/deposit_addressGenerate currency deposit address
WalletApilist_withdrawalsGET /wallet/withdrawalsRetrieve withdrawal records
WalletApilist_depositsGET /wallet/depositsRetrieve deposit records
WalletApitransferPOST /wallet/transfersTransfer between trading accounts
WalletApilist_sub_account_transfersGET /wallet/sub_account_transfersRetrieve transfer records between main and sub accounts
WalletApitransfer_with_sub_accountPOST /wallet/sub_account_transfersTransfer between main and sub accounts
WalletApilist_withdraw_statusGET /wallet/withdraw_statusRetrieve withdrawal status
WalletApilist_sub_account_balancesGET /wallet/sub_account_balancesRetrieve sub account balances
WalletApilist_sub_account_margin_balancesGET /wallet/sub_account_margin_balancesQuery sub accounts' margin balances
WalletApilist_sub_account_futures_balancesGET /wallet/sub_account_futures_balancesQuery sub accounts' futures account balances
WalletApilist_sub_account_cross_margin_balancesGET /wallet/sub_account_cross_margin_balancesQuery subaccount's cross_margin account info
WalletApilist_saved_addressGET /wallet/saved_addressQuery saved address
WalletApiget_trade_feeGET /wallet/feeRetrieve personal trading fee
WalletApiget_total_balanceGET /wallet/total_balanceRetrieve user's total balances
WithdrawalApiwithdrawPOST /withdrawalsWithdraw
WithdrawalApicancel_withdrawalDELETE /withdrawals/{withdrawal_id}Cancel withdrawal with specified ID

Documentation For Models

Documentation For Authorization

apiv4

Authentication with APIv4 key and secret

For details, refer to: APIv4 signed request requirements

Author

support@mail.gate.io

GitHub Stars

163

LAST COMMIT

7mos ago

MAINTAINERS

1

CONTRIBUTORS

2

OPEN ISSUES

18

OPEN PRs

0
VersionTagPublished
4.26.0
1mo ago
4.25.1
1mo ago
4.24.0
2mos ago
4.23.4
4mos ago
No alternatives found
No tutorials found
Add a tutorial