Skip to main content

Crate divkit

Crate divkit 

Source
Expand description

divkit — US equity dividends and dividend yield for Rust, from SEC EDGAR.

Provides trailing-year annual dividend, dividend frequency, and yield calculations sourced from EDGAR public-domain XBRL filings.

§Quick start — free functions

The simplest path: one call, no client to manage.

use divkit::{annual_dividend_for, dividend_snapshot_for};

#[tokio::main]
async fn main() -> divkit::Result<()> {
    // Trailing 12-month dividend
    if let Some(amt) = annual_dividend_for("KO").await? {
        println!("KO annual dividend: ${amt:.4}");
    }

    // Full snapshot — frequency, history, and yield
    let snap = dividend_snapshot_for("KO").await?;
    let yield_pct = snap.yield_on(64.50) * 100.0;
    println!("KO dividend yield at $64.50: {yield_pct:.2}%");
    Ok(())
}

§Client pattern (connection-pool reuse)

Create Divkit once and reuse it across calls to share the internal reqwest connection pool.

use divkit::Divkit;

#[tokio::main]
async fn main() -> divkit::Result<()> {
    let client = Divkit::new();

    // Annual dividend (trailing 12 months)
    if let Some(amt) = client.annual_dividend("KO").await? {
        println!("KO: ${amt:.4}");
    }

    // Snapshot with frequency detection and yield helper
    let snap = client.dividend_snapshot("MSFT").await?;
    println!("MSFT frequency: {:?}", snap.frequency());
    println!("MSFT yield at $420: {:.2}%", snap.yield_on(420.0) * 100.0);
    Ok(())
}

Re-exports§

pub use parquet_io::read_dividends;
pub use parquet_io::write_dividends;
pub use parquet_io::DivRow;

Modules§

parquet_io
Parquet reader/writer for dividend rows.

Structs§

DivEvent
DividendCache
In-memory hydrated dividend cache.
DividendSnapshot
Divkit
Stateful divkit client.

Enums§

Concept
Error
Frequency

Traits§

PriceProvider

Functions§

annual_dividend_for
Annual dividend for ticker using a temporary one-shot client.
dividend_snapshot_for
DividendSnapshot for ticker using a temporary one-shot client.
dividends_for
All dividend events for ticker using a temporary one-shot client.

Type Aliases§

Result