finance-query v3.0.0

RSS / Atom Feeds#

abstract · Cargo Docs

docs.rs/finance-query — feeds

The feeds module aggregates RSS and Atom news from over 30 named financial sources, or any custom URL. Multiple feeds can be fetched concurrently in a single call with automatic deduplication and chronological sorting.

This page is a living document: every code block is compiled as a generated test (cargo soothfast docs gen-tests), the offline parsing example actually runs, and the performance statements are soothfast:claim markers checked against real measurements in CI.

Fetching a Single Feed#

rust · no_run
use finance_query::feeds::{self, FeedSource};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Federal Reserve press releases and speeches
    let fed_news = feeds::fetch(FeedSource::FederalReserve).await?;

    for entry in fed_news.iter().take(5) {
        println!("{}: {}", entry.published.as_deref().unwrap_or("?"), entry.title);
        println!("  {}", entry.url);
    }
    Ok(())
}

Fetching Multiple Feeds#

rust · no_run
use finance_query::feeds::{self, FeedSource};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Aggregate multiple sources concurrently
    let news = feeds::fetch_all([
        FeedSource::FederalReserve,
        FeedSource::SecPressReleases,
        FeedSource::MarketWatch,
        FeedSource::Bloomberg,
        FeedSource::WsjMarkets,
    ]).await?;

    println!("Total entries (deduplicated): {}", news.len());
    for entry in news.iter().take(10) {
        println!("[{}] {}: {}", entry.source, entry.published.as_deref().unwrap_or("?"), entry.title);
    }
    Ok(())
}

fetch_all fetches all sources concurrently, deduplicates by URL, and sorts newest-first where dates are available. Individual feed failures are silently skipped.

Custom Feed URLs#

rust · no_run
use finance_query::feeds::{self, FeedSource};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let custom = feeds::fetch(FeedSource::Custom(
        "https://example.com/feed.xml".to_string()
    )).await?;
    println!("{} entries", custom.len());
    Ok(())
}

Offline Parsing#

The extractor behind every fetch is feeds::parse_bytes — a hand-rolled, dependency-free RSS/Atom parser. It works on raw bytes, so you can use it on feeds obtained by other means. This example runs as a real test:

rust · runnable
use finance_query::feeds;

let xml = br#"<?xml version="1.0"?>
<rss version="2.0"><channel>
  <title>Example</title>
  <item>
    <title>Markets rally</title>
    <link>https://example.com/a</link>
    <pubDate>Mon, 06 Jul 2026 12:00:00 GMT</pubDate>
  </item>
</channel></rss>"#;

let entries = feeds::parse_bytes(xml, "Example").unwrap();
assert_eq!(entries.len(), 1);
assert_eq!(entries[0].title, "Markets rally");
assert_eq!(entries[0].url, "https://example.com/a");
assert_eq!(entries[0].source, "Example");
println!("parsed {} entr(y/ies)", entries.len());
println!("title  = {:?}", entries[0].title);
println!("url    = {:?}", entries[0].url);
recorded outputcargo soothfast docs capture
parsed 1 entr(y/ies)
title  = "Markets rally"
url    = "https://example.com/a"
checked claims
rss_parseCPU instructions64,879<100,000
rss_parsemedian time5.2 µs<30.0 µs

Cheap enough to re-parse on every poll.

FeedEntry Fields#

FeedEntry·verified current
FieldTypeDescription
titleStringArticle or item title
urlStringCanonical link to the article
publishedOption<String>Publication date/time as RFC 3339 string
summaryOption<String>Short summary or description
sourceStringHuman-readable source name (e.g., "Federal Reserve")

Available FeedSource Variants#

Regulatory & Government#

VariantSource
FederalReserveFederal Reserve press releases and speeches
SecPressReleasesSEC enforcement actions and rule changes
SecFilings(form_type)SEC EDGAR filings by form type (e.g., "10-K", "8-K")
BeaUS Bureau of Economic Analysis data releases
EcbEuropean Central Bank press releases and speeches
CfpbConsumer Financial Protection Bureau newsroom
BankOfEnglandBank of England monetary policy notices

Financial News#

VariantSource
MarketWatchMarketWatch top stories
WsjMarketsWall Street Journal Markets
BloombergBloomberg Markets news
FinancialTimesFinancial Times Markets section
FtLexFT Lex — daily market commentary column
CnbcCNBC Markets
NytBusinessNew York Times Business section
GuardianBusinessThe Guardian Business section
InvestingInvesting.com all news
FortuneFortune — business and finance news
BusinessWireBusiness Wire — corporate press releases (earnings, dividends, M&A)
TheEconomistThe Economist — global economics
FinancialPostFinancial Post — Canadian markets
RitholtzBigPictureThe Big Picture (Ritholtz) — macro commentary
CalculatedRiskCalculated Risk — housing, mortgage, macro data

Crypto & Tech#

VariantSource
CoinDeskCoinDesk — cryptocurrency and blockchain news
CoinTelegraphCoinTelegraph — crypto news and analysis
TechCrunchTechCrunch — startup, VC, and tech news
HackerNewsHacker News — curated tech posts (100+ points)
VentureBeatVentureBeat — AI and enterprise technology
YCombinatorY Combinator blog — startup ecosystem

International#

VariantSource
ScmpSouth China Morning Post — China business and trade
NikkeiAsiaNikkei Asia — Japanese and Asian business news
OilPriceOilPrice.com — energy geopolitics

Custom#

VariantDescription
Custom(String)Any RSS/Atom feed URL

Example: SEC EDGAR Filing Feed#

rust · no_run
use finance_query::feeds::{self, FeedSource};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Stream the latest 10-K filings
    let filings = feeds::fetch(FeedSource::SecFilings("10-K".to_string())).await?;

    for f in &filings {
        println!("{}: {}", f.published.as_deref().unwrap_or("?"), f.title);
        println!("  {}", f.url);
    }
    Ok(())
}

Next Steps#

built with cargo soothfast docs build source