snap_to_epsilon#

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

snap_to_epsilon(available_token_quantity, calculated_token_quantity, epsilon=Decimal('1.0000000000000000209225608301284726753266340892878361046314239501953125E-8'))[source]#

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

Parameters:
  • available_token_quantity (Decimal) –

  • calculated_token_quantity (Decimal) –

Return type:

Decimal