Skip to content

Commit 2f10575

Browse files
committed
spot public trades supports time range query
1 parent 8bbc6d5 commit 2f10575

9 files changed

Lines changed: 58 additions & 30 deletions

File tree

README.md

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

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

8-
- API version: 4.22.2
9-
- Package version: 4.22.2
8+
- API version: 4.22.3
9+
- Package version: 4.22.3
1010
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
1111
For more information, please visit [https://www.gate.io/page/contacts](https://www.gate.io/page/contacts)
1212

docs/MarginApi.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ api_client = gate_api.ApiClient(configuration)
308308
api_instance = gate_api.MarginApi(api_client)
309309
currency = 'currency_example' # str | List records related to specified currency only. If specified, `currency_pair` is also required. (optional)
310310
currency_pair = 'currency_pair_example' # str | List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided (optional)
311-
_from = 56 # int | Time range beginning, default to 7 days before current time (optional)
312-
to = 56 # int | Time range ending, default to current time (optional)
311+
_from = 1627706330 # int | Start timestamp of the query (optional)
312+
to = 1635329650 # int | Time range ending, default to current time (optional)
313313
page = 1 # int | Page number (optional) (default to 1)
314314
limit = 100 # int | Maximum number of records to be returned in a single list (optional) (default to 100)
315315

@@ -329,7 +329,7 @@ Name | Type | Description | Notes
329329
------------- | ------------- | ------------- | -------------
330330
**currency** | **str**| List records related to specified currency only. If specified, `currency_pair` is also required. | [optional]
331331
**currency_pair** | **str**| List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided | [optional]
332-
**_from** | **int**| Time range beginning, default to 7 days before current time | [optional]
332+
**_from** | **int**| Start timestamp of the query | [optional]
333333
**to** | **int**| Time range ending, default to current time | [optional]
334334
**page** | **int**| Page number | [optional] [default to 1]
335335
**limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100]
@@ -1673,8 +1673,8 @@ api_client = gate_api.ApiClient(configuration)
16731673
# Create an instance of the API class
16741674
api_instance = gate_api.MarginApi(api_client)
16751675
currency = 'currency_example' # str | Filter by currency (optional)
1676-
_from = 56 # int | Time range beginning, default to 7 days before current time (optional)
1677-
to = 56 # int | Time range ending, default to current time (optional)
1676+
_from = 1627706330 # int | Start timestamp of the query (optional)
1677+
to = 1635329650 # int | Time range ending, default to current time (optional)
16781678
page = 1 # int | Page number (optional) (default to 1)
16791679
limit = 100 # int | Maximum number of records to be returned in a single list (optional) (default to 100)
16801680
type = 'borrow' # str | Only retrieve changes of the specified type. All types will be returned if not specified. (optional)
@@ -1694,7 +1694,7 @@ except ApiException as e:
16941694
Name | Type | Description | Notes
16951695
------------- | ------------- | ------------- | -------------
16961696
**currency** | **str**| Filter by currency | [optional]
1697-
**_from** | **int**| Time range beginning, default to 7 days before current time | [optional]
1697+
**_from** | **int**| Start timestamp of the query | [optional]
16981698
**to** | **int**| Time range ending, default to current time | [optional]
16991699
**page** | **int**| Page number | [optional] [default to 1]
17001700
**limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100]

