gate-exchange-futures

The USDT perpetual futures trading function of Gate Exchange: open position, close position, cancel order, amend order. Trigger phrases: open position, close position, cancel order, amend order, reverse, close all.

25 stars

Best use case

gate-exchange-futures is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

The USDT perpetual futures trading function of Gate Exchange: open position, close position, cancel order, amend order. Trigger phrases: open position, close position, cancel order, amend order, reverse, close all.

Teams using gate-exchange-futures should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/gate-exchange-futures/SKILL.md --create-dirs "https://raw.githubusercontent.com/ComeOnOliver/skillshub/main/skills/aiskillstore/marketplace/gate/gate-exchange-futures/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/gate-exchange-futures/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How gate-exchange-futures Compares

Feature / Agentgate-exchange-futuresStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

The USDT perpetual futures trading function of Gate Exchange: open position, close position, cancel order, amend order. Trigger phrases: open position, close position, cancel order, amend order, reverse, close all.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Gate Futures Trading Suite

This skill is the single entry for Gate USDT perpetual futures. It supports **four operations only**: open position, close position, cancel order, amend order. User intent is routed to the matching workflow.

## Module overview

| Module | Description | Trigger keywords |
|--------|-------------|------------------|
| **Open** | Limit/market open long or short, cross/isolated mode | `long`, `short`, `buy`, `sell`, `open` |
| **Close** | Full close, partial close, reverse position | `close`, `close all`, `reverse` |
| **Cancel** | Cancel one or many orders | `cancel`, `revoke` |
| **Amend** | Change order price or size | `amend`, `modify` |

## Routing rules

| Intent | Example phrases | Route to |
|--------|-----------------|----------|
| **Open position** | "BTC long 1 contract", "market short ETH", "10x leverage long" | Read `references/open-position.md` |
| **Close position** | "close all BTC", "close half", "reverse to short", "close everything" | Read `references/close-position.md` |
| **Cancel orders** | "cancel that buy order", "cancel all orders", "list my orders" | Read `references/cancel-order.md` |
| **Amend order** | "change price to 60000", "change order size" | Read `references/amend-order.md` |
| **Unclear** | "help with futures", "show my position" | **Clarify**: query position/orders, then guide user |

## Execution workflow

### 1. Intent and parameters

- Determine module (Open/Close/Cancel/Amend).
- Extract: `contract`, `side`, `size`, `price`, `leverage`.
- **Missing**: if required params missing (e.g. size), ask user (clarify mode).

### 2. Pre-flight checks

- **Contract**: call `get_futures_contract` to ensure contract exists and is tradeable.
- **Account**: check balance and conflicting positions (e.g. when switching margin mode).
- **Risk**: do **not** pre-calculate valid limit price from `order_price_deviate` (actual deviation limit depends on risk_limit_tier). On `PRICE_TOO_DEVIATED`, show the valid range from the error message.
- **Margin mode vs position mode** (only when user **explicitly** requested a margin mode and it differs from current): call **`get_futures_accounts(settle)`** to get **position mode**. From response **`position_mode`**: `single` = single position mode, `dual` = dual (hedge) position mode. Margin mode from position: use **position query** per dual/single above → `pos_margin_mode` (cross/isolated). **If user did not specify margin mode, do not switch; place order in current mode.**
  - **Single position** (`position_mode === "single"`): do **not** interrupt. Prompt user: *"You already have a {currency} position; switching margin mode will apply to this position too. Continue?"* (e.g. currency from contract: BTC_USDT → BTC). Wait for user confirmation, then continue.
  - **Dual position** (`position_mode === "dual"`): **interrupt** flow. Tell user: *"Please close the position first, then open a new one."*

- **Dual mode vs single mode (API choice)**: call **`get_futures_accounts(settle)`** first. If **`position_mode === "dual"`** (or **`in_dual_mode === true`**):
  - **Position / leverage query**: use **`list_futures_positions(settle, holding=true)`** or **`get_futures_dual_mode_position(settle, contract)`**. Do **not** use `get_futures_position` in dual mode (API returns an array and causes parse error).
  - **Margin mode switch**: use **`update_futures_dual_comp_position_cross_mode(settle, contract, mode)`** (do not use `update_futures_position_cross_mode` in dual mode).
  - **Leverage**: use **`update_futures_dual_mode_position_leverage(settle, contract, leverage)`** (do not use `update_futures_position_leverage` in dual mode; it returns array and causes parse error).
  If **single** mode: use **`get_futures_position(settle, contract)`** for position; **`update_futures_dual_comp_position_cross_mode`** for mode switch; **`update_futures_position_leverage`** for leverage.

