|
|
@ -206,26 +206,26 @@ export class YahooFinanceDataEnhancerService implements DataEnhancerInterface { |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
if (['ETF', 'MUTUALFUND'].includes(assetSubClass)) { |
|
|
if (['ETF', 'MUTUALFUND'].includes(assetSubClass)) { |
|
|
response.sectors = []; |
|
|
response.holdings = |
|
|
|
|
|
assetProfile.topHoldings?.holdings?.map( |
|
|
for (const sectorWeighting of assetProfile.topHoldings |
|
|
({ holdingName, holdingPercent }) => { |
|
|
?.sectorWeightings ?? []) { |
|
|
return { |
|
|
for (const [sector, weight] of Object.entries(sectorWeighting)) { |
|
|
name: this.formatName({ longName: holdingName }), |
|
|
response.sectors.push({ |
|
|
weight: holdingPercent |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
) ?? []; |
|
|
|
|
|
|
|
|
|
|
|
response.sectors = ( |
|
|
|
|
|
assetProfile.topHoldings?.sectorWeightings ?? [] |
|
|
|
|
|
).flatMap((sectorWeighting) => { |
|
|
|
|
|
return Object.entries(sectorWeighting).map(([sector, weight]) => { |
|
|
|
|
|
return { |
|
|
name: this.parseSector(sector), |
|
|
name: this.parseSector(sector), |
|
|
weight: weight as number |
|
|
weight: weight as number |
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
response.holdings = assetProfile.topHoldings.holdings.map( |
|
|
|
|
|
({ holdingName, holdingPercent }) => { |
|
|
|
|
|
return { |
|
|
|
|
|
name: this.formatName({ longName: holdingName }), |
|
|
|
|
|
weight: holdingPercent |
|
|
|
|
|
}; |
|
|
}; |
|
|
} |
|
|
}); |
|
|
); |
|
|
}); |
|
|
} else if ( |
|
|
} else if ( |
|
|
assetSubClass === 'STOCK' && |
|
|
assetSubClass === 'STOCK' && |
|
|
assetProfile.summaryProfile?.country |
|
|
assetProfile.summaryProfile?.country |
|
|
|