Browse Source

Improve handling of excluded holdings

pull/7828/head
Thomas Kaul 1 day ago
parent
commit
0cd70fdc35
  1. 14
      apps/api/src/app/portfolio/calculator/portfolio-calculator.factory.ts
  2. 8
      apps/api/src/app/portfolio/calculator/portfolio-calculator.ts
  3. 4
      apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-valuable.spec.ts

14
apps/api/src/app/portfolio/calculator/portfolio-calculator.factory.ts

@ -34,16 +34,16 @@ export class PortfolioCalculatorFactory {
calculationType,
currency,
filters = [],
userId,
usePortfolioSnapshotCache = true
usePortfolioSnapshotCache = true,
userId
}: {
accountBalanceItems?: HistoricalDataItem[];
activities: Activity[];
calculationType: PerformanceCalculationType;
currency: string;
filters?: Filter[];
userId: string;
usePortfolioSnapshotCache?: boolean;
userId: string;
}): PortfolioCalculator {
switch (calculationType) {
case PerformanceCalculationType.MWR:
@ -52,8 +52,8 @@ export class PortfolioCalculatorFactory {
activities,
currency,
filters,
userId,
usePortfolioSnapshotCache,
userId,
configurationService: this.configurationService,
currentRateService: this.currentRateService,
exchangeRateDataService: this.exchangeRateDataService,
@ -67,8 +67,8 @@ export class PortfolioCalculatorFactory {
activities,
currency,
filters,
userId,
usePortfolioSnapshotCache,
userId,
configurationService: this.configurationService,
currentRateService: this.currentRateService,
exchangeRateDataService: this.exchangeRateDataService,
@ -82,8 +82,8 @@ export class PortfolioCalculatorFactory {
activities,
currency,
filters,
userId,
usePortfolioSnapshotCache,
userId,
configurationService: this.configurationService,
currentRateService: this.currentRateService,
exchangeRateDataService: this.exchangeRateDataService,
@ -97,8 +97,8 @@ export class PortfolioCalculatorFactory {
activities,
currency,
filters,
userId,
usePortfolioSnapshotCache,
userId,
configurationService: this.configurationService,
currentRateService: this.currentRateService,
exchangeRateDataService: this.exchangeRateDataService,

8
apps/api/src/app/portfolio/calculator/portfolio-calculator.ts

@ -90,8 +90,8 @@ export abstract class PortfolioCalculator {
private snapshotPromise: Promise<void>;
private startDate: Date;
private transactionPoints: TransactionPoint[];
private userId: string;
private usePortfolioSnapshotCache: boolean;
private userId: string;
public constructor({
accountBalanceItems,
@ -103,8 +103,8 @@ export abstract class PortfolioCalculator {
filters,
portfolioSnapshotService,
redisCacheService,
userId,
usePortfolioSnapshotCache = true
usePortfolioSnapshotCache = true,
userId
}: {
accountBalanceItems: HistoricalDataItem[];
activities: Activity[];
@ -115,8 +115,8 @@ export abstract class PortfolioCalculator {
filters: Filter[];
portfolioSnapshotService: PortfolioSnapshotService;
redisCacheService: RedisCacheService;
userId: string;
usePortfolioSnapshotCache?: boolean;
userId: string;
}) {
this.accountBalanceItems = accountBalanceItems;
this.configurationService = configurationService;

4
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-valuable.spec.ts

@ -108,8 +108,8 @@ describe('PortfolioCalculator', () => {
activities,
calculationType: PerformanceCalculationType.ROAI,
currency: 'USD',
userId: userDummyData.id,
usePortfolioSnapshotCache: false
usePortfolioSnapshotCache: false,
userId: userDummyData.id
});
const portfolioSnapshot = await portfolioCalculator.getSnapshot();

Loading…
Cancel
Save