leverage_calculations#

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

Module description#

Helpers for leverage calculations.

  • Collateral/borrow size

  • Fees needed to pay

  • Liquidation price

Classes#

LeverageEstimate

Estimate token quantities and fees for a leverage position.

Functions#

calculate_liquidation_price(collateral_size, ...)

Calculate the liquidation price for a short position.

calculate_sizes_for_leverage(...)

Calculate the collateral and borrow loan size to hit the target leverage with a starting capital.