Close Perp
You can close any percentage of an active perp position with a market close order. Price-triggered exits are handled through TP/SL orders, not through a separate limit-close order. You can choose to receive either currency of the pool when closing.
Partial and Full Close
A close can consume part of the position or the full remaining position. For a partial close, the closed base quantity, collateral, accrued borrow fees, and close fee are all applied to the closed fraction. The remaining position keeps the unclosed fraction.
For a full close, the position is terminal. The position account is closed, rent is returned to the owner, and any companion TP/SL orderbook closure must preserve the orderbook cleanup rules: the orderbook can only be closed when no TP or SL orders remain, and the position's tp_sl_orderbook pointer is cleared when that closure happens.
PnL
Perp PnL uses the stored base quantity from the position and the oracle spot price. The entry price is the spot oracle price at open:
The current close price is:
The closed quantity is:
PnL on the closed fraction is:
Borrow Fees
Before closing, the position accrues borrow fees through the relevant custody's cumulative borrow-rate index. A long perp accrues against the underlying custody index. A short perp accrues against the USDC custody index.
For a partial close, only the closed portion of accrued borrow fees is charged. The remaining borrow-fee debt stays with the remaining position.
Close Settlement
The close result is computed from the closed collateral, realized PnL, accrued borrow fees on the closed portion, and the voluntary close fee:
The voluntary close fee is:
The fee routes through the protocol fee split: 25% to the company fee bucket and 75% to the pool. Keeper rewards are not paid from the close fee.
If settlement is positive, the owner receives the payout in the selected receive currency. If settlement is zero or negative, there is no positive payout to send.