bingx-fund-account

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

BingX Fund Account

BingX资金账户

Authenticated endpoints for BingX fund account management. All endpoints require HMAC SHA256 signature authentication.
Base URLs: see
references/base-urls.md
| Authentication: see
references/authentication.md

经过身份验证的BingX资金账户管理端点。所有端点均需要HMAC SHA256签名验证。
基础URL:查看
references/base-urls.md
| 身份验证:查看
references/authentication.md

Quick Reference

快速参考

EndpointMethodDescriptionAuthentication
/openApi/spot/v1/account/balance
GETQuery fund account asset balancesYes
/openApi/account/v1/allAccountBalance
GETAsset overview across all account typesYes
/openApi/api/asset/v1/transfer
POSTTransfer assets between account typesYes
/openApi/api/v3/asset/transfer
GETQuery asset transfer recordsYes
/openApi/wallets/v1/capital/innerTransfer/apply
POSTInternal P2P transfer to another BingX userYes
/openApi/wallets/v1/capital/innerTransfer/records
GETQuery internal transfer historyYes

端点请求方法描述是否需要身份验证
/openApi/spot/v1/account/balance
GET查询资金账户资产余额
/openApi/account/v1/allAccountBalance
GET全账户类型资产概览
/openApi/api/asset/v1/transfer
POST账户间划转资产
/openApi/api/v3/asset/transfer
GET查询资产划转记录
/openApi/wallets/v1/capital/innerTransfer/apply
POST向其他BingX用户发起内部P2P转账
/openApi/wallets/v1/capital/innerTransfer/records
GET查询内部转账历史

Parameters

参数说明

Asset Transfer Parameters

资产划转参数

  • type: Transfer direction (see TransferDirection enum) — required
  • asset: Coin name (e.g.,
    USDT
    ,
    BTC
    ) — required
  • 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
    10
    , max
    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.,
    USDT
    ) — required
  • 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
    userAccountType
    is
    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 (
type
for asset transfer):
  • FUND_SFUTURES
    — Funding Account → Standard Contract
  • SFUTURES_FUND
    — Standard Contract → Funding Account
  • FUND_PFUTURES
    — Funding Account → Perpetual Futures
  • PFUTURES_FUND
    — Perpetual Futures → Funding Account
  • SFUTURES_PFUTURES
    — Standard Contract → Perpetual Futures
  • PFUTURES_SFUTURES
    — Perpetual Futures → Standard Contract
AccountType (
accountType
for asset overview):
  • sopt
    — Spot / Fund account
  • stdFutures
    — Standard futures account
  • coinMPerp
    — Coin-margined perpetual account
  • USDTMPerp
    — USDT-margined perpetual account
  • copyTrading
    — Copy trading account
  • grid
    — Grid trading account
  • eran
    — Wealth management account
  • c2c
    — C2C account
UserAccountType (
userAccountType
for internal transfer):
  • 1
    — UID
  • 2
    — Phone number (requires
    callingCode
    )
  • 3
    — Email address
WalletType (
walletType
for internal transfer source):
  • 1
    — Fund account
  • 2
    — Standard contract account
TransferDirection(资产划转的
type
参数):
  • FUND_SFUTURES
    —— 资金账户 → 标准合约
  • SFUTURES_FUND
    —— 标准合约 → 资金账户
  • FUND_PFUTURES
    —— 资金账户 → 永续合约
  • PFUTURES_FUND
    —— 永续合约 → 资金账户
  • SFUTURES_PFUTURES
    —— 标准合约 → 永续合约
  • PFUTURES_SFUTURES
    —— 永续合约 → 标准合约
AccountType(资产概览的
accountType
参数):
  • sopt
    —— 现货/资金账户
  • stdFutures
    —— 标准期货账户
  • coinMPerp
    —— 币本位永续合约账户
  • USDTMPerp
    —— USDT本位永续合约账户
  • copyTrading
    —— 跟单交易账户
  • grid
    —— 网格交易账户
  • eran
    —— 理财账户
  • c2c
    —— C2C账户
UserAccountType(内部转账的
userAccountType
参数):
  • 1
    —— UID
  • 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
    ^[A-Z0-9]{1,20}$
    (e.g.,
    USDT
    ,
    BTC
    )
  • amount: Must be a positive number (> 0); precision depends on the asset
  • type: Must exactly match one of the
    TransferDirection
    enum values (e.g.,
    FUND_PFUTURES
    )
  • userAccount: Non-empty string; format depends on
    userAccountType
    — UID (digits), email, or phone number
  • callingCode: Required when
    userAccountType
    is
    2
    (phone); must be a valid international dialing code (e.g.,
    86
    ,
    1
    )
  • size: Integer, 1–100; default
    10
  • startTime / endTime: Unix timestamps in milliseconds;
    endTime
    must be ≥
    startTime
  • recvWindow: Integer, 1–5000 ms; keep as small as possible (see Replay Protection)
  • timestamp: Unix time in milliseconds; must be within
    recvWindow
    of server time

