|
|
@ -910,10 +910,16 @@ export abstract class PortfolioCalculator { |
|
|
|
type, |
|
|
|
unitPrice |
|
|
|
} of this.activities) { |
|
|
|
const factor = getFactor(type); |
|
|
|
|
|
|
|
// Only create transaction point symbols for investment activities
|
|
|
|
let currentTransactionPointItem: TransactionPointSymbol; |
|
|
|
const oldAccumulatedSymbol = symbols[SymbolProfile.symbol]; |
|
|
|
const shouldCreateSymbol = ['BUY', 'SELL', 'DIVIDEND'].includes( |
|
|
|
type as string |
|
|
|
); |
|
|
|
|
|
|
|
const factor = getFactor(type); |
|
|
|
if (shouldCreateSymbol) { |
|
|
|
const oldAccumulatedSymbol = symbols[SymbolProfile.symbol]; |
|
|
|
|
|
|
|
if (oldAccumulatedSymbol) { |
|
|
|
let investment = oldAccumulatedSymbol.investment; |
|
|
@ -969,6 +975,7 @@ export abstract class PortfolioCalculator { |
|
|
|
); |
|
|
|
|
|
|
|
symbols[SymbolProfile.symbol] = currentTransactionPointItem; |
|
|
|
} |
|
|
|
|
|
|
|
const items = lastTransactionPoint?.items ?? []; |
|
|
|
|
|
|
@ -976,7 +983,10 @@ export abstract class PortfolioCalculator { |
|
|
|
return symbol !== SymbolProfile.symbol; |
|
|
|
}); |
|
|
|
|
|
|
|
// Only add the symbol if it was created (i.e., for investment activities)
|
|
|
|
if (shouldCreateSymbol && currentTransactionPointItem) { |
|
|
|
newItems.push(currentTransactionPointItem); |
|
|
|
} |
|
|
|
|
|
|
|
newItems.sort((a, b) => { |
|
|
|
return a.symbol?.localeCompare(b.symbol); |
|
|
|