close_perp_position
Close a perp position (full/partial) on its venue (non-custodial).
position_id is venue-native (for Drift it is the market symbol). close_pct in (0, 100]. Returns an UNSIGNED tx / signing payload to sign + broadcast.
jurisdiction: closes are geo-gated too --
see place_perp_order.
idempotency_key (optional): a client-generated UUID.
Retrying with the same key + same args replays the original result instead
of re-closing the position. Reuse the SAME key across the build call and
its signed_transaction completion call -- see
place_perp_order; the two legs dedupe independently, so this never raises
IDEMPOTENCY_CONFLICT.
signed_transaction / verify (two-phase execution):
see place_perp_order -- re-call with the signed payload and Crank relays it
by custody tier and verifies the result.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ip | No | ||
| venue | No | ||
| verify | No | ||
| caller_id | No | ||
| close_pct | No | ||
| position_id | Yes | ||
| jurisdiction | No | ||
| pay_in_crank | No | ||
| payment_header | No | ||
| wallet_address | Yes | ||
| idempotency_key | No | ||
| acknowledge_tier_b | No | ||
| signed_transaction | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||