Skip to main content

normalize_prices

Function normalize_prices 

Source
pub fn normalize_prices(txn: &mut Transaction)
Expand description

Normalize total prices (@@) to per-unit prices (@) on a transaction.

This converts PriceAnnotation::Total to PriceAnnotation::Unit by dividing the total price by the number of units. This should be called AFTER validation (balance checking) to preserve exact total prices for precise residual calculation.

Matches Python beancount behavior where @@ is converted to @.