docs/SpotApi.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,12 @@ No authorization required
381381
[[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)
382382

383383
# **list_trades**
384-
> list[Trade] list_trades(currency_pair, limit=limit, last_id=last_id, reverse=reverse)
384+
> list[Trade] list_trades(currency_pair, limit=limit, last_id=last_id, reverse=reverse, _from=_from, to=to, page=page)
385385
386386
Retrieve market trades
387387

388+
You can use `from` and `to` to query by time range, or use `last_id` by scrolling page. The default behavior is by time range. Scrolling query using `last_id` is not recommended any more. If `last_id` is specified, time range query parameters will be ignored.
389+
388390
### Example
389391

390392
```python
@@ -404,10 +406,13 @@ currency_pair = 'BTC_USDT' # str | Currency pair
404406
limit = 100 # int | Maximum number of records to be returned in a single list (optional) (default to 100)
405407
last_id = '12345' # str | Specify list staring point using the `id` of last record in previous list-query results (optional)
406408
reverse = False # bool | Whether the id of records to be retrieved should be smaller than the last_id specified- true: Retrieve records where id is smaller than the specified last_id- false: Retrieve records where id is larger than the specified last_idDefault to false. When `last_id` is specified. Set `reverse` to `true` to trace back trading history; `false` to retrieve latest tradings. No effect if `last_id` is not specified. (optional) (default to False)
409+
_from = 1627706330 # int | Start timestamp of the query (optional)
410+
to = 1635329650 # int | Time range ending, default to current time (optional)
411+
page = 1 # int | Page number (optional) (default to 1)
407412

408413
try:
409414
# Retrieve market trades
410-
api_response = api_instance.list_trades(currency_pair, limit=limit, last_id=last_id, reverse=reverse)
415+
api_response = api_instance.list_trades(currency_pair, limit=limit, last_id=last_id, reverse=reverse, _from=_from, to=to, page=page)
411416
print(api_response)
412417
except GateApiException as ex:
413418
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
@@ -423,6 +428,9 @@ Name | Type | Description | Notes
423428
**limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100]
424429
**last_id** | **str**| Specify list staring point using the `id` of last record in previous list-query results | [optional]
425430
**reverse** | **bool**| Whether the id of records to be retrieved should be smaller than the last_id specified- true: Retrieve records where id is smaller than the specified last_id- false: Retrieve records where id is larger than the specified last_idDefault to false. When `last_id` is specified. Set `reverse` to `true` to trace back trading history; `false` to retrieve latest tradings. No effect if `last_id` is not specified. | [optional] [default to False]
431+
**_from** | **int**| Start timestamp of the query | [optional]
432+
**to** | **int**| Time range ending, default to current time | [optional]
433+
**page** | **int**| Page number | [optional] [default to 1]
426434

427435
### Return type
428436

@@ -826,8 +834,8 @@ status = 'open' # str | List orders based on status `open` - order is waiting t
826834
page = 1 # int | Page number (optional) (default to 1)
827835
limit = 100 # int | Maximum number of records to be returned. If `status` is `open`, maximum of `limit` is 100 (optional) (default to 100)
828836
account = 'cross_margin' # str | Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional)
829-
_from = 56 # int | Time range beginning, default to 7 days before current time (optional)
830-
to = 56 # int | Time range ending, default to current time (optional)
837+
_from = 1627706330 # int | Start timestamp of the query (optional)
838+
to = 1635329650 # int | Time range ending, default to current time (optional)
831839
side = 'sell' # str | All bids or asks. Both included if not specified (optional)
832840

833841
try:
@@ -849,7 +857,7 @@ Name | Type | Description | Notes
849857
**page** | **int**| Page number | [optional] [default to 1]
850858
**limit** | **int**| Maximum number of records to be returned. If `status` is `open`, maximum of `limit` is 100 | [optional] [default to 100]
851859
**account** | **str**| Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account | [optional]
852-
**_from** | **int**| Time range beginning, default to 7 days before current time | [optional]
860+
**_from** | **int**| Start timestamp of the query | [optional]
853861
**to** | **int**| Time range ending, default to current time | [optional]
854862
**side** | **str**| All bids or asks. Both included if not specified | [optional]
855863

@@ -1266,8 +1274,8 @@ limit = 100 # int | Maximum number of records to be returned in a single list (o
12661274
page = 1 # int | Page number (optional) (default to 1)
12671275
order_id = '12345' # str | Filter trades with specified order ID. `currency_pair` is also required if this field is present (optional)
12681276
account = 'cross_margin' # str | Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional)
1269-
_from = 56 # int | Time range beginning, default to 7 days before current time (optional)
1270-
to = 56 # int | Time range ending, default to current time (optional)
1277+
_from = 1627706330 # int | Start timestamp of the query (optional)
1278+
to = 1635329650 # int | Time range ending, default to current time (optional)
12711279

12721280
try:
12731281
# List personal trading history
@@ -1288,7 +1296,7 @@ Name | Type | Description | Notes
12881296
**page** | **int**| Page number | [optional] [default to 1]
12891297
**order_id** | **str**| Filter trades with specified order ID. `currency_pair` is also required if this field is present | [optional]
12901298
**account** | **str**| Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account | [optional]
1291-
**_from** | **int**| Time range beginning, default to 7 days before current time | [optional]
1299+
**_from** | **int**| Start timestamp of the query | [optional]
12921300
**to** | **int**| Time range ending, default to current time | [optional]
12931301

12941302
### Return type

gate_api/__init__.py

Lines changed: 1 addition & 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.22.2"
17+
__version__ = "4.22.3"
1818

1919
# import apis into sdk package
2020
from gate_api.api.delivery_api import DeliveryApi

gate_api/api/margin_api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ def list_margin_account_book(self, **kwargs): # noqa: E501
445445
:param bool async_req: execute request asynchronously
446446
:param str currency: List records related to specified currency only. If specified, `currency_pair` is also required.
447447
:param str currency_pair: List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided
448-
:param int _from: Time range beginning, default to 7 days before current time
448+
:param int _from: Start timestamp of the query
449449
:param int to: Time range ending, default to current time
450450
:param int page: Page number
451451
:param int limit: Maximum number of records to be returned in a single list
@@ -475,7 +475,7 @@ def list_margin_account_book_with_http_info(self, **kwargs): # noqa: E501
475475
:param bool async_req: execute request asynchronously
476476
:param str currency: List records related to specified currency only. If specified, `currency_pair` is also required.
477477
:param str currency_pair: List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided
478-
:param int _from: Time range beginning, default to 7 days before current time
478+
:param int _from: Start timestamp of the query
479479
:param int to: Time range ending, default to current time
480480
:param int page: Page number
481481
:param int limit: Maximum number of records to be returned in a single list
@@ -2685,7 +2685,7 @@ def list_cross_margin_account_book(self, **kwargs): # noqa: E501
26852685
26862686
:param bool async_req: execute request asynchronously
26872687
:param str currency: Filter by currency
2688-
:param int _from: Time range beginning, default to 7 days before current time
2688+
:param int _from: Start timestamp of the query
26892689
:param int to: Time range ending, default to current time
26902690
:param int page: Page number
26912691
:param int limit: Maximum number of records to be returned in a single list
@@ -2715,7 +2715,7 @@ def list_cross_margin_account_book_with_http_info(self, **kwargs): # noqa: E501
27152715
27162716
:param bool async_req: execute request asynchronously
27172717
:param str currency: Filter by currency
2718-
:param int _from: Time range beginning, default to 7 days before current time
2718+
:param int _from: Start timestamp of the query
27192719
:param int to: Time range ending, default to current time
27202720
:param int page: Page number
27212721
:param int limit: Maximum number of records to be returned in a single list

0 commit comments

Comments
 (0)