From f3ea8ceaabaad96bd913a14ce917985fea9cd6ed Mon Sep 17 00:00:00 2001 From: Richard Holzeis Date: Wed, 24 Apr 2024 11:28:42 +0200 Subject: [PATCH] fix: Set quantity to zero when initiation order view with open position If we don't have a position we default the quantity to the max quantity. If we have an open position we default the quantity to zero because the contracts will be defaulted to the open quantity. The behaviour should be that in case of an open position the default contracts on the opposite direction is to close the position. --- mobile/lib/features/trade/trade_bottom_sheet_tab.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/lib/features/trade/trade_bottom_sheet_tab.dart b/mobile/lib/features/trade/trade_bottom_sheet_tab.dart index 98ad32005..24b1456de 100644 --- a/mobile/lib/features/trade/trade_bottom_sheet_tab.dart +++ b/mobile/lib/features/trade/trade_bottom_sheet_tab.dart @@ -86,7 +86,7 @@ class _TradeBottomSheetTabState extends State final tradeValues = provider.fromDirection(position.direction.opposite()); tradeValues.openQuantity = position.quantity; - tradeValues.updateQuantity(tradeValues.maxQuantity - tradeValues.openQuantity); + tradeValues.updateQuantity(Usd.zero()); // by default the contracts are set to the amount of open contracts of the current position. tradeValues.updateContracts(tradeValues.openQuantity);