Skip to content

Commit c6eeb4d

Browse files
committed
add futures stats and single margin pair query
1 parent f97e64e commit c6eeb4d

19 files changed

Lines changed: 692 additions & 36 deletions

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ APIv4 provides spot, margin and futures trading operations. There are public API
33

44
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
55

6-
- API version: 4.15.4
7-
- Package version: 4.15.4
6+
- API version: 4.15.5
7+
- Package version: 4.15.5
88
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
99
For more information, please visit [https://www.gate.io/page/contacts](https://www.gate.io/page/contacts)
1010

@@ -142,6 +142,7 @@ Class | Method | HTTP request | Description
142142
*FuturesApi* | [**list_futures_tickers**](docs/FuturesApi.md#list_futures_tickers) | **GET** /futures/{settle}/tickers | List futures tickers
143143
*FuturesApi* | [**list_futures_funding_rate_history**](docs/FuturesApi.md#list_futures_funding_rate_history) | **GET** /futures/{settle}/funding_rate | Funding rate history
144144
*FuturesApi* | [**list_futures_insurance_ledger**](docs/FuturesApi.md#list_futures_insurance_ledger) | **GET** /futures/{settle}/insurance | Futures insurance balance history
145+
*FuturesApi* | [**list_contract_stats**](docs/FuturesApi.md#list_contract_stats) | **GET** /futures/{settle}/contract_stats | Futures stats
145146
*FuturesApi* | [**list_futures_accounts**](docs/FuturesApi.md#list_futures_accounts) | **GET** /futures/{settle}/accounts | Query futures account
146147
*FuturesApi* | [**list_futures_account_book**](docs/FuturesApi.md#list_futures_account_book) | **GET** /futures/{settle}/account_book | Query account book
147148
*FuturesApi* | [**list_positions**](docs/FuturesApi.md#list_positions) | **GET** /futures/{settle}/positions | List all positions of a user
@@ -163,6 +164,7 @@ Class | Method | HTTP request | Description
163164
*FuturesApi* | [**get_price_triggered_order**](docs/FuturesApi.md#get_price_triggered_order) | **GET** /futures/{settle}/price_orders/{order_id} | Get a single order
164165
*FuturesApi* | [**cancel_price_triggered_order**](docs/FuturesApi.md#cancel_price_triggered_order) | **DELETE** /futures/{settle}/price_orders/{order_id} | Cancel a single order
165166
*MarginApi* | [**list_margin_currency_pairs**](docs/MarginApi.md#list_margin_currency_pairs) | **GET** /margin/currency_pairs | List all supported currency pairs supported in margin trading
167+
*MarginApi* | [**get_margin_currency_pair**](docs/MarginApi.md#get_margin_currency_pair) | **GET** /margin/currency_pairs/{currency_pair} | Query one single margin currency pair
166168
*MarginApi* | [**list_funding_book**](docs/MarginApi.md#list_funding_book) | **GET** /margin/funding_book | Order book of lending loans
167169
*MarginApi* | [**list_margin_accounts**](docs/MarginApi.md#list_margin_accounts) | **GET** /margin/accounts | Margin account list
168170
*MarginApi* | [**list_margin_account_book**](docs/MarginApi.md#list_margin_account_book) | **GET** /margin/account_book | List margin account balance change history
@@ -211,6 +213,7 @@ Class | Method | HTTP request | Description
211213
- [CancelOrder](docs/CancelOrder.md)
212214
- [CancelOrderResult](docs/CancelOrderResult.md)
213215
- [Contract](docs/Contract.md)
216+
- [ContractStat](docs/ContractStat.md)
214217
- [CurrencyPair](docs/CurrencyPair.md)
215218
- [DeliveryContract](docs/DeliveryContract.md)
216219
- [DeliverySettlement](docs/DeliverySettlement.md)

docs/ContractStat.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# ContractStat
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**time** | **int** | Stat timestamp | [optional]
7+
**lsr_taker** | **float** | Long/short account number ratio | [optional]
8+
**lsr_account** | **float** | Long/short taker size ratio | [optional]
9+
**liq_size** | **int** | Liquidation size | [optional]
10+
**open_interest** | **int** | Open interest | [optional]
11+
12+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
13+
14+

docs/DeliveryApi.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ settle = 'usdt' # str | Settle currency
242242
contract = 'BTC_USDT_20200814' # str | Futures contract
243243
limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100)
244244
last_id = '12345' # str | Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range (optional)
245-
_from = 1546905600 # float | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional)
246-
to = 1546935600 # float | Specify end time in Unix seconds, default to current time (optional)
245+
_from = 1546905600 # int | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional)
246+
to = 1546935600 # int | Specify end time in Unix seconds, default to current time (optional)
247247

248248
try:
249249
# Futures trading history
@@ -263,8 +263,8 @@ Name | Type | Description | Notes
263263
**contract** | **str**| Futures contract |
264264
**limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100]
265265
**last_id** | **str**| Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range | [optional]
266-
**_from** | **float**| Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. | [optional]
267-
**to** | **float**| Specify end time in Unix seconds, default to current time | [optional]
266+
**_from** | **int**| Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. | [optional]
267+
**to** | **int**| Specify end time in Unix seconds, default to current time | [optional]
268268

269269
### Return type
270270

@@ -310,8 +310,8 @@ api_client = gate_api.ApiClient(configuration)
310310
api_instance = gate_api.DeliveryApi(api_client)
311311
settle = 'usdt' # str | Settle currency
312312
contract = 'BTC_USDT_20200814' # str | Futures contract
313-
_from = 1546905600 # float | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional)
314-
to = 1546935600 # float | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional)
313+
_from = 1546905600 # int | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional)
314+
to = 1546935600 # int | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional)
315315
limit = 100 # int | Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional) (default to 100)
316316
interval = '5m' # str | Interval time between data points (optional) (default to '5m')
317317

@@ -331,8 +331,8 @@ Name | Type | Description | Notes
331331
------------- | ------------- | ------------- | -------------
332332
**settle** | **str**| Settle currency |
333333
**contract** | **str**| Futures contract |
334-
**_from** | **float**| Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified | [optional]
335-
**to** | **float**| End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time | [optional]
334+
**_from** | **int**| Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified | [optional]
335+
**to** | **int**| End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time | [optional]
336336
**limit** | **int**| Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. | [optional] [default to 100]
337337
**interval** | **str**| Interval time between data points | [optional] [default to '5m']
338338

docs/FuturesApi.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Method | HTTP request | Description
1212
[**list_futures_tickers**](FuturesApi.md#list_futures_tickers) | **GET** /futures/{settle}/tickers | List futures tickers
1313
[**list_futures_funding_rate_history**](FuturesApi.md#list_futures_funding_rate_history) | **GET** /futures/{settle}/funding_rate | Funding rate history
1414
[**list_futures_insurance_ledger**](FuturesApi.md#list_futures_insurance_ledger) | **GET** /futures/{settle}/insurance | Futures insurance balance history
15+
[**list_contract_stats**](FuturesApi.md#list_contract_stats) | **GET** /futures/{settle}/contract_stats | Futures stats
1516
[**list_futures_accounts**](FuturesApi.md#list_futures_accounts) | **GET** /futures/{settle}/accounts | Query futures account
1617
[**list_futures_account_book**](FuturesApi.md#list_futures_account_book) | **GET** /futures/{settle}/account_book | Query account book
1718
[**list_positions**](FuturesApi.md#list_positions) | **GET** /futures/{settle}/positions | List all positions of a user
@@ -538,6 +539,70 @@ No authorization required
538539

539540
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
540541

542+
# **list_contract_stats**
543+
> list[ContractStat] list_contract_stats(settle, contract, interval=interval, limit=limit)
544+
545+
Futures stats
546+
547+
### Example
548+
549+
```python
550+
from __future__ import print_function
551+
import gate_api
552+
from gate_api.exceptions import ApiException, GateApiException
553+
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
554+
# See configuration.py for a list of all supported configuration parameters.
555+
configuration = gate_api.Configuration(
556+
host = "https://api.gateio.ws/api/v4"
557+
)
558+
559+
api_client = gate_api.ApiClient(configuration)
560+
# Create an instance of the API class
561+
api_instance = gate_api.FuturesApi(api_client)
562+
settle = 'btc' # str | Settle currency (default to 'btc')
563+
contract = 'BTC_USD' # str | Futures contract
564+
interval = '5m' # str | (optional) (default to '5m')
565+
limit = 30 # int | (optional) (default to 30)
566+
567+
try:
568+
# Futures stats
569+
api_response = api_instance.list_contract_stats(settle, contract, interval=interval, limit=limit)
570+
print(api_response)
571+
except GateApiException as ex:
572+
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
573+
except ApiException as e:
574+
print("Exception when calling FuturesApi->list_contract_stats: %s\n" % e)
575+
```
576+
577+
### Parameters
578+
579+
Name | Type | Description | Notes
580+
------------- | ------------- | ------------- | -------------
581+
**settle** | **str**| Settle currency | [default to 'btc']
582+
**contract** | **str**| Futures contract |
583+
**interval** | **str**| | [optional] [default to '5m']
584+
**limit** | **int**| | [optional] [default to 30]
585+
586+
### Return type
587+
588+
[**list[ContractStat]**](ContractStat.md)
589+
590+
### Authorization
591+
592+
No authorization required
593+
594+
### HTTP request headers
595+
596+
- **Content-Type**: Not defined
597+
- **Accept**: application/json
598+
599+
### HTTP response details
600+
| Status code | Description | Response headers |
601+
|-------------|-------------|------------------|
602+
**200** | List retrieved | - |
603+
604+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
605+
541606
# **list_futures_accounts**
542607
> FuturesAccount list_futures_accounts(settle)
543608

docs/MarginApi.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ All URIs are relative to *https://api.gateio.ws/api/v4*
55
Method | HTTP request | Description
66
------------- | ------------- | -------------
77
[**list_margin_currency_pairs**](MarginApi.md#list_margin_currency_pairs) | **GET** /margin/currency_pairs | List all supported currency pairs supported in margin trading
8+
[**get_margin_currency_pair**](MarginApi.md#get_margin_currency_pair) | **GET** /margin/currency_pairs/{currency_pair} | Query one single margin currency pair
89
[**list_funding_book**](MarginApi.md#list_funding_book) | **GET** /margin/funding_book | Order book of lending loans
910
[**list_margin_accounts**](MarginApi.md#list_margin_accounts) | **GET** /margin/accounts | Margin account list
1011
[**list_margin_account_book**](MarginApi.md#list_margin_account_book) | **GET** /margin/account_book | List margin account balance change history
@@ -76,6 +77,64 @@ No authorization required
7677

7778
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
7879

80+
# **get_margin_currency_pair**
81+
> MarginCurrencyPair get_margin_currency_pair(currency_pair)
82+
83+
Query one single margin currency pair
84+
85+
### Example
86+
87+
```python
88+
from __future__ import print_function
89+
import gate_api
90+
from gate_api.exceptions import ApiException, GateApiException
91+
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
92+
# See configuration.py for a list of all supported configuration parameters.
93+
configuration = gate_api.Configuration(
94+
host = "https://api.gateio.ws/api/v4"
95+
)
96+
97+
api_client = gate_api.ApiClient(configuration)
98+
# Create an instance of the API class
99+
api_instance = gate_api.MarginApi(api_client)
100+
currency_pair = 'BTC_USDT' # str | Margin currency pair
101+
102+
try:
103+
# Query one single margin currency pair
104+
api_response = api_instance.get_margin_currency_pair(currency_pair)
105+
print(api_response)
106+
except GateApiException as ex:
107+
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
108+
except ApiException as e:
109+
print("Exception when calling MarginApi->get_margin_currency_pair: %s\n" % e)
110+
```
111+
112+
### Parameters
113+
114+
Name | Type | Description | Notes
115+
------------- | ------------- | ------------- | -------------
116+
**currency_pair** | **str**| Margin currency pair |
117+
118+
### Return type
119+
120+
[**MarginCurrencyPair**](MarginCurrencyPair.md)
121+
122+
### Authorization
123+
124+
No authorization required
125+
126+
### HTTP request headers
127+
128+
- **Content-Type**: Not defined
129+
- **Accept**: application/json
130+
131+
### HTTP response details
132+
| Status code | Description | Response headers |
133+
|-------------|-------------|------------------|
134+
**200** | Successfully retrieved | - |
135+
136+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
137+
79138
# **list_funding_book**
80139
> list[FundingBookItem] list_funding_book(currency)
81140

docs/OrderBook.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Properties
44
Name | Type | Description | Notes
55
------------ | ------------- | ------------- | -------------
6+
**id** | **int** | Order book ID, which is updated whenever the order book is changed. Valid only when `with_id` is set to `true` | [optional]
67
**asks** | **list[list[str]]** | Asks order depth |
78
**bids** | **list[list[str]]** | Bids order depth |
89

docs/SpotApi.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ No authorization required
196196
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
197197

198198
# **list_order_book**
199-
> OrderBook list_order_book(currency_pair, interval=interval, limit=limit)
199+
> OrderBook list_order_book(currency_pair, interval=interval, limit=limit, with_id=with_id)
200200
201201
Retrieve order book
202202

@@ -220,10 +220,11 @@ api_instance = gate_api.SpotApi(api_client)
220220
currency_pair = 'BTC_USDT' # str | Currency pair
221221
interval = '0' # str | Order depth. 0 means no aggregation is applied. default to 0 (optional) (default to '0')
222222
limit = 10 # int | Maximum number of order depth data in asks or bids (optional) (default to 10)
223+
with_id = False # bool | Return order book ID (optional) (default to False)
223224

224225
try:
225226
# Retrieve order book
226-
api_response = api_instance.list_order_book(currency_pair, interval=interval, limit=limit)
227+
api_response = api_instance.list_order_book(currency_pair, interval=interval, limit=limit, with_id=with_id)
227228
print(api_response)
228229
except GateApiException as ex:
229230
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
@@ -238,6 +239,7 @@ Name | Type | Description | Notes
238239
**currency_pair** | **str**| Currency pair |
239240
**interval** | **str**| Order depth. 0 means no aggregation is applied. default to 0 | [optional] [default to '0']
240241
**limit** | **int**| Maximum number of order depth data in asks or bids | [optional] [default to 10]
242+
**with_id** | **bool**| Return order book ID | [optional] [default to False]
241243

242244
### Return type
243245

docs/WalletApi.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ api_client = gate_api.ApiClient(configuration)
112112
# Create an instance of the API class
113113
api_instance = gate_api.WalletApi(api_client)
114114
currency = 'BTC' # str | Filter by currency. Return all currency records if not specified (optional)
115-
_from = 56 # int | Time range beginning, default to 7 days before current time (optional)
116-
to = 56 # int | Time range ending, default to current time (optional)
115+
_from = 1602120000 # int | Time range beginning, default to 7 days before current time (optional)
116+
to = 1602123600 # int | Time range ending, default to current time (optional)
117117
limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100)
118118
offset = 0 # int | List offset, starting from 0 (optional) (default to 0)
119119

@@ -189,8 +189,8 @@ api_client = gate_api.ApiClient(configuration)
189189
# Create an instance of the API class
190190
api_instance = gate_api.WalletApi(api_client)
191191
currency = 'BTC' # str | Filter by currency. Return all currency records if not specified (optional)
192-
_from = 56 # int | Time range beginning, default to 7 days before current time (optional)
193-
to = 56 # int | Time range ending, default to current time (optional)
192+
_from = 1602120000 # int | Time range beginning, default to 7 days before current time (optional)
193+
to = 1602123600 # int | Time range ending, default to current time (optional)
194194
limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100)
195195
offset = 0 # int | List offset, starting from 0 (optional) (default to 0)
196196

@@ -334,8 +334,8 @@ api_client = gate_api.ApiClient(configuration)
334334
# Create an instance of the API class
335335
api_instance = gate_api.WalletApi(api_client)
336336
sub_uid = '10003' # str | Sub account user ID. Return records related to all sub accounts if not specified (optional)
337-
_from = 56 # int | Time range beginning, default to 7 days before current time (optional)
338-
to = 56 # int | Time range ending, default to current time (optional)
337+
_from = 1602120000 # int | Time range beginning, default to 7 days before current time (optional)
338+
to = 1602123600 # int | Time range ending, default to current time (optional)
339339
limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100)
340340
offset = 0 # int | List offset, starting from 0 (optional) (default to 0)
341341

gate_api/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from __future__ import absolute_import
1616

17-
__version__ = "4.15.4"
17+
__version__ = "4.15.5"
1818

1919
# import apis into sdk package
2020
from gate_api.api.delivery_api import DeliveryApi
@@ -38,6 +38,7 @@
3838
from gate_api.models.cancel_order import CancelOrder
3939
from gate_api.models.cancel_order_result import CancelOrderResult
4040
from gate_api.models.contract import Contract
41+
from gate_api.models.contract_stat import ContractStat
4142
from gate_api.models.currency_pair import CurrencyPair
4243
from gate_api.models.delivery_contract import DeliveryContract
4344
from gate_api.models.delivery_settlement import DeliverySettlement

0 commit comments

Comments
 (0)