ensure_exact_zero#

API documentation for tradeexecutor.utils.accuracy.ensure_exact_zero Python function.

ensure_exact_zero(quantity, epsilon=Decimal('1.00000000000000007154242405462192450852805618492324772617063644020163337700068950653076171875E-18'))[source]#

Ensure that we hit precise zero.

Parameters:

quantity (Decimal) – If this number is one bit off the zero due to decimal math, then assume it is zero.

Returns:

Exact zero for quantities that are too close to zero.

Return type:

Decimal