paft-domain

Crates.iopaft-domain
lib.rspaft-domain
version0.7.1
created_at2025-10-02 11:39:27.551043+00
updated_at2025-10-31 17:56:06.980507+00
descriptionDomain modeling primitives (instrument, exchange, period, market state) for the paft ecosystem.
homepage
repositoryhttps://github.com/paft-rs/paft
max_upload_size
id1864276
size122,570
G. Ramistella (gramistella)

documentation

README

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");

Links

Commit count: 38

cargo fmt