balance - Query Account Balance
Retrieve your current account balance and position information.
What is balance?
balance is a simple utility command that returns your current account balance for the exchange and asset in your webhook.
The exact information returned depends on the exchange and market type (spot vs futures), but typically includes:
Total balance (equity)
Available balance (free to trade)
Used balance (locked in orders/positions)
Current position size (for futures)
Common Use Cases
- • Check balance before placing large orders
- • Verify trades executed correctly
- • Debug webhook execution issues
- • Monitor account status in webhook execution logs
Syntax
// Default: USDT or USDC
balance
// Specify coin
balance ALGOThe coin parameter is optional. Call balance without parameters to query the default coin (USDT for most exchanges, USDC for Binance Spot).
Parameters
coinOptionalType: string | Default: USDT (USDC for Binance Spot)
Specify which coin/asset balance to query. If not provided, defaults to:
- • USDT - ByBit, Kucoin, and most exchanges
- • USDC - Binance Spot
Examples: balance BTC, balance ETH, balance USDT
Real-World Examples
1. Check Balance Before Trading
Query balance at the start of your webhook to verify available funds.
BTCUSDT on My_API_Key
// Check current balance
balance
// Continue with trading
market long 0.01Balance info will appear in the webhook execution log before the market order executes.
2. Verify Trade Execution
Check balance before and after trading to confirm orders executed correctly.
ETHUSDT on My_API_Key
// Balance before
balance
market long 0.5
// Balance after
balanceCompare before/after balances to see the exact impact of your trade.
3. Query Specific Coin Balance
Check balance of a specific coin.
BTCUSDT on My_API_Key
// Check BTC balance
balance BTC
// Check ETH balance
balance ETH
// Check USDT balance
balance USDTQuery balances for multiple coins in a single webhook.
4. Position Verification
Use with position management to verify your current position size.
BTCUSDT on My_API_Key
rem all
pos 0
// Verify position closed
balance
market long 0.01
// Verify new position
balanceConfirms position was closed before entering new one, and verifies new position size.
5. Debug Webhook Issues
When troubleshooting, add balance commands to understand execution flow.
BTCUSDT on My_API_Key
// Checkpoint 1
balance
market long 50%
// Checkpoint 2
balance
sl-or-tp short 100%p sl off 2% tp off 5%
// Checkpoint 3
balanceMultiple balance commands create checkpoints to see exactly where issues occur.
Response Format
The balance information appears in your webhook execution log. Typical response includes:
// Example Balance Response (ByBit Futures)
{
"coin": "USDT",
"balance": {
"coin": "USDT",
"free": 66.80098378,
"used": 0.0,
"total": 66.80098378
}
}Fields vary by exchange, but typically show total balance, available (free), and used (locked) amounts.
Best Practices
Use for debugging - Add balance commands when troubleshooting webhook issues
Verify position changes - Check balance before and after position modifications
Monitor available funds - Confirm you have enough balance for planned trades
Check execution logs - Balance info appears in webhook execution history
Important Notes
- • Balance info defaults to USDT for most exchanges, USDC for Binance Spot
- • Use
balance BTCto query specific coin balances - • Response format varies by exchange (ByBit, Binance, Kucoin have different structures)
- • For spot markets, shows coin holdings; for futures, shows margin balance
- • Does not modify anything - purely informational
Bitunix Exchange Limitation
The balance command is not supported on Bitunix. If you need to check balances, use the Bitunix web interface or API directly.
Related Commands
market- Execute trades based on balance
set- Configure exchange settings like leverage