-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IND-503]: Add historical trading reward block and aggregation endpoints #954
Conversation
WalkthroughThe recent updates to the codebase focus on enhancing the functionality of trading rewards and their historical data retrieval. Two new query parameters have been introduced to refine searches by date and block height. The API version 4 now includes endpoints for fetching historical block trading rewards and aggregations with these additional parameters. Changes include the introduction of new enums, schema modifications for request validation, controller updates, and the transformation of database entities to response objects for the updated API endpoints. Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 4
Configuration used: CodeRabbit UI
Files ignored due to filter (1)
- indexer/services/comlink/public/swagger.json
Files selected for processing (13)
- indexer/packages/postgres/src/stores/trading-reward-aggregation-table.ts (3 hunks)
- indexer/packages/postgres/src/stores/trading-reward-table.ts (3 hunks)
- indexer/packages/postgres/src/types/query-types.ts (3 hunks)
- indexer/services/comlink/tests/controllers/api/v4/historical-block-trading-reward-controller.test.ts (1 hunks)
- indexer/services/comlink/tests/controllers/api/v4/historical-trading-reward-aggregations-controller.test.ts (1 hunks)
- indexer/services/comlink/public/api-documentation.md (4 hunks)
- indexer/services/comlink/src/controllers/api/index-v4.ts (2 hunks)
- indexer/services/comlink/src/controllers/api/v4/addresses-controller.ts (3 hunks)
- indexer/services/comlink/src/controllers/api/v4/historical-block-trading-rewards-controller.ts (1 hunks)
- indexer/services/comlink/src/controllers/api/v4/historical-trading-reward-aggregations-controller.ts (1 hunks)
- indexer/services/comlink/src/lib/validation/schemas.ts (2 hunks)
- indexer/services/comlink/src/request-helpers/request-transformer.ts (3 hunks)
- indexer/services/comlink/src/types.ts (2 hunks)
Additional comments: 26
indexer/services/comlink/src/controllers/api/index-v4.ts (2)
9-12: The import statements for
HistoricalBlockTradingRewardController
andHistoricalTradingRewardController
have been added correctly, ensuring that the new controllers are available for use in the router setup.30-33: The router has been updated to use the new controllers for the routes
/historicalBlockTradingRewards
and/historicalTradingRewardAggregations
. This correctly exposes the new endpoints as part of the application's API.indexer/packages/postgres/src/stores/trading-reward-table.ts (2)
31-31: The
findAll
function now accepts a new parameterblockHeightBeforeOrAt
. This parameter should be used to filter the results to only include trading rewards at or before the specified block height.76-77: The query logic has been correctly updated to include a condition that filters the results based on the
blockHeightBeforeOrAt
parameter if it is provided.indexer/services/comlink/src/controllers/api/v4/historical-block-trading-rewards-controller.ts (2)
30-38: The
HistoricalBlockTradingRewardsController
class has been defined with agetTradingRewards
method that correctly retrieves trading rewards based on the provided query parameters.56-62: The router setup for the
/historicalBlockTradingRewards/:address
endpoint includes middleware for country restrictions, rate limiting, validation, and response code statistics. This is a comprehensive setup that ensures proper request handling and response.indexer/services/comlink/src/lib/validation/schemas.ts (2)
21-25: The
checkAddressSchemaRecord
has been added to define validation rules for theaddress
parameter. This is a good practice to ensure that the address provided in requests is validated against expected criteria.140-155: The
CheckHistoricalBlockTradingRewardsSchema
has been modified to include additional validation rules forstartingBeforeOrAt
andstartingBeforeOrAtHeight
. This ensures that the query parameters are validated correctly before being processed by the controller.indexer/services/comlink/src/controllers/api/v4/historical-trading-reward-aggregations-controller.ts (2)
31-40: The
HistoricalTradingRewardAggregationsController
class has been defined with agetAggregations
method that correctly retrieves trading reward aggregations based on the provided query parameters.58-62: The router setup for the
/historicalTradingRewardAggregations/:address
endpoint includes middleware for country restrictions, rate limiting, and validation. This is a comprehensive setup that ensures proper request handling and response.indexer/packages/postgres/src/stores/trading-reward-aggregation-table.ts (2)
37-38: The
findAll
function now accepts two new parametersstartedAtBeforeOrAt
andstartedAtHeightBeforeOrAt
. These parameters should be used to filter the results to only include trading reward aggregations at or before the specified times and block heights.79-87: The query logic has been correctly updated to include conditions that filter the results based on the
startedAtBeforeOrAt
andstartedAtHeightBeforeOrAt
parameters if they are provided.indexer/services/comlink/__tests__/controllers/api/v4/historical-block-trading-reward-controller.test.ts (1)
- 65-138: The test cases for the
historical-block-trading-reward-controller
cover various scenarios, including fetching all rewards, fetching with a limit, fetching with no rewards, and fetching with time and height filters. These tests are well-structured and should validate the functionality of the controller effectively.indexer/services/comlink/__tests__/controllers/api/v4/historical-trading-reward-aggregations-controller.test.ts (1)
- 71-151: The test cases for the
historical-trading-reward-aggregations-controller
cover various scenarios, including fetching all aggregations, fetching with a limit, fetching with no aggregations, and fetching with time and height filters. These tests are well-structured and should validate the functionality of the controller effectively.indexer/packages/postgres/src/types/query-types.ts (3)
82-84: The addition of new enum values
BLOCK_HEIGHT_BEFORE_OR_AT
,STARTED_AT_BEFORE_OR_AT
, andSTARTED_AT_HEIGHT_BEFORE_OR_AT
toQueryableField
is consistent with the PR objectives to allow filtering based on specific block heights and timestamps.286-286: The new field
[QueryableField.BLOCK_HEIGHT_BEFORE_OR_AT]?: IsoString;
has been correctly added to theTradingRewardQueryConfig
interface to support the new query parameter for block height filtering.295-296: The new fields
[QueryableField.STARTED_AT_BEFORE_OR_AT]?: IsoString;
and[QueryableField.STARTED_AT_HEIGHT_BEFORE_OR_AT]?: string;
have been correctly added to theTradingRewardAggregationQueryConfig
interface to support the new query parameters for timestamp and block height filtering.indexer/services/comlink/src/types.ts (4)
21-21: The addition of
TradingRewardAggregationPeriod
enum is consistent with the PR objectives to support aggregation periods for historical trading rewards.409-413: The new interface
HistoricalTradingRewardAggregationRequest
correctly defines the structure for requests related to historical trading reward aggregations, including the period and starting timestamps.415-429: The new interface
HistoricalTradingRewardAggregationsResponse
andHistoricalTradingRewardAggregation
are well-defined and align with the PR objectives to provide responses for historical trading reward aggregations.432-448: The new interfaces
HistoricalBlockTradingRewardRequest
,HistoricalBlockTradingRewardsResponse
, andHistoricalBlockTradingReward
are correctly added to handle requests and responses for historical block trading rewards.indexer/services/comlink/src/controllers/api/v4/addresses-controller.ts (2)
55-55: The import of
CheckAddressSchema
from the validation schemas is consistent with the PR objectives to refactor schema validation logic.260-260: The replacement of
...checkSchema({...})
with...CheckAddressSchema
in therouter.get
method is a correct implementation of the new schema validation logic.indexer/services/comlink/src/request-helpers/request-transformer.ts (3)
25-26: The addition of
TradingRewardAggregationFromDatabase
andTradingRewardFromDatabase
imports aligns with the PR's objective to handle historical trading reward data. These imports are necessary for the new transformation functions added later in the file.458-468: The function
tradingRewardAggregationToResponse
correctly transforms aTradingRewardAggregationFromDatabase
object into aHistoricalTradingRewardAggregation
response object. The fields are appropriately mapped, and the function is concise and follows best practices.471-478: The function
tradingRewardToResponse
correctly transforms aTradingRewardFromDatabase
object into aHistoricalBlockTradingReward
response object. The mapping of fields is consistent with the expected response structure. This function is also concise and follows best practices.
## GetTradingRewards | ||
|
||
<a id="opIdGetTradingRewards"></a> | ||
|
||
> Code samples | ||
|
||
```python | ||
import requests | ||
headers = { | ||
'Accept': 'application/json' | ||
} | ||
|
||
r = requests.get('https://dydx-testnet.imperator.co/v4/historicalBlockTradingRewards/{address}', params={ | ||
'limit': '0' | ||
}, headers = headers) | ||
|
||
print(r.json()) | ||
|
||
``` | ||
|
||
```javascript | ||
|
||
const headers = { | ||
'Accept':'application/json' | ||
}; | ||
|
||
fetch('https://dydx-testnet.imperator.co/v4/historicalBlockTradingRewards/{address}?limit=0', | ||
{ | ||
method: 'GET', | ||
|
||
headers: headers | ||
}) | ||
.then(function(res) { | ||
return res.json(); | ||
}).then(function(body) { | ||
console.log(body); | ||
}); | ||
|
||
``` | ||
|
||
`GET /historicalBlockTradingRewards/{address}` | ||
|
||
### Parameters | ||
|
||
|Name|In|Type|Required|Description| | ||
|---|---|---|---|---| | ||
|address|path|string|true|none| | ||
|limit|query|number(double)|true|none| | ||
|startingBeforeOrAt|query|[IsoString](#schemaisostring)|false|none| | ||
|startingBeforeOrAtHeight|query|string|false|none| | ||
|
||
> Example responses | ||
|
||
> 200 Response | ||
|
||
```json | ||
{ | ||
"rewards": [ | ||
{ | ||
"tradingReward": "string", | ||
"createdAt": "string", | ||
"createdAtHeight": "string" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### Responses | ||
|
||
|Status|Meaning|Description|Schema| | ||
|---|---|---|---| | ||
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[HistoricalBlockTradingRewardsResponse](#schemahistoricalblocktradingrewardsresponse)| | ||
|
||
<aside class="success"> | ||
This operation does not require authentication | ||
</aside> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation for the GetTradingRewards
operation appears to be complete and well-structured, including parameters, code samples, and example responses. However, the limit
parameter in the code samples is set to '0', which might be an error since it usually indicates no data would be returned. This should be clarified or corrected if it's a mistake.
- 'limit': '0'
+ 'limit': '10' # Assuming '10' is a reasonable default for demonstration purposes
Committable suggestion
❗ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
## GetTradingRewards | |
<a id="opIdGetTradingRewards"></a> | |
> Code samples | |
```python | |
import requests | |
headers = { | |
'Accept': 'application/json' | |
} | |
r = requests.get('https://dydx-testnet.imperator.co/v4/historicalBlockTradingRewards/{address}', params={ | |
'limit': '0' | |
}, headers = headers) | |
print(r.json()) | |
``` | |
```javascript | |
const headers = { | |
'Accept':'application/json' | |
}; | |
fetch('https://dydx-testnet.imperator.co/v4/historicalBlockTradingRewards/{address}?limit=0', | |
{ | |
method: 'GET', | |
headers: headers | |
}) | |
.then(function(res) { | |
return res.json(); | |
}).then(function(body) { | |
console.log(body); | |
}); | |
``` | |
`GET /historicalBlockTradingRewards/{address}` | |
### Parameters | |
|Name|In|Type|Required|Description| | |
|---|---|---|---|---| | |
|address|path|string|true|none| | |
|limit|query|number(double)|true|none| | |
|startingBeforeOrAt|query|[IsoString](#schemaisostring)|false|none| | |
|startingBeforeOrAtHeight|query|string|false|none| | |
> Example responses | |
> 200 Response | |
```json | |
{ | |
"rewards": [ | |
{ | |
"tradingReward": "string", | |
"createdAt": "string", | |
"createdAtHeight": "string" | |
} | |
] | |
} | |
``` | |
### Responses | |
|Status|Meaning|Description|Schema| | |
|---|---|---|---| | |
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[HistoricalBlockTradingRewardsResponse](#schemahistoricalblocktradingrewardsresponse)| | |
<aside class="success"> | |
This operation does not require authentication | |
</aside> | |
## GetTradingRewards | |
<a id="opIdGetTradingRewards"></a> | |
> Code samples | |
```python | |
import requests | |
headers = { | |
'Accept': 'application/json' | |
} | |
r = requests.get('https://dydx-testnet.imperator.co/v4/historicalBlockTradingRewards/{address}', params={ | |
'limit': '10' # Assuming '10' is a reasonable default for demonstration purposes | |
}, headers = headers) | |
print(r.json()) | |
const headers = {
'Accept':'application/json'
};
fetch('https://dydx-testnet.imperator.co/v4/historicalBlockTradingRewards/{address}?limit=10',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
GET /historicalBlockTradingRewards/{address}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
address | path | string | true | none |
limit | query | number(double) | true | none |
startingBeforeOrAt | query | IsoString | false | none |
startingBeforeOrAtHeight | query | string | false | none |
Example responses
200 Response
{
"rewards": [
{
"tradingReward": "string",
"createdAt": "string",
"createdAtHeight": "string"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Ok | HistoricalBlockTradingRewardsResponse |
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
## GetAggregations | ||
|
||
<a id="opIdGetAggregations"></a> | ||
|
||
> Code samples | ||
|
||
```python | ||
import requests | ||
headers = { | ||
'Accept': 'application/json' | ||
} | ||
|
||
r = requests.get('https://dydx-testnet.imperator.co/v4/historicalTradingRewardAggregations/{address}', params={ | ||
'period': 'DAILY', 'limit': '0' | ||
}, headers = headers) | ||
|
||
print(r.json()) | ||
|
||
``` | ||
|
||
```javascript | ||
|
||
const headers = { | ||
'Accept':'application/json' | ||
}; | ||
|
||
fetch('https://dydx-testnet.imperator.co/v4/historicalTradingRewardAggregations/{address}?period=DAILY&limit=0', | ||
{ | ||
method: 'GET', | ||
|
||
headers: headers | ||
}) | ||
.then(function(res) { | ||
return res.json(); | ||
}).then(function(body) { | ||
console.log(body); | ||
}); | ||
|
||
``` | ||
|
||
`GET /historicalTradingRewardAggregations/{address}` | ||
|
||
### Parameters | ||
|
||
|Name|In|Type|Required|Description| | ||
|---|---|---|---|---| | ||
|address|path|string|true|none| | ||
|period|query|[TradingRewardAggregationPeriod](#schematradingrewardaggregationperiod)|true|none| | ||
|limit|query|number(double)|true|none| | ||
|startingBeforeOrAt|query|[IsoString](#schemaisostring)|false|none| | ||
|startingBeforeOrAtHeight|query|string|false|none| | ||
|
||
#### Enumerated Values | ||
|
||
|Parameter|Value| | ||
|---|---| | ||
|period|DAILY| | ||
|period|WEEKLY| | ||
|period|MONTHLY| | ||
|
||
> Example responses | ||
|
||
> 200 Response | ||
|
||
```json | ||
{ | ||
"rewards": [ | ||
{ | ||
"tradingReward": "string", | ||
"startedAt": "string", | ||
"startedAtHeight": "string", | ||
"endedAt": "string", | ||
"endedAtHeight": "string", | ||
"period": "DAILY" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### Responses | ||
|
||
|Status|Meaning|Description|Schema| | ||
|---|---|---|---| | ||
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[HistoricalTradingRewardAggregationsResponse](#schemahistoricaltradingrewardaggregationsresponse)| | ||
|
||
<aside class="success"> | ||
This operation does not require authentication | ||
</aside> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the previous comment, the GetAggregations
operation documentation is well-structured. However, the limit
parameter in the code samples is also set to '0'. This should be verified and corrected if necessary.
- 'limit': '0'
+ 'limit': '10' # Assuming '10' is a reasonable default for demonstration purposes
Committable suggestion
❗ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
## GetAggregations | |
<a id="opIdGetAggregations"></a> | |
> Code samples | |
```python | |
import requests | |
headers = { | |
'Accept': 'application/json' | |
} | |
r = requests.get('https://dydx-testnet.imperator.co/v4/historicalTradingRewardAggregations/{address}', params={ | |
'period': 'DAILY', 'limit': '0' | |
}, headers = headers) | |
print(r.json()) | |
``` | |
```javascript | |
const headers = { | |
'Accept':'application/json' | |
}; | |
fetch('https://dydx-testnet.imperator.co/v4/historicalTradingRewardAggregations/{address}?period=DAILY&limit=0', | |
{ | |
method: 'GET', | |
headers: headers | |
}) | |
.then(function(res) { | |
return res.json(); | |
}).then(function(body) { | |
console.log(body); | |
}); | |
``` | |
`GET /historicalTradingRewardAggregations/{address}` | |
### Parameters | |
|Name|In|Type|Required|Description| | |
|---|---|---|---|---| | |
|address|path|string|true|none| | |
|period|query|[TradingRewardAggregationPeriod](#schematradingrewardaggregationperiod)|true|none| | |
|limit|query|number(double)|true|none| | |
|startingBeforeOrAt|query|[IsoString](#schemaisostring)|false|none| | |
|startingBeforeOrAtHeight|query|string|false|none| | |
#### Enumerated Values | |
|Parameter|Value| | |
|---|---| | |
|period|DAILY| | |
|period|WEEKLY| | |
|period|MONTHLY| | |
> Example responses | |
> 200 Response | |
```json | |
{ | |
"rewards": [ | |
{ | |
"tradingReward": "string", | |
"startedAt": "string", | |
"startedAtHeight": "string", | |
"endedAt": "string", | |
"endedAtHeight": "string", | |
"period": "DAILY" | |
} | |
] | |
} | |
``` | |
### Responses | |
|Status|Meaning|Description|Schema| | |
|---|---|---|---| | |
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[HistoricalTradingRewardAggregationsResponse](#schemahistoricaltradingrewardaggregationsresponse)| | |
<aside class="success"> | |
This operation does not require authentication | |
</aside> | |
## GetAggregations | |
<a id="opIdGetAggregations"></a> | |
> Code samples | |
```python | |
import requests | |
headers = { | |
'Accept': 'application/json' | |
} | |
r = requests.get('https://dydx-testnet.imperator.co/v4/historicalTradingRewardAggregations/{address}', params={ | |
'period': 'DAILY', 'limit': '10' # Assuming '10' is a reasonable default for demonstration purposes | |
}, headers = headers) | |
print(r.json()) | |
const headers = {
'Accept':'application/json'
};
fetch('https://dydx-testnet.imperator.co/v4/historicalTradingRewardAggregations/{address}?period=DAILY&limit=10',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
GET /historicalTradingRewardAggregations/{address}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
address | path | string | true | none |
period | query | TradingRewardAggregationPeriod | true | none |
limit | query | number(double) | true | none |
startingBeforeOrAt | query | IsoString | false | none |
startingBeforeOrAtHeight | query | string | false | none |
Enumerated Values
Parameter | Value |
---|---|
period | DAILY |
period | WEEKLY |
period | MONTHLY |
Example responses
200 Response
{
"rewards": [
{
"tradingReward": "string",
"startedAt": "string",
"startedAtHeight": "string",
"endedAt": "string",
"endedAtHeight": "string",
"period": "DAILY"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Ok | HistoricalTradingRewardAggregationsResponse |
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
## HistoricalBlockTradingReward | ||
|
||
<a id="schemahistoricalblocktradingreward"></a> | ||
<a id="schema_HistoricalBlockTradingReward"></a> | ||
<a id="tocShistoricalblocktradingreward"></a> | ||
<a id="tocshistoricalblocktradingreward"></a> | ||
|
||
```json | ||
{ | ||
"tradingReward": "string", | ||
"createdAt": "string", | ||
"createdAtHeight": "string" | ||
} | ||
|
||
``` | ||
|
||
### Properties | ||
|
||
|Name|Type|Required|Restrictions|Description| | ||
|---|---|---|---|---| | ||
|tradingReward|string|true|none|none| | ||
|createdAt|[IsoString](#schemaisostring)|true|none|none| | ||
|createdAtHeight|string|true|none|none| | ||
|
||
## HistoricalBlockTradingRewardsResponse | ||
|
||
<a id="schemahistoricalblocktradingrewardsresponse"></a> | ||
<a id="schema_HistoricalBlockTradingRewardsResponse"></a> | ||
<a id="tocShistoricalblocktradingrewardsresponse"></a> | ||
<a id="tocshistoricalblocktradingrewardsresponse"></a> | ||
|
||
```json | ||
{ | ||
"rewards": [ | ||
{ | ||
"tradingReward": "string", | ||
"createdAt": "string", | ||
"createdAtHeight": "string" | ||
} | ||
] | ||
} | ||
|
||
``` | ||
|
||
### Properties | ||
|
||
|Name|Type|Required|Restrictions|Description| | ||
|---|---|---|---|---| | ||
|rewards|[[HistoricalBlockTradingReward](#schemahistoricalblocktradingreward)]|true|none|none| | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The HistoricalBlockTradingReward
and HistoricalBlockTradingRewardsResponse
data structures are documented with JSON examples and a table of properties. The properties are marked as required, but there are no restrictions or descriptions provided. It would be beneficial to add descriptions to each property to ensure clarity for the API consumers.
## TradingRewardAggregationPeriod | ||
|
||
<a id="schematradingrewardaggregationperiod"></a> | ||
<a id="schema_TradingRewardAggregationPeriod"></a> | ||
<a id="tocStradingrewardaggregationperiod"></a> | ||
<a id="tocstradingrewardaggregationperiod"></a> | ||
|
||
```json | ||
"DAILY" | ||
|
||
``` | ||
|
||
### Properties | ||
|
||
|Name|Type|Required|Restrictions|Description| | ||
|---|---|---|---|---| | ||
|*anonymous*|string|false|none|none| | ||
|
||
#### Enumerated Values | ||
|
||
|Property|Value| | ||
|---|---| | ||
|*anonymous*|DAILY| | ||
|*anonymous*|WEEKLY| | ||
|*anonymous*|MONTHLY| | ||
|
||
## HistoricalTradingRewardAggregation | ||
|
||
<a id="schemahistoricaltradingrewardaggregation"></a> | ||
<a id="schema_HistoricalTradingRewardAggregation"></a> | ||
<a id="tocShistoricaltradingrewardaggregation"></a> | ||
<a id="tocshistoricaltradingrewardaggregation"></a> | ||
|
||
```json | ||
{ | ||
"tradingReward": "string", | ||
"startedAt": "string", | ||
"startedAtHeight": "string", | ||
"endedAt": "string", | ||
"endedAtHeight": "string", | ||
"period": "DAILY" | ||
} | ||
|
||
``` | ||
|
||
### Properties | ||
|
||
|Name|Type|Required|Restrictions|Description| | ||
|---|---|---|---|---| | ||
|tradingReward|string|true|none|none| | ||
|startedAt|[IsoString](#schemaisostring)|true|none|none| | ||
|startedAtHeight|string|true|none|none| | ||
|endedAt|[IsoString](#schemaisostring)|false|none|none| | ||
|endedAtHeight|string|false|none|none| | ||
|period|[TradingRewardAggregationPeriod](#schematradingrewardaggregationperiod)|true|none|none| | ||
|
||
## HistoricalTradingRewardAggregationsResponse | ||
|
||
<a id="schemahistoricaltradingrewardaggregationsresponse"></a> | ||
<a id="schema_HistoricalTradingRewardAggregationsResponse"></a> | ||
<a id="tocShistoricaltradingrewardaggregationsresponse"></a> | ||
<a id="tocshistoricaltradingrewardaggregationsresponse"></a> | ||
|
||
```json | ||
{ | ||
"rewards": [ | ||
{ | ||
"tradingReward": "string", | ||
"startedAt": "string", | ||
"startedAtHeight": "string", | ||
"endedAt": "string", | ||
"endedAtHeight": "string", | ||
"period": "DAILY" | ||
} | ||
] | ||
} | ||
|
||
``` | ||
|
||
### Properties | ||
|
||
|Name|Type|Required|Restrictions|Description| | ||
|---|---|---|---|---| | ||
|rewards|[[HistoricalTradingRewardAggregation](#schemahistoricaltradingrewardaggregation)]|true|none|none| | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TradingRewardAggregationPeriod
enum and the HistoricalTradingRewardAggregation
and HistoricalTradingRewardAggregationsResponse
data structures are well-documented. The JSON examples and properties tables are clear. However, the period
property in the HistoricalTradingRewardAggregation
structure is documented as required, but the example JSON marks it as "DAILY". It should be clarified whether this is a default value or if other values are also acceptable.
Changelist
Add historical trading reward block and aggregation endpoints
Test Plan
Unit tests
Author/Reviewer Checklist
state-breaking
label.indexer-postgres-breaking
label.PrepareProposal
orProcessProposal
, manually add the labelproposal-breaking
.feature:[feature-name]
.backport/[branch-name]
.refactor
,chore
,bug
.