Skip to content

Commit

Permalink
Use correct side for position notifications. (#716)
Browse files Browse the repository at this point in the history
  • Loading branch information
prashanDYDX authored Oct 18, 2024
1 parent 87df8d9 commit cde9fd2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,11 @@ enum class OrderSide(val rawValue: String) {
Buy("BUY"),
Sell("SELL");

fun opposite() = when (this) {
Buy -> Sell
Sell -> Buy
}

companion object {
operator fun invoke(rawValue: String?) =
OrderSide.values().firstOrNull { it.rawValue == rawValue }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,11 @@ class FillsNotificationProvider(
val asset = stateMachine.state?.assetOfMarket(marketId) ?: return null
val assetText = asset.name
val marketImageUrl = asset.resources?.imageUrl
val side = fill.side.rawValue

// opposite because these notifications are all about positions, not the fill that triggered the notif.
val side = fill.side.opposite().rawValue
val sideText = uiImplementations.localizer?.localize("APP.GENERAL.$side")

val amountText = parser.asString(fill.size)
val priceText = parser.asString(fill.price)
val fillType = fill.type.rawValue
Expand Down

0 comments on commit cde9fd2

Please sign in to comment.