paft-domain
Domain modeling primitives for the paft ecosystem: instruments, exchanges, periods, and market state.
- Strongly-typed identifiers for securities (
Symbol,Figi,Isin) with enforced validation Instrumentwith hierarchical identifiers for securities (FIGI → ISIN → Symbol@Exchange → Symbol)- Canonical, serde-stable extensible enums (
Exchange,AssetKind,MarketState) Periodparsing for quarters, years, and dates with a canonical wire format
Install
Prefer the facade crate for most applications:
[]
= "0.8.0"
Advanced (direct dependency, minimal):
[]
= { = "0.8.0", = false }
Enable DataFrame helpers as needed:
[]
= { = "0.8.0", = false, = ["dataframe"] }
Features
tracing: enable lightweight instrumentation on constructors and validatorsdataframe: enable DataFrame traits for Polars integration
Quickstart
The quickstart below uses the direct paft-domain dependency shown above. If
you depend on the facade crate instead, import these types from paft::domain
or paft::prelude.
use ;
// Minimal: instrument from symbol + exchange
let aapl = from_symbol_and_exchange
.unwrap;
// Globally-identified: build the flat struct directly to attach FIGI/ISIN
// (preferred over symbol when available).
let aapl_pro = Instrument ;
assert_eq!;
// Period parsing with canonical output (wire = Display)
let q4 = "2023-Q4"..unwrap;
assert_eq!;
// Unknown provider states round-trip through Other(Canonical).
let delayed = "DELAYED"..unwrap;
assert_eq!;
Prediction markets
Prediction-market identity is intentionally outside paft-domain; use the separate paft-prediction crate:
[]
= "0.8.0"
= "0.8.0"
use PredictionInstrument;
// Create an instrument for a prediction market outcome
let pm = new.unwrap;
// Unique key for prediction markets is event_id/outcome_id
let expected = concat!;
assert_eq!;
Links
- API docs: https://docs.rs/paft-domain
- Workspace overview: https://github.com/paft-rs/paft/blob/main/README.md
- License: LICENSE