Closed dydxwill closed 2 weeks ago
The changes in this pull request introduce a new property, cumulativeEntryPrice
, across various components related to perpetual positions. This property is added to types, interfaces, and models, enhancing their structure to track cumulative entry prices effectively. Additionally, test cases are updated to incorporate this new property, ensuring that calculations and validations reflect the changes. A migration script is also included to modify the database schema accordingly, allowing for the storage of this new data.
File | Change Summary |
---|---|
indexer/packages/postgres/__tests__/db/helpers.test.ts |
Added cumulativeEntryPrice to PerpetualPositionFromDatabase type; tests updated to utilize this property. |
indexer/packages/postgres/__tests__/helpers/constants.ts |
Added cumulativeEntryPrice to defaultPerpetualPosition and isolatedPerpetualPosition objects. |
indexer/packages/postgres/__tests__/stores/perpetual-position-table.test.ts |
Added and modified tests for PerpetualPositionTable , enhancing coverage and error handling. |
indexer/packages/postgres/src/db/helpers.ts |
Modified getUnrealizedPnl function to use cumulativeEntryPrice instead of entryPrice . |
indexer/packages/postgres/src/db/migrations/migration_files/20241022151729_add_perpetual_positions_cumulative_entry_price.ts |
Added migration to include cumulativeEntryPrice column in perpetual_positions table. |
indexer/packages/postgres/src/models/perpetual-position-model.ts |
Added cumulativeEntryPrice to PerpetualPositionModel class and its schema. |
indexer/packages/postgres/src/types/db-model-types.ts |
Added cumulativeEntryPrice property to PerpetualPositionFromDatabase interface. |
indexer/packages/postgres/src/types/perpetual-position-types.ts |
Added cumulativeEntryPrice to several interfaces and an enum related to perpetual positions. |
indexer/packages/postgres/src/types/websocket-message-types.ts |
Added cumulativeEntryPrice to PerpetualPositionSubaccountMessageContents interface. |
cumulativeEntryPrice
property in the PerpetualPositionFromDatabase
type.cumulativeEntryPrice
.feature:indexer/affiliates
🐇 In the garden, I hop and play,
WithcumulativeEntryPrice
here to stay.
Numbers dance, and tests align,
In perpetual joy, our code will shine!
So let’s celebrate, with carrots in sight,
Our changes are done, all feels just right! 🥕✨
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?
Changelist
[Describe or list the changes made in this PR]
Test Plan
[Describe how this PR was tested (if applicable)]
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
.Summary by CodeRabbit
Release Notes
New Features
cumulativeEntryPrice
, to enhance tracking of entry prices in perpetual positions across various interfaces and models.Bug Fixes
Tests
Chores
cumulativeEntryPrice
column in the database, ensuring data integrity and structure.