/bingx-ai-skills:bingx-swap-marketfrom bingx-ai-skills
Queries BingX perpetual swap market data: ticker prices, order book depth, recent trades, funding rates, klines, open interest, mark price, contract info, and trading schedules. No API key required.
Ships in bingx-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Public market data for BingX perpetual futures. No API key or HMAC signature is required. Only trading rules and historical trades require a current timestamp; do not add it to every request. Private trading and account endpoints still require authentication.
| Endpoint | Method | Description | Required | Optional |
|---|---|---|---|---|
/openApi/swap/v2/quote/contracts | GET | All contract specifications | None | symbol |
/openApi/swap/v1/tradingRules | GET | Trading rules and specifications | timestamp, symbol | recvWindow |
/openApi/swap/v2/quote/depth | GET | Order book bids & asks | symbol | limit, timestamp, recvWindow |
/openApi/swap/v2/quote/trades | GET | Recent public trades | symbol | limit, timestamp, recvWindow |
/openApi/swap/v1/market/historicalTrades | GET | Historical trade lookup | timestamp | symbol, limit, fromId, recvWindow |
/openApi/swap/v2/quote/premiumIndex | GET | Mark price and funding rate | None | symbol, timestamp, recvWindow |
/openApi/swap/v2/quote/fundingRate | GET | Historical settled funding rates | None | symbol, startTime, endTime, limit, timestamp, recvWindow |
/openApi/swap/v3/quote/klines | GET | OHLCV candlestick data | symbol, interval | startTime, endTime, limit, timestamp, recvWindow |
/openApi/swap/v1/market/markPriceKlines | GET | Mark price kline data | symbol, interval | startTime, endTime, limit, timestamp, recvWindow |
/openApi/swap/v2/quote/openInterest | GET | Total open interest | symbol | timestamp, recvWindow |
/openApi/swap/v2/quote/ticker | GET | 24h price change statistics | None | symbol, timestamp, recvWindow |
/openApi/swap/v1/ticker/price | GET | Latest price ticker | None | symbol, timestamp, recvWindow |
/openApi/swap/v2/quote/bookTicker | GET | Best bid/ask price & qty | symbol | timestamp, recvWindow |
/openApi/swap/v2/server/time | GET | Query server time | None | None |
/openApi/swap/v1/quote/tradingSchedule | GET | TradFi trading schedule (PROD only) | None | symbol |
Trading Schedule uses only https://open-api.bingx.com, with no API key, timestamp, recvWindow, or signature. Do not route it to VST or infer support on an alternate host. Only an optional non-crypto contract symbol is accepted; omit it for all eligible contracts. See Trading Schedule for the fixed window, eligibility, and response semantics.
BASE-QUOTE format (e.g., BTC-USDT, ETH-USDT, SOL-USDT)1735693200000)1735693200000)5000, max 60000)1m | 3m | 5m | 15m | 30m | 1h | 2h | 4h | 6h | 8h | 12h | 1d | 3d | 1w | 1M^[A-Z0-9]+-[A-Z]+$; max 20 characters (e.g., BTC-USDT)endTime must be ≥ startTimerecvWindow of server timeTrading Schedule is an exception to the common time parameters: never send startTime or endTime, even as an empty value or 0 (server error 109400). It always covers 7 complete calendar days from today's 00:00 in UTC+08:00, not a rolling window from request time.
Base URLs: see references/base-urls.md
TypeScript helper:
CONSTRAINT: You MUST copy the
fetchSwapMarketfunction below verbatim when generating code. Do NOT rewrite the request or JSON parsing logic. Only modify: (1)BASEURL entries for custom environments, (2) business parameters passed tofetchSwapMarket. This helper is for public GET market endpoints only, not private trading or account APIs.
import JSONBig from "json-bigint";
const JSONBigParse = JSONBig({ storeAsString: true });
// Trading Schedule is PROD .com only; other endpoints retain network/timeout fallback.
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 fetchSwapMarket(env: string,
path: string, params: Record<string, string | number> = {}
) {
const isTradingSchedule = path === "/openApi/swap/v1/quote/tradingSchedule";
if (isTradingSchedule) {
if (env !== "prod-live") throw new Error("Trading Schedule is available in prod-live only");
if (Object.keys(params).some((key) => key !== "symbol")) {
throw new Error("Trading Schedule accepts only the optional symbol parameter; omit time and authentication parameters");
}
}
if (env !== "prod-live" && env !== "prod-vst") throw new Error("UnknownEnvironment");
const urls = isTradingSchedule ? [BASE["prod-live"][0]] : BASE[env];
const requiresTimestamp = path === "/openApi/swap/v1/tradingRules"
|| path === "/openApi/swap/v1/market/historicalTrades";
const all = requiresTimestamp ? { ...params, timestamp: Date.now() } : { ...params };
validateParams(all);
const qs = new URLSearchParams(
Object.entries(all).map(([k, v]) => [k, String(v)])
).toString();
for (const base of urls) {
try {
const url = `${base}${path}${qs ? `?${qs}` : ""}`;
const res = await fetch(url, {
method: "GET",
headers: { "X-SOURCE-KEY": "BX-AI-SKILL" },
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;
}
}
}
fetchSwapMarket verbatim -- do not simplify or rewritejson-bigint (JSONBigParse.parse) for response parsing -- not JSON.parseX-SOURCE-KEY: BX-AI-SKILL header on every requestisNetworkOrTimeout check for other endpoints. Trading Schedule uses PROD .com only; do not fall back to VST or an unverified host.24h ticker price for BTC-USDT:
const ticker = await fetchSwapMarket("prod-live",
"/openApi/swap/v2/quote/ticker", { symbol: "BTC-USDT" }
);
// ticker.lastPrice, ticker.priceChangePercent, ticker.volume
Order book depth (top 20 levels):
const depth = await fetchSwapMarket("prod-live",
"/openApi/swap/v2/quote/depth", { symbol: "BTC-USDT", limit: 20 }
);
// depth.bids / depth.asks: [price, base-asset quantity][]; do not multiply quantity by contracts.size.
// REST depth has no lastUpdateId; do not use it as an incremental WebSocket sequence baseline.
1-hour klines (last 100 candles):
const klines = await fetchSwapMarket("prod-live",
"/openApi/swap/v3/quote/klines", { symbol: "BTC-USDT", interval: "1h", limit: 100 }
);
// Each item is an object: { open, high, low, close, volume, time }.
// Read fields by name. time is the candle opening time in Unix milliseconds; no closeTime is returned.
Historical settled funding rates:
const funding = await fetchSwapMarket("prod-live",
"/openApi/swap/v2/quote/fundingRate", { symbol: "BTC-USDT" }
);
// funding is an array: each record has symbol, fundingRate, fundingTime and markPrice.
// This endpoint does not return nextFundingTime; query premiumIndex for the next settlement time.
Best bid/ask price:
const bookTicker = await fetchSwapMarket("prod-live",
"/openApi/swap/v2/quote/bookTicker", { symbol: "BTC-USDT" }
);
// bookTicker.bidPrice, bookTicker.askPrice
Trading rules and historical trades (timestamp generated by the helper):
const rules = await fetchSwapMarket("prod-live",
"/openApi/swap/v1/tradingRules", { symbol: "BTC-USDT" }
);
const historicalTrades = await fetchSwapMarket("prod-live",
"/openApi/swap/v1/market/historicalTrades", { symbol: "BTC-USDT", limit: 10 }
);
TradFi trading schedule (PROD only, fixed UTC+08:00 calendar window):
const schedules = await fetchSwapMarket("prod-live",
"/openApi/swap/v1/quote/tradingSchedule", { symbol: "NCSKMSFT2USD-USDT" }
);
// data is always an array, including for one symbol. Omit symbol to query all eligible contracts.
// REGULAR alone does not prove tradability; check marketStatus and other restrictions.
For complete parameter descriptions, optional fields, and full response schemas, 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.
swap-market provides public read-only market data. Do not request API keys or sign these requests. Trading rules and historical trades still require a dynamic timestamp. No CONFIRM needed. The interaction goal is to collect query parameters.
When the user's request is vague (e.g. "check the market" or "look at BTC"), first identify what type of data they want to query:
Please select the market data type:
- Price / 24h change — ticker
- Best bid/ask price (top of book) — bookTicker
- Order book depth — depth
- K-lines / Candlesticks — klines
- Funding rate — fundingRate
- Mark price / Index price / Funding rate — premiumIndex
- Open interest — openInterest
- Contract specification list — contracts
- TradFi trading sessions and market status — tradingSchedule (PROD only)
Applicable endpoints: depth, trades, fundingRate, klines, openInterest
Please select a trading pair (or type another):
- BTC-USDT
- ETH-USDT
- SOL-USDT
- BNB-USDT
- Other (enter manually, format: BASE-USDT)
If the trading pair can be inferred from context (e.g. "BTC market today" or "Ethereum funding rate"), infer it automatically without asking again.
Please select a K-line interval:
- 1m (1 minute)
- 5m (5 minutes)
- 15m (15 minutes)
- 1h (1 hour)
- 4h (4 hours)
- 1d (daily)
- 1w (weekly)
symbol is optional for ticker and premiumIndex (returns all contracts if omitted). bookTicker requires symbol. If the user does not specify a trading pair for ticker/premiumIndex, query all contracts and inform the user; if a trading pair is specified, query only that pair.
For tradingSchedule, omit symbol to query all eligible online or paused non-crypto contracts supported by Open API. Do not default to BTC-USDT: cryptocurrency, pre-listing, and delisted contracts are unsupported (109419). A listed contract in a Rebase pre-open phase is different from a pre-listing contract. Do not request a custom time range or switch to VST.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub bingx-api/api-ai-skills --plugin bingx-ai-skills29 skills in this plugin
/bingx-agentBingX Agent (affiliate/broker) management — query invited users, daily commission details, agent user information, API transaction commission, and partner information. Use when the user asks about BingX agent invited users, affiliate commissions, referral relationships, partner data, or broker commission reports./bingx-announcementQuery BingX official announcements by module type — latest announcements, promotions, product updates, maintenance notices, listing/delisting, funding rate, crypto scout. Use when the user asks about BingX announcements, notices, activities, or the announcement API./bingx-dynamic-sl-tpUse when the user asks to set, adjust, or optimize stop-loss and take-profit for BingX perpetual futures, including dynamic stop-loss, trailing take-profit, partial take-profit, ATR stop-loss, volatility stop-loss, break-even stop, and trailing stop. It calculates SL/TP based on ATR, volatility, and support/resistance through bingx-swap-market and bingx-swap-trade./bingx-maker-entryUse when the user wants to open a BingX perpetual futures position with limit orders, maker entry, split entry, iceberg-style entry, or fee-saving execution instead of market orders. It scans order book depth, places multi-level limit orders near best price, and adjusts orders as price moves through bingx-swap-market, bingx-swap-trade, and bingx-swap-account./bingx-rsi-bottom-hunterUse when the user asks for RSI bottom fishing, oversold buying, RSI strategy, bottom hunter, or buying when RSI is low. It monitors RSI, confirms signals with bingx-technical-analysis, and supports entry, stop-loss, and take-profit planning through bingx-swap-market, bingx-swap-trade, and bingx-swap-account./bingx-sentiment-dashboardUse when the user asks about market sentiment, Fear & Greed Index, funding rate heatmap, OI anomalies, AHR999, DCA zone, or overall market mood.Other plugins' skills for the same job