paft
Facade crate for Provider Agnostic Financial Types.
Use this crate when you want one dependency that re-exports the paft workspace:
money and decimal primitives, domain identifiers, market data, fundamentals,
optional aggregate snapshots, optional prediction-market types, and a unified
paft::Error / paft::Result.
paft::preludeimports the common public types enabled by your featurespaft::moneyexposes currency, money, price, and quantity primitivespaft::domain,paft::market, andpaft::fundamentalsare enabled by defaultpaft::aggregates,paft::prediction, andpaft::dataframeare feature-gatedpaft::Decimalfollows the active decimal backend
Install
Most applications should start with the default feature set:
[]
= "0.9.0"
The default features are domain, market, and fundamentals. For a smaller
dependency, disable defaults and opt into only what you use:
[]
= { = "0.9.0", = false, = ["domain"] }
Add one or more optional features to the default set:
[]
= { = "0.9.0", = ["aggregates", "prediction", "dataframe"] }
Use full when you want every domain crate plus DataFrame support:
[]
= { = "0.9.0", = ["full"] }
Use bigdecimal when you need an arbitrary-precision decimal backend:
[]
= { = "0.9.0", = ["bigdecimal"] }
Features
domain(default): instruments, exchanges, identifiers, periods, horizons, and market statemarket(default, enablesdomain): quotes, history, options, order books, news, search, downloads, and request buildersfundamentals(default, enablesdomain): profiles, statements, analysis rows, holders, ESG, and key statisticsaggregates(enablesdomain):Snapshotinstrument snapshotsprediction: prediction-market venue/id, event/market metadata, fixed-point price, book, quote, and trade typesdataframe: Polars DataFrame traits and implementations for enabled paft typesbigdecimal: switch the shared decimal backend fromrust_decimaltobigdecimalmoney-formatting: locale-awareMoneyformatting and strict parsing APIspanicking-money-ops: opt in toMoneyarithmetic operators that panic on invalid operationstracing: lightweight instrumentation in selected constructors and validatorsfull: convenience bundle fordomain,market,fundamentals,aggregates,prediction, anddataframe
Quickstart
use *;
run.unwrap;
Global security identifiers are strongly typed. Use the flat Instrument
fields when FIGI or ISIN data is available:
use *;
let instrument = Instrument ;
assert_eq!;
assert_eq!;
DataFrame support
Enable the dataframe feature and import the traits from the facade prelude:
[]
= { = "0.9.0", = ["dataframe"] }
use *;
let quotes = vec!;
let df = quotes.to_dataframe?;
Contextual price fields flatten into amount columns such as price.amount;
the containing record carries denomination in its currency column. Provider
metadata columns are namespaced under provider.*.
Money formatting
Enable money-formatting when you need localized presentation or strict
locale-aware parsing. Canonical Display remains stable as "<amount> <CODE>".
[]
= { = "0.9.0", = ["money-formatting"] }
use ;
let usd = Iso;
let money = from_canonical_str?;
assert_eq!;
assert_eq!;
let parsed = from_str_locale?;
assert_eq!;
Examples
examples/v09_ergonomics.rs: default facade usage without provider metadataexamples/provider_metadata.rs: generic provider metadata payloadsexamples/metadata_dataframe.rs: DataFrame export with provider metadataexamples/nested_metadata_propagation.rs: independent provider metadata at each nested layerexamples/extensible_enums.rs: unknown provider tokens and typedOtherwrappers
Links
- API docs: https://docs.rs/paft
- Workspace overview: https://github.com/paft-rs/paft/blob/main/README.md
- License: LICENSE