1017 / MQL5 / USDⓈ-M FUTURES
How can MQL5 query Binance USD-M futures account balances V3?
Call ufFuturesAccountBalanceV3 to retrieve account asset balances. This example traverses the assets for balance, cross wallet balance, unrealized PnL, available balance and maximum withdrawal amount, then prints the asset, balance and available balance for nonempty asset records.
What do you need to use this example?
- Install and configure MT5 Binance and API credentials. Make mt5binance.mqh, JAson.mqh and the account permissions required by this example available.
- Enable futures balance access for the API key. No trading symbol is passed, so results are account assets rather than chart-symbol-specific balances.
How does the source execute?
- On each tick, call ufFuturesAccountBalanceV3 with handles, recvWindow and the response buffer.
- Convert and parse the returned array, reading accountAlias, asset, balance and related fields.
- For records with a nonempty asset name, print balance and availableBalance. Other fields are read into local variables.
Requests run on every OnTick without an effective one-shot guard. Frequency follows ticks received by the chart.
Parameters and execution behavior
| Parameter | Source value or behavior |
|---|---|
| Main interface | ufFuturesAccountBalanceV3 |
| Scope | Assets returned for the account |
| Version | V3 |
| Balance fields | balance / crossWalletBalance / availableBalance |
| Other fields | crossUnPnl / maxWithdrawAmount / updateTime |
| Request timing window | recvWindow = 3000 ms |
| Execution trigger | Requests run on every OnTick without an effective one-shot guard. Frequency follows ticks received by the chart. |