Skip to content

Commit

Permalink
Close frozen positions
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed Jan 19, 2025
1 parent 66b3342 commit f68d95a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion deps/web3-ethereum-defi
7 changes: 6 additions & 1 deletion tradeexecutor/cli/close_position.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,12 @@ def close_single_or_all_positions(
positions_to_close = list(open_positions)
else:
logger.info("Performing close-position for position #%d", position_id)
positions_to_close = [state.portfolio.open_positions[position_id]]
if position_id in state.portfolio.open_positions:
positions_to_close = [state.portfolio.open_positions[position_id]]
elif position_id in state.portfolio.frozen_positions:
positions_to_close = [state.portfolio.frozen_positions[position_id]]
else:
raise RuntimeError(f"Position #{position_id} does not exist")

for p in positions_to_close:
logger.info(" Position: %s, quantity %s", p, p.get_quantity())
Expand Down
2 changes: 1 addition & 1 deletion tradeexecutor/cli/commands/correct_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def correct_accounts(
test_evm_uniswap_v2_init_code_hash: Optional[str] = shared_options.test_evm_uniswap_v2_init_code_hash,
unit_testing: bool = shared_options.unit_testing,

chain_settle_wait_seconds: float = Option(60.0, "--chain-settle-wait-seconds", envvar="CHAIN_SETTLE_WAIT_SECONDS", help="How long we wait after the account correction to see if our broadcasted transactions fixed the issue."),
chain_settle_wait_seconds: float = Option(15.0, "--chain-settle-wait-seconds", envvar="CHAIN_SETTLE_WAIT_SECONDS", help="How long we wait after the account correction to see if our broadcasted transactions fixed the issue."),
skip_save: bool = Option(False, "--skip-save", envvar="SKIP_SAVE", help="Do not update state file. Useful for testing."),
skip_interest: bool = Option(False, "--skip-interest", envvar="SKIP_INTEREST", help="Do not do interest distribution. If an position balance is fixed down due to redemption, this is useful."),
process_redemption: bool = Option(False, "--process-redemption", envvar="PROCESS_REDEMPTION", help="Attempt to process deposit and redemption requests before correcting accounts."),
Expand Down

0 comments on commit f68d95a

Please sign in to comment.