|
|
|
@ -30,8 +30,6 @@ export class PortfolioCalculator {
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
public computeTransactionPoints(orders: PortfolioOrder[]) {
|
|
|
|
|
console.time('compute-transaction-points');
|
|
|
|
|
|
|
|
|
|
orders.sort((a, b) => a.date.localeCompare(b.date));
|
|
|
|
|
|
|
|
|
|
this.transactionPoints = [];
|
|
|
|
@ -97,7 +95,6 @@ export class PortfolioCalculator {
|
|
|
|
|
}
|
|
|
|
|
lastDate = currentDate;
|
|
|
|
|
}
|
|
|
|
|
console.timeEnd('compute-transaction-points');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public setTransactionPoints(transactionPoints: TransactionPoint[]) {
|
|
|
|
@ -247,8 +244,6 @@ export class PortfolioCalculator {
|
|
|
|
|
if (timelineSpecification.length === 0) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
console.time('calculate-timeline-total');
|
|
|
|
|
console.time('calculate-timeline-calculations');
|
|
|
|
|
|
|
|
|
|
const startDate = timelineSpecification[0].start;
|
|
|
|
|
const start = parseDate(startDate);
|
|
|
|
@ -296,17 +291,11 @@ export class PortfolioCalculator {
|
|
|
|
|
timelinePeriodPromises.push(timePeriodForDates);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
console.timeEnd('calculate-timeline-calculations');
|
|
|
|
|
|
|
|
|
|
console.time('calculate-timeline-periods');
|
|
|
|
|
|
|
|
|
|
const timelinePeriods: TimelinePeriod[][] = await Promise.all(
|
|
|
|
|
timelinePeriodPromises
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
console.timeEnd('calculate-timeline-periods');
|
|
|
|
|
console.timeEnd('calculate-timeline-total');
|
|
|
|
|
|
|
|
|
|
return flatten(timelinePeriods);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|