Browse Source

Task/filter out sectors with zero weight in Yahoo Finance data enhancer (#6895)

* Filter out sectors with zero weight

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

1
CHANGELOG.md

@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improved the pagination in the activities table of the account detail dialog - Improved the pagination in the activities table of the account detail dialog
- Improved the pagination in the activities table of the holding detail dialog - Improved the pagination in the activities table of the holding detail dialog
- Randomized the placeholder in the assistant - Randomized the placeholder in the assistant
- Filtered out sectors with zero weight for ETF and mutual fund assets in the _Yahoo Finance_ data enhancer
- Enabled the _Bull Dashboard_ in the admin control panel without requiring an environment variable (experimental) - Enabled the _Bull Dashboard_ in the admin control panel without requiring an environment variable (experimental)
- Relaxed the URL validation in the asset profile DTOs to accept both `HTTP` and `HTTPS` protocols - Relaxed the URL validation in the asset profile DTOs to accept both `HTTP` and `HTTPS` protocols
- Relaxed the URL validation in the platform DTOs to accept both `HTTP` and `HTTPS` protocols - Relaxed the URL validation in the platform DTOs to accept both `HTTP` and `HTTPS` protocols

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

@ -218,15 +218,17 @@ export class YahooFinanceDataEnhancerService implements DataEnhancerInterface {
}; };
}) ?? []; }) ?? [];
response.sectors = ( response.sectors = (assetProfile.topHoldings?.sectorWeightings ?? [])
assetProfile.topHoldings?.sectorWeightings ?? [] .flatMap((sectorWeighting) => {
).flatMap((sectorWeighting) => {
return Object.entries(sectorWeighting).map(([sector, weight]) => { return Object.entries(sectorWeighting).map(([sector, weight]) => {
return { return {
name: this.parseSector(sector), name: this.parseSector(sector),
weight: weight as number weight: weight as number
}; };
}); });
})
.filter(({ weight }) => {
return weight > 0;
}); });
} else if ( } else if (
assetSubClass === 'STOCK' && assetSubClass === 'STOCK' &&

Loading…
Cancel
Save