Acquire.Accounting._decimal module

create_decimal(value, default=0)[source]

Create a decimal from the passed value. This is a decimal that has 6 decimal places and is clamped between -1 quadrillion < value < 1 quadrillion

Parameters:value

Value to convert to Decimal

Returns:
Decimal: Decimal version of value
get_decimal_context()[source]

Return the context used for all decimals in transactions. This context rounds to 6 decimal places and provides sufficient precision to support any value between 0 and 999,999,999,999,999.999,999,999 (i.e. everything up to just under one quadrillion - I doubt we will

ever have an account that has more than a trillion units in it!)

Returns:
Context: The context (specifying precision etc.) of the decimals used in transactions