|
@ -59,6 +59,7 @@ export class PortfolioCalculator { |
|
|
currentTransactionPointItem = { |
|
|
currentTransactionPointItem = { |
|
|
currency: order.currency, |
|
|
currency: order.currency, |
|
|
fee: order.fee, |
|
|
fee: order.fee, |
|
|
|
|
|
feeAccumulated: order.fee.plus(oldAccumulatedSymbol.feeAccumulated), |
|
|
firstBuyDate: oldAccumulatedSymbol.firstBuyDate, |
|
|
firstBuyDate: oldAccumulatedSymbol.firstBuyDate, |
|
|
investment: newQuantity.eq(0) |
|
|
investment: newQuantity.eq(0) |
|
|
? new Big(0) |
|
|
? new Big(0) |
|
@ -74,6 +75,7 @@ export class PortfolioCalculator { |
|
|
currentTransactionPointItem = { |
|
|
currentTransactionPointItem = { |
|
|
currency: order.currency, |
|
|
currency: order.currency, |
|
|
fee: order.fee, |
|
|
fee: order.fee, |
|
|
|
|
|
feeAccumulated: order.fee, |
|
|
firstBuyDate: order.date, |
|
|
firstBuyDate: order.date, |
|
|
investment: unitPrice.mul(order.quantity).mul(factor), |
|
|
investment: unitPrice.mul(order.quantity).mul(factor), |
|
|
quantity: order.quantity.mul(factor), |
|
|
quantity: order.quantity.mul(factor), |
|
@ -474,6 +476,7 @@ export class PortfolioCalculator { |
|
|
endDate: Date |
|
|
endDate: Date |
|
|
): Promise<TimelinePeriod[]> { |
|
|
): Promise<TimelinePeriod[]> { |
|
|
let investment: Big = new Big(0); |
|
|
let investment: Big = new Big(0); |
|
|
|
|
|
let fees: Big = new Big(0); |
|
|
|
|
|
|
|
|
const marketSymbolMap: { |
|
|
const marketSymbolMap: { |
|
|
[date: string]: { [symbol: string]: Big }; |
|
|
[date: string]: { [symbol: string]: Big }; |
|
@ -486,6 +489,7 @@ export class PortfolioCalculator { |
|
|
currencies[item.symbol] = item.currency; |
|
|
currencies[item.symbol] = item.currency; |
|
|
symbols.push(item.symbol); |
|
|
symbols.push(item.symbol); |
|
|
investment = investment.add(item.investment); |
|
|
investment = investment.add(item.investment); |
|
|
|
|
|
fees = fees.add(item.feeAccumulated); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
let marketSymbols: GetValueObject[] = []; |
|
|
let marketSymbols: GetValueObject[] = []; |
|
@ -545,12 +549,13 @@ export class PortfolioCalculator { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (!invalid) { |
|
|
if (!invalid) { |
|
|
|
|
|
const grossPerformance = value.minus(investment); |
|
|
const result = { |
|
|
const result = { |
|
|
|
|
|
grossPerformance, |
|
|
investment, |
|
|
investment, |
|
|
value, |
|
|
value, |
|
|
date: currentDateAsString, |
|
|
date: currentDateAsString, |
|
|
grossPerformance: value.minus(investment), |
|
|
netPerformance: grossPerformance.minus(fees) |
|
|
netPerformance: new Big(0) // TODO
|
|
|
|
|
|
}; |
|
|
}; |
|
|
results.push(result); |
|
|
results.push(result); |
|
|
} |
|
|
} |
|
|