Browse Source

Fix portfolio summary

pull/547/head
Thomas 4 years ago
parent
commit
aace943d56
  1. 11
      apps/api/src/app/portfolio/portfolio.service.ts

11
apps/api/src/app/portfolio/portfolio.service.ts

@ -829,8 +829,7 @@ export class PortfolioService {
currency currency
); );
const orders = await this.orderService.getOrders({ const orders = await this.orderService.getOrders({
userId, userId
types: ['BUY', 'SELL']
}); });
const dividend = this.getDividend(orders).toNumber(); const dividend = this.getDividend(orders).toNumber();
const fees = this.getFees(orders).toNumber(); const fees = this.getFees(orders).toNumber();
@ -851,11 +850,13 @@ export class PortfolioService {
fees, fees,
firstOrderDate, firstOrderDate,
netWorth, netWorth,
totalBuy,
totalSell,
cash: balance, cash: balance,
committedFunds: committedFunds.toNumber(), committedFunds: committedFunds.toNumber(),
ordersCount: orders.length, ordersCount: orders.filter((order) => {
totalBuy: totalBuy, return order.type === 'BUY' || order.type === 'SELL';
totalSell: totalSell }).length
}; };
} }

Loading…
Cancel
Save