[go: up one dir, main page]

Skip to content

Commit

Permalink
spot public trades supports time range query
Browse files Browse the repository at this point in the history
  • Loading branch information
revilwang committed Oct 28, 2021
1 parent a193806 commit 4750d39
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ APIv4 provides spot, margin and futures trading operations. There are public API
## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.

- API version: 4.22.2
- Package version: 6.22.2
- API version: 4.22.3
- Package version: 6.22.3
- Build package: org.openapitools.codegen.languages.GoClientCodegen
For more information, please visit [https://www.gate.io/page/contacts](https://www.gate.io/page/contacts)

Expand Down
4 changes: 2 additions & 2 deletions api_margin.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ Only transferals from and to margin account are provided for now. Time range all
* @param optional nil or *ListMarginAccountBookOpts - Optional Parameters:
* @param "Currency" (optional.String) - List records related to specified currency only. If specified, `currency_pair` is also required.
* @param "CurrencyPair" (optional.String) - List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided
* @param "From" (optional.Int64) - Time range beginning, default to 7 days before current time
* @param "From" (optional.Int64) - Start timestamp of the query
* @param "To" (optional.Int64) - Time range ending, default to current time
* @param "Page" (optional.Int32) - Page number
* @param "Limit" (optional.Int32) - Maximum number of records to be returned in a single list
Expand Down Expand Up @@ -2345,7 +2345,7 @@ Record time range cannot exceed 30 days
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param optional nil or *ListCrossMarginAccountBookOpts - Optional Parameters:
* @param "Currency" (optional.String) - Filter by currency
* @param "From" (optional.Int64) - Time range beginning, default to 7 days before current time
* @param "From" (optional.Int64) - Start timestamp of the query
* @param "To" (optional.Int64) - Time range ending, default to current time
* @param "Page" (optional.Int32) - Page number
* @param "Limit" (optional.Int32) - Maximum number of records to be returned in a single list
Expand Down
20 changes: 18 additions & 2 deletions api_spot.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,16 +569,23 @@ type ListTradesOpts struct {
Limit optional.Int32
LastId optional.String
Reverse optional.Bool
From optional.Int64
To optional.Int64
Page optional.Int32
}

/*
ListTrades Retrieve market trades
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.
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param currencyPair Currency pair
* @param optional nil or *ListTradesOpts - Optional Parameters:
* @param "Limit" (optional.Int32) - Maximum number of records to be returned in a single list
* @param "LastId" (optional.String) - Specify list staring point using the `id` of last record in previous list-query results
* @param "Reverse" (optional.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.
* @param "From" (optional.Int64) - Start timestamp of the query
* @param "To" (optional.Int64) - Time range ending, default to current time
* @param "Page" (optional.Int32) - Page number
@return []Trade
*/
func (a *SpotApiService) ListTrades(ctx context.Context, currencyPair string, localVarOptionals *ListTradesOpts) ([]Trade, *http.Response, error) {
Expand Down Expand Up @@ -607,6 +614,15 @@ func (a *SpotApiService) ListTrades(ctx context.Context, currencyPair string, lo
if localVarOptionals != nil && localVarOptionals.Reverse.IsSet() {
localVarQueryParams.Add("reverse", parameterToString(localVarOptionals.Reverse.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.From.IsSet() {
localVarQueryParams.Add("from", parameterToString(localVarOptionals.From.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.To.IsSet() {
localVarQueryParams.Add("to", parameterToString(localVarOptionals.To.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Page.IsSet() {
localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), ""))
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}

Expand Down Expand Up @@ -1202,7 +1218,7 @@ Spot and margin orders are returned by default. If cross margin orders are neede
* @param "Page" (optional.Int32) - Page number
* @param "Limit" (optional.Int32) - Maximum number of records to be returned. If `status` is `open`, maximum of `limit` is 100
* @param "Account" (optional.String) - Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account
* @param "From" (optional.Int64) - Time range beginning, default to 7 days before current time
* @param "From" (optional.Int64) - Start timestamp of the query
* @param "To" (optional.Int64) - Time range ending, default to current time
* @param "Side" (optional.String) - All bids or asks. Both included if not specified
@return []Order
Expand Down Expand Up @@ -1834,7 +1850,7 @@ Spot and margin trades are queried by default. If cross margin trades are needed
* @param "Page" (optional.Int32) - Page number
* @param "OrderId" (optional.String) - Filter trades with specified order ID. `currency_pair` is also required if this field is present
* @param "Account" (optional.String) - Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account
* @param "From" (optional.Int64) - Time range beginning, default to 7 days before current time
* @param "From" (optional.Int64) - Start timestamp of the query
* @param "To" (optional.Int64) - Time range ending, default to current time
@return []Trade
*/
Expand Down
2 changes: 1 addition & 1 deletion configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func NewConfiguration() *Configuration {
cfg := &Configuration{
BasePath: "https://api.gateio.ws/api/v4",
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/6.22.2/go",
UserAgent: "OpenAPI-Generator/6.22.3/go",
Debug: false,
Servers: []ServerConfiguration{
{
Expand Down
4 changes: 2 additions & 2 deletions docs/MarginApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**currency** | **optional.String**| List records related to specified currency only. If specified, `currency_pair` is also required. |
**currencyPair** | **optional.String**| List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided |
**from** | **optional.Int64**| Time range beginning, default to 7 days before current time |
**from** | **optional.Int64**| Start timestamp of the query |
**to** | **optional.Int64**| Time range ending, default to current time |
**page** | **optional.Int32**| Page number | [default to 1]
**limit** | **optional.Int32**| Maximum number of records to be returned in a single list | [default to 100]
Expand Down Expand Up @@ -1759,7 +1759,7 @@ Optional parameters are passed through a pointer to a ListCrossMarginAccountBook
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**currency** | **optional.String**| Filter by currency |
**from** | **optional.Int64**| Time range beginning, default to 7 days before current time |
**from** | **optional.Int64**| Start timestamp of the query |
**to** | **optional.Int64**| Time range ending, default to current time |
**page** | **optional.Int32**| Page number | [default to 1]
**limit** | **optional.Int32**| Maximum number of records to be returned in a single list | [default to 100]
Expand Down
9 changes: 7 additions & 2 deletions docs/SpotApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,8 @@ No authorization required
Retrieve market trades

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.

### Required Parameters

Name | Type | Description | Notes
Expand All @@ -443,6 +445,9 @@ Name | Type | Description | Notes
**limit** | **optional.Int32**| Maximum number of records to be returned in a single list | [default to 100]
**lastId** | **optional.String**| Specify list staring point using the `id` of last record in previous list-query results |
**reverse** | **optional.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. | [default to false]
**from** | **optional.Int64**| Start timestamp of the query |
**to** | **optional.Int64**| Time range ending, default to current time |
**page** | **optional.Int32**| Page number | [default to 1]

### Example

Expand Down Expand Up @@ -902,7 +907,7 @@ Name | Type | Description | Notes
**page** | **optional.Int32**| Page number | [default to 1]
**limit** | **optional.Int32**| Maximum number of records to be returned. If `status` is `open`, maximum of `limit` is 100 | [default to 100]
**account** | **optional.String**| Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account |
**from** | **optional.Int64**| Time range beginning, default to 7 days before current time |
**from** | **optional.Int64**| Start timestamp of the query |
**to** | **optional.Int64**| Time range ending, default to current time |
**side** | **optional.String**| All bids or asks. Both included if not specified |

Expand Down Expand Up @@ -1376,7 +1381,7 @@ Name | Type | Description | Notes
**page** | **optional.Int32**| Page number | [default to 1]
**orderId** | **optional.String**| Filter trades with specified order ID. `currency_pair` is also required if this field is present |
**account** | **optional.String**| Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account |
**from** | **optional.Int64**| Time range beginning, default to 7 days before current time |
**from** | **optional.Int64**| Start timestamp of the query |
**to** | **optional.Int64**| Time range ending, default to current time |

### Example
Expand Down

0 comments on commit 4750d39

Please sign in to comment.