Skip to main content

Crate gold_melt_value

Crate gold_melt_value 

Source
Expand description

§gold-melt-value

Compute precious-metal melt value from karat (purity), weight, and a live spot price. Pure, dependency-free math — the same engine behind the GoldGramPrice live gold calculator.

§Quick example

use gold_melt_value::{melt_value_grams, purity};

let spot_per_oz = 3983.30;          // USD per troy ounce
let grams = 10.0;                    // a 10 g chain
let karat = 14;

let usd = melt_value_grams(grams, karat, spot_per_oz);
// 10 g of 14k contains ~5.83 g pure gold → melt ≈ $747.05
assert!((usd - 747.05).abs() < 0.05);
assert_eq!(purity(14), 14.0 / 24.0);

Modules§

karats
Common karat purities used in jewelry (US).

Constants§

GRAMS_PER_TROY_OZ
Grams in one troy ounce (1 oz t = 31.1034768 g).

Functions§

melt_value_dwt
Melt value for a weight in pennyweight (dwt). 1 dwt = 1/20 troy oz.
melt_value_grams
Melt value (in the spot-price currency) for a given weight in grams, karat, and spot_per_troy_oz.
melt_value_troy_oz
Melt value for a weight in troy ounces (already in troy units).
purity
Decimal purity for a karat value (karat / 24).
spot_per_gram
Spot price per gram of pure metal, derived from a per-troy-ounce quote.