divkit 0.0.3

US equity dividends and dividend yield for Rust, from SEC EDGAR public-domain XBRL. Companion to curvekit.
Documentation

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(())
}