Skip to main content

Crate forecite

Crate forecite 

Source
Expand description

Official Rust SDK for the Forecite API — the scored news feed (REST), the Verdict scoring engine, and the realtime WebSocket stream. Async, built on reqwest + tokio-tungstenite.

use forecite::{Forecite, FeedsQuery, StreamFilters, StreamEvent};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let forecite = Forecite::new("fc_live_your_key");

    // REST
    let feeds = forecite
        .feeds_list(&FeedsQuery { symbol: Some("TSLA".into()), limit: Some(20), ..Default::default() })
        .await?;
    println!("{} feeds", feeds.data.len());

    // Realtime
    let filters = StreamFilters { symbols: Some(vec!["TSLA".into()]), ..Default::default() };
    let mut stream = forecite.stream(&filters, 10).await?;
    while let Some(event) = stream.next().await? {
        if let StreamEvent::Feed { data, .. } = event {
            println!("{:?}", data.title);
        }
    }
    Ok(())
}

Structs§

Artifact
FeedItem
FeedList
FeedScoring
FeedSymbol
FeedsQuery
Query params for feeds_list. Build with FeedsQuery::default() then set fields.
Forecite
Forecite API client — REST + scoring + realtime streaming.
ForeciteBuilder
Builder for Forecite — override base_url / ws_url for local dev.
ForeciteStream
A live feed subscription. Drive it by calling ForeciteStream::next in a loop; it returns Ok(None) when the connection closes.
KeyInfo
Provider
ScoreOptions
SourceInfo
StreamFilters
SymbolInfo
TagDimensionValues
TagValue
UpdateWebhook
UsageInfo
Verdict
Webhook

Enums§

ForeciteError
Errors returned by the Forecite client.
StreamEvent
An event received on the realtime stream.