leverage_close
Unwind a tracked leveraged position: sell -> repay stable -> withdraw.
Returns an ORDERED STEP PLAN. position_id from leverage_long. Past the daily free tier an x402 payment_header is required.
jurisdiction: closes are geo-gated too --
see short_open.
idempotency_key (optional): a client-generated UUID.
Retrying with the same key + same args replays the original result instead
of re-unwinding the position.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ip | No | ||
| market | No | ||
| caller_id | No | ||
| position_id | Yes | ||
| jurisdiction | No | ||
| pay_in_crank | No | ||
| slippage_bps | No | ||
| payment_header | No | ||
| wallet_address | Yes | ||
| idempotency_key | No | ||
| marginfi_account | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||