update_interest#

API documentation for tradeexecutor.strategy.interest.update_interest Python function.

update_interest(state, position, asset, new_token_amount, event_at, asset_price, block_number=None, tx_hash=None, log_index=None, max_interest_gain=0.05)[source]#

Poke leverage position to increase its interest amount.

Parameters:
  • position (TradingPosition) – Trading position to update

  • asset (AssetIdentifier) –

    The asset of which we update the events for.

    aToken for collateral, vToken for debt.

  • new_token_amount (Decimal) – The new on-chain value of aToken/vToken tracking the loan.

  • asset_price (float) –

    The latest known price for the underlying asset.

    Needed to revalue dollar nominated loans.

  • event_at (datetime) – Block mined timestamp

  • max_interest_gain (float) –

    Safety threshold to check that any interest gains are below this value.

    Terminate execution if bad math detected.

  • state (State) –

  • block_number (int | None) –

  • tx_hash (int | None) –

  • log_index (int | None) –

Return type:

BalanceUpdate