|
@ -187,8 +187,7 @@ export abstract class PortfolioCalculator { |
|
|
totalInterestWithCurrencyEffect: new Big(0), |
|
|
totalInterestWithCurrencyEffect: new Big(0), |
|
|
totalInvestment: new Big(0), |
|
|
totalInvestment: new Big(0), |
|
|
totalInvestmentWithCurrencyEffect: new Big(0), |
|
|
totalInvestmentWithCurrencyEffect: new Big(0), |
|
|
totalLiabilitiesWithCurrencyEffect: new Big(0), |
|
|
totalLiabilitiesWithCurrencyEffect: new Big(0) |
|
|
totalValuablesWithCurrencyEffect: new Big(0) |
|
|
|
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -198,7 +197,6 @@ export abstract class PortfolioCalculator { |
|
|
let firstTransactionPoint: TransactionPoint = null; |
|
|
let firstTransactionPoint: TransactionPoint = null; |
|
|
let totalInterestWithCurrencyEffect = new Big(0); |
|
|
let totalInterestWithCurrencyEffect = new Big(0); |
|
|
let totalLiabilitiesWithCurrencyEffect = new Big(0); |
|
|
let totalLiabilitiesWithCurrencyEffect = new Big(0); |
|
|
let totalValuablesWithCurrencyEffect = new Big(0); |
|
|
|
|
|
|
|
|
|
|
|
for (const { currency, dataSource, symbol } of transactionPoints[ |
|
|
for (const { currency, dataSource, symbol } of transactionPoints[ |
|
|
firstIndex - 1 |
|
|
firstIndex - 1 |
|
@ -364,8 +362,7 @@ export abstract class PortfolioCalculator { |
|
|
totalInterestInBaseCurrency, |
|
|
totalInterestInBaseCurrency, |
|
|
totalInvestment, |
|
|
totalInvestment, |
|
|
totalInvestmentWithCurrencyEffect, |
|
|
totalInvestmentWithCurrencyEffect, |
|
|
totalLiabilitiesInBaseCurrency, |
|
|
totalLiabilitiesInBaseCurrency |
|
|
totalValuablesInBaseCurrency |
|
|
|
|
|
} = this.getSymbolMetrics({ |
|
|
} = this.getSymbolMetrics({ |
|
|
chartDateMap, |
|
|
chartDateMap, |
|
|
marketSymbolMap, |
|
|
marketSymbolMap, |
|
@ -444,10 +441,6 @@ export abstract class PortfolioCalculator { |
|
|
totalLiabilitiesWithCurrencyEffect = |
|
|
totalLiabilitiesWithCurrencyEffect = |
|
|
totalLiabilitiesWithCurrencyEffect.plus(totalLiabilitiesInBaseCurrency); |
|
|
totalLiabilitiesWithCurrencyEffect.plus(totalLiabilitiesInBaseCurrency); |
|
|
|
|
|
|
|
|
totalValuablesWithCurrencyEffect = totalValuablesWithCurrencyEffect.plus( |
|
|
|
|
|
totalValuablesInBaseCurrency |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
if ( |
|
|
(hasErrors || |
|
|
(hasErrors || |
|
|
currentRateErrors.find(({ dataSource, symbol }) => { |
|
|
currentRateErrors.find(({ dataSource, symbol }) => { |
|
@ -597,7 +590,6 @@ export abstract class PortfolioCalculator { |
|
|
netPerformance: totalNetPerformanceValue.toNumber(), |
|
|
netPerformance: totalNetPerformanceValue.toNumber(), |
|
|
netPerformanceWithCurrencyEffect: |
|
|
netPerformanceWithCurrencyEffect: |
|
|
totalNetPerformanceValueWithCurrencyEffect.toNumber(), |
|
|
totalNetPerformanceValueWithCurrencyEffect.toNumber(), |
|
|
// TODO: Add valuables
|
|
|
|
|
|
netWorth: totalCurrentValueWithCurrencyEffect |
|
|
netWorth: totalCurrentValueWithCurrencyEffect |
|
|
.plus(totalAccountBalanceWithCurrencyEffect) |
|
|
.plus(totalAccountBalanceWithCurrencyEffect) |
|
|
.toNumber(), |
|
|
.toNumber(), |
|
@ -619,7 +611,6 @@ export abstract class PortfolioCalculator { |
|
|
positions, |
|
|
positions, |
|
|
totalInterestWithCurrencyEffect, |
|
|
totalInterestWithCurrencyEffect, |
|
|
totalLiabilitiesWithCurrencyEffect, |
|
|
totalLiabilitiesWithCurrencyEffect, |
|
|
totalValuablesWithCurrencyEffect, |
|
|
|
|
|
hasErrors: hasAnySymbolMetricsErrors || overall.hasErrors |
|
|
hasErrors: hasAnySymbolMetricsErrors || overall.hasErrors |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
@ -754,7 +745,7 @@ export abstract class PortfolioCalculator { |
|
|
? 0 |
|
|
? 0 |
|
|
: netPerformanceWithCurrencyEffectSinceStartDate / |
|
|
: netPerformanceWithCurrencyEffectSinceStartDate / |
|
|
timeWeightedInvestmentValue |
|
|
timeWeightedInvestmentValue |
|
|
// TODO: Add net worth with valuables
|
|
|
// TODO: Add net worth
|
|
|
// netWorth: totalCurrentValueWithCurrencyEffect
|
|
|
// netWorth: totalCurrentValueWithCurrencyEffect
|
|
|
// .plus(totalAccountBalanceWithCurrencyEffect)
|
|
|
// .plus(totalAccountBalanceWithCurrencyEffect)
|
|
|
// .toNumber()
|
|
|
// .toNumber()
|
|
@ -819,12 +810,6 @@ export abstract class PortfolioCalculator { |
|
|
return this.transactionPoints; |
|
|
return this.transactionPoints; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async getValuablesInBaseCurrency() { |
|
|
|
|
|
await this.snapshotPromise; |
|
|
|
|
|
|
|
|
|
|
|
return this.snapshot.totalValuablesWithCurrencyEffect; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private getChartDateMap({ |
|
|
private getChartDateMap({ |
|
|
endDate, |
|
|
endDate, |
|
|
startDate, |
|
|
startDate, |
|
@ -1000,19 +985,12 @@ export abstract class PortfolioCalculator { |
|
|
liabilities = quantity.mul(unitPrice); |
|
|
liabilities = quantity.mul(unitPrice); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
let valuables = new Big(0); |
|
|
|
|
|
|
|
|
|
|
|
if (type === 'ITEM') { |
|
|
|
|
|
valuables = quantity.mul(unitPrice); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (lastDate !== date || lastTransactionPoint === null) { |
|
|
if (lastDate !== date || lastTransactionPoint === null) { |
|
|
lastTransactionPoint = { |
|
|
lastTransactionPoint = { |
|
|
date, |
|
|
date, |
|
|
fees, |
|
|
fees, |
|
|
interest, |
|
|
interest, |
|
|
liabilities, |
|
|
liabilities, |
|
|
valuables, |
|
|
|
|
|
items: newItems |
|
|
items: newItems |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -1024,8 +1002,6 @@ export abstract class PortfolioCalculator { |
|
|
lastTransactionPoint.items = newItems; |
|
|
lastTransactionPoint.items = newItems; |
|
|
lastTransactionPoint.liabilities = |
|
|
lastTransactionPoint.liabilities = |
|
|
lastTransactionPoint.liabilities.plus(liabilities); |
|
|
lastTransactionPoint.liabilities.plus(liabilities); |
|
|
lastTransactionPoint.valuables = |
|
|
|
|
|
lastTransactionPoint.valuables.plus(valuables); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
lastDate = date; |
|
|
lastDate = date; |
|
|