reduce_short_position

Documentation for eth_defi.one_delta.position.reduce_short_position function.

reduce_short_position(one_delta_deployment, *, collateral_token, borrow_token, atoken, pool_fee, wallet_address, reduce_borrow_amount=None, reduce_collateral_amount=None, min_borrow_amount_out=None, max_collateral_amount_in=None, withdraw_collateral_amount=None, exchange=Exchange.UNISWAP_V3, interest_mode=AaveV3InterestRateMode.VARIABLE)[source]

Reduce a short position size.

NOTE: only single-hop swap is supported at the moment

Parameters
  • one_delta_deployment (eth_defi.one_delta.deployment.OneDeltaDeployment) – 1delta deployment

  • collateral_token (web3.contract.contract.Contract) – collateral token contract proxy

  • borrow_token (web3.contract.contract.Contract) – borrow token contract proxy

  • pool_fee (int) – raw fee of the pool which is used for the swap

  • wallet_address (str) – wallet address of the user

  • reduce_borrow_amount (Optional[int]) – amount of borrow token to be reduced

  • reduce_collateral_amount (Optional[int]) – amount of collateral to be reduced

  • min_borrow_amount_out (Optional[int]) – minimum amount of borrow token to be received

  • min_collateral_amount_out – minimum amount of collateral to be received

  • withdraw_collateral_amount (Optional[int]) – the amount of collateral to be withdrawn, if 0 then only flash swap will be executed

  • exchange (eth_defi.one_delta.constants.Exchange) – exchange to be used for the swap

  • interest_mode (eth_defi.aave_v3.constants.AaveV3InterestRateMode) – interest mode, variable or stable

  • atoken (web3.contract.contract.Contract) –

  • max_collateral_amount_in (Optional[int]) –

Returns

multicall contract function to reduce short position then withdraw collateral

Return type

web3.contract.contract.ContractFunction