|
|
@ -553,8 +553,12 @@ export class PortfolioService { |
|
|
|
otherMarkets: 0 |
|
|
|
}; |
|
|
|
|
|
|
|
this.calculateMarketsAllocation(symbolProfile, markets, marketsAdvanced, value); |
|
|
|
|
|
|
|
this.calculateMarketsAllocation( |
|
|
|
symbolProfile, |
|
|
|
markets, |
|
|
|
marketsAdvanced, |
|
|
|
value |
|
|
|
); |
|
|
|
|
|
|
|
holdings[item.symbol] = { |
|
|
|
markets, |
|
|
@ -738,60 +742,60 @@ export class PortfolioService { |
|
|
|
}, |
|
|
|
value: Big |
|
|
|
) { |
|
|
|
if (symbolProfile.countries.length > 0) { |
|
|
|
for (const country of symbolProfile.countries) { |
|
|
|
if (developedMarkets.includes(country.code)) { |
|
|
|
markets.developedMarkets = new Big(markets.developedMarkets) |
|
|
|
.plus(country.weight) |
|
|
|
.toNumber(); |
|
|
|
} else if (emergingMarkets.includes(country.code)) { |
|
|
|
markets.emergingMarkets = new Big(markets.emergingMarkets) |
|
|
|
.plus(country.weight) |
|
|
|
.toNumber(); |
|
|
|
} else { |
|
|
|
markets.otherMarkets = new Big(markets.otherMarkets) |
|
|
|
.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(); |
|
|
|
} |
|
|
|
if (symbolProfile.countries.length > 0) { |
|
|
|
for (const country of symbolProfile.countries) { |
|
|
|
if (developedMarkets.includes(country.code)) { |
|
|
|
markets.developedMarkets = new Big(markets.developedMarkets) |
|
|
|
.plus(country.weight) |
|
|
|
.toNumber(); |
|
|
|
} else if (emergingMarkets.includes(country.code)) { |
|
|
|
markets.emergingMarkets = new Big(markets.emergingMarkets) |
|
|
|
.plus(country.weight) |
|
|
|
.toNumber(); |
|
|
|
} else { |
|
|
|
markets.otherMarkets = new Big(markets.otherMarkets) |
|
|
|
.plus(country.weight) |
|
|
|
.toNumber(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
markets[UNKNOWN_KEY] = new Big(markets[UNKNOWN_KEY]) |
|
|
|
.plus(value) |
|
|
|
.toNumber(); |
|
|
|
|
|
|
|
marketsAdvanced[UNKNOWN_KEY] = new Big(marketsAdvanced[UNKNOWN_KEY]) |
|
|
|
.plus(value) |
|
|
|
.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(); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
markets[UNKNOWN_KEY] = new Big(markets[UNKNOWN_KEY]) |
|
|
|
.plus(value) |
|
|
|
.toNumber(); |
|
|
|
|
|
|
|
marketsAdvanced[UNKNOWN_KEY] = new Big(marketsAdvanced[UNKNOWN_KEY]) |
|
|
|
.plus(value) |
|
|
|
.toNumber(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public async getPosition( |
|
|
|
aDataSource: DataSource, |
|
|
|