#![allow(unused)]
#[rustfmt::skip]
#[test]
fn doc_block_line_58() {
use finance_query::Ticker;
use finance_query::format::Both;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let ticker = Ticker::builder("AAPL").logo().build().await?;
let quote = ticker.quote::<Both>().await?;
if let Some(price) = quote.regular_market_price.as_ref().and_then(|v| v.raw) {
println!("AAPL: ${:.2}", price);
}
Ok(())
}
main();
}
#[rustfmt::skip]
#[test]
fn doc_block_line_76() {
use finance_query::{Tickers, Interval, TimeRange};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let tickers = Tickers::builder(vec!["AAPL", "MSFT", "GOOGL"]).logo().build().await?;
let response = tickers.quotes().await?;
for (symbol, quote) in &response.quotes {
if let Some(price) = quote.regular_market_price.as_ref().and_then(|v| v.raw) {
println!("{}: ${:.2}", symbol, price);
}
}
Ok(())
}
main();
}
#[rustfmt::skip]
#[test]
fn doc_block_line_96() {
use finance_query::edgar;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
edgar::init("your.email@example.com")?;
let cik = edgar::resolve_cik("AAPL").await?;
let submissions = edgar::submissions(cik).await?;
if let Some(name) = &submissions.name {
println!("Company: {}", name);
}
let facts = edgar::company_facts(cik).await?;
if let Some(us_gaap) = facts.facts.get("us-gaap")
&& let Some(revenue) = us_gaap.0.get("Revenues")
&& let Some(usd) = revenue.units.get("USD")
{
for point in usd.iter().take(3) {
if let (Some(fy), Some(val)) = (point.fy, point.val) {
println!("FY {}: ${}", fy, val);
}
}
}
Ok(())
}
main();
}