### 3. Module logic

#### Module A: Open position

1. **Unit conversion**: if user does not specify size in **contracts**, get `mark_price`, `quanto_multiplier` from `get_futures_contract`, then convert:
   - **U (USDT notional)**: contracts = u ÷ mark_price ÷ quanto_multiplier (no leverage); **with leverage**: contracts = u × leverage ÷ mark_price ÷ quanto_multiplier
   - **Base (e.g. BTC, ETH)**: contracts = base_amount ÷ quanto_multiplier
   - Round/truncate to `order_size_min` and size precision.
2. **Mode**: **Switch margin mode only when the user explicitly requests it**: switch to isolated only when user explicitly asks for isolated (e.g. "isolated", "逐仓"); switch to cross only when user explicitly asks for cross (e.g. "cross", "全仓"). **If the user does not specify margin mode, do not switch — place the order in the current margin mode** (from position `pos_margin_mode`). If user explicitly wants isolated, check leverage.
3. **Mode switch**: only when user **explicitly** requested a margin mode and it **differs from current** (current from position: `pos_margin_mode`), then **before** calling `update_futures_dual_comp_position_cross_mode`: get **position mode** via `get_futures_accounts(settle)` → **`position_mode`** (single/dual); if `position_mode === "single"`, show prompt *"You already have a {currency} position; switching margin mode will apply to this position too. Continue?"* and continue only after user confirms; if `position_mode === "dual"`, **do not** switch—interrupt and tell user *"Please close the position first, then open a new one."*
4. **Mode switch (no conflict)**: only when user **explicitly** requested cross or isolated and that target differs from current: if no position, or single position and user confirmed, call `update_futures_dual_comp_position_cross_mode(settle, contract, mode)` with **`mode`** `"CROSS"` or `"ISOLATED"`. **Do not switch if the user did not explicitly request a margin mode.**
5. **Leverage**: if user specified leverage and it **differs from current** (from position query per dual/single above), call **`update_futures_dual_mode_position_leverage`** in dual mode or **`update_futures_position_leverage`** in single mode **first**, then proceed.
6. **Pre-order confirmation**: get current leverage from **position query** (dual: `list_futures_positions` or `get_futures_dual_mode_position`; single: `get_futures_position`) for contract + side. Show **final order summary** (contract, side, size, price or market, mode, **leverage**, estimated margin/liq price). Ask user to confirm (e.g. "Reply 'confirm' to place the order."). **Only after user confirms**, place order.
7. **Place order**: call `create_futures_order` (market: `tif=ioc`, `price=0`).
8. **Verify**: confirm position via **position query** (dual: `list_futures_positions(holding=true)` or `get_futures_dual_mode_position`; single: `get_futures_position`).

#### Module B: Close position

1. **Position**: get current `size` and side via **position query** (dual: `list_futures_positions(settle, holding=true)` or `get_futures_dual_mode_position(settle, contract)`; single: `get_futures_position(settle, contract)`).
2. **Branch**: full close (query then close with reduce_only); partial (compute size, `create_futures_order` reduce_only); reverse (close then open opposite in two steps).
3. **Verify**: confirm remaining position via same position query as step 1.

#### Module C: Cancel order

1. **Locate**: by order_id, or `list_futures_orders` and let user choose.
2. **Cancel**: single `cancel_futures_order` only (no batch cancel).
3. **Verify**: `finish_as` == `cancelled`.

#### Module D: Amend order

1. **Check**: order status must be `open`.
2. **Precision**: validate new price/size against contract.
3. **Amend**: call `amend_futures_order` to update price or size.

## Report template

After each operation, output a short standardized result.

## Safety rules

### Confirmation

- **Open**: show final order summary (contract, side, size, price/market, mode, leverage, estimated liq/margin), then ask for confirmation before `create_futures_order`. Do **not** add text about mark price vs limit price, order_price_deviate, or suggesting to adjust price. Example: *"Reply 'confirm' to place the order."*
- **Close all, reverse, batch cancel**: show scope and ask for confirmation. Example: *"Close all positions? Reply to confirm."* / *"Cancel all orders for this contract. Continue?"*

### Errors

