Browse Source

Task/ignore nested ETFs when fetching top holdings in Yahoo Finance service (#6319)

* Ignore nested ETFs in top holdings

* Update changelog
pull/6322/head
Thomas Kaul 2 weeks ago
committed by GitHub
parent
commit
8a98c0a3f0
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      CHANGELOG.md
  2. 10
      apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts

4
CHANGELOG.md

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased ## Unreleased
### Changed
- Ignored nested ETFs when fetching top holdings for ETF and mutual fund assets from _Yahoo Finance_
### Fixed ### Fixed
- Added the missing `valueInBaseCurrency` to the response of the import activities endpoint - Added the missing `valueInBaseCurrency` to the response of the import activities endpoint

10
apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts

@ -207,14 +207,16 @@ export class YahooFinanceDataEnhancerService implements DataEnhancerInterface {
if (['ETF', 'MUTUALFUND'].includes(assetSubClass)) { if (['ETF', 'MUTUALFUND'].includes(assetSubClass)) {
response.holdings = response.holdings =
assetProfile.topHoldings?.holdings?.map( assetProfile.topHoldings?.holdings
({ holdingName, holdingPercent }) => { ?.filter(({ holdingName }) => {
return !holdingName?.includes('ETF');
})
?.map(({ holdingName, holdingPercent }) => {
return { return {
name: this.formatName({ longName: holdingName }), name: this.formatName({ longName: holdingName }),
weight: holdingPercent weight: holdingPercent
}; };
} }) ?? [];
) ?? [];
response.sectors = ( response.sectors = (
assetProfile.topHoldings?.sectorWeightings ?? [] assetProfile.topHoldings?.sectorWeightings ?? []

Loading…
Cancel
Save