-
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
[TRA-107] Add parentSubaccountNumber endpoint for historical-pnl #1476
Conversation
Signed-off-by: Shrenuj Bansal <shrenuj@dydx.exchange>
SubaccountTable.findAll( | ||
{ | ||
id: childSubaccountIds, | ||
}, | ||
[QueryableField.ID], | ||
), | ||
PnlTicksTable.findAll( | ||
{ | ||
subaccountId: childSubaccountIds, | ||
limit, | ||
createdBeforeOrAtBlockHeight: createdBeforeOrAtHeight | ||
? createdBeforeOrAtHeight.toString() | ||
: undefined, | ||
createdBeforeOrAt, | ||
createdOnOrAfterBlockHeight: createdOnOrAfterHeight | ||
? createdOnOrAfterHeight.toString() | ||
: undefined, | ||
createdOnOrAfter, | ||
}, | ||
[QueryableField.LIMIT], | ||
{ | ||
...DEFAULT_POSTGRES_OPTIONS, | ||
orderBy: [[QueryableField.BLOCK_HEIGHT, Ordering.DESC]], | ||
}, | ||
), |
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.
don't you want the to pull both the childSubaccountIds and the parentSubaccountId? You're ignoring the parent now
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 childSubccountIds are inclusive. So parentSubaccountNumber 0 will have childSubaccountNumbers 0, 128, 256 , ...
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 getChildSubaccountId
or getChildSubaccountNums
doesn't seem to indicate that, could you update?
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.
It does?
* Child subaccounts = [128*0+parentSubaccount, 128*1+parentSubaccount ... 128*999+parentSubaccount] |
Is there anything more you'd like to have specified?
@@ -207,5 +207,65 @@ describe('pnlTicks-controller#V4', () => { | |||
], | |||
}); | |||
}); | |||
|
|||
it('Get /historical-pnl/parentSubaccountNumber', async () => { |
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.
can you create a test to verify that this returns an aggregated pnl of child and parent subaccount?
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.
That is exactly what this test does. It aggregates the pnl for subaccounts 0 and 128 when parentSubaccountNumber 0 is requested
@Mergifyio backport release/indexer/v5.x |
✅ Backports have been created
|
Signed-off-by: Shrenuj Bansal <shrenuj@dydx.exchange> (cherry picked from commit eadfc82)
Changelist
Add parentSubaccountNumber endpoint for historical-pnl
Test Plan
Added 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
.