|
|
@ -2065,15 +2065,14 @@ export class PortfolioService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Returns one chart item per calendar year of the date range, like the |
|
|
* Returns one chart item per calendar year of the date range, dated on |
|
|
* dividends and the investments grouped by year, dated on 1 January. Each |
|
|
* 1 January. Each year stands alone and is not accumulated, so its values |
|
|
* year stands alone and is not accumulated, so its values are the same as |
|
|
* are the same as for the date range of the year (e.g. '2024'), clipped to |
|
|
* for the date range of the year (e.g. '2024'), clipped to the requested |
|
|
* the requested date range. The investment is the sum of the year, the other |
|
|
* date range. The investment is the sum of the year, the other values are |
|
|
* values are the ones at the end of the year. The first chart item of the |
|
|
* the ones at the end of the year. The first chart item of the date range |
|
|
* date range carries the values at its start date and belongs to the |
|
|
* carries the values at its start date and belongs to the previous period, |
|
|
* previous period, like 31 December for a calendar year, so the years before |
|
|
* like 31 December for a calendar year, so the years before the first |
|
|
* the first activity have no chart item. |
|
|
* activity have no chart item. |
|
|
|
|
|
*/ |
|
|
*/ |
|
|
private async getPerformanceByYear({ |
|
|
private async getPerformanceByYear({ |
|
|
chartOfDateRange, |
|
|
chartOfDateRange, |
|
|
@ -2089,7 +2088,7 @@ export class PortfolioService { |
|
|
const chart: HistoricalDataItem[] = []; |
|
|
const chart: HistoricalDataItem[] = []; |
|
|
|
|
|
|
|
|
const years = uniq( |
|
|
const years = uniq( |
|
|
chartOfDateRange?.slice(1).map(({ date }) => { |
|
|
chartOfDateRange.slice(1).map(({ date }) => { |
|
|
return date.substring(0, 4); |
|
|
return date.substring(0, 4); |
|
|
}) |
|
|
}) |
|
|
); |
|
|
); |
|
|
@ -2103,10 +2102,6 @@ export class PortfolioService { |
|
|
start: index === 0 ? startDate : startDateOfYear |
|
|
start: index === 0 ? startDate : startDateOfYear |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
if (!chartOfYear?.length) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let investmentValueWithCurrencyEffect = new Big(0); |
|
|
let investmentValueWithCurrencyEffect = new Big(0); |
|
|
|
|
|
|
|
|
for (const historicalDataItem of chartOfYear.slice(1)) { |
|
|
for (const historicalDataItem of chartOfYear.slice(1)) { |
|
|
|