Skip to main content

sector

Function sector 

Source
pub async fn sector(sector_type: Sector) -> Result<SectorData>
Expand description

Fetch detailed sector data from Yahoo Finance

Returns comprehensive sector information including overview, performance, top companies, ETFs, mutual funds, industries, and research reports.

§Arguments

  • sector_type - The sector to fetch data for

§Examples

use finance_query::{finance, Sector};

let sector = finance::sector(Sector::Technology).await?;
println!("Sector: {} ({} companies)", sector.name,
    sector.overview.as_ref().map(|o| o.companies_count.unwrap_or(0)).unwrap_or(0));

for company in sector.top_companies.iter().take(5) {
    println!("  {} - {:?}", company.symbol, company.name);
}