paft-domain
Domain modeling primitives for the paft ecosystem: instruments, exchanges, periods, horizons, and market state.
- Validated identifiers for securities (
Symbol,Figi,Isin) Instrumentidentity precedence: FIGI, then ISIN, then symbol plus exchange, then symbol- Canonical, serde-stable open enums (
Exchange,AssetKind,MarketState) ReportingPeriodparsing for fiscal/provider labels with a canonical wire formatCalendarPeriodhelpers for calendar year/quarter/date boundariesHorizonparsing for relative lookback windows such as7d,1mo, and1y
Install
Prefer the facade crate for most applications:
[]
= "0.9.0"
Advanced (direct dependency, minimal):
[]
= { = "0.9.0", = false }
Enable DataFrame helpers as needed:
[]
= { = "0.9.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;
assert_eq!;
assert_eq!;
// Attach global identifiers directly when provider data includes them.
let aapl_pro = Instrument ;
assert_eq!;
assert_eq!;
// ReportingPeriod models reporting/fiscal labels; constructors validate components.
let reported_q4 = quarterly.unwrap;
assert_eq!;
assert!;
// CalendarPeriod is the type for calendar date-boundary logic.
let calendar_q4 = quarterly.unwrap;
assert_eq!;
assert_eq!;
// Parsing keeps provider-friendly inputs available too.
let parsed = "2023-Q4"..unwrap;
assert_eq!;
// Horizon parsing is separate from reporting period parsing.
let horizon = "3mo"..unwrap;
assert_eq!;
Prediction markets
Prediction-market identity is intentionally outside paft-domain. Use
paft-prediction for PredictionVenue, role-specific prediction ids,
PredictionEvent, BinaryMarket, and OutcomeInstrument.
Links
- API docs: https://docs.rs/paft-domain
- Workspace overview: https://github.com/paft-rs/paft/blob/main/README.md
- License: LICENSE