Partial close lets you reduce an existing Parquet position without exiting it entirely. It is not in the trading UI as of the current frontend — the Close button always closes the full position. The capability lives at the on-chain handler and is plumbed through the SDK, so power users and programmatic traders can call it directly. This page documents theDocumentation Index
Fetch the complete documentation index at: https://docs.parquet.exchange/llms.txt
Use this file to discover all available pages before exploring further.
closeSize parameter, its validation rules, fee treatment, and a worked example.
The closeSize parameter
The SDK exposes partial close through the same closePositionIx builder that does full closes:
null— full close. The entire position is unwound, collateral is released, and the position account is closed.- A
BNvalue — partial close. The number is interpreted as USDC notional in 6-decimal base units. For example,new BN(100_000_000)closes $100 of notional.
- Computes the fraction
closeSize / position.size_usdc. - Realizes PnL on that fraction only, settling against the LP pool.
- Pro-rates collateral release by the same fraction.
- Decrements
position.size_usdcbycloseSize(the remaining position keeps its entry price unchanged — partial close is not a re-open). - Updates open interest on the market accordingly.
Validation
The instruction enforces three rules. Violating any of them returns an error before any state change.| Rule | Condition | Error on failure |
|---|---|---|
| Size bound | 0 < closeSize ≤ position.size_usdc | InvalidCloseSize |
| Min collateral | Remaining collateral ≥ MIN_COLLATERAL_USDC ($10) | BelowMinCollateral (code 2006) |
| Position health | Position not already below maintenance margin | Same gate as a full close |
There is no special path to close a position that is already below MMR. Partial close uses the same health gate as full close — if the position is liquidatable, you cannot exit it via
closePosition; the keeper will liquidate it.Fee treatment
Fees scale with the closed notional, not the full position size. Closing 25% of a 250 of notional, not $1,000. The favorable-rate logic still applies, evaluated on the partial-close trade:- Base rate —
BASE_FEE_BPS = 0.1%(10 bps), applied to the closed notional. - Favorable rate —
FEE_BPS_FAVORABLE = 0.05%(5 bps), applied if the partial close reduces OI imbalance for the market. The check is the same as for a full close: if your side is the heavier side of the book, closing reduces imbalance and you pay the favorable rate.
docs/reference/published-numbers.md — see the sources trailer at the bottom of this page for the verified values.
Example: close 25% of a position
The following snippet closes $100 of a position via direct instruction construction. It assumes you already have aPerpClient and have looked up the relevant PDAs.
closePositionIx builder returns a plain TransactionInstruction, so you can add it to a transaction alongside compute-budget instructions, priority fees, or other actions.
Why isn’t this in the UI?
Honest answer: scope. The v1 launch frontend prioritized the open / close / margin-adjust loop with a single Close button, and partial close did not make the cut. The on-chain handler is general — it has always supported partial closes — and the SDK was wired up alongside it. Exposing a “Close 25% / 50% / 75% / 100%” selector or a free-form size input in the trade panel is tracked as a follow-up; in the meantime, power users get full access via the SDK. If you want to reduce risk on a position from the UI today, the supported path is to add margin rather than reduce size — see Margin management for that flow.See also
- SDK reference:
PerpClient— full surface forclosePositionIxand related builders. - Margin management — UI-supported way to reduce risk without closing.