Skip to main content

build_conversion_price

Function build_conversion_price 

Source
pub fn build_conversion_price(
    from_split_id: Uuid,
    to_split_id: Uuid,
    from_commodity: Uuid,
    to_commodity: Uuid,
    from_num: i64,
    from_denom: i64,
    to_num: i64,
    to_denom: i64,
) -> Price
Expand description

Build a Price for a multi-currency split from rational components.

from is the spent amount (will be negated in the split), to is the received amount in a different commodity. Returns a Price whose rate converts to back to from units.