Browse Source
Bugfix/fix exception when fetching top holdings in Yahoo Finance service (#6279)
* Add missing guard
* Update changelog
pull/6280/head
Thomas Kaul
4 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
21 additions and
17 deletions
-
CHANGELOG.md
-
apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts
|
|
|
@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
|
|
|
|
- Upgraded `stripe` from version `20.1.0` to `20.3.0` |
|
|
|
|
|
|
|
### Fixed |
|
|
|
|
|
|
|
- Fixed an exception when fetching the top holdings for ETF and mutual fund assets from _Yahoo Finance_ |
|
|
|
|
|
|
|
## 2.235.0 - 2026-02-03 |
|
|
|
|
|
|
|
### Added |
|
|
|
|
|
|
|
@ -206,26 +206,26 @@ export class YahooFinanceDataEnhancerService implements DataEnhancerInterface { |
|
|
|
); |
|
|
|
|
|
|
|
if (['ETF', 'MUTUALFUND'].includes(assetSubClass)) { |
|
|
|
response.sectors = []; |
|
|
|
|
|
|
|
for (const sectorWeighting of assetProfile.topHoldings |
|
|
|
?.sectorWeightings ?? []) { |
|
|
|
for (const [sector, weight] of Object.entries(sectorWeighting)) { |
|
|
|
response.sectors.push({ |
|
|
|
name: this.parseSector(sector), |
|
|
|
weight: weight as number |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
response.holdings = assetProfile.topHoldings.holdings.map( |
|
|
|
response.holdings = |
|
|
|
assetProfile.topHoldings?.holdings?.map( |
|
|
|
({ holdingName, holdingPercent }) => { |
|
|
|
return { |
|
|
|
name: this.formatName({ longName: holdingName }), |
|
|
|
weight: holdingPercent |
|
|
|
}; |
|
|
|
} |
|
|
|
); |
|
|
|
) ?? []; |
|
|
|
|
|
|
|
response.sectors = ( |
|
|
|
assetProfile.topHoldings?.sectorWeightings ?? [] |
|
|
|
).flatMap((sectorWeighting) => { |
|
|
|
return Object.entries(sectorWeighting).map(([sector, weight]) => { |
|
|
|
return { |
|
|
|
name: this.parseSector(sector), |
|
|
|
weight: weight as number |
|
|
|
}; |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else if ( |
|
|
|
assetSubClass === 'STOCK' && |
|
|
|
assetProfile.summaryProfile?.country |
|
|
|
|