bingx-fund-account
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBingX Fund Account
BingX资金账户
Authenticated endpoints for BingX fund account management. All endpoints require HMAC SHA256 signature authentication.
Base URLs: see | Authentication: see
references/base-urls.mdreferences/authentication.md经过身份验证的BingX资金账户管理端点。所有端点均需要HMAC SHA256签名验证。
基础URL:查看 | 身份验证:查看
references/base-urls.mdreferences/authentication.mdQuick Reference
快速参考
| 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 |
| 端点 | 请求方法 | 描述 | 是否需要身份验证 |
|---|---|---|---|
| GET | 查询资金账户资产余额 | 是 |
| GET | 全账户类型资产概览 | 是 |
| POST | 账户间划转资产 | 是 |
| GET | 查询资产划转记录 | 是 |
| POST | 向其他BingX用户发起内部P2P转账 | 是 |
| GET | 查询内部转账历史 | 是 |
Parameters
参数说明
Asset Transfer Parameters
资产划转参数
- type: Transfer direction (see TransferDirection enum) — required
- asset: Coin name (e.g., ,
USDT) — requiredBTC - amount: Transfer amount — required
- tranId: Transaction ID (for record queries; mutually exclusive with )
type - startTime: Start of time range in milliseconds
- endTime: End of time range in milliseconds
- current: Page index for pagination (default )
1 - size: Page size for pagination (default , max
10)100 - recvWindow: Request validity window in milliseconds (max )
60000
- type:划转方向(参考TransferDirection枚举)——必填
- asset:币种名称(例如:、
USDT)——必填BTC - amount:划转金额——必填
- tranId:交易ID(用于记录查询;与互斥)
type - startTime:时间范围起始时间(毫秒级时间戳)
- endTime:时间范围结束时间(毫秒级时间戳)
- current:分页页码(默认值)
1 - size:分页每页数量(默认值,最大值
10)100 - recvWindow:请求有效窗口(毫秒级,最大值)
60000
Internal Transfer Parameters
内部转账参数
- coin: Name of the transferred coin (e.g., ) — required
USDT - userAccountType: Recipient account identifier type — required (see UserAccountType enum)
- userAccount: Recipient account value (UID, phone number, or email) — required
- amount: Transfer amount — required
- walletType: Source account type — required (see WalletType enum)
- callingCode: Phone calling code (required when is
userAccountType)2 - transferClientId: Custom client ID for the transfer (optional, for idempotency)
- recvWindow: Request validity window in milliseconds (max )
60000
- coin:划转币种名称(例如:)——必填
USDT - userAccountType:接收方账户标识类型——必填(参考UserAccountType枚举)
- userAccount:接收方账户值(UID、手机号或邮箱)——必填
- amount:划转金额——必填
- walletType:划转源账户类型——必填(参考WalletType枚举)
- callingCode:电话区号(当为
userAccountType时必填)2 - transferClientId:自定义转账客户端ID(可选,用于幂等性)
- recvWindow:请求有效窗口(毫秒级,最大值)
60000
Asset Overview Parameters
资产概览参数
- accountType: Filter by account type (see AccountType enum); returns all accounts if omitted
- recvWindow: Request validity window in milliseconds
- accountType:按账户类型筛选(参考AccountType枚举;若省略则返回所有账户)
- recvWindow:请求有效窗口(毫秒级)
Enums
枚举值
TransferDirection ( for asset transfer):
type- — Funding Account → Standard Contract
FUND_SFUTURES - — Standard Contract → Funding Account
SFUTURES_FUND - — Funding Account → Perpetual Futures
FUND_PFUTURES - — Perpetual Futures → Funding Account
PFUTURES_FUND - — Standard Contract → Perpetual Futures
SFUTURES_PFUTURES - — Perpetual Futures → Standard Contract
PFUTURES_SFUTURES
AccountType ( for asset overview):
accountType- — Spot / Fund account
sopt - — Standard futures account
stdFutures - — Coin-margined perpetual account
coinMPerp - — USDT-margined perpetual account
USDTMPerp - — Copy trading account
copyTrading - — Grid trading account
grid - — Wealth management account
eran - — C2C account
c2c
UserAccountType ( for internal transfer):
userAccountType- — UID
1 - — Phone number (requires
2)callingCode - — Email address
3
WalletType ( for internal transfer source):
walletType- — Fund account
1 - — Standard contract account
2
TransferDirection(资产划转的参数):
type- —— 资金账户 → 标准合约
FUND_SFUTURES - —— 标准合约 → 资金账户
SFUTURES_FUND - —— 资金账户 → 永续合约
FUND_PFUTURES - —— 永续合约 → 资金账户
PFUTURES_FUND - —— 标准合约 → 永续合约
SFUTURES_PFUTURES - —— 永续合约 → 标准合约
PFUTURES_SFUTURES
AccountType(资产概览的参数):
accountType- —— 现货/资金账户
sopt - —— 标准期货账户
stdFutures - —— 币本位永续合约账户
coinMPerp - —— USDT本位永续合约账户
USDTMPerp - —— 跟单交易账户
copyTrading - —— 网格交易账户
grid - —— 理财账户
eran - —— C2C账户
c2c
UserAccountType(内部转账的参数):
userAccountType- —— UID
1 - —— 手机号(需要
2)callingCode - —— 邮箱地址
3
WalletType(内部转账源账户的参数):
walletType- —— 资金账户
1 - —— 标准合约账户
2
Parameter Validation Rules
参数验证规则
Before sending a request, validate parameters client-side to avoid unnecessary API errors:
- asset / coin: Uppercase letters and digits only; pattern (e.g.,
^[A-Z0-9]{1,20}$,USDT)BTC - amount: Must be a positive number (> 0); precision depends on the asset
- type: Must exactly match one of the enum values (e.g.,
TransferDirection)FUND_PFUTURES - userAccount: Non-empty string; format depends on — UID (digits), email, or phone number
userAccountType - callingCode: Required when is
userAccountType(phone); must be a valid international dialing code (e.g.,2,86)1 - size: Integer, 1–100; default
10 - startTime / endTime: Unix timestamps in milliseconds; must be ≥
endTimestartTime - recvWindow: Integer, 1–5000 ms; keep as small as possible (see Replay Protection)
- timestamp: Unix time in milliseconds; must be within of server time
recvWindow
发送请求前,请在客户端验证参数,避免不必要的API错误:
- asset / coin:仅允许大写字母和数字;格式匹配(例如:
^[A-Z0-9]{1,20}$、USDT)BTC - amount:必须为正数(>0);精度取决于币种
- type:必须与枚举值完全匹配(例如:
TransferDirection)FUND_PFUTURES - userAccount:非空字符串;格式取决于——UID(数字)、邮箱或手机号
userAccountType - callingCode:当为
userAccountType(手机号)时必填;必须为有效的国际区号(例如:2、86)1 - size:整数,范围1–100;默认值
10 - startTime / endTime:毫秒级Unix时间戳;必须≥
endTimestartTime - recvWindow:整数,范围1–5000毫秒;应尽可能小(参考重放保护)
- timestamp:毫秒级Unix时间;必须在服务器时间的范围内
recvWindow
Quick Start
快速开始
CONSTRAINT: 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
typescript
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;
}
}
}约束:生成代码时必须完全复制下方的函数,不得重写签名、请求或JSON解析逻辑。仅可修改:(1) 自定义环境的fetchSignedURL条目,(2) 传递给BASE的业务参数。如需支持URL编码和JSON请求体的完整客户端,请查看fetchSigned。references/authentication.md
typescript
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;
}
}
}Code Usage Rules
代码使用规则
- MUST copy verbatim -- do not simplify or rewrite
fetchSigned - MUST use (
json-bigint) for response parsing -- notJSONBigParse.parseJSON.parse - MUST include header on every request
X-SOURCE-KEY: BX-AI-SKILL - MUST NOT remove the domain fallback loop or check
isNetworkOrTimeout
- 必须完全复制函数——不得简化或重写
fetchSigned - 必须使用(
json-bigint)解析响应——不得使用JSONBigParse.parseJSON.parse - 必须在每个请求中包含请求头
X-SOURCE-KEY: BX-AI-SKILL - 不得移除域名回退循环或检查
isNetworkOrTimeout
Common Calls
常见调用示例
Query fund account balance:
typescript
const balance = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/spot/v1/account/balance"
);
// balance.balances[].asset, balance.balances[].free, balance.balances[].lockedGet asset overview across all accounts:
typescript
const overview = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/account/v1/allAccountBalance"
);
// overview[].accountType, overview[].usdtBalanceTransfer assets from Fund Account to Perpetual Futures:
typescript
const result = await fetchSigned("prod-live", API_KEY, SECRET, "POST",
"/openApi/api/v3/asset/transfer", {
type: "FUND_PFUTURES",
asset: "USDT",
amount: 100,
}
);
// result.tranId — transaction IDQuery asset transfer records:
typescript
const 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[].tranIdInternal P2P transfer to another user (by UID):
typescript
const 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 IDQuery internal transfer records:
typescript
const 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[].receiver查询资金账户余额:
typescript
const balance = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/spot/v1/account/balance"
);
// balance.balances[].asset, balance.balances[].free, balance.balances[].locked获取全账户类型资产概览:
typescript
const overview = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
"/openApi/account/v1/allAccountBalance"
);
// overview[].accountType, overview[].usdtBalance从资金账户划转资产至永续合约:
typescript
const result = await fetchSigned("prod-live", API_KEY, SECRET, "POST",
"/openApi/api/v3/asset/transfer", {
type: "FUND_PFUTURES",
asset: "USDT",
amount: 100,
}
);
// result.tranId — transaction ID查询资产划转记录:
typescript
const 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[].tranId向其他用户发起内部P2P转账(通过UID):
typescript
const 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 ID查询内部转账记录:
typescript
const 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[].receiverAdditional Resources
额外资源
For full parameter descriptions and response schemas, see api-reference.md.
如需完整的参数描述和响应 schema,请查看api-reference.md。
Agent Interaction Rules
Agent交互规则
Write operations ( asset transfer and internal transfer) require CONFIRM on . Read-only queries do not.
POSTprod-live- prod-live: Ask user to type CONFIRM before any asset transfer or internal transfer.
- prod-vst: No CONFIRM required. Inform user: "You are operating in the Production Simulated (VST) environment."
写入操作(资产划转和内部转账)在环境下需要CONFIRM确认。只读查询无需确认。
POSTprod-live- prod-live:在执行任何资产划转或内部转账前,需让用户输入CONFIRM。
- prod-vst:无需CONFIRM确认。需告知用户:“您当前在模拟生产(VST)环境中操作。”
Step 1 — Identify the Operation
步骤1 — 识别操作意图
If the user's intent is unclear, present options:
What 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
若用户意图不明确,提供选项:
您需要执行什么操作?
- 查询资金账户余额
- 查看全账户类型资产概览
- 账户间划转资产(例如:现货 ↔ 期货)
- 查看资产划转历史
- 向其他BingX用户发起内部转账
- 查看内部转账历史
Step 2 — Collect details based on operation
步骤2 — 收集操作详情
For asset transfer:
- Ask for transfer direction:
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
- Spot → Perpetual Futures (
- Ask for coin (e.g., ) and amount.
USDT
For internal transfer:
- Ask for coin and amount.
- Ask for recipient account type:
Recipient identifier:
- — UID
1 - — Phone number
2 - — Email address
3
- Ask for the recipient account value (UID / phone / email).
- If phone number: ask for calling code (e.g., for China).
86 - Ask for source wallet:
Source account:
- — Fund account
1 - — Standard contract account
2
资产划转操作:
- 询问划转方向:
划转方向:
- 现货 → 永续合约()
FUND_PFUTURES - 永续合约 → 现货()
PFUTURES_FUND - 现货 → 标准合约()
FUND_SFUTURES - 标准合约 → 现货()
SFUTURES_FUND - 标准合约 → 永续合约()
SFUTURES_PFUTURES - 永续合约 → 标准合约()
PFUTURES_SFUTURES
- 现货 → 永续合约(
- 询问币种(例如:)和金额。
USDT
内部转账操作:
- 询问币种和金额。
- 询问接收方账户类型:
接收方标识类型:
- —— UID
1 - —— 手机号
2 - —— 邮箱地址
3
- 询问接收方账户值(UID/手机号/邮箱)。
- 若为手机号:询问电话区号(例如:中国为)。
86 - 询问源账户类型:
源账户:
- —— 资金账户
1 - —— 标准合约账户
2
Step 3 — Confirm (prod-live write ops only)
步骤3 — 确认(仅prod-live环境下的写入操作需要)
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.
您即将在生产实盘环境划转**{amount} {coin}**:
- 划转方向/接收方信息:{transfer direction or recipient info}
- 源账户:{wallet type}
输入CONFIRM继续,输入其他内容取消操作。
Step 4 — Execute and report
步骤4 — 执行并反馈结果
Execute the API call and return key result fields to the user:
- Asset transfer:
tranId - Internal transfer: (internal transfer record ID)
id - Balance query: list of assets with and
freebalanceslocked - Asset overview: list of account types with equivalent USDT value
执行API调用,并向用户返回关键结果字段:
- 资产划转:
tranId - 内部转账:(内部转账记录ID)
id - 余额查询:展示各币种的可用余额()和锁定余额(
free)locked - 资产概览:展示各账户类型的USDT等值资产