finance-query 3.0.0

A Rust library for querying financial data
Documentation
// @generated by `cargo soothfast docs gen-tests`
// source: docs/library/screeners.md
#![allow(unused)]

// line 12: compile-only (no_run)
#[rustfmt::skip]
#[allow(dead_code)]
fn doc_block_line_12() {
    use finance_query::{finance, Screener};

    #[tokio::main]
    async fn main() -> Result<(), Box<dyn std::error::Error>> {
        // Top 25 day gainers
        let gainers = finance::screener(Screener::DayGainers, 25).await?;

        // Most actively traded stocks
        let actives = finance::screener(Screener::MostActives, 50).await?;
        println!("Most actives returned: {}", actives.quotes.len());

        // Process results
        for quote in &gainers.quotes {
            let change_pct = quote.regular_market_change_percent.raw.unwrap_or(0.0);
            println!("{}: {:+.2}%", quote.symbol, change_pct);
        }
        Ok(())
    }
}

// line 81: compile-only (no_run)
#[rustfmt::skip]
#[allow(dead_code)]
fn doc_block_line_81() {
    use finance_query::{finance, EquityScreenerQuery, EquityField, ScreenerFieldExt};

    #[tokio::main]
    async fn main() -> Result<(), Box<dyn std::error::Error>> {
        // Find US large-cap value stocks with healthy volume
        let query = EquityScreenerQuery::new()
            .size(50)
            .sort_by(EquityField::IntradayMarketCap, false)   // descending
            .add_condition(EquityField::Region.eq_str("us"))
            .add_condition(EquityField::AvgDailyVol3M.gt(500_000.0))
            .add_condition(EquityField::IntradayMarketCap.gt(10_000_000_000.0))
            .add_condition(EquityField::PeRatio.between(10.0, 25.0));

        let results = finance::custom_screener(query).await?;
        println!("Found {} stocks", results.quotes.len());
        Ok(())
    }
}

// line 191: compile-only (no_run)
#[rustfmt::skip]
#[allow(dead_code)]
fn doc_block_line_191() {
    use finance_query::{EquityScreenerQuery, finance};

    #[tokio::main]
    async fn main() -> Result<(), Box<dyn std::error::Error>> {
        // Most shorted US stocks with average volume > 200K
        let results = finance::custom_screener(EquityScreenerQuery::most_shorted()).await?;

        // High-dividend US stocks (forward yield > 3%, volume > 100K)
        let results = finance::custom_screener(EquityScreenerQuery::high_dividend()).await?;

        // US large-cap growth stocks (market cap > $10B, positive EPS growth)
        let results = finance::custom_screener(EquityScreenerQuery::large_cap_growth()).await?;
        println!("Large-cap growth: {}", results.quotes.len());
        Ok(())
    }
}

// line 213: compile-only (no_run)
#[rustfmt::skip]
#[allow(dead_code)]
fn doc_block_line_213() {
    use finance_query::{finance, FundScreenerQuery, FundField, ScreenerFieldExt};

    #[tokio::main]
    async fn main() -> Result<(), Box<dyn std::error::Error>> {
        let query = FundScreenerQuery::new()
            .size(25)
            .sort_by(FundField::PerformanceRating, false)
            .add_condition(FundField::RiskRating.lte(3.0))
            .include_fields(vec![
                FundField::Ticker,
                FundField::CompanyShortName,
                FundField::IntradayPrice,
                FundField::CategoryName,
                FundField::PerformanceRating,
                FundField::RiskRating,
            ]);

        let results = finance::custom_screener(query).await?;
        println!("Funds: {}", results.quotes.len());
        Ok(())
    }
}