finance-query v3.0.0

Filings API Reference#

abstract · Cargo Docs

docs.rs/finance-query — Filings

The Filings domain handle fetches SEC filings for a given symbol. It is backed by EDGAR (keyless — no API key required) with an optional Polygon fallback, and is always available with no feature gate.

Getting a Handle#

Create a Filings handle from a Providers instance and call .get() to fetch the filing data:

rust · no_run
use finance_query::{Providers, edgar};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // EDGAR is keyless but SEC requires a contact email in the User-Agent.
    // Initialise it once per process (or set the EDGAR_EMAIL env var).
    edgar::init("you@example.com")?;

    let providers = Providers::builder().build().await?;
    let filings = providers.filings("AAPL");
    let result = filings.get().await?;

    for f in result.filings.iter().take(5) {
        println!(
            "{} {}: {}",
            f.filing_date.as_deref().unwrap_or("?"),
            f.filing_type.as_deref().unwrap_or("?"),
            f.filing_url.as_deref().unwrap_or("-")
        );
    }
    Ok(())
}
checked claims
ProviderFilingverified current
de_edgar_submissionsmedian time 451.7 µs(limit < 2.0 ms)0limit 2.0 ms

note · EDGAR requires a contact email

EDGAR needs no API key, but SEC's fair-access policy requires a contact email in the request User-Agent. Call edgar::init("you@example.com") once before fetching, or set the EDGAR_EMAIL environment variable.

ProviderFilings·verified current

The returned ProviderFilings value contains the ticker symbol (symbol) and a list of individual filing entries (filings).

Each entry is a ProviderFiling:

FieldTypeDescription
accession_numberOption<String>SEC accession number (unique filing ID)
filing_dateOption<String>Filing date as YYYY-MM-DD
filing_typeOption<String>Filing type (e.g., "10-K", "10-Q", "8-K")
filing_urlOption<String>URL to the filing document
company_nameOption<String>Company name at time of filing
cikOption<String>SEC CIK number

Congressional Trades#

Call .congressional_trades() to fetch legislator stock-trade disclosures naming this symbol, filed under the STOCK Act as Periodic Transaction Reports (PTRs):

rust · no_run feature=housetrades,senatetrades
use finance_query::{Capability, Provider, Providers};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let providers = Providers::builder()
        .route(Capability::FILINGS, [Provider::CongressTrades, Provider::Edgar])
        .build()
        .await?;

    let filings = providers.filings("AAPL");
    for trade in filings.congressional_trades().await? {
        println!(
            "{} {}: {} {} on {}",
            trade.office.as_deref().unwrap_or("?"),
            trade.last_name.as_deref().unwrap_or("?"),
            trade.trade_type.as_deref().unwrap_or("?"),
            trade.amount.as_deref().unwrap_or("?"),
            trade.transaction_date.as_deref().unwrap_or("?")
        );
    }
    Ok(())
}
checked claims
CongressionalTradeverified current

Two keyless sources feed this: the House Clerk (housetrades feature) and the Senate eFD system (senatetrades feature), merged by Provider::CongressTrades when both are compiled in. Each result row's office field says which chamber it came from, "House" or "Senate". If the Senate source fails (a network error, or Akamai bot protection blocking the request; see the Senate PTR page for why that happens), the merge drops just those rows and returns House-only results rather than failing the whole call. Only both sources failing (or the single compiled source failing, when just one is enabled) surfaces an error.

FieldTypeDescription
symbolOption<String>Ticker symbol traded
first_nameOption<String>Legislator's first name
last_nameOption<String>Legislator's last name
officeOption<String>"House" or "Senate", depending on which source the row came from
districtOption<String>District, for House members; always None for Senate rows
trade_typeOption<String>Transaction type (e.g. "Purchase", "Sale")
amountOption<String>Reported transaction amount range (e.g. "$1,001 - $15,000")
asset_descriptionOption<String>Description of the asset traded
transaction_dateOption<String>Date the transaction occurred (YYYY-MM-DD)
disclosure_dateOption<String>Date the transaction was publicly disclosed (YYYY-MM-DD)
linkOption<String>Link to the source disclosure filing

Filing Sections#

Call .sections(accession_number, form) to fetch the sectioned text of one filing (10-K or 8-K), split into FilingSections by item heading:

rust · no_run
use finance_query::{FilingSectionForm, Providers};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let providers = Providers::builder().build().await?;
    let filings = providers.filings("AAPL");

    let submissions = filings.get().await?;
    let latest_10k = submissions
        .filings
        .iter()
        .find(|f| f.filing_type.as_deref() == Some("10-K"))
        .and_then(|f| f.accession_number.as_deref())
        .unwrap_or_default();

    for section in filings.sections(latest_10k, FilingSectionForm::TenK).await? {
        println!(
            "{}: {} chars",
            section.section.as_deref().unwrap_or("?"),
            section.content.as_deref().unwrap_or("").len()
        );
    }
    Ok(())
}
checked claims
FilingSectionverified current

This is served by keyless EDGAR (best-effort heading detection over the filing's own HTML — see the module's recall caveat below) or Polygon, whichever the FILINGS route resolves to first; the default route already puts EDGAR ahead of nothing else, so no explicit .route() call is required.

FieldTypeDescription
sectionOption<String>Section key/name (e.g. "risk_factors", "mdna")
contentOption<String>Section text content

Risk Factors#

Call .risk_factors() for this symbol's risk factors, extracted from its most recent 10-K:

rust · no_run
use finance_query::Providers;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let providers = Providers::builder().build().await?;
    let filings = providers.filings("AAPL");

    for factor in filings.risk_factors().await?.iter().take(5) {
        println!("{}", factor.title.as_deref().unwrap_or("?"));
    }
    Ok(())
}
checked claims
RiskFactorverified current
FieldTypeDescription
titleOption<String>Risk factor title
textOption<String>Risk factor text
categoryOption<String>Risk category
filing_dateOption<String>Date of the filing the factor was extracted from (YYYY-MM-DD)

note · Recall caveat

EDGAR's section and risk-factor extraction is heuristic: it detects Item N headings in the filing's raw HTML rather than using a structured index, so malformed or unusually formatted filings can yield partial or empty results. It returns best-effort output rather than erroring on those filings.

Fails to Deliver#

Call .fails_to_deliver() for this symbol's SEC fails-to-deliver history, the settlement-date record of shares that a broker-dealer failed to deliver on time:

rust · no_run feature=secftd
use finance_query::{Providers, edgar};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    edgar::init("you@example.com")?;

    let providers = Providers::builder().build().await?;
    let filings = providers.filings("AAPL");

    for row in filings.fails_to_deliver().await? {
        println!(
            "{}: {:?} shares of {:?}",
            row.date.as_deref().unwrap_or("?"),
            row.quantity,
            row.name
        );
    }
    Ok(())
}
checked claims
FailToDeliververified current

This is served by keyless EDGAR (secftd feature), which the default FILINGS route already puts ahead of Yahoo, so no explicit .route() call is required once secftd is compiled in. FMP also serves this operation for callers who route Capability::FILINGS to it instead.

FieldTypeDescription
symbolOption<String>Ticker symbol
dateOption<String>Settlement date (YYYY-MM-DD)
quantityOption<f64>Number of shares that failed to deliver
priceOption<f64>Closing price on the settlement date
nameOption<String>Security name
descriptionOption<String>Additional description, when reported

See Also#

built with cargo soothfast docs build source