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
- Feed
Item - Feed
List - Feed
Scoring - Feed
Symbol - Feeds
Query - Query params for
feeds_list. Build withFeedsQuery::default()then set fields. - Forecite
- Forecite API client — REST + scoring + realtime streaming.
- Forecite
Builder - Builder for
Forecite— overridebase_url/ws_urlfor local dev. - Forecite
Stream - A live feed subscription. Drive it by calling
ForeciteStream::nextin a loop; it returnsOk(None)when the connection closes. - KeyInfo
- Provider
- Score
Options - Source
Info - Stream
Filters - Symbol
Info - TagDimension
Values - TagValue
- Update
Webhook - Usage
Info - Verdict
- Webhook
Enums§
- Forecite
Error - Errors returned by the Forecite client.
- Stream
Event - An event received on the realtime stream.