close_gmx_position
Close or reduce a perpetual position on GMX V2 (Arbitrum) using a MarketDecrease order. Specify market, collateral, size, acceptable price, and direction.
Instructions
Closes (fully or partially) a perpetual position on GMX V2 (Arbitrum). Creates a MarketDecrease order. Specify the market, collateral token, size to close, and direction. Use the full position size in size_delta_usd for a complete close.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| market | Yes | Market label (e.g. "ETH/USD") or market token address. | |
| is_long | Yes | true if closing a long position, false for short. | |
| chain_id | No | Chain ID. Default: 42161 (Arbitrum One). | |
| size_delta_usd | Yes | Size to close in USD with 30 decimals. Use full position size for complete close. | |
| acceptable_price | Yes | Min acceptable price for longs, max for shorts (30 decimals). Set with a buffer to avoid keeper rejection. | |
| collateral_token | Yes | Collateral token of the existing position. |