Opening, Editing, Closing, and Canceling Positions

Updated May 22, 2026 · 2 min read

Open, resize, and close Hyperliquid positions from your strategy wallets, set TP/SL, and cancel resting orders.

Where positions live

Senpi uses dedicated strategy sub-wallets to open positions. Your Main Senpi wallet is only for funding and managing money - it cannot open positions directly. To trade, you need to fund a strategy wallet and place orders from there. If you tried to place an order from your Main Wallet and nothing happened, this is why.

The four primary position-management MCP tools

create_position

Opens one position inside an existing strategy.

parameters
strategy id, asset (case-sensitive - BTC, ETH, kPEPE, xyz:TSLA), direction (LONG/SHORT), leverage, size in USD notional, optional TP/SL %, optional orderType.
orderType
MARKET fills immediately. FEE_OPTIMIZED_LIMIT places a maker ALO order that rests (if you omit feeOptimizedLimitOptions) or falls back to market after a timeout (article 8).
TP/SL
Percentages are relative to margin, not raw price (article 11).
prerequisite
You need an existing strategy first - create one with strategy_create_custom_strategy.
edit_position

Resizes a position, flips its direction, or updates TP/SL on an existing position.

semantics
Uses target-size semantics, not delta. Partial closes go through edit_position, not close_position.
restriction
Does not accept orderType: LIMIT - returns EDIT_LIMIT_NOT_SUPPORTED (since March 2026 schema update).
close_position

Fully closes a single position and clears its TP/SL triggers.

restriction
Does not accept orderType: LIMIT - returns CLOSE_LIMIT_NOT_SUPPORTED.
strategy_close_positions

Closes one or more positions on a strategy while the strategy itself stays ACTIVE or PAUSED.

gotcha
Passing an empty coins array (or omitting coins) closes ALL positions on that strategy.
cancel_order

Cancel a resting order. Idempotent - calling it on an order that is already filled or cancelled will not error; you get a status indicating the current state.

parameters
Pass the coin (case-sensitive) and the order id.
states
Orders in PENDING or RESTING state can be cancelled; once FILLED they cannot.
fee-optimized
For fee-optimized orders that may rest indefinitely (when feeOptimizedLimitOptions is omitted), either call cancel_order explicitly or let the 45-second server-default fallback to market handle it (if you set ensureExecutionAsTaker: true).

Exit price vs mark price

The exit price shown is the average price across all fills when closing the position, not the mark price at the time of exit. If a position was partially sold over time, each partial sale contributes to the average exit price, which can result in the displayed exit price differing from the mark price at the final close. Market orders also execute at fill price, not mark price, and there can be differences between the two, especially during volatile moves.

For automated exits, see Section H. For strategy-level open/close (not position-level), see article 16.

Trade on Senpi

Open, edit, and close Hyperliquid positions from the app.

Open senpi.ai
Share

Related articles