Skip to main content

Crate use_portfolio_weight

Crate use_portfolio_weight 

Source
Expand description

§use-portfolio-weight

Primitive portfolio weight vocabulary for RustUse quantitative crates.

use-portfolio-weight stores finite f64 weights, including negative weights for short exposure vocabulary, and deterministic asset-weight sets.

§Example

use use_portfolio_weight::{AssetWeight, PortfolioWeight, WeightSet};

let weights = WeightSet::from_asset_weights([
    AssetWeight::new("ABC", PortfolioWeight::new(0.60)?)?,
    AssetWeight::new("XYZ", PortfolioWeight::new(0.40)?)?,
])?;

assert_eq!(weights.sum(), 1.0);
assert!(weights.is_approximately_fully_invested(1.0e-12)?);

§Scope

Use this crate for descriptive asset weights. It does not optimize portfolios, rebalance, trade, or provide allocation advice.

§License

Licensed under either MIT or Apache-2.0.

Modules§

prelude
Common portfolio weight primitives.

Structs§

AssetWeight
A non-empty asset identifier paired with a portfolio weight.
PortfolioWeight
A finite portfolio weight value.
WeightSet
A deterministic set of asset weights keyed by asset identifier.

Enums§

PortfolioWeightError
Errors returned by portfolio weight helpers.