11# gate-client
2- APIv4 合约接口提供了与合约交易相关的操作,包括公共接口查询合约市场行情,以及需要认证的私有接口, 实现基于 API 的自动交易。 API 文档按照 OpenAPI v3 标准制定 API 文档, 方便 API 使用者能够轻松生成需要的客户端代码,快速接入新的功能
2+ APIv4 futures provides all sorts of futures trading operations. There are public APIs to retrieve the real-time market statistics,
3+ and private APIs which needs authentication to trade on user's behalf.
34
45This Python package is automatically generated by the [ OpenAPI Generator] ( https://openapi-generator.tech ) project:
56
@@ -47,36 +48,25 @@ Please follow the [installation procedure](#installation--usage) and then run th
4748
4849``` python
4950from __future__ import print_function
50- import time
5151import gate_client
5252from gate_client.rest import ApiException
53- from pprint import pprint
5453
5554# Configure API key authorization: api_key
5655configuration = gate_client.Configuration()
57- configuration.api_key[' KEY' ] = ' YOUR_API_KEY'
58- # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
59- # configuration.api_key_prefix['KEY'] = 'Bearer'
60- # Configure API key authorization: api_sign
61- configuration = gate_client.Configuration()
62- configuration.api_key[' SIGN' ] = ' YOUR_API_KEY'
63- # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
64- # configuration.api_key_prefix['SIGN'] = 'Bearer'
65- # Configure API key authorization: api_timestamp
66- configuration = gate_client.Configuration()
67- configuration.api_key[' Timestamp' ] = ' YOUR_API_KEY'
68- # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
69- # configuration.api_key_prefix['Timestamp'] = 'Bearer'
56+ configuration.key = " YOUR_API_KEY"
57+ configuration.secret = " YOUR_API_SECRET"
58+ # uncomment the next line if you are testing the API with TestNet
59+ # configuration.host = "https://fx-api-testnet.gateio.io/api/v4"
7060
7161# create an instance of the API class
7262api_instance = gate_client.FuturesApi(gate_client.ApiClient(configuration))
73- order_id = ' order_id_example' # str | 成功创建订单时返回的 ID
7463
7564try :
76- # 撤销单个订单
77- api_instance.cancel_order(order_id)
65+ order = gate_client.FuturesOrder(contract = ' BTC_USD' , size = 100 , price = " 4000" )
66+ order = api_instance.create_order(futures_order = order)
67+ print (order.id)
7868except ApiException as e:
79- print (" Exception when calling FuturesApi->cancel_order : %s \n " % e)
69+ print (" Exception when calling FuturesApi->create_order : %s \n " % e)
8070
8171```
8272
@@ -86,68 +76,43 @@ All URIs are relative to *https://fx-api.gateio.io/api/v4*
8676
8777Class | Method | HTTP request | Description
8878------------ | ------------- | ------------- | -------------
89- * FuturesApi* | [ ** cancel_order** ] ( docs/FuturesApi.md#cancel_order ) | ** DELETE** /futures/orders/{order_id} | 撤销单个订单
90- * FuturesApi* | [ ** cancel_orders** ] ( docs/FuturesApi.md#cancel_orders ) | ** DELETE** /futures/orders | 批量取消状态为 open 的订单
91- * FuturesApi* | [ ** create_order** ] ( docs/FuturesApi.md#create_order ) | ** POST** /futures/orders | 期货交易下单
92- * FuturesApi* | [ ** get_my_trades** ] ( docs/FuturesApi.md#get_my_trades ) | ** GET** /futures/my_trades | 查询个人成交记录
93- * FuturesApi* | [ ** get_order** ] ( docs/FuturesApi.md#get_order ) | ** GET** /futures/orders/{order_id} | 查询单个订单详情
94- * FuturesApi* | [ ** list_futures_accounts** ] ( docs/FuturesApi.md#list_futures_accounts ) | ** GET** /futures/accounts | 获取期货账号
95- * FuturesApi* | [ ** list_futures_candlesticks** ] ( docs/FuturesApi.md#list_futures_candlesticks ) | ** GET** /futures/candlesticks | 期货市场 K 线图
96- * FuturesApi* | [ ** list_futures_contracts** ] ( docs/FuturesApi.md#list_futures_contracts ) | ** GET** /futures/contracts | 查询所有的期货信息
97- * FuturesApi* | [ ** list_futures_funding_rate_history** ] ( docs/FuturesApi.md#list_futures_funding_rate_history ) | ** GET** /futures/funding_rate | 期货市场历史资金费率
98- * FuturesApi* | [ ** list_futures_insurance_ledger** ] ( docs/FuturesApi.md#list_futures_insurance_ledger ) | ** GET** /futures/insurance | 期货市场保险基金历史
99- * FuturesApi* | [ ** list_futures_order_book** ] ( docs/FuturesApi.md#list_futures_order_book ) | ** GET** /futures/order_book | 查询期货市场深度信息
100- * FuturesApi* | [ ** list_futures_tickers** ] ( docs/FuturesApi.md#list_futures_tickers ) | ** GET** /futures/tickers | 获取所有期货交易行情统计
101- * FuturesApi* | [ ** list_futures_trades** ] ( docs/FuturesApi.md#list_futures_trades ) | ** GET** /futures/trades | 期货市场成交记录
102- * FuturesApi* | [ ** list_orders** ] ( docs/FuturesApi.md#list_orders ) | ** GET** /futures/orders | 查询订单列表
103- * FuturesApi* | [ ** list_positions** ] ( docs/FuturesApi.md#list_positions ) | ** GET** /futures/positions | 获取用户头寸列表
104- * FuturesApi* | [ ** update_position_leverage** ] ( docs/FuturesApi.md#update_position_leverage ) | ** POST** /futures/positions/{contract}/leverage | 更新头寸杠杆
105- * FuturesApi* | [ ** update_position_margin** ] ( docs/FuturesApi.md#update_position_margin ) | ** POST** /futures/positions/{contract}/margin | 更新头寸保证金
106- * FuturesApi* | [ ** update_position_risk_limit** ] ( docs/FuturesApi.md#update_position_risk_limit ) | ** POST** /futures/positions/{contract}/risk_limit | 更新头寸风险限额
79+ * FuturesApi* | [ ** cancel_order** ] ( docs/FuturesApi.md#cancel_order ) | ** DELETE** /futures/orders/{order_id} | Cancel a single order
80+ * FuturesApi* | [ ** cancel_orders** ] ( docs/FuturesApi.md#cancel_orders ) | ** DELETE** /futures/orders | Cancel all &#x 60 ; open&#x 60 ; orders matched
81+ * FuturesApi* | [ ** create_order** ] ( docs/FuturesApi.md#create_order ) | ** POST** /futures/orders | Create a futures order
82+ * FuturesApi* | [ ** get_my_trades** ] ( docs/FuturesApi.md#get_my_trades ) | ** GET** /futures/my_trades | List personal trading history
83+ * FuturesApi* | [ ** get_order** ] ( docs/FuturesApi.md#get_order ) | ** GET** /futures/orders/{order_id} | Get a single order
84+ * FuturesApi* | [ ** list_futures_accounts** ] ( docs/FuturesApi.md#list_futures_accounts ) | ** GET** /futures/accounts | Query futures account
85+ * FuturesApi* | [ ** list_futures_candlesticks** ] ( docs/FuturesApi.md#list_futures_candlesticks ) | ** GET** /futures/candlesticks | Get futures candlesticks
86+ * FuturesApi* | [ ** list_futures_contracts** ] ( docs/FuturesApi.md#list_futures_contracts ) | ** GET** /futures/contracts | List all futures contracts
87+ * FuturesApi* | [ ** list_futures_funding_rate_history** ] ( docs/FuturesApi.md#list_futures_funding_rate_history ) | ** GET** /futures/funding_rate | Funding rate history
88+ * FuturesApi* | [ ** list_futures_insurance_ledger** ] ( docs/FuturesApi.md#list_futures_insurance_ledger ) | ** GET** /futures/insurance | Futures insurance balance history
89+ * FuturesApi* | [ ** list_futures_order_book** ] ( docs/FuturesApi.md#list_futures_order_book ) | ** GET** /futures/order_book | Futures order book
90+ * FuturesApi* | [ ** list_futures_tickers** ] ( docs/FuturesApi.md#list_futures_tickers ) | ** GET** /futures/tickers | List futures tickers
91+ * FuturesApi* | [ ** list_futures_trades** ] ( docs/FuturesApi.md#list_futures_trades ) | ** GET** /futures/trades | Futures trading history
92+ * FuturesApi* | [ ** list_orders** ] ( docs/FuturesApi.md#list_orders ) | ** GET** /futures/orders | List futures orders
93+ * FuturesApi* | [ ** list_positions** ] ( docs/FuturesApi.md#list_positions ) | ** GET** /futures/positions | List all positions
94+ * FuturesApi* | [ ** update_position_leverage** ] ( docs/FuturesApi.md#update_position_leverage ) | ** POST** /futures/positions/{contract}/leverage | Update position leverage
95+ * FuturesApi* | [ ** update_position_margin** ] ( docs/FuturesApi.md#update_position_margin ) | ** POST** /futures/positions/{contract}/margin | Update position margin
96+ * FuturesApi* | [ ** update_position_risk_limit** ] ( docs/FuturesApi.md#update_position_risk_limit ) | ** POST** /futures/positions/{contract}/risk_limit | Update poisition risk limit
10797
10898
10999## Documentation For Models
110100
111101 - [ Contract] ( docs/Contract.md )
112- - [ FundingRateHistory] ( docs/FundingRateHistory.md )
113- - [ FundingRateHistoryInner] ( docs/FundingRateHistoryInner.md )
102+ - [ FundingRateRecord] ( docs/FundingRateRecord.md )
114103 - [ FuturesAccount] ( docs/FuturesAccount.md )
115- - [ FuturesCandlesticks] ( docs/FuturesCandlesticks.md )
116- - [ FuturesCandlesticksInner] ( docs/FuturesCandlesticksInner.md )
104+ - [ FuturesCandlestick] ( docs/FuturesCandlestick.md )
117105 - [ FuturesErrorResponse] ( docs/FuturesErrorResponse.md )
118106 - [ FuturesOrder] ( docs/FuturesOrder.md )
119107 - [ FuturesOrderBook] ( docs/FuturesOrderBook.md )
120- - [ FuturesOrderBookAsks ] ( docs/FuturesOrderBookAsks .md )
108+ - [ FuturesOrderBookItem ] ( docs/FuturesOrderBookItem .md )
121109 - [ FuturesTicker] ( docs/FuturesTicker.md )
122110 - [ FuturesTrade] ( docs/FuturesTrade.md )
123111 - [ InsuranceRecord] ( docs/InsuranceRecord.md )
124- - [ InsuranceRecordInner] ( docs/InsuranceRecordInner.md )
125112 - [ MyFuturesTrade] ( docs/MyFuturesTrade.md )
126113 - [ Position] ( docs/Position.md )
127114
128115
129- ## Documentation For Authorization
130-
131-
132- ## api_key
133-
134- - ** Type** : API key
135- - ** API key parameter name** : KEY
136- - ** Location** : HTTP header
137-
138- ## api_sign
139-
140- - ** Type** : API key
141- - ** API key parameter name** : SIGN
142- - ** Location** : HTTP header
143-
144- ## api_timestamp
145-
146- - ** Type** : API key
147- - ** API key parameter name** : Timestamp
148- - ** Location** : HTTP header
149-
150-
151116## Author
152117
153118support@mail.gate.io
0 commit comments