|
|
@ -863,19 +863,17 @@ export class PortfolioService { |
|
|
new Date() |
|
|
new Date() |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const [firstActivity] = activitiesOfHolding; |
|
|
|
|
|
const referenceUnitPrice = |
|
|
|
|
|
firstActivity?.unitPriceInAssetProfileCurrency ?? marketPrice; |
|
|
|
|
|
|
|
|
const historicalDataArray: HistoricalDataItem[] = []; |
|
|
const historicalDataArray: HistoricalDataItem[] = []; |
|
|
let marketPriceMax = Math.max( |
|
|
let marketPriceMax = Math.max(referenceUnitPrice, marketPrice); |
|
|
activitiesOfHolding[0].unitPriceInAssetProfileCurrency, |
|
|
|
|
|
marketPrice |
|
|
|
|
|
); |
|
|
|
|
|
let marketPriceMaxDate = |
|
|
let marketPriceMaxDate = |
|
|
marketPrice > activitiesOfHolding[0].unitPriceInAssetProfileCurrency |
|
|
marketPrice > referenceUnitPrice |
|
|
? new Date() |
|
|
? new Date() |
|
|
: activitiesOfHolding[0].date; |
|
|
: (firstActivity?.date ?? new Date()); |
|
|
let marketPriceMin = Math.min( |
|
|
let marketPriceMin = Math.min(referenceUnitPrice, marketPrice); |
|
|
activitiesOfHolding[0].unitPriceInAssetProfileCurrency, |
|
|
|
|
|
marketPrice |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const historicalDataItems = |
|
|
const historicalDataItems = |
|
|
historicalData[getAssetProfileIdentifier({ dataSource, symbol })]; |
|
|
historicalData[getAssetProfileIdentifier({ dataSource, symbol })]; |
|
|
@ -926,10 +924,10 @@ export class PortfolioService { |
|
|
} else { |
|
|
} else { |
|
|
// Add historical entry for buy date, if no historical data available
|
|
|
// Add historical entry for buy date, if no historical data available
|
|
|
historicalDataArray.push({ |
|
|
historicalDataArray.push({ |
|
|
averagePrice: activitiesOfHolding[0].unitPriceInAssetProfileCurrency, |
|
|
averagePrice: referenceUnitPrice, |
|
|
date: dateOfFirstActivity, |
|
|
date: dateOfFirstActivity, |
|
|
marketPrice: activitiesOfHolding[0].unitPriceInAssetProfileCurrency, |
|
|
marketPrice: referenceUnitPrice, |
|
|
quantity: activitiesOfHolding[0].quantity |
|
|
quantity: firstActivity?.quantity ?? quantity.toNumber() |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|