发送请求前,请在客户端验证参数,避免不必要的API错误:
  • asset / coin:仅允许大写字母和数字;格式匹配
    ^[A-Z0-9]{1,20}$
    (例如:
    USDT
    BTC
  • amount:必须为正数(>0);精度取决于币种
  • type:必须与
    TransferDirection
    枚举值完全匹配(例如:
    FUND_PFUTURES
  • userAccount:非空字符串;格式取决于
    userAccountType
    ——UID(数字)、邮箱或手机号
  • callingCode:当
    userAccountType
    2
    (手机号)时必填;必须为有效的国际区号(例如:
    86
    1
  • size:整数,范围1–100;默认值
    10
  • startTime / endTime:毫秒级Unix时间戳;
    endTime
    必须≥
    startTime
  • recvWindow:整数,范围1–5000毫秒;应尽可能小(参考重放保护
  • timestamp:毫秒级Unix时间;必须在服务器时间的
    recvWindow
    范围内

Quick Start

快速开始

CONSTRAINT: You MUST copy the
fetchSigned
function below verbatim when generating code. Do NOT rewrite the signing, request, or JSON parsing logic. Only modify: (1)
BASE
URL entries for custom environments, (2) business parameters passed to
fetchSigned
. For the full client with URL-encoding and JSON body support, see
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;
    }
  }
}
约束:生成代码时必须完全复制下方的
fetchSigned
函数,不得重写签名、请求或JSON解析逻辑。仅可修改:(1) 自定义环境的
BASE
URL条目,(2) 传递给
fetchSigned
的业务参数。如需支持URL编码和JSON请求体的完整客户端,请查看
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
    fetchSigned
    verbatim -- do not simplify or rewrite
  • MUST use
    json-bigint
    (
    JSONBigParse.parse
    ) for response parsing -- not
    JSON.parse
  • MUST include
    X-SOURCE-KEY: BX-AI-SKILL
    header on every request
  • MUST NOT remove the domain fallback loop or
    isNetworkOrTimeout
    check

  • 必须完全复制
    fetchSigned
    函数——不得简化或重写
  • 必须使用
    json-bigint
    JSONBigParse.parse
    )解析响应——不得使用
    JSON.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[].locked
Get asset overview across all accounts:
typescript
const overview = await fetchSigned("prod-live", API_KEY, SECRET, "GET",
  "/openApi/account/v1/allAccountBalance"
);
// overview[].accountType, overview[].usdtBalance
Transfer 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 ID
Query 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[].tranId
Internal 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 ID
Query 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[].receiver

Additional Resources

额外资源

For full parameter descriptions and response schemas, see api-reference.md.

如需完整的参数描述和响应 schema,请查看api-reference.md

Agent Interaction Rules

Agent交互规则

Write operations (
POST
asset transfer and internal transfer) require CONFIRM on
prod-live
. Read-only queries do not.
  • 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."
写入操作(
POST
资产划转和内部转账)在
prod-live
环境下需要CONFIRM确认。只读查询无需确认。
  • 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:
  1. 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
      )
  2. Ask for coin (e.g.,
    USDT
    ) and amount.
For internal transfer:
  1. Ask for coin and amount.
  2. Ask for recipient account type:
    Recipient identifier:
    • 1
      — UID
    • 2
      — Phone number
    • 3
      — Email address
  3. Ask for the recipient account value (UID / phone / email).
  4. If phone number: ask for calling code (e.g.,
    86
    for China).
  5. Ask for source wallet:
    Source account:
    • 1
      — Fund account
    • 2
      — Standard contract account
资产划转操作:
  1. 询问划转方向:
    划转方向:
    • 现货 → 永续合约(
      FUND_PFUTURES
    • 永续合约 → 现货(
      PFUTURES_FUND
    • 现货 → 标准合约(
      FUND_SFUTURES
    • 标准合约 → 现货(
      SFUTURES_FUND
    • 标准合约 → 永续合约(
      SFUTURES_PFUTURES
    • 永续合约 → 标准合约(
      PFUTURES_SFUTURES
  2. 询问币种(例如:
    USDT
    )和金额。
内部转账操作:
  1. 询问币种和金额。
  2. 询问接收方账户类型:
    接收方标识类型:
    • 1
      —— UID
    • 2
      —— 手机号
    • 3
      —— 邮箱地址
  3. 询问接收方账户值(UID/手机号/邮箱)。
  4. 若为手机号:询问电话区号(例如:中国为
    86
    )。
  5. 询问源账户类型:
    源账户:
    • 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:
    id
    (internal transfer record ID)
  • Balance query: list of assets with
    free
    and
    locked
    balances
  • Asset overview: list of account types with equivalent USDT value
执行API调用,并向用户返回关键结果字段:
  • 资产划转:
    tranId
  • 内部转账:
    id
    (内部转账记录ID)
  • 余额查询:展示各币种的可用余额(
    free
    )和锁定余额(
    locked
  • 资产概览:展示各账户类型的USDT等值资产