paft_market/lib.rs
1//! Market data types, requests, and responses for paft.
2//!
3//! This crate provides strongly-typed market data models (quotes, options,
4//! news), request builders (search, history), and response types that are
5//! consistent across providers. It aims to:
6//! - Offer validated builders to avoid invalid request states
7//! - Encode canonical, serde-stable string forms for interop
8//! - Integrate with `paft-domain` and `paft-money` for identifiers and values
9//!
10//! # Quickstart
11//! ```rust
12//! use paft_market::{HistoryRequest, Interval, Range, SearchRequest};
13//!
14//! // Build a history request for 1 month of daily candles
15//! let req = HistoryRequest::try_from_range(Range::M1, Interval::D1).unwrap();
16//! assert_eq!(req.interval(), Interval::D1);
17//!
18//! // Build a validated search request
19//! let search = SearchRequest::new("AAPL").unwrap();
20//! assert_eq!(search.query(), "AAPL");
21//! ```
22//!
23//! # Feature flags
24//! - `rust-decimal` (default): `paft-money` uses `rust-decimal`
25//! - `bigdecimal`: `paft-money` uses `bigdecimal`
26//! - `dataframe`: enable `polars`/`df-derive` integration for dataframe export
27//!
28//! # Serde
29//! All models serialize with stable, human-readable representations suitable for
30//! storage and transport. Dataframe support emits string codes for enums.
31#![forbid(unsafe_code)]
32#![warn(missing_docs)]
33
34pub mod error;
35pub mod market;
36pub mod requests;
37pub mod responses;
38
39pub use error::MarketError;
40
41pub use market::{
42 action::Action,
43 news::NewsArticle,
44 options::{OptionChain, OptionContract, OptionGreeks},
45 quote::{Quote, QuoteUpdate},
46};
47pub use requests::history::{HistoryRequest, HistoryRequestBuilder, Interval, Range};
48pub use requests::options::{OptionChainRequest, OptionExpirationsRequest};
49pub use requests::search::SearchRequest;
50pub use responses::download::DownloadResponse;
51pub use responses::history::{Candle, HistoryMeta, HistoryResponse};
52pub use responses::options::OptionExpirationsResponse;
53pub use responses::search::{SearchResponse, SearchResult};