#market-data #instrument #serde #type

paft-domain

Domain modeling primitives (instrument, exchange, period, market state) for the paft ecosystem

10 releases (4 breaking)

Uses new Rust 2024

0.7.1 Oct 31, 2025
0.7.0 Oct 28, 2025
0.6.0 Oct 21, 2025
0.5.2 Oct 19, 2025
0.3.2 Oct 3, 2025

#443 in Finance

Download history 595/week @ 2025-10-15 228/week @ 2025-10-22 113/week @ 2025-10-29 27/week @ 2025-11-05 29/week @ 2025-11-12 37/week @ 2025-11-19 42/week @ 2025-11-26 19/week @ 2025-12-03 32/week @ 2025-12-10 99/week @ 2025-12-17 114/week @ 2025-12-24 88/week @ 2025-12-31 64/week @ 2026-01-07 66/week @ 2026-01-14 67/week @ 2026-01-21 150/week @ 2026-01-28

360 downloads per month
Used in 11 crates (4 directly)

MIT license

88KB
1.5K SLoC

paft-domain

Domain modeling primitives for the paft ecosystem: instruments, exchanges, periods, and market state.

Crates.io Docs.rs

  • Strongly-typed identifiers (Isin, Figi) with enforced validation
  • Instrument with hierarchical identifiers (FIGI → ISIN → Symbol@Exchange → Symbol)
  • Canonical, serde-stable enums (Exchange, AssetKind, MarketState)
  • Period parsing for quarters, years, and dates with a canonical wire format

Install

Prefer the facade crate for most applications:

[dependencies]
paft = "0.7.1"

Advanced (direct dependency, minimal):

[dependencies]
paft-domain = { version = "0.7.1", default-features = false }

Alternate decimal backend: enable on dependent crates (e.g., via the facade):

[dependencies]
paft = { version = "0.7.1", features = ["bigdecimal"] }

Enable DataFrame helpers as needed:

[dependencies]
paft-domain = { version = "0.7.1", default-features = false, features = ["dataframe"] }

Features

  • bigdecimal: change money backend from rust_decimal to bigdecimal via paft-money
  • dataframe: enable DataFrame traits for Polars integration

Quickstart

use paft_domain::{Instrument, AssetKind, Exchange, Period};

// Instrument with optional global identifiers
let aapl = Instrument::try_new(
    "AAPL",
    AssetKind::Equity,
    Some("BBG000B9XRY4"), // FIGI
    Some("US0378331005"), // ISIN
    Some(Exchange::NASDAQ),
).unwrap();

assert!(aapl.is_globally_identified());
assert_eq!(aapl.unique_key(), "BBG000B9XRY4");

// Period parsing with canonical output
let q4 = "2023-Q4".parse::<Period>().unwrap();
assert_eq!(q4.to_string(), "2023Q4");

Dependencies

~3–20MB
~194K SLoC