finance-query 3.0.0

A Rust library for querying financial data
Documentation
// @generated by `cargo soothfast docs gen-tests`
// source: docs/library/dataframe.md line 676
#[cfg(feature = "dataframe")]
mod soothfast_capture_body {
    use finance_query::{Dividend, Interval, Ticker, TimeRange};
    use polars::prelude::*;

    #[tokio::main]
    pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
        let aapl = Ticker::new("AAPL").await?;
        let aapl_chart = aapl.chart(Interval::OneDay, TimeRange::OneMonth).await?;
        let aapl_divs = aapl.dividends(TimeRange::OneMonth).await?;

        let price_df = aapl_chart.to_dataframe()?;
        let div_df = Dividend::vec_to_dataframe(&aapl_divs)?;

        let joined = price_df.left_join(&div_df, ["timestamp"], ["timestamp"])?;
        println!("joined shape: {:?}", joined.shape());
        Ok(())
    }
}
#[cfg(feature = "dataframe")]
pub use soothfast_capture_body::main;

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