Loading...
Loading...
BingX Fund Account management — query fund account balance, get asset overview across all account types, transfer assets between accounts, and perform internal P2P transfers. Use when the user asks about BingX fund account balance, asset overview, transferring assets between spot/futures/standard contract accounts, or sending internal transfers to other BingX users.
npx skill4agent add bingx-api/api-ai-skills bingx-fund-accountreferences/base-urls.mdreferences/authentication.md| Endpoint | Method | Description | Authentication |
|---|---|---|---|
| GET | Query fund account asset balances | Yes |
| GET | Asset overview across all account types | Yes |
| POST | Transfer assets between account types | Yes |
| GET | Query asset transfer records | Yes |
| POST | Internal P2P transfer to another BingX user | Yes |
| GET | Query internal transfer history | Yes |
USDTBTCtype11010060000USDTuserAccountType260000typeFUND_SFUTURESSFUTURES_FUNDFUND_PFUTURESPFUTURES_FUNDSFUTURES_PFUTURESPFUTURES_SFUTURESaccountTypesoptstdFuturescoinMPerpUSDTMPerpcopyTradinggrideranc2cuserAccountType12callingCode3walletType12^[A-Z0-9]{1,20}$USDTBTCTransferDirectionFUND_PFUTURESuserAccountTypeuserAccountType286110endTimestartTimerecvWindowCONSTRAINT: You MUST copy thefunction below verbatim when generating code. Do NOT rewrite the signing, request, or JSON parsing logic. Only modify: (1)fetchSignedURL entries for custom environments, (2) business parameters passed toBASE. For the full client with URL-encoding and JSON body support, seefetchSigned.references/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;
}
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() };
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;
}
}
}fetchSignedjson-bigintJSONBigParse.parseJSON.parseX-SOURCE-KEY: BX-AI-SKILLisNetworkOrTimeoutconst balance = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/spot/v1/account/balance"
);
// balance.balances[].asset, balance.balances[].free, balance.balances[].lockedconst overview = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/account/v1/allAccountBalance"
);
// overview[].accountType, overview[].usdtBalanceconst result = await fetchSigned("prod-live", API_KEY, SECRET, "POST",
"/openApi/api/v3/asset/transfer", {
type: "FUND_PFUTURES",
asset: "USDT",
amount: 100,
}
);
// result.tranId — transaction IDconst records = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/api/v3/asset/transfer", {
type: "FUND_PFUTURES",
current: 1,
size: 20,
}
);
// records.total, records.rows[].asset, records.rows[].amount, records.rows[].status, records.rows[].tranIdconst result = await fetchSigned("prod-live", API_KEY, SECRET, "POST",
"/openApi/wallets/v1/capital/innerTransfer/apply", {
coin: "USDT",
userAccountType: 1,
userAccount: "123456789", // recipient UID
amount: 50,
walletType: 1,
}
);
// result.id — internal transfer record IDconst records = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/wallets/v1/capital/innerTransfer/records", {
coin: "USDT",
limit: 20,
}
);
// records.data[].id, records.data[].coin, records.data[].amount, records.data[].status, records.data[].receiverPOSTprod-liveWhat would you like to do?
- Check fund account balance
- View asset overview (all account types)
- Transfer assets between accounts (e.g., Spot ↔ Futures)
- View asset transfer history
- Send an internal transfer to another BingX user
- View internal transfer history
Transfer direction:
- Spot → Perpetual Futures (
)FUND_PFUTURES- Perpetual Futures → Spot (
)PFUTURES_FUND- Spot → Standard Contract (
)FUND_SFUTURES- Standard Contract → Spot (
)SFUTURES_FUND- Standard Contract → Perpetual Futures (
)SFUTURES_PFUTURES- Perpetual Futures → Standard Contract (
)PFUTURES_SFUTURES
USDTRecipient identifier:
— UID1 — Phone number2 — Email address3
86Source account:
— Fund account1 — Standard contract account2
You are about to transfer {amount} {coin} on Production Live:
- Direction: {transfer direction or recipient info}
- Source: {wallet type}
Type CONFIRM to proceed, or anything else to cancel.
tranIdidfreelocked