accuracy#

API documentation for tradeexecutor.utils.accuracy Python module in Trading Strategy.

Module description#

Make sure we use accurate enough Decimal math to cover token asset quantity.

Ethereum assets have 18 decimals.

Functions#

ensure_exact_zero(quantity[, epsilon])

Ensure that we hit precise zero.

setup_decimal_accuracy()

Make sure we can handle Decimals up to 18 digits.

snap_to_epsilon(available_token_quantity, ...)

Make sure our calculated quantity does not exceed max available tokens.

sum_decimal(numbers[, epsilon])

Decimal safe sum().