strategy.strategies.dynamic_lp.states.close_position
json
partial
pprint
TYPE_CHECKING
ActionType
ExecutionStatus
Action
ActionBundle
ClosePositionParams
close_position
def close_position(strat: "StrategyDynamicLP") -> ActionBundle
Closes the current liquidity position in the pool.
This function constructs an action to close the liquidity position identified by position_id
.
The liquidity and the fees are collected, and the NFT position is burned and 100% of these assets will
be used to open the next position. It uses the Close Position Multicall Action.
Returns:
ActionBundle
- An action bundle with the close position action (using the multicall action).
prepare_close_position
def prepare_close_position(strat: "StrategyDynamicLP") -> ActionBundle
Prepares the close position actions.
Returns:
ActionBundle
- An action bundle with the close position action (using the multicall action).
validate_close_position
def validate_close_position(strat: "StrategyDynamicLP") -> bool
Validates the close position actions and retrieves the amounts from closing the position (liquidity + fees), using transaction receipts. It loads the transaction statuses from the executioner and processes them.
Returns:
bool
- True if the close position actions were successful and the amounts were retrieved correctly.
Notes:
The only possible ExecutionStatus at this point is ExecutionStatus.SUCCESS otherwise should be in sadflow redoing the actions.
sadflow_close_position
def sadflow_close_position(strat: "StrategyDynamicLP") -> ActionBundle
Handles the sadflow for the close position state. Calls the appropriate function based on the status of the actions.
sadflow_retry
def sadflow_retry(strat: "StrategyDynamicLP") -> ActionBundle
Handles the basic retry sadflow.
sadflow_partial_retry
def sadflow_partial_retry(strat: "StrategyDynamicLP") -> ActionBundle
Handles the complex partial retry sadflow.
Close position with Multicall has no partial sadflow, it's all or nothing.