Browse Source

Feature/extract top holdings from Yahoo Finance for ETF and mutual funds (#6254)

* Extract top holdings from Yahoo Finance for ETF and mutual funds

* Update changelog
pull/6265/head
Kenrick Tandrian 3 days ago
committed by GitHub
parent
commit
7dbacdbf0f
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      CHANGELOG.md
  2. 17
      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
### Added
- Added the ability to fetch top holdings for ETF and mutual fund assets from _Yahoo Finance_
### Changed
- Removed the deprecated `firstBuyDate` in the portfolio calculator

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

@ -135,10 +135,10 @@ export class YahooFinanceDataEnhancerService implements DataEnhancerInterface {
shortName,
symbol
}: {
longName: Price['longName'];
quoteType: Price['quoteType'];
shortName: Price['shortName'];
symbol: Price['symbol'];
longName?: Price['longName'];
quoteType?: Price['quoteType'];
shortName?: Price['shortName'];
symbol?: Price['symbol'];
}) {
let name = longName;
@ -217,6 +217,15 @@ export class YahooFinanceDataEnhancerService implements DataEnhancerInterface {
});
}
}
response.holdings = assetProfile.topHoldings.holdings.map(
({ holdingName, holdingPercent }) => {
return {
name: this.formatName({ longName: holdingName }),
weight: holdingPercent
};
}
);
} else if (
assetSubClass === 'STOCK' &&
assetProfile.summaryProfile?.country

Loading…
Cancel
Save