Skip to content
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

feat: market close all positions #660

Merged
merged 3 commits into from
Sep 18, 2024
Merged

feat: market close all positions #660

merged 3 commits into from
Sep 18, 2024

Conversation

aforaleka
Copy link
Contributor

@aforaleka aforaleka commented Sep 17, 2024

adding a helper function to market close all open positions under parent subaccount 0

in the future when indexer supports mid price ws endpoint, and protocol support limit close (reduce-only non-IOC), we'll only add a limit close option. until then, this is just full closing all positions with market price (i.e. oracle price + slippage)

tested locally dydxprotocol/v4-web#1031

@@ -268,6 +286,19 @@ internal class SubaccountTransactionPayloadProvider(
return HumanReadableTriggerOrdersPayload(marketId, positionSize, placeOrderPayloads, cancelOrderPayloads)
}

private fun subaccountNumberForPosition(marketId: String): Int {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we have another helper for this somewhere already? @jaredvu

ruixhuang
ruixhuang previously approved these changes Sep 18, 2024
@aforaleka aforaleka merged commit 9399502 into main Sep 18, 2024
3 checks passed
@aforaleka aforaleka deleted the market-close-all branch September 18, 2024 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants