perp_close
Close a perp position, full or partial (non-custodial).
close_pct in (0, 100]. Returns an UNSIGNED base64 tx to sign + broadcast, plus exit price + realized P&L estimate (incl funding). Past the daily free tier an x402 payment_header is required.
jurisdiction: closes are geo-gated too --
see perp_open_long.
idempotency_key (optional): a client-generated UUID.
Retrying with the same key + same args replays the original result instead
of re-closing the position.
signed_transaction / verify (two-phase execution):
see perp_open_long -- re-call with the signed tx and Crank broadcasts it,
confirms it on-chain, and re-reads the position.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ip | No | ||
| market | Yes | ||
| verify | No | ||
| caller_id | No | ||
| close_pct | No | ||
| position_id | No | ||
| jurisdiction | No | ||
| pay_in_crank | No | ||
| payment_header | No | ||
| wallet_address | Yes | ||
| idempotency_key | No | ||
| signed_transaction | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||