Feature/remove accounts from holding endpoint (#3765)

* Clean up accounts
pull/3770/head
Thomas Kaul 3 months ago committed by GitHub
parent d236ecfe85
commit 9fb80e5067
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -5,10 +5,9 @@ import {
HistoricalDataItem
} from '@ghostfolio/common/interfaces';
import { Account, Tag } from '@prisma/client';
import { Tag } from '@prisma/client';
export interface PortfolioHoldingDetail {
accounts: Account[];
averagePrice: number;
dataProviderInfo: DataProviderInfo;
dividendInBaseCurrency: number;

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

Loading…
Cancel
Save