Skip to main content
Glama

close_perp_position

Destructive

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.

venue_action (optional, completion leg only): see place_perp_order -- pass back the build leg's extra['venue_action'] (e.g. Jupiter's decrease-position) so the relay route is the venue's own declared one instead of one inferred from the signed bytes.

simulate (optional): true = rehearse this call. The full gate stack (capability, kill switch, session signer, wallet policy, permission mode, soft launch, venue / compliance / token checks, fee quote) is evaluated read-only and returned as verdicts + would_execute, with a paper fill where one applies. Nothing is built, signed, broadcast or charged. Omitted = your wallet's default_simulate setting; false = execute.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipNo
venueNo
verifyNo
simulateNo
caller_idNo
close_pctNo
position_idYes
jurisdictionNo
pay_in_crankNo
venue_actionNo
payment_headerNo
wallet_addressYes
idempotency_keyNo
acknowledge_tier_bNo
signed_transactionNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / simulate
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "boolean"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null
      +}
  2. Changed1 schema field changed
    • addedInput schema / properties / venue_action
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null
      +}
  3. Changed2 schema fields changed
    • addedInput schema / properties / ip
      Added value: +{
      +  "default": "",
      +  "type": "string"
      +}
    • addedInput schema / properties / jurisdiction
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null
      +}
  4. Changed2 schema fields changed
    • addedInput schema / properties / signed_transaction
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null
      +}
    • addedInput schema / properties / verify
      Added value: +{
      +  "default": true,
      +  "type": "boolean"
      +}
  5. First observed

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources