Skip to content

Haut/edgar-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

edgar-rs

Crates.io Documentation CI License: MIT

Async Rust client for the SEC EDGAR API with built-in rate limiting.

Features

  • Full coverage of the EDGAR public API (tickers, submissions, documents, XBRL, full-text search)
  • Automatic rate limiting (10 req/s default, per SEC fair access policy)
  • Strongly typed responses with serde
  • Cik newtype for type-safe CIK number handling
  • Async/await with reqwest and tokio

Installation

cargo add edgar-rs

Or add to your Cargo.toml:

[dependencies]
edgar-rs = "0.1"
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }

Quick start

use edgar_rs::{ClientBuilder, Cik};

#[tokio::main]
async fn main() -> edgar_rs::Result<()> {
    // SEC requires a User-Agent identifying your application
    let client = ClientBuilder::new("MyApp/1.0 contact@example.com")
        .build()?;

    // Fetch all company tickers
    let tickers = client.get_tickers().await?;
    println!("Total tickers: {}", tickers.len());

    // Get Apple's submission data
    let submission = client.get_submission(Cik::new(320193)).await?;
    println!("Company: {}", submission.name);

    Ok(())
}

API coverage

Method Description
get_tickers() CIK-to-ticker mapping for all companies
get_submission(cik) Company metadata and filing history
get_document(cik, accession, doc) Individual filing document content
get_company_concept(cik, taxonomy, tag) XBRL data for a single concept
get_company_facts(cik) All XBRL facts for a company
get_frame(taxonomy, tag, unit, period) Aggregated XBRL data across all companies
search(query, options) Full-text search across filings

Rate limiting

SEC EDGAR requires all automated tools to limit requests to 10 per second. This client enforces that by default. You can adjust it via ClientBuilder::rate_limit(), but going above 10 is not recommended.

License

MIT

About

Async Rust client for the SEC EDGAR API with built-in rate limiting

Topics

Resources

License

Stars

Watchers

Forks

Contributors