From 51d091b6de1cfa0b2c40fd4b921ffcd77390aa28 Mon Sep 17 00:00:00 2001 From: ElRodrigote Date: Mon, 29 Jul 2024 13:01:21 +0200 Subject: [PATCH 1/2] fix: use the start date to compute the 'Next Order' for orders with no slots --- packages/app/components/stack-modal/StackFrequencyAndDates.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/app/components/stack-modal/StackFrequencyAndDates.tsx b/packages/app/components/stack-modal/StackFrequencyAndDates.tsx index 0d3640f3..81c1d72a 100644 --- a/packages/app/components/stack-modal/StackFrequencyAndDates.tsx +++ b/packages/app/components/stack-modal/StackFrequencyAndDates.tsx @@ -50,7 +50,7 @@ export const StackFrequencyAndDates = ({ stackOrder }: StackOrderProps) => { ? "Finished with funds" : stackOrder.cancelledAt ? "Cancelled" - : formatTimestampToDateWithTime(nextSlot)} + : formatTimestampToDateWithTime(hasSlots ? nextSlot : firstSlot)} ); From 94129b12e3e522a5538dd3a8b655f4301bde62d0 Mon Sep 17 00:00:00 2001 From: ElRodrigote Date: Mon, 29 Jul 2024 13:07:42 +0200 Subject: [PATCH 2/2] fix: if there's no executed buy amount, return 0 to compute the avg buy price --- packages/app/models/stack-order/stack-order.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/app/models/stack-order/stack-order.ts b/packages/app/models/stack-order/stack-order.ts index 5ba7fd44..6bb65fe7 100644 --- a/packages/app/models/stack-order/stack-order.ts +++ b/packages/app/models/stack-order/stack-order.ts @@ -41,7 +41,7 @@ export const calculateStackAveragePrice = (order: StackOrder) => { ); }); const averagePrice = totalExecutedSellAmount / totalExecutedBuyAmount; - return averagePrice; + return totalExecutedBuyAmount ? averagePrice : 0; }; export const totalFundsUsed = (order: StackOrder) => {