tradestation-api 0.1.1

Complete TradeStation REST API v3 wrapper for Rust
Documentation
//! HTTP chunked-transfer streaming for TradeStation v3.
//!
//! TradeStation uses HTTP streaming (NOT WebSocket):
//! - Content-Type: `application/vnd.tradestation.streams.v3+json`
//! - Newline-delimited JSON objects
//! - `StreamStatus` messages signal snapshot boundaries (`EndSnapshot`) and
//!   reconnect requests (`GoAway`)
//!
//! All stream methods return a [`BoxStream`] of typed updates that can be
//! consumed with `futures::StreamExt`.
//!
//! # Example
//!
//! ```no_run
//! # use tradestation_api::{Client, Credentials};
//! # async fn example(client: &mut Client) -> Result<(), Box<dyn std::error::Error>> {
//! use futures::StreamExt;
//!
//! let mut stream = client.stream_quotes(&["AAPL"]).await?;
//! while let Some(result) = stream.next().await {
//!     let quote = result?;
//!     if !quote.is_status() {
//!         println!("{}: {}", quote.symbol.as_deref().unwrap_or("?"), quote.last.as_deref().unwrap_or("?"));
//!     }
//! }
//! # Ok(())
//! # }
//! ```

use futures::stream::Stream;
use std::pin::Pin;

use crate::Error;

mod brokerage_streams;
mod dto;
mod market_data_streams;

pub use dto::*;

/// Type alias for a boxed async stream of results.
///
/// All streaming methods return this type. Consume it with
/// `futures::StreamExt::next()`.
pub type BoxStream<T> = Pin<Box<dyn Stream<Item = Result<T, Error>> + Send>>;