Skip to main content
Adjust the margin on an isolated position via PerpsClient.updatePositionMargin. The registered provider plugin authorizes and submits the action according to its descriptor.
Position-margin support is market-specific. Read market.positionMarginAdjustment or use the helper predicates below instead of assuming every provider supports both directions.

Capability and removable margin

PositionMarginAdjustment has three values:
isPositionMarginAdjustable(position) is true for isolated positions on markets whose positionMarginAdjustment is not NONE. isPositionMarginRemovable(position) additionally requires ADD_AND_REMOVE. perps.getPositionRemovableMargin(position) returns the largest amount you can remove, as a decimal string rounded down to 6 decimals: The formula is venue-specific: The method throws PerpsError (ValidationError) when a Position decimal the formula reads is malformed. It does not read the venue; the input is the Position you already fetched. The venue still rejects a removal that would leave the position below its margin requirement.

updatePositionMargin

Pass action: 'remove' (with a positive amount) to withdraw margin from the position without changing its size. A venue refusal does not throw; check status on each entry of result.results. See Execution reports and Error Handling. After the write, re-read the position once after a short delay; the venue’s read can lag the update. API Reference: POST /createAction · /executeAction