update_short_loan#

API documentation for tradeexecutor.strategy.lending_protocol_leverage.update_short_loan Python function.

update_short_loan(loan, position, trade, mode='plan', close_position=False)[source]#

Update the loan data tracking for short position.

  • Check that the information looks correct for a short position.

Parameters:
  • loan (Loan) –

    Loan which is about to change.

    Clone the existing loan, will be mutated in place.

  • position (tradeexecutor.state.position.TradingPosition) – Associated trading position

  • trade (TradeExecution) – The trade that is changing this loan

  • close_position

    Is this loan update for a position close.

    For closing position, we hack a special tolerance for the collateral epsilon.

    This is due to slippage collateral spilling to the next position with the same collateral in Aave.

  • mode (Literal['plan', 'execute']) –