Bond

Checking network...

Developer FAQ

Frequently asked questions about the Bond API.

General

What are the base URLs for the API?

Spot API: https://api.bond.xyz | Futures API: https://fapi.bond.xyz | Spot WS: wss://ws-api.bond.xyz:443/ws-api/v3 | Futures WS: wss://ws-fapi.bond.xyz/ws-fapi/v1

What programming languages are supported?

The API works with any language that can make HTTP requests. Official SDKs are available for Python and Java. See the SDKs page for details.

Authentication

How do I generate API keys?

Log in to your Bond account > Account Settings > API Management > Create API Key. Save your API key and secret key securely. Never share your secret key.

What is the signature parameter?

The signature is an HMAC SHA256 hash of your request parameters, created using your secret key. It proves you own the API key without sending the secret key itself.

Why am I getting "Invalid signature" errors?

1) Parameters not sorted alphabetically before signing. 2) Wrong timestamp (must be within 5s of server time). 3) Incorrect UTF-8 encoding. 4) Wrong secret key.

Can I use the same API key for Spot and Futures?

Yes, but you may want separate keys for security and permission management.

Rate Limits

What are the rate limits?

Request Weight: 2400 per minute (IP-based). Orders: 300 per 10 seconds, 1200 per minute. See the Rate Limits page for full details.

How do I avoid rate limits?

1) Use WebSocket for market data instead of polling REST. 2) Monitor rate limit headers. 3) Implement exponential backoff. 4) Batch requests when possible.

What happens if I exceed rate limits?

You will receive a 429 Too Many Requests error. Implement backoff and retry logic. Repeated violations may result in temporary IP bans (HTTP 418).

Trading

What order types are supported?

Spot: LIMIT, MARKET, POST_ONLY. Futures: LIMIT, MARKET, STOP, STOP_MARKET, TAKE_PROFIT, TAKE_PROFIT_MARKET, TRAILING_STOP_MARKET.

What is the minimum order size?

Varies by symbol. Check the LOT_SIZE filter in the /exchangeInfo endpoint for minQty.

How do I set a stop-loss?

Spot: Not directly supported; monitor positions and place manual sell orders. Futures: Use STOP_MARKET order type with stopPrice and closePosition=true.

Futures

What is leverage?

Leverage allows you to control a larger position with less capital. 10x leverage means $10,000 worth traded with $1,000. Higher leverage = higher risk.

Cross vs. Isolated margin?

Cross: all available balance backs all positions (lower liquidation risk per position, but losses affect all). Isolated: each position has separate margin (independent liquidation).

What is a funding rate?

Periodic payments between long and short traders to keep perpetual futures prices close to spot. Positive rate = longs pay shorts. Negative rate = shorts pay longs.

How do I avoid liquidation?

1) Use lower leverage. 2) Monitor margin ratio regularly. 3) Always set stop-losses. 4) Do not over-leverage your account. 5) Add margin to positions if ratio gets low.

WebSocket

How long do WebSocket connections last?

Connections are valid for 24 hours, then automatically disconnect. Implement reconnection logic in your application.

How do I handle ping/pong?

Spot: Server sends ping every 20 seconds; respond with pong within 1 minute. Futures: Server sends ping every 3 minutes; respond within 10 minutes.

Can I use WebSocket for placing orders?

Yes, the WebSocket API supports both market data and trading operations using a request/response pattern.

Errors

What does error code -1022 mean?

Invalid signature. Check: parameters sorted alphabetically, timestamp is recent (within 5s), using correct secret key, proper UTF-8 encoding.

What does error code -2010 mean?

Insufficient balance. Your account does not have enough funds for the order. Check your balance before trading.

What should I do after a 5XX error?

5XX errors indicate server issues. Order status is unknown. Wait 1 second, query order status using client order ID. If order exists, proceed; if not, safe to retry.

Best Practices

REST or WebSocket?

REST: good for occasional requests, trading operations. WebSocket: better for real-time data, high-frequency updates. Use WebSocket for market data to avoid rate limits.

How should I store API keys?

Use environment variables. Never hardcode in source code. Never commit to version control. Use separate keys for different purposes. Rotate keys regularly.

How do I monitor my trading bot?

1) Log all operations. 2) Track PnL regularly. 3) Monitor rate limit usage. 4) Set up alerts for errors. 5) Regularly check open orders and positions.