Feature/refactor ordersCount to activityCount (#4688)
* Refactor ordersCount to activityCount
This commit is contained in:
parent
57c43e5815
commit
a0f377e8eb
@ -1249,7 +1249,7 @@ export class PortfolioService {
|
|||||||
|
|
||||||
const rules: PortfolioReportResponse['rules'] = {
|
const rules: PortfolioReportResponse['rules'] = {
|
||||||
accountClusterRisk:
|
accountClusterRisk:
|
||||||
summary.ordersCount > 0
|
summary.activityCount > 0
|
||||||
? await this.rulesService.evaluate(
|
? await this.rulesService.evaluate(
|
||||||
[
|
[
|
||||||
new AccountClusterRiskCurrentInvestment(
|
new AccountClusterRiskCurrentInvestment(
|
||||||
@ -1265,7 +1265,7 @@ export class PortfolioService {
|
|||||||
)
|
)
|
||||||
: undefined,
|
: undefined,
|
||||||
assetClassClusterRisk:
|
assetClassClusterRisk:
|
||||||
summary.ordersCount > 0
|
summary.activityCount > 0
|
||||||
? await this.rulesService.evaluate(
|
? await this.rulesService.evaluate(
|
||||||
[
|
[
|
||||||
new AssetClassClusterRiskEquity(
|
new AssetClassClusterRiskEquity(
|
||||||
@ -1281,7 +1281,7 @@ export class PortfolioService {
|
|||||||
)
|
)
|
||||||
: undefined,
|
: undefined,
|
||||||
currencyClusterRisk:
|
currencyClusterRisk:
|
||||||
summary.ordersCount > 0
|
summary.activityCount > 0
|
||||||
? await this.rulesService.evaluate(
|
? await this.rulesService.evaluate(
|
||||||
[
|
[
|
||||||
new CurrencyClusterRiskBaseCurrencyCurrentInvestment(
|
new CurrencyClusterRiskBaseCurrencyCurrentInvestment(
|
||||||
@ -1297,7 +1297,7 @@ export class PortfolioService {
|
|||||||
)
|
)
|
||||||
: undefined,
|
: undefined,
|
||||||
economicMarketClusterRisk:
|
economicMarketClusterRisk:
|
||||||
summary.ordersCount > 0
|
summary.activityCount > 0
|
||||||
? await this.rulesService.evaluate(
|
? await this.rulesService.evaluate(
|
||||||
[
|
[
|
||||||
new EconomicMarketClusterRiskDevelopedMarkets(
|
new EconomicMarketClusterRiskDevelopedMarkets(
|
||||||
@ -1338,7 +1338,7 @@ export class PortfolioService {
|
|||||||
userSettings
|
userSettings
|
||||||
),
|
),
|
||||||
regionalMarketClusterRisk:
|
regionalMarketClusterRisk:
|
||||||
summary.ordersCount > 0
|
summary.activityCount > 0
|
||||||
? await this.rulesService.evaluate(
|
? await this.rulesService.evaluate(
|
||||||
[
|
[
|
||||||
new RegionalMarketClusterRiskAsiaPacific(
|
new RegionalMarketClusterRiskAsiaPacific(
|
||||||
@ -1981,6 +1981,9 @@ export class PortfolioService {
|
|||||||
netPerformanceWithCurrencyEffect,
|
netPerformanceWithCurrencyEffect,
|
||||||
totalBuy,
|
totalBuy,
|
||||||
totalSell,
|
totalSell,
|
||||||
|
activityCount: activities.filter(({ type }) => {
|
||||||
|
return ['BUY', 'SELL'].includes(type);
|
||||||
|
}).length,
|
||||||
committedFunds: committedFunds.toNumber(),
|
committedFunds: committedFunds.toNumber(),
|
||||||
currentValueInBaseCurrency: currentValueInBaseCurrency.toNumber(),
|
currentValueInBaseCurrency: currentValueInBaseCurrency.toNumber(),
|
||||||
dividendInBaseCurrency: dividendInBaseCurrency.toNumber(),
|
dividendInBaseCurrency: dividendInBaseCurrency.toNumber(),
|
||||||
@ -2008,9 +2011,6 @@ export class PortfolioService {
|
|||||||
interest: interest.toNumber(),
|
interest: interest.toNumber(),
|
||||||
items: valuables.toNumber(),
|
items: valuables.toNumber(),
|
||||||
liabilities: liabilities.toNumber(),
|
liabilities: liabilities.toNumber(),
|
||||||
ordersCount: activities.filter(({ type }) => {
|
|
||||||
return ['BUY', 'SELL'].includes(type);
|
|
||||||
}).length,
|
|
||||||
totalInvestment: totalInvestment.toNumber(),
|
totalInvestment: totalInvestment.toNumber(),
|
||||||
totalValueInBaseCurrency: netWorth
|
totalValueInBaseCurrency: netWorth
|
||||||
};
|
};
|
||||||
|
@ -1515,6 +1515,7 @@ describe('redactAttributes', () => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
summary: {
|
summary: {
|
||||||
|
activityCount: 29,
|
||||||
annualizedPerformancePercent: 0.16690880197786,
|
annualizedPerformancePercent: 0.16690880197786,
|
||||||
annualizedPerformancePercentWithCurrencyEffect: 0.1694019484552876,
|
annualizedPerformancePercentWithCurrencyEffect: 0.1694019484552876,
|
||||||
cash: null,
|
cash: null,
|
||||||
@ -1538,7 +1539,6 @@ describe('redactAttributes', () => {
|
|||||||
interest: null,
|
interest: null,
|
||||||
items: null,
|
items: null,
|
||||||
liabilities: null,
|
liabilities: null,
|
||||||
ordersCount: 29,
|
|
||||||
totalInvestment: null,
|
totalInvestment: null,
|
||||||
totalValueInBaseCurrency: null,
|
totalValueInBaseCurrency: null,
|
||||||
currentNetWorth: null
|
currentNetWorth: null
|
||||||
@ -3018,6 +3018,7 @@ describe('redactAttributes', () => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
summary: {
|
summary: {
|
||||||
|
activityCount: 29,
|
||||||
annualizedPerformancePercent: 0.16690880197786,
|
annualizedPerformancePercent: 0.16690880197786,
|
||||||
annualizedPerformancePercentWithCurrencyEffect: 0.1694019484552876,
|
annualizedPerformancePercentWithCurrencyEffect: 0.1694019484552876,
|
||||||
cash: null,
|
cash: null,
|
||||||
@ -3041,7 +3042,6 @@ describe('redactAttributes', () => {
|
|||||||
interest: null,
|
interest: null,
|
||||||
items: null,
|
items: null,
|
||||||
liabilities: null,
|
liabilities: null,
|
||||||
ordersCount: 29,
|
|
||||||
totalInvestment: null,
|
totalInvestment: null,
|
||||||
totalValueInBaseCurrency: null,
|
totalValueInBaseCurrency: null,
|
||||||
currentNetWorth: null
|
currentNetWorth: null
|
||||||
|
@ -7,11 +7,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="flex-nowrap px-3 py-1 row"
|
class="flex-nowrap px-3 py-1 row"
|
||||||
[hidden]="summary?.ordersCount === null"
|
[hidden]="summary?.activityCount === null"
|
||||||
>
|
>
|
||||||
<div class="d-flex flex-grow-1 ml-3 text-truncate">
|
<div class="d-flex flex-grow-1 ml-3 text-truncate">
|
||||||
{{ summary?.ordersCount }}
|
{{ summary?.activityCount }}
|
||||||
<ng-container i18n>{summary?.ordersCount, plural,
|
<ng-container i18n>{summary?.activityCount, plural,
|
||||||
=1 {activity}
|
=1 {activity}
|
||||||
other {activities}
|
other {activities}
|
||||||
}</ng-container>
|
}</ng-container>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { PortfolioPerformance } from './portfolio-performance.interface';
|
import { PortfolioPerformance } from './portfolio-performance.interface';
|
||||||
|
|
||||||
export interface PortfolioSummary extends PortfolioPerformance {
|
export interface PortfolioSummary extends PortfolioPerformance {
|
||||||
|
activityCount: number;
|
||||||
annualizedPerformancePercent: number;
|
annualizedPerformancePercent: number;
|
||||||
annualizedPerformancePercentWithCurrencyEffect: number;
|
annualizedPerformancePercentWithCurrencyEffect: number;
|
||||||
cash: number;
|
cash: number;
|
||||||
@ -21,7 +22,6 @@ export interface PortfolioSummary extends PortfolioPerformance {
|
|||||||
interest: number;
|
interest: number;
|
||||||
items: number;
|
items: number;
|
||||||
liabilities: number;
|
liabilities: number;
|
||||||
ordersCount: number;
|
|
||||||
totalBuy: number;
|
totalBuy: number;
|
||||||
totalSell: number;
|
totalSell: number;
|
||||||
totalValueInBaseCurrency?: number;
|
totalValueInBaseCurrency?: number;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user