|
@ -39,6 +39,7 @@ import { IOrder } from '../services/interfaces/interfaces'; |
|
|
import { RulesService } from '../services/rules.service'; |
|
|
import { RulesService } from '../services/rules.service'; |
|
|
import { PortfolioInterface } from './interfaces/portfolio.interface'; |
|
|
import { PortfolioInterface } from './interfaces/portfolio.interface'; |
|
|
import { Order } from './order'; |
|
|
import { Order } from './order'; |
|
|
|
|
|
import { OrderType } from './order-type'; |
|
|
import { AccountClusterRiskCurrentInvestment } from './rules/account-cluster-risk/current-investment'; |
|
|
import { AccountClusterRiskCurrentInvestment } from './rules/account-cluster-risk/current-investment'; |
|
|
import { AccountClusterRiskInitialInvestment } from './rules/account-cluster-risk/initial-investment'; |
|
|
import { AccountClusterRiskInitialInvestment } from './rules/account-cluster-risk/initial-investment'; |
|
|
import { AccountClusterRiskSingleAccount } from './rules/account-cluster-risk/single-account'; |
|
|
import { AccountClusterRiskSingleAccount } from './rules/account-cluster-risk/single-account'; |
|
@ -285,6 +286,14 @@ export class Portfolio implements PortfolioInterface { |
|
|
...data[symbol], |
|
|
...data[symbol], |
|
|
accounts, |
|
|
accounts, |
|
|
symbol, |
|
|
symbol, |
|
|
|
|
|
allocationCurrent: |
|
|
|
|
|
this.exchangeRateDataService.toCurrency( |
|
|
|
|
|
portfolioItem.positions[symbol].quantity * now, |
|
|
|
|
|
data[symbol]?.currency, |
|
|
|
|
|
this.user.Settings.currency |
|
|
|
|
|
) / value, |
|
|
|
|
|
allocationInvestment: |
|
|
|
|
|
portfolioItem.positions[symbol].investment / investment, |
|
|
grossPerformance: roundTo( |
|
|
grossPerformance: roundTo( |
|
|
portfolioItemsNow.positions[symbol].quantity * (now - before), |
|
|
portfolioItemsNow.positions[symbol].quantity * (now - before), |
|
|
2 |
|
|
2 |
|
@ -292,14 +301,6 @@ export class Portfolio implements PortfolioInterface { |
|
|
grossPerformancePercent: roundTo((now - before) / before, 4), |
|
|
grossPerformancePercent: roundTo((now - before) / before, 4), |
|
|
investment: portfolioItem.positions[symbol].investment, |
|
|
investment: portfolioItem.positions[symbol].investment, |
|
|
quantity: portfolioItem.positions[symbol].quantity, |
|
|
quantity: portfolioItem.positions[symbol].quantity, |
|
|
shareCurrent: |
|
|
|
|
|
this.exchangeRateDataService.toCurrency( |
|
|
|
|
|
portfolioItem.positions[symbol].quantity * now, |
|
|
|
|
|
data[symbol]?.currency, |
|
|
|
|
|
this.user.Settings.currency |
|
|
|
|
|
) / value, |
|
|
|
|
|
shareInvestment: |
|
|
|
|
|
portfolioItem.positions[symbol].investment / investment, |
|
|
|
|
|
transactionCount: portfolioItem.positions[symbol].transactionCount |
|
|
transactionCount: portfolioItem.positions[symbol].transactionCount |
|
|
}; |
|
|
}; |
|
|
}); |
|
|
}); |
|
@ -537,12 +538,12 @@ export class Portfolio implements PortfolioInterface { |
|
|
this.orders.push( |
|
|
this.orders.push( |
|
|
new Order({ |
|
|
new Order({ |
|
|
account: order.Account, |
|
|
account: order.Account, |
|
|
currency: <any>order.currency, |
|
|
currency: order.currency, |
|
|
date: order.date.toISOString(), |
|
|
date: order.date.toISOString(), |
|
|
fee: order.fee, |
|
|
fee: order.fee, |
|
|
quantity: order.quantity, |
|
|
quantity: order.quantity, |
|
|
symbol: order.symbol, |
|
|
symbol: order.symbol, |
|
|
type: <any>order.type, |
|
|
type: <OrderType>order.type, |
|
|
unitPrice: order.unitPrice |
|
|
unitPrice: order.unitPrice |
|
|
}) |
|
|
}) |
|
|
); |
|
|
); |
|
|