Skip to content

Commit

Permalink
fix(STK-253): My Stacks displaying NaN (#191)
Browse files Browse the repository at this point in the history
* fix: use the start date to compute the 'Next Order' for orders with no slots
* fix: if there's no executed buy amount, return 0 to compute the avg buy price
  • Loading branch information
ElRodrigote authored Jul 29, 2024
1 parent 0c96f6e commit 6f5dfa5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const StackFrequencyAndDates = ({ stackOrder }: StackOrderProps) => {
? "Finished with funds"
: stackOrder.cancelledAt
? "Cancelled"
: formatTimestampToDateWithTime(nextSlot)}
: formatTimestampToDateWithTime(hasSlots ? nextSlot : firstSlot)}
</StackDetail>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/app/models/stack-order/stack-order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const calculateStackAveragePrice = (order: StackOrder) => {
);
});
const averagePrice = totalExecutedSellAmount / totalExecutedBuyAmount;
return averagePrice;
return totalExecutedBuyAmount ? averagePrice : 0;
};

export const totalFundsUsed = (order: StackOrder) => {
Expand Down

0 comments on commit 6f5dfa5

Please sign in to comment.