|
|
@ -73,7 +73,7 @@ import {
|
|
|
|
parseISO,
|
|
|
|
parseISO,
|
|
|
|
set
|
|
|
|
set
|
|
|
|
} from 'date-fns';
|
|
|
|
} from 'date-fns';
|
|
|
|
import { isEmpty, last, uniq, uniqBy } from 'lodash';
|
|
|
|
import { isEmpty, last, uniq } from 'lodash';
|
|
|
|
|
|
|
|
|
|
|
|
import { PortfolioCalculator } from './calculator/portfolio-calculator';
|
|
|
|
import { PortfolioCalculator } from './calculator/portfolio-calculator';
|
|
|
|
import {
|
|
|
|
import {
|
|
|
@ -625,7 +625,6 @@ export class PortfolioService {
|
|
|
|
|
|
|
|
|
|
|
|
if (activities.length === 0) {
|
|
|
|
if (activities.length === 0) {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
accounts: [],
|
|
|
|
|
|
|
|
averagePrice: undefined,
|
|
|
|
averagePrice: undefined,
|
|
|
|
dataProviderInfo: undefined,
|
|
|
|
dataProviderInfo: undefined,
|
|
|
|
dividendInBaseCurrency: undefined,
|
|
|
|
dividendInBaseCurrency: undefined,
|
|
|
@ -699,15 +698,6 @@ export class PortfolioService {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const accounts: PortfolioHoldingDetail['accounts'] = uniqBy(
|
|
|
|
|
|
|
|
activitiesOfPosition.filter(({ Account }) => {
|
|
|
|
|
|
|
|
return Account;
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
'Account.id'
|
|
|
|
|
|
|
|
).map(({ Account }) => {
|
|
|
|
|
|
|
|
return Account;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const dividendYieldPercent = getAnnualizedPerformancePercent({
|
|
|
|
const dividendYieldPercent = getAnnualizedPerformancePercent({
|
|
|
|
daysInMarket: differenceInDays(new Date(), parseDate(firstBuyDate)),
|
|
|
|
daysInMarket: differenceInDays(new Date(), parseDate(firstBuyDate)),
|
|
|
|
netPerformancePercentage: timeWeightedInvestment.eq(0)
|
|
|
|
netPerformancePercentage: timeWeightedInvestment.eq(0)
|
|
|
@ -788,7 +778,6 @@ export class PortfolioService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
accounts,
|
|
|
|
|
|
|
|
firstBuyDate,
|
|
|
|
firstBuyDate,
|
|
|
|
marketPrice,
|
|
|
|
marketPrice,
|
|
|
|
maxPrice,
|
|
|
|
maxPrice,
|
|
|
@ -883,7 +872,6 @@ export class PortfolioService {
|
|
|
|
maxPrice,
|
|
|
|
maxPrice,
|
|
|
|
minPrice,
|
|
|
|
minPrice,
|
|
|
|
SymbolProfile,
|
|
|
|
SymbolProfile,
|
|
|
|
accounts: [],
|
|
|
|
|
|
|
|
averagePrice: 0,
|
|
|
|
averagePrice: 0,
|
|
|
|
dataProviderInfo: undefined,
|
|
|
|
dataProviderInfo: undefined,
|
|
|
|
dividendInBaseCurrency: 0,
|
|
|
|
dividendInBaseCurrency: 0,
|
|
|
|