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
- Dividend
Cache - In-memory hydrated dividend cache.
- Dividend
Snapshot - Divkit
- Stateful divkit client.
Enums§
Traits§
Functions§
- annual_
dividend_ for - Annual dividend for
tickerusing a temporary one-shot client. - dividend_
snapshot_ for DividendSnapshotfortickerusing a temporary one-shot client.- dividends_
for - All dividend events for
tickerusing a temporary one-shot client.