Browse Source

Add allocations by (advanced) market

pull/2171/head
Thomas 2 years ago
parent
commit
31431abacb
  1. 42
      apps/api/src/app/portfolio/portfolio.service.ts
  2. 1
      apps/api/src/assets/countries/asia-pacific-markets.json
  3. 19
      apps/api/src/assets/countries/europe-markets.json
  4. 54
      apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts
  5. 30
      apps/client/src/app/pages/portfolio/allocations/allocations-page.html
  6. 30
      apps/client/src/locales/messages.de.xlf
  7. 30
      apps/client/src/locales/messages.es.xlf
  8. 30
      apps/client/src/locales/messages.fr.xlf
  9. 30
      apps/client/src/locales/messages.it.xlf
  10. 30
      apps/client/src/locales/messages.nl.xlf
  11. 30
      apps/client/src/locales/messages.pt.xlf
  12. 29
      apps/client/src/locales/messages.xlf
  13. 3
      libs/common/src/lib/interfaces/portfolio-position.interface.ts
  14. 2
      libs/common/src/lib/types/index.ts
  15. 7
      libs/common/src/lib/types/market-advanced.type.ts
  16. 19
      libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts

42
apps/api/src/app/portfolio/portfolio.service.ts

@ -42,7 +42,6 @@ import type {
AccountWithValue,
DateRange,
GroupBy,
Market,
OrderWithAccount,
RequestWithUser,
UserWithSettings
@ -84,7 +83,9 @@ import {
import { PortfolioCalculator } from './portfolio-calculator';
import { RulesService } from './rules.service';
const asiaPacificMarkets = require('../../assets/countries/asia-pacific-markets.json');
const developedMarkets = require('../../assets/countries/developed-markets.json');
const europeMarkets = require('../../assets/countries/europe-markets.json');
const emergingMarkets = require('../../assets/countries/emerging-markets.json');
@Injectable()
@ -538,11 +539,19 @@ export class PortfolioService {
const symbolProfile = symbolProfileMap[item.symbol];
const dataProviderResponse = dataProviderResponses[item.symbol];
const markets: { [key in Market]: number } = {
const markets: PortfolioPosition['markets'] = {
developedMarkets: 0,
emergingMarkets: 0,
otherMarkets: 0
};
const marketsAdvanced: PortfolioPosition['marketsAdvanced'] = {
asiaPacific: 0,
emergingMarkets: 0,
europe: 0,
japan: 0,
northAmerica: 0,
otherMarkets: 0
};
for (const country of symbolProfile.countries) {
if (developedMarkets.includes(country.code)) {
@ -558,10 +567,39 @@ export class PortfolioService {
.plus(country.weight)
.toNumber();
}
if (country.code === 'JP') {
marketsAdvanced.japan = new Big(marketsAdvanced.japan)
.plus(country.weight)
.toNumber();
} else if (country.code === 'CA' || country.code === 'US') {
marketsAdvanced.northAmerica = new Big(marketsAdvanced.northAmerica)
.plus(country.weight)
.toNumber();
} else if (asiaPacificMarkets.includes(country.code)) {
marketsAdvanced.asiaPacific = new Big(marketsAdvanced.asiaPacific)
.plus(country.weight)
.toNumber();
} else if (emergingMarkets.includes(country.code)) {
marketsAdvanced.emergingMarkets = new Big(
marketsAdvanced.emergingMarkets
)
.plus(country.weight)
.toNumber();
} else if (europeMarkets.includes(country.code)) {
marketsAdvanced.europe = new Big(marketsAdvanced.europe)
.plus(country.weight)
.toNumber();
} else {
marketsAdvanced.otherMarkets = new Big(marketsAdvanced.otherMarkets)
.plus(country.weight)
.toNumber();
}
}
holdings[item.symbol] = {
markets,
marketsAdvanced,
allocationInPercentage: filteredValueInBaseCurrency.eq(0)
? 0
: value.div(filteredValueInBaseCurrency).toNumber(),

1
apps/api/src/assets/countries/asia-pacific-markets.json

@ -0,0 +1 @@
["AU", "HK", "NZ", "SG"]

19
apps/api/src/assets/countries/europe-markets.json

@ -0,0 +1,19 @@
[
"AT",
"BE",
"CH",
"DE",
"DK",
"ES",
"FI",
"FR",
"GB",
"IE",
"IL",
"IT",
"LU",
"NL",
"NO",
"PT",
"SE"
]

54
apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts

@ -18,7 +18,7 @@ import {
User
} from '@ghostfolio/common/interfaces';
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
import { Market } from '@ghostfolio/common/types';
import { Market, MarketAdvanced } from '@ghostfolio/common/types';
import { translate } from '@ghostfolio/ui/i18n';
import { Account, AssetClass, DataSource, Platform } from '@prisma/client';
import { isNumber } from 'lodash';
@ -54,6 +54,13 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
public markets: {
[key in Market]: { name: string; value: number };
};
public marketsAdvanced: {
[key in MarketAdvanced]: {
id: MarketAdvanced;
name: string;
value: number;
};
};
public placeholder = '';
public platforms: {
[id: string]: Pick<Platform, 'name'> & {
@ -235,6 +242,38 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
value: undefined
}
};
this.marketsAdvanced = {
asiaPacific: {
id: 'asiaPacific',
name: translate('Asia-Pacific'),
value: 0
},
emergingMarkets: {
id: 'emergingMarkets',
name: translate('Emerging Markets'),
value: 0
},
europe: {
id: 'europe',
name: translate('Europe'),
value: 0
},
japan: {
id: 'japan',
name: translate('Japan'),
value: 0
},
northAmerica: {
id: 'northAmerica',
name: translate('North America'),
value: 0
},
otherMarkets: {
id: 'otherMarkets',
name: translate('Other Markets'),
value: 0
}
};
this.platforms = {};
this.portfolioDetails = {
accounts: {},
@ -324,6 +363,19 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
this.markets.otherMarkets.value +=
position.markets.otherMarkets * position.valueInBaseCurrency;
this.marketsAdvanced.asiaPacific.value +=
position.marketsAdvanced.asiaPacific * position.valueInBaseCurrency;
this.marketsAdvanced.emergingMarkets.value +=
position.marketsAdvanced.emergingMarkets *
position.valueInBaseCurrency;
this.marketsAdvanced.europe.value +=
position.marketsAdvanced.europe * position.valueInBaseCurrency;
this.marketsAdvanced.japan.value +=
position.marketsAdvanced.japan * position.valueInBaseCurrency;
this.marketsAdvanced.northAmerica.value +=
position.marketsAdvanced.northAmerica *
position.valueInBaseCurrency;
for (const country of position.countries) {
const { code, continent, name, weight } = country;

30
apps/client/src/app/pages/portfolio/allocations/allocations-page.html

@ -174,7 +174,7 @@
<mat-card appearance="outlined" class="mb-3">
<mat-card-header class="overflow-hidden w-100">
<mat-card-title class="align-items-center d-flex text-truncate"
><span i18n>By Country</span
><span i18n>By Market</span
><gf-premium-indicator
*ngIf="user?.subscription?.type === 'Basic'"
class="ml-1"
@ -186,10 +186,8 @@
[baseCurrency]="user?.settings?.baseCurrency"
[colorScheme]="user?.settings?.colorScheme"
[isInPercent]="hasImpersonationId || user.settings.isRestrictedView"
[keys]="['name']"
[locale]="user?.settings?.locale"
[maxItems]="10"
[positions]="countries"
[positions]="marketsAdvanced"
></gf-portfolio-proportion-chart>
</mat-card-content>
</mat-card>
@ -250,6 +248,30 @@
</div>
</div>
<div class="row">
<div class="col-md-4">
<mat-card appearance="outlined" class="mb-3">
<mat-card-header class="overflow-hidden w-100">
<mat-card-title class="align-items-center d-flex text-truncate"
><span i18n>By Country</span
><gf-premium-indicator
*ngIf="user?.subscription?.type === 'Basic'"
class="ml-1"
></gf-premium-indicator
></mat-card-title>
</mat-card-header>
<mat-card-content>
<gf-portfolio-proportion-chart
[baseCurrency]="user?.settings?.baseCurrency"
[colorScheme]="user?.settings?.colorScheme"
[isInPercent]="hasImpersonationId || user.settings.isRestrictedView"
[keys]="['name']"
[locale]="user?.settings?.locale"
[maxItems]="10"
[positions]="countries"
></gf-portfolio-proportion-chart>
</mat-card-content>
</mat-card>
</div>
<div class="col-md-4">
<mat-card appearance="outlined" class="mb-3">
<mat-card-header class="overflow-hidden w-100">

30
apps/client/src/locales/messages.de.xlf

@ -1954,7 +1954,7 @@
<target state="translated">Nach Konto</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">256</context>
<context context-type="linenumber">278</context>
</context-group>
</trans-unit>
<trans-unit id="b79f5520c0cb9a00bd589e8a4c86ffcf5ae439d7" datatype="html">
@ -2002,7 +2002,7 @@
<target state="translated">Nach Land</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">177</context>
<context context-type="linenumber">255</context>
</context-group>
</trans-unit>
<trans-unit id="85780db87ac6c9f202615ac63754551c061e7236" datatype="html">
@ -2010,7 +2010,7 @@
<target state="translated">Regionen</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">203</context>
<context context-type="linenumber">201</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2650,7 +2650,7 @@
<target state="translated">Entwickelte Länder</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">226</context>
<context context-type="linenumber">224</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2662,7 +2662,7 @@
<target state="translated">Schwellenländer</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">235</context>
<context context-type="linenumber">233</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2674,7 +2674,7 @@
<target state="translated">Andere Länder</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">244</context>
<context context-type="linenumber">242</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2782,7 +2782,7 @@
<target state="translated">Filtern nach Konto oder Tag...</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts</context>
<context context-type="linenumber">139</context>
<context context-type="linenumber">141</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts</context>
@ -3078,7 +3078,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts</context>
<context context-type="linenumber">373</context>
<context context-type="linenumber">384</context>
</context-group>
</trans-unit>
<trans-unit id="4893616715766810081" datatype="html">
@ -3086,11 +3086,11 @@
<target state="translated">Keine Daten verfügbar</target>
<context-group purpose="location">
<context context-type="sourcefile">libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts</context>
<context context-type="linenumber">375</context>
<context context-type="linenumber">386</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts</context>
<context context-type="linenumber">388</context>
<context context-type="linenumber">399</context>
</context-group>
</trans-unit>
<trans-unit id="1228771048078164312" datatype="html">
@ -3870,7 +3870,7 @@
<target state="translated">Nach ETF-Anbieter</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">276</context>
<context context-type="linenumber">298</context>
</context-group>
</trans-unit>
<trans-unit id="e0c92dc95e1e0fc33d21b5e2df5ea28a86439d56" datatype="html">
@ -7061,6 +7061,14 @@
<context context-type="linenumber">19</context>
</context-group>
</trans-unit>
<trans-unit id="834807cba8928b6f8b27ea62c886f7f3715079b0" datatype="html">
<source>By Market</source>
<target state="translated">Nach Markt</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">177</context>
</context-group>
</trans-unit>
</body>
</file>
</xliff>

30
apps/client/src/locales/messages.es.xlf

@ -1955,7 +1955,7 @@
<target state="translated">Por cuenta</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">256</context>
<context context-type="linenumber">278</context>
</context-group>
</trans-unit>
<trans-unit id="b79f5520c0cb9a00bd589e8a4c86ffcf5ae439d7" datatype="html">
@ -2003,7 +2003,7 @@
<target state="translated">Por país</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">177</context>
<context context-type="linenumber">255</context>
</context-group>
</trans-unit>
<trans-unit id="85780db87ac6c9f202615ac63754551c061e7236" datatype="html">
@ -2011,7 +2011,7 @@
<target state="translated">Regiones</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">203</context>
<context context-type="linenumber">201</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2571,7 +2571,7 @@
<target state="translated">Mercados desarrollados</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">226</context>
<context context-type="linenumber">224</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2619,7 +2619,7 @@
<target state="translated">Otros mercados</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">244</context>
<context context-type="linenumber">242</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2631,7 +2631,7 @@
<target state="translated">Mercados emergentes</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">235</context>
<context context-type="linenumber">233</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2775,7 +2775,7 @@
<target state="translated">Filtrar por cuenta o etiqueta...</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts</context>
<context context-type="linenumber">139</context>
<context context-type="linenumber">141</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts</context>
@ -3079,7 +3079,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts</context>
<context context-type="linenumber">373</context>
<context context-type="linenumber">384</context>
</context-group>
</trans-unit>
<trans-unit id="4893616715766810081" datatype="html">
@ -3087,11 +3087,11 @@
<target state="translated">Sin datos disponibles</target>
<context-group purpose="location">
<context context-type="sourcefile">libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts</context>
<context context-type="linenumber">375</context>
<context context-type="linenumber">386</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts</context>
<context context-type="linenumber">388</context>
<context context-type="linenumber">399</context>
</context-group>
</trans-unit>
<trans-unit id="1228771048078164312" datatype="html">
@ -3871,7 +3871,7 @@
<target state="new">By ETF Provider</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">276</context>
<context context-type="linenumber">298</context>
</context-group>
</trans-unit>
<trans-unit id="e0c92dc95e1e0fc33d21b5e2df5ea28a86439d56" datatype="html">
@ -7062,6 +7062,14 @@
<context context-type="linenumber">19</context>
</context-group>
</trans-unit>
<trans-unit id="834807cba8928b6f8b27ea62c886f7f3715079b0" datatype="html">
<source>By Market</source>
<target state="new">By Market</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">177</context>
</context-group>
</trans-unit>
</body>
</file>
</xliff>

30
apps/client/src/locales/messages.fr.xlf

@ -2526,7 +2526,7 @@
<target state="translated">Filtrer par compte ou étiquette...</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts</context>
<context context-type="linenumber">139</context>
<context context-type="linenumber">141</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts</context>
@ -2558,7 +2558,7 @@
<target state="translated">Par Compte</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">256</context>
<context context-type="linenumber">278</context>
</context-group>
</trans-unit>
<trans-unit id="b79f5520c0cb9a00bd589e8a4c86ffcf5ae439d7" datatype="html">
@ -2606,7 +2606,7 @@
<target state="translated">Par Pays</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">177</context>
<context context-type="linenumber">255</context>
</context-group>
</trans-unit>
<trans-unit id="85780db87ac6c9f202615ac63754551c061e7236" datatype="html">
@ -2614,7 +2614,7 @@
<target state="translated">Régions</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">203</context>
<context context-type="linenumber">201</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2626,7 +2626,7 @@
<target state="translated">Marchés Développés</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">226</context>
<context context-type="linenumber">224</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2638,7 +2638,7 @@
<target state="translated">Marchés Émergents</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">235</context>
<context context-type="linenumber">233</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2650,7 +2650,7 @@
<target state="translated">Autres marchés</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">244</context>
<context context-type="linenumber">242</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -3146,7 +3146,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts</context>
<context context-type="linenumber">373</context>
<context context-type="linenumber">384</context>
</context-group>
</trans-unit>
<trans-unit id="1803867056160333091" datatype="html">
@ -3330,11 +3330,11 @@
<target state="translated">Pas de données disponibles</target>
<context-group purpose="location">
<context context-type="sourcefile">libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts</context>
<context context-type="linenumber">375</context>
<context context-type="linenumber">386</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts</context>
<context context-type="linenumber">388</context>
<context context-type="linenumber">399</context>
</context-group>
</trans-unit>
<trans-unit id="0f845001c88b82c18535e6d44f5597061f506e42" datatype="html">
@ -3870,7 +3870,7 @@
<target state="translated">Par Émetteur d&apos;ETF</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">276</context>
<context context-type="linenumber">298</context>
</context-group>
</trans-unit>
<trans-unit id="e0c92dc95e1e0fc33d21b5e2df5ea28a86439d56" datatype="html">
@ -7061,6 +7061,14 @@
<context context-type="linenumber">19</context>
</context-group>
</trans-unit>
<trans-unit id="834807cba8928b6f8b27ea62c886f7f3715079b0" datatype="html">
<source>By Market</source>
<target state="new">By Market</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">177</context>
</context-group>
</trans-unit>
</body>
</file>
</xliff>

30
apps/client/src/locales/messages.it.xlf

@ -1955,7 +1955,7 @@
<target state="translated">Per account</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">256</context>
<context context-type="linenumber">278</context>
</context-group>
</trans-unit>
<trans-unit id="b79f5520c0cb9a00bd589e8a4c86ffcf5ae439d7" datatype="html">
@ -2003,7 +2003,7 @@
<target state="translated">Per paese</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">177</context>
<context context-type="linenumber">255</context>
</context-group>
</trans-unit>
<trans-unit id="85780db87ac6c9f202615ac63754551c061e7236" datatype="html">
@ -2011,7 +2011,7 @@
<target state="translated">Regioni</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">203</context>
<context context-type="linenumber">201</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2571,7 +2571,7 @@
<target state="translated">Mercati sviluppati</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">226</context>
<context context-type="linenumber">224</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2619,7 +2619,7 @@
<target state="translated">Altri mercati</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">244</context>
<context context-type="linenumber">242</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2631,7 +2631,7 @@
<target state="translated">Mercati emergenti</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">235</context>
<context context-type="linenumber">233</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2775,7 +2775,7 @@
<target state="translated">Filtra per account o tag...</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts</context>
<context context-type="linenumber">139</context>
<context context-type="linenumber">141</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts</context>
@ -3079,7 +3079,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts</context>
<context context-type="linenumber">373</context>
<context context-type="linenumber">384</context>
</context-group>
</trans-unit>
<trans-unit id="4893616715766810081" datatype="html">
@ -3087,11 +3087,11 @@
<target state="new">No data available</target>
<context-group purpose="location">
<context context-type="sourcefile">libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts</context>
<context context-type="linenumber">375</context>
<context context-type="linenumber">386</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts</context>
<context context-type="linenumber">388</context>
<context context-type="linenumber">399</context>
</context-group>
</trans-unit>
<trans-unit id="1228771048078164312" datatype="html">
@ -3871,7 +3871,7 @@
<target state="new">By ETF Provider</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">276</context>
<context context-type="linenumber">298</context>
</context-group>
</trans-unit>
<trans-unit id="e0c92dc95e1e0fc33d21b5e2df5ea28a86439d56" datatype="html">
@ -7062,6 +7062,14 @@
<context context-type="linenumber">19</context>
</context-group>
</trans-unit>
<trans-unit id="834807cba8928b6f8b27ea62c886f7f3715079b0" datatype="html">
<source>By Market</source>
<target state="new">By Market</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">177</context>
</context-group>
</trans-unit>
</body>
</file>
</xliff>

30
apps/client/src/locales/messages.nl.xlf

@ -1954,7 +1954,7 @@
<target state="translated">Per rekening</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">256</context>
<context context-type="linenumber">278</context>
</context-group>
</trans-unit>
<trans-unit id="b79f5520c0cb9a00bd589e8a4c86ffcf5ae439d7" datatype="html">
@ -2002,7 +2002,7 @@
<target state="translated">Per land</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">177</context>
<context context-type="linenumber">255</context>
</context-group>
</trans-unit>
<trans-unit id="85780db87ac6c9f202615ac63754551c061e7236" datatype="html">
@ -2010,7 +2010,7 @@
<target state="translated">Regio&apos;s</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">203</context>
<context context-type="linenumber">201</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2570,7 +2570,7 @@
<target state="translated">Ontwikkelde markten</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">226</context>
<context context-type="linenumber">224</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2618,7 +2618,7 @@
<target state="translated">Andere markten</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">244</context>
<context context-type="linenumber">242</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2630,7 +2630,7 @@
<target state="translated">Opkomende markten</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">235</context>
<context context-type="linenumber">233</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2774,7 +2774,7 @@
<target state="translated">Filter op account of tag...</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts</context>
<context context-type="linenumber">139</context>
<context context-type="linenumber">141</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts</context>
@ -3078,7 +3078,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts</context>
<context context-type="linenumber">373</context>
<context context-type="linenumber">384</context>
</context-group>
</trans-unit>
<trans-unit id="4893616715766810081" datatype="html">
@ -3086,11 +3086,11 @@
<target state="translated">Geen gegevens beschikbaar</target>
<context-group purpose="location">
<context context-type="sourcefile">libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts</context>
<context context-type="linenumber">375</context>
<context context-type="linenumber">386</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts</context>
<context context-type="linenumber">388</context>
<context context-type="linenumber">399</context>
</context-group>
</trans-unit>
<trans-unit id="1228771048078164312" datatype="html">
@ -3870,7 +3870,7 @@
<target state="new">By ETF Provider</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">276</context>
<context context-type="linenumber">298</context>
</context-group>
</trans-unit>
<trans-unit id="e0c92dc95e1e0fc33d21b5e2df5ea28a86439d56" datatype="html">
@ -7061,6 +7061,14 @@
<context context-type="linenumber">19</context>
</context-group>
</trans-unit>
<trans-unit id="834807cba8928b6f8b27ea62c886f7f3715079b0" datatype="html">
<source>By Market</source>
<target state="new">By Market</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">177</context>
</context-group>
</trans-unit>
</body>
</file>
</xliff>

30
apps/client/src/locales/messages.pt.xlf

@ -2446,7 +2446,7 @@
<target state="translated">Filtrar por conta ou marcador...</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts</context>
<context context-type="linenumber">139</context>
<context context-type="linenumber">141</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts</context>
@ -2478,7 +2478,7 @@
<target state="translated">Por Conta</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">256</context>
<context context-type="linenumber">278</context>
</context-group>
</trans-unit>
<trans-unit id="b79f5520c0cb9a00bd589e8a4c86ffcf5ae439d7" datatype="html">
@ -2526,7 +2526,7 @@
<target state="translated">Por País</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">177</context>
<context context-type="linenumber">255</context>
</context-group>
</trans-unit>
<trans-unit id="85780db87ac6c9f202615ac63754551c061e7236" datatype="html">
@ -2534,7 +2534,7 @@
<target state="translated">Regiões</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">203</context>
<context context-type="linenumber">201</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2546,7 +2546,7 @@
<target state="translated">Mercados Desenvoldidos</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">226</context>
<context context-type="linenumber">224</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2558,7 +2558,7 @@
<target state="translated">Mercados Emergentes</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">235</context>
<context context-type="linenumber">233</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2570,7 +2570,7 @@
<target state="translated">Outros Mercados</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">244</context>
<context context-type="linenumber">242</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -3010,7 +3010,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts</context>
<context context-type="linenumber">373</context>
<context context-type="linenumber">384</context>
</context-group>
</trans-unit>
<trans-unit id="8106025670158480144" datatype="html">
@ -3186,11 +3186,11 @@
<target state="translated">Sem dados disponíveis</target>
<context-group purpose="location">
<context context-type="sourcefile">libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts</context>
<context context-type="linenumber">375</context>
<context context-type="linenumber">386</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts</context>
<context context-type="linenumber">388</context>
<context context-type="linenumber">399</context>
</context-group>
</trans-unit>
<trans-unit id="064d88bead9e71bd849ecaefd8b38cca8f195a88" datatype="html">
@ -3870,7 +3870,7 @@
<target state="translated">Por Prestador de ETF</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">276</context>
<context context-type="linenumber">298</context>
</context-group>
</trans-unit>
<trans-unit id="e0c92dc95e1e0fc33d21b5e2df5ea28a86439d56" datatype="html">
@ -7061,6 +7061,14 @@
<context context-type="linenumber">19</context>
</context-group>
</trans-unit>
<trans-unit id="834807cba8928b6f8b27ea62c886f7f3715079b0" datatype="html">
<source>By Market</source>
<target state="new">By Market</target>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">177</context>
</context-group>
</trans-unit>
</body>
</file>
</xliff>

29
apps/client/src/locales/messages.xlf

@ -1792,7 +1792,7 @@
<source>By Account</source>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">256</context>
<context context-type="linenumber">278</context>
</context-group>
</trans-unit>
<trans-unit id="b79f5520c0cb9a00bd589e8a4c86ffcf5ae439d7" datatype="html">
@ -1834,14 +1834,14 @@
<source>By Country</source>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">177</context>
<context context-type="linenumber">255</context>
</context-group>
</trans-unit>
<trans-unit id="85780db87ac6c9f202615ac63754551c061e7236" datatype="html">
<source>Regions</source>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">203</context>
<context context-type="linenumber">201</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2344,7 +2344,7 @@
<source>Developed Markets</source>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">226</context>
<context context-type="linenumber">224</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2388,7 +2388,7 @@
<source>Other Markets</source>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">244</context>
<context context-type="linenumber">242</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2399,7 +2399,7 @@
<source>Emerging Markets</source>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">235</context>
<context context-type="linenumber">233</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/public/public-page.html</context>
@ -2528,7 +2528,7 @@
<source>Filter by account or tag...</source>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts</context>
<context context-type="linenumber">139</context>
<context context-type="linenumber">141</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts</context>
@ -2785,11 +2785,11 @@
<source>No data available</source>
<context-group purpose="location">
<context context-type="sourcefile">libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts</context>
<context context-type="linenumber">375</context>
<context context-type="linenumber">386</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts</context>
<context context-type="linenumber">388</context>
<context context-type="linenumber">399</context>
</context-group>
</trans-unit>
<trans-unit id="6268646680388419543" datatype="html">
@ -2807,7 +2807,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts</context>
<context context-type="linenumber">373</context>
<context context-type="linenumber">384</context>
</context-group>
</trans-unit>
<trans-unit id="1228771048078164312" datatype="html">
@ -3487,7 +3487,7 @@
<source>By ETF Provider</source>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">276</context>
<context context-type="linenumber">298</context>
</context-group>
</trans-unit>
<trans-unit id="3c32a07710e402b2c056bd346e7c42f6015334a6" datatype="html">
@ -6623,6 +6623,13 @@
<context context-type="linenumber">184</context>
</context-group>
</trans-unit>
<trans-unit id="834807cba8928b6f8b27ea62c886f7f3715079b0" datatype="html">
<source>By Market</source>
<context-group purpose="location">
<context context-type="sourcefile">apps/client/src/app/pages/portfolio/allocations/allocations-page.html</context>
<context context-type="linenumber">177</context>
</context-group>
</trans-unit>
</body>
</file>
</xliff>

3
libs/common/src/lib/interfaces/portfolio-position.interface.ts

@ -1,6 +1,6 @@
import { AssetClass, AssetSubClass, DataSource, Tag } from '@prisma/client';
import { Market, MarketState } from '../types';
import { Market, MarketAdvanced, MarketState } from '../types';
import { Country } from './country.interface';
import { Sector } from './sector.interface';
@ -20,6 +20,7 @@ export interface PortfolioPosition {
marketChangePercent?: number;
marketPrice: number;
markets?: { [key in Market]: number };
marketsAdvanced?: { [key in MarketAdvanced]: number };
marketState: MarketState;
name: string;
netPerformance: number;

2
libs/common/src/lib/types/index.ts

@ -5,6 +5,7 @@ import type { ColorScheme } from './color-scheme.type';
import type { DateRange } from './date-range.type';
import type { Granularity } from './granularity.type';
import type { GroupBy } from './group-by.type';
import type { MarketAdvanced } from './market-advanced.type';
import type { MarketDataPreset } from './market-data-preset.type';
import type { MarketState } from './market-state.type';
import type { Market } from './market.type';
@ -24,6 +25,7 @@ export type {
Granularity,
GroupBy,
Market,
MarketAdvanced,
MarketDataPreset,
MarketState,
OrderWithAccount,

7
libs/common/src/lib/types/market-advanced.type.ts

@ -0,0 +1,7 @@
export type MarketAdvanced =
| 'asiaPacific'
| 'emergingMarkets'
| 'europe'
| 'japan'
| 'northAmerica'
| 'otherMarkets';

19
libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts

@ -90,7 +90,7 @@ export class PortfolioProportionChartComponent
[symbol: string]: {
color?: string;
name: string;
subCategory: { [symbol: string]: { value: Big } };
subCategory?: { [symbol: string]: { value: Big } };
value: Big;
};
} = {};
@ -99,12 +99,14 @@ export class PortfolioProportionChartComponent
[UNKNOWN_KEY]: `rgba(${getTextColor(this.colorScheme)}, 0.12)`
};
if (this.keys.length > 0) {
Object.keys(this.positions).forEach((symbol) => {
if (this.positions[symbol][this.keys[0]]?.toUpperCase()) {
if (chartData[this.positions[symbol][this.keys[0]].toUpperCase()]) {
chartData[this.positions[symbol][this.keys[0]].toUpperCase()].value =
chartData[
this.positions[symbol][this.keys[0]].toUpperCase()
].value = chartData[
this.positions[symbol][this.keys[0]].toUpperCase()
].value.plus(this.positions[symbol].value);
if (
@ -122,8 +124,9 @@ export class PortfolioProportionChartComponent
} else {
chartData[
this.positions[symbol][this.keys[0]].toUpperCase()
].subCategory[this.positions[symbol][this.keys[1]] ?? UNKNOWN_KEY] =
{ value: new Big(this.positions[symbol].value) };
].subCategory[
this.positions[symbol][this.keys[1]] ?? UNKNOWN_KEY
] = { value: new Big(this.positions[symbol].value) };
}
} else {
chartData[this.positions[symbol][this.keys[0]].toUpperCase()] = {
@ -158,6 +161,14 @@ export class PortfolioProportionChartComponent
}
}
});
} else {
Object.keys(this.positions).forEach((symbol) => {
chartData[symbol] = {
name: this.positions[symbol].name,
value: new Big(this.positions[symbol].value)
};
});
}
let chartDataSorted = Object.entries(chartData)
.sort((a, b) => {

Loading…
Cancel
Save