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

indexer subaccount order type update #367

Closed
wants to merge 5 commits into from

Conversation

aforaleka
Copy link
Contributor

@aforaleka aforaleka commented May 20, 2024

indexer will soon send ws msg when cancel is received for non existent order, thus we'll need to update the subaccount order type to handle that scenario

those fields should only really be null when the order is already canceled, so most existing code paths can still expect those fields to be nonnull

Copy link
Contributor

@moo-onthelawn moo-onthelawn left a comment

Choose a reason for hiding this comment

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

I defer to @prashanDYDX for typing things in kotlin, but overall looks gouda

order.side.isOppositeOf(currentSide)
} ?: false
}
val stopLossOrders = triggerOrders?.filter { order ->
selectedSubaccountPosition?.side?.current?.let { currentSide ->
(order.type == OrderType.stopMarket || order.type == OrderType.stopLimit) &&
(order.type == OrderType.stopMarket || order.type == OrderType.stopLimit) && order.side != null &&
Copy link
Contributor

Choose a reason for hiding this comment

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

could we simplify this to order.side?.isOppositeOf(currentSide)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

um kinda! can change to order.side?.isOppositeOf(currentSide) == true

ParsingErrorType.MissingRequiredData,
"no existing order to be cancelled for $orderId",
)
val marketId = existingOrder.marketId
val marketId = existingOrder.marketId!!
Copy link
Contributor

Choose a reason for hiding this comment

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

sad that kotlin can't deduce this :'(

@aforaleka aforaleka force-pushed the update-subaccount-order-type branch from 603ad00 to 12b47dc Compare May 21, 2024 18:33
@aforaleka aforaleka closed this May 22, 2024
@prashanDYDX prashanDYDX deleted the update-subaccount-order-type branch September 4, 2024 16:00
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.

2 participants