From aace943d5618e4f2b6469b838ec7040a44d756cd Mon Sep 17 00:00:00 2001 From: Thomas <4159106+dtslvr@users.noreply.github.com> Date: Sun, 19 Dec 2021 18:09:56 +0100 Subject: [PATCH] Fix portfolio summary --- apps/api/src/app/portfolio/portfolio.service.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index eb0d60ed5..738846680 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -829,8 +829,7 @@ export class PortfolioService { currency ); const orders = await this.orderService.getOrders({ - userId, - types: ['BUY', 'SELL'] + userId }); const dividend = this.getDividend(orders).toNumber(); const fees = this.getFees(orders).toNumber(); @@ -851,11 +850,13 @@ export class PortfolioService { fees, firstOrderDate, netWorth, + totalBuy, + totalSell, cash: balance, committedFunds: committedFunds.toNumber(), - ordersCount: orders.length, - totalBuy: totalBuy, - totalSell: totalSell + ordersCount: orders.filter((order) => { + return order.type === 'BUY' || order.type === 'SELL'; + }).length }; }