| Code | Action |
|------|--------|
| `BALANCE_NOT_ENOUGH` | Suggest deposit or lower leverage/size. |
| `PRICE_TOO_DEVIATED` | Extract **actual valid price range from the error message** and show to user (do not rely on contract `order_price_deviate`; actual limit depends on risk_limit_tier). |
| `POSITION_HOLDING` (mode switch) | API returns this (not `POSITION_NOT_EMPTY`). Ask user to close position first. |
| `CONTRACT_NOT_FOUND` | Contract invalid or not tradeable. Confirm contract name (e.g. BTC_USDT) and settle; suggest listing contracts. |
| `ORDER_NOT_FOUND` | Order already filled, cancelled, or wrong order_id. Suggest checking order history. |
| `SIZE_TOO_LARGE` | Order size exceeds limit. Suggest reducing size or check contract `order_size_max`. |
| `ORDER_FOK` | FOK order could not be filled entirely. Suggest different price/size or use GTC/IOC. |
| `ORDER_POC` | POC order would have taken liquidity; exchange rejected. Suggest different price for maker-only. |
| `INVALID_PARAM_VALUE` | Often in dual mode when wrong API or params used (e.g. `update_futures_position_cross_mode` or `update_futures_position_leverage` in dual). Use dual-mode APIs: `update_futures_dual_comp_position_cross_mode`, `update_futures_dual_mode_position_leverage`; for position use `list_futures_positions` or `get_futures_dual_mode_position`. |

Related Skills

building-api-gateway

25
from ComeOnOliver/skillshub

Create API gateways with routing, load balancing, rate limiting, and authentication. Use when routing and managing multiple API services. Trigger with phrases like "build API gateway", "create API router", or "setup API gateway".

api-gateway-config

25
from ComeOnOliver/skillshub

Api Gateway Config - Auto-activating skill for AWS Skills. Triggers on: api gateway config, api gateway config Part of the AWS Skills skill category.

clarity-gate

25
from ComeOnOliver/skillshub

Pre-ingestion verification for epistemic quality in RAG systems with 9-point verification and Two-Round HITL workflow

azure-aigateway

25
from ComeOnOliver/skillshub

Configure Azure API Management (APIM) as AI Gateway to secure, observe, control AI models, MCP servers, agents. Helps with rate limiting, semantic caching, content safety, load balancing. USE FOR: AI Gateway, APIM, setup gateway, configure gateway, add gateway, model gateway, MCP server, rate limit, token limit, semantic cache, content safety, load balance, OpenAPI import, convert API to MCP. DO NOT USE FOR: deploy models (use microsoft-foundry), Azure Functions (use azure-functions), databases (use azure-postgres).

gate-mcp-installer

25
from ComeOnOliver/skillshub

One-click installer and configurator for Gate MCP (mcporter) in OpenClaw. Use when the user wants to (1) Install mcporter CLI tool, (2) Configure Gate MCP server connection, (3) Verify Gate MCP setup, or (4) Troubleshoot Gate MCP connectivity issues.

gate-exchange-spot

25
from ComeOnOliver/skillshub

Gate spot trading and account operations skill. Use this skill whenever the user asks to buy/sell crypto, check account value, cancel/amend spot orders, place conditional buy/sell plans, verify fills, or perform coin-to-coin swaps in Gate spot trading. Trigger phrases include 'buy coin', 'sell coin', 'monitor market', 'cancel order', 'amend order', 'break-even price', 'rebalance', 'spot trading', 'buy/sell', or any request that combines spot order execution with account checks.

gate-exchange-marketanalysis

25
from ComeOnOliver/skillshub

The market analysis function of Gate Exchange — liquidity, momentum, liquidation, funding arbitrage, basis, manipulation risk, order book explainer, slippage simulation. Use when the user asks about liquidity, depth, slippage, buy/sell pressure, liquidation, funding rate arbitrage, basis/premium, manipulation risk, order book explanation, or slippage simulation (e.g. market buy $X slippage). Trigger phrases: liquidity, depth, slippage, momentum, buy/sell pressure, liquidation, squeeze, funding rate, arbitrage, basis, premium, manipulation, order book, spread, slippage simulation.

gate-dex-market

25
from ComeOnOliver/skillshub

Gate Wallet market data and token info queries. K-line, transaction stats, liquidity, token details, rankings, security audit, new token discovery. Use when users ask about market data, prices, or token info. All queries require no authentication. Not for executing trades.

testing-gate

25
from ComeOnOliver/skillshub

Gate 6 - Verify tests exist and cover critical paths. Issues result in WARNINGS (encourages tests, doesn't block).

security-gate

25
from ComeOnOliver/skillshub

Verify security considerations were addressed before shipping. Issues result in WARNINGS that strongly recommend fixing.

performance-gate

25
from ComeOnOliver/skillshub

Verify performance implications were considered and no obvious anti-patterns exist. Issues result in WARNINGS.

ownership-gate

25
from ComeOnOliver/skillshub

Verify the junior can explain and defend every line of code they wrote. This gate BLOCKS completion if failed.