finance-query 3.0.0

A Rust library for querying financial data
Documentation
// @generated by `cargo soothfast docs gen-tests`
// source: docs/library/crypto.md line 184
#[cfg(feature = "crypto")]
fn main() {
    use finance_query::CryptoQuote;

    // `CryptoQuote` is #[non_exhaustive] outside the crate, so construct via
    // serde. With live data: `providers.crypto("BTC").quote("usd").await?`.
    let quote: CryptoQuote = serde_json::from_value(serde_json::json!({
        "id": "BTC",
        "symbol": "BTC",
        "name": "Bitcoin",
        "price": 67234.50,
        "market_cap": 1_325_000_000_000.0,
        "volume_24h": 28_400_000_000.0,
        "change_24h": 1540.20,
        "change_percent_24h": 2.35,
        "high_24h": 67800.0,
        "low_24h": 65500.0,
        "circulating_supply": 19_700_000.0,
    }))
    .unwrap();

    fn verify_crypto_quote_price(q: CryptoQuote) {
        let _: Option<f64> = q.price;
    }
    verify_crypto_quote_price(quote.clone());

    println!("symbol = {}", quote.symbol);
    println!("price = {:?}", quote.price);
}

#[cfg(not(feature = "crypto"))]
fn main() {}