calculate_liquidation_price#

API documentation for tradeexecutor.utils.leverage_calculations.calculate_liquidation_price Python function.

calculate_liquidation_price(collateral_size, borrow_quantity, shorting_pair)[source]#

Calculate the liquidation price for a short position.

lP = buy_USD * cfBuy / sell

where: buy_USD: buy/deposit asset amount in USD sell: sell/borrow asset amount in sell currency

Parameters:
  • collateral_size (float) – Collateral size in USD

  • borrow_quantity (Decimal) – Borrow quantity in sell currency

  • shorting_pair (TradingPairIdentifier) – Leverage short trading pair

Returns:

Liquidation price in USD

Return type:

float