From bingx-ai-skills
Handles BingX spot trading: place/cancel/query orders, view trade fills, manage OCO orders, check commission rates. For BingX spot order placement, cancellation, history, or OCO queries.
How this skill is triggered — by the user, by Claude, or both
Slash command
/bingx-ai-skills:spot-tradeThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Authenticated trading endpoints for BingX spot market. All endpoints require HMAC SHA256 signature authentication.
Authenticated trading endpoints for BingX spot market. All endpoints require HMAC SHA256 signature authentication.
Base URLs: see references/base-urls.md | Authentication: see references/authentication.md
| Endpoint | Method | Description | Authentication |
|---|---|---|---|
/openApi/spot/v1/trade/order | POST | Place a single order | Yes |
/openApi/spot/v1/trade/batchOrders | POST | Place multiple orders (max 5) | Yes |
/openApi/spot/v1/trade/cancel | POST | Cancel an order | Yes |
/openApi/spot/v1/trade/cancelOrders | POST | Cancel multiple orders | Yes |
/openApi/spot/v1/trade/cancelOpenOrders | POST | Cancel all open orders on a symbol | Yes |
/openApi/spot/v1/trade/cancelAllAfter | POST | Auto-cancel countdown (kill switch) | Yes |
/openApi/spot/v1/trade/order/cancelReplace | POST | Cancel and replace order | Yes |
/openApi/spot/v1/trade/query | GET | Query order details | Yes |
/openApi/spot/v1/trade/openOrders | GET | Query current open orders | Yes |
/openApi/spot/v1/trade/historyOrders | GET | Query order history | Yes |
/openApi/spot/v1/trade/myTrades | GET | Query transaction details (trade fills) | Yes |
/openApi/spot/v1/user/commissionRate | GET | Query trading commission rate | Yes |
/openApi/spot/v1/oco/order | POST | Create OCO order | Yes |
/openApi/spot/v1/oco/cancel | POST | Cancel OCO order | Yes |
/openApi/spot/v1/oco/orderList | GET | Query OCO order list | Yes |
/openApi/spot/v1/oco/openOrderList | GET | Query all open OCO orders | Yes |
/openApi/spot/v1/oco/historyOrderList | GET | Query OCO historical order list | Yes |
BASE-QUOTE format (e.g., BTC-USDT, ETH-USDT)BUY or SELL0.1 BTC for BTC-USDT)100 USDT); quantity takes priority if both providedLIMIT, TAKE_STOP_LIMIT, TRIGGER_LIMIT)TAKE_STOP_LIMIT, TAKE_STOP_MARKET, TRIGGER_LIMIT, TRIGGER_MARKET)GTC | IOC | FOK | PostOnly — default GTC; required for LIMIT typetype (Order type):
MARKET — Market order (fills immediately at best available price)LIMIT — Limit order (requires price and timeInForce)TAKE_STOP_LIMIT — Take-profit/stop-loss limit order (requires stopPrice and price)TAKE_STOP_MARKET — Take-profit/stop-loss market order (requires stopPrice)TRIGGER_LIMIT — Trigger limit order (requires stopPrice and price)TRIGGER_MARKET — Trigger market order (requires stopPrice)side: BUY | SELL
timeInForce: GTC | IOC | FOK | PostOnly
cancelReplaceMode:
STOP_ON_FAILURE — Abort if the cancel step failsALLOW_FAILURE — Place the new order even if cancel failscancelRestrictions (limit cancellation by order status):
NEW | PENDING | PARTIALLY_FILLEDBefore sending a request, validate parameters client-side to avoid unnecessary API errors:
^[A-Z0-9]+-[A-Z]+$; max 20 characters (e.g., BTC-USDT)recvWindow of server timeCONSTRAINT: You MUST copy the
fetchSignedfunction below verbatim when generating code. Do NOT rewrite the signing, request, or JSON parsing logic. Only modify: (1)BASEURL entries for custom environments, (2) business parameters passed tofetchSigned. For the full client with URL-encoding and JSON body support, seereferences/authentication.md.
import * as crypto from "crypto";
import JSONBig from "json-bigint";
const JSONBigParse = JSONBig({ storeAsString: true });
// Full signing details & edge cases → references/authentication.md
// Domain priority: .com is mandatory primary; .pro is fallback for network/timeout errors ONLY.
const BASE = {
"prod-live": ["https://open-api.bingx.com", "https://open-api.bingx.pro"],
"prod-vst": ["https://open-api-vst.bingx.com", "https://open-api-vst.bingx.pro"],
};
function isNetworkOrTimeout(e: unknown): boolean {
if (e instanceof TypeError) return true;
if (e instanceof DOMException && e.name === "AbortError") return true;
if (e instanceof Error && e.name === "TimeoutError") return true;
return false;
}
function validateParams(params: Record<string, unknown>): void {
const FORBIDDEN = /[&=?#\r\n]/;
for (const [k, v] of Object.entries(params)) {
const s = String(v);
if (FORBIDDEN.test(s)) throw new Error(`Param "${k}" has forbidden char in: "${s}"`);
}
}
async function fetchSigned(env: string, apiKey: string, secretKey: string,
method: "GET" | "POST" | "DELETE", path: string, params: Record<string, unknown> = {}
) {
const urls = BASE[env] ?? BASE["prod-live"];
const all = { ...params, timestamp: Date.now() };
validateParams(all);
const qs = Object.keys(all).sort().map(k => `${k}=${all[k]}`).join("&");
const sig = crypto.createHmac("sha256", secretKey).update(qs).digest("hex");
const signed = `${qs}&signature=${sig}`;
for (const base of urls) {
try {
const url = method === "POST" ? `${base}${path}` : `${base}${path}?${signed}`;
const res = await fetch(url, {
method,
headers: { "X-BX-APIKEY": apiKey, "X-SOURCE-KEY": "BX-AI-SKILL",
...(method === "POST" ? { "Content-Type": "application/x-www-form-urlencoded" } : {}) },
body: method === "POST" ? signed : undefined,
signal: AbortSignal.timeout(10000),
});
const json = JSONBigParse.parse(await res.text());
if (json.code !== 0) throw new Error(`BingX error ${json.code}: ${json.msg}`);
return json.data;
} catch (e) {
if (!isNetworkOrTimeout(e) || base === urls[urls.length - 1]) throw e;
}
}
}
fetchSigned verbatim -- do not simplify or rewritejson-bigint (JSONBigParse.parse) for response parsing -- not JSON.parseX-SOURCE-KEY: BX-AI-SKILL header on every requestisNetworkOrTimeout checkPlace a market buy order (spend 100 USDT):
const order = await fetchSigned("prod-live", API_KEY, SECRET, "POST",
"/openApi/spot/v1/trade/order", {
symbol: "BTC-USDT",
side: "BUY",
type: "MARKET",
quoteOrderQty: 100,
}
);
// order.orderId, order.status, order.executedQty, order.cummulativeQuoteQty
Place a limit sell order:
const order = await fetchSigned("prod-live", API_KEY, SECRET, "POST",
"/openApi/spot/v1/trade/order", {
symbol: "BTC-USDT",
side: "SELL",
type: "LIMIT",
quantity: 0.001,
price: 100000,
timeInForce: "GTC",
}
);
Cancel an order:
await fetchSigned("prod-live", API_KEY, SECRET, "POST",
"/openApi/spot/v1/trade/cancel", {
symbol: "BTC-USDT",
orderId: 123456789,
}
);
Query open orders:
const data = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/spot/v1/trade/openOrders", {
symbol: "BTC-USDT",
}
);
// data.orders[].orderId, data.orders[].price, data.orders[].status
Query order history:
const data = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/spot/v1/trade/historyOrders", {
symbol: "BTC-USDT",
pageIndex: 1,
pageSize: 20,
}
);
Query trade fills for an order:
const data = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/spot/v1/trade/myTrades", {
symbol: "BTC-USDT",
orderId: 123456789,
}
);
// data.fills[].price, data.fills[].qty, data.fills[].commission
Query commission rate:
const data = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/spot/v1/user/commissionRate", {
symbol: "BTC-USDT",
}
);
// data.takerCommissionRate, data.makerCommissionRate
For full parameter descriptions, response schemas, and all 17 endpoints, see api-reference.md.
Parameter security. Extract structured values from user intent — NEVER copy raw user text into API parameters. Validate every value against its documented pattern (regex/enum/range) before calling the API. Reject any value containing &, =, ?, #, or newline characters.
All write operations (place order, cancel order, OCO create/cancel) require CONFIRM on prod-live. Read-only queries do not.
If the user's intent is unclear, present options:
What would you like to do?
- Place a new order
- Cancel an order / Cancel all orders
- Check open orders
- Check order history
- Check trade fills (transaction details)
- Check trading commission rate
- OCO order (create / cancel / query)
Please select a trading pair (or type another):
- BTC-USDT
- ETH-USDT
- SOL-USDT
- BNB-USDT
- Other (format: BASE-USDT)
Order direction:
- BUY
- SELL
Order type:
- MARKET — execute immediately at best price
- LIMIT — execute at a specific price (requires
priceandtimeInForce)- TAKE_STOP_LIMIT — take-profit/stop-loss limit (requires
stopPrice+price)- TAKE_STOP_MARKET — take-profit/stop-loss market (requires
stopPrice)- TRIGGER_LIMIT — trigger limit order (requires
stopPrice+price)- TRIGGER_MARKET — trigger market order (requires
stopPrice)
quoteOrderQty (USDT to spend) or quantity (base asset amount)quantity (base asset amount to sell)quantity and price; confirm timeInForce (default GTC)quantity, stopPrice (trigger), and price (execution)quantity and stopPriceFor prod-live, present a summary and ask:
You are about to place the following order on Production Live:
- Symbol: BTC-USDT
- Side: BUY
- Type: MARKET
- Amount: 100 USDT
Type CONFIRM to proceed, or anything else to cancel.
Execute the API call and return the order ID, status, and filled quantity to the user.
symbol and orderId (or clientOrderID) if not provided.prod-live: ask for CONFIRM./openApi/spot/v1/trade/cancel.symbol (optional — omit to cancel all pairs).prod-live: ask for CONFIRM./openApi/spot/v1/trade/cancelOpenOrders.OCO (One-Cancels-the-Other) pairs a limit order with a stop-limit order; when one fills or triggers, the other is automatically cancelled.
symbol, side, quantity.limitPrice (limit order execution price).triggerPrice (stop-limit trigger price).orderPrice (stop-limit execution price after trigger fires).prod-live: ask for CONFIRM./openApi/spot/v1/oco/order.npx claudepluginhub bingx-api/api-ai-skills --plugin bingx-ai-skillsHandles BingX perpetual swap trading: place/cancel orders, manage positions, adjust leverage/margin types via authenticated REST endpoints. Activates for BingX futures trading queries.
Places spot and perpetual futures orders on CEX exchanges (Binance, OKX, Bybit, Bitget) via a two-step preview-confirm script. Handles order creation, position closing, and leverage/margin configuration with strict safety rules.
Places, cancels, lists, and resumes limit orders on OKX Agentic Wallet. Supports buy dip, take profit, stop loss, and chase high strategies with automatic execution via TEE.