Atlas LP
  1. Home
  2. Blog
  3. Engineering Reliable Balance Tracking for Multi-Exchange Crypto Bots

Engineering

Engineering Reliable Balance Tracking for Multi-Exchange Crypto Bots

Explore the technical challenges and solutions for accurately tracking balances across multiple exchange accounts in a multi-tenant crypto market making platform.

Published

Why Reliable Balance Tracking Matters in Multi-Exchange Market Making

In crypto market making, maintaining an accurate view of available balances is fundamental to risk management, order placement, and operational transparency. For teams running liquidity bots across several centralized exchanges, the challenge compounds: each venue has its own API quirks, update intervals, and potential data inconsistencies. In a multi-tenant environment—where many users operate bots on different accounts and symbols—engineering a robust balance tracking system is critical for both safety and performance.

This article explores the core challenges and practical solutions for reliable balance tracking in multi-exchange crypto bot platforms, drawing on the design principles implemented in Atlas LP.


The Core Challenges of Balance Tracking

1. Exchange API Variability

Every exchange exposes its own API for balance queries, with differences in endpoints, response formats, rate limits, and error handling. Some exchanges update balances in real time, while others introduce lags or batch updates. Handling these differences is essential to prevent stale or inconsistent data from affecting trading decisions.

2. Synchronizing Multiple Accounts and Symbols

A multi-tenant platform like Atlas LP may manage bots for dozens or hundreds of users, each with multiple exchange accounts and trading pairs. Each bot needs an up-to-date view of balances for the relevant assets (base and quote currencies) to ensure orders are sized correctly and do not risk over-committing funds.

3. Handling Pending Orders and Fills

Balances on an exchange are affected not just by filled trades, but also by open limit orders. Funds locked in open orders are unavailable for new trades. A reliable system must account for both available and reserved balances, and update them promptly as orders are placed, filled, or cancelled.

4. Dealing with API Errors and Data Gaps

Network issues, API downtime, or permission errors can interrupt balance updates. The system must detect and handle these interruptions gracefully, alerting users if necessary and avoiding actions based on outdated information.


Atlas LP’s Approach to Reliable Balance Tracking

Atlas LP is designed to address these challenges with a focus on security, accuracy, and transparency. Here’s how it manages balance tracking across supported spot exchanges:

Multi-Account, Multi-Symbol Architecture

  • Per-Account, Per-Symbol Tracking: Each user can register multiple exchange accounts and run a separate bot per symbol. The platform maintains isolated balance tracking for each account-symbol pair, preventing cross-account confusion.
  • AES-256-GCM Encryption: API keys and secrets are encrypted before storage, and only decrypted when a worker needs to call the exchange, ensuring credentials are protected at all times.

Real-Time Synchronization and Validation

  • Frequent Balance Updates: On each tick (as often as every 0.5 seconds), the bot fetches the latest balances from the exchange, along with open orders and recent fills. This ensures the bot’s view of available and reserved funds is always current.
  • Order-Aware Balance Calculation: The bot distinguishes between available balances and amounts locked in open limit orders. This prevents accidental over-ordering and respects exchange constraints.
  • API Verification Checks: When a new account is registered, Atlas LP performs detailed checks—verifying balances, open orders, and permissions—to ensure the API key is valid and correctly configured for spot trading.

Handling Errors and Data Staleness

  • Stale Data Detection: If the exchange fails to provide fresh balance data, or if an API call returns an error, the bot skips trading actions for that tick. This prevents decisions based on outdated or incomplete information.
  • Error Status and Alerts: If credentials are rejected or persistent errors occur, the bot stops and notifies the user, reducing the risk of unintended trades.

Transparency for Users

  • Console Balance Display: Users can view up-to-date balances, open orders, and recent fills directly in the Atlas LP console. This transparency enables teams to monitor their inventory and reconcile with exchange statements.
  • Daily Asset Value Snapshots: Each day, Atlas LP records a snapshot of account asset values, supporting audit trails and long-term monitoring.

Practical Example: Balance Tracking in Action

Let’s walk through a typical cycle for a spot market making bot on Atlas LP:

  1. Tick Begins: The bot reads the latest ticker and order book data from the exchange.
  2. Balance Sync: The bot fetches balances for the relevant assets (e.g., BTC and USDT for BTC/USDT).
  3. Open Order Sync: The bot retrieves all open limit orders for the symbol, calculating the amounts currently reserved.
  4. Order Placement Logic: Using the available (not reserved) balance, the bot computes the desired order ladder and places new limit orders only if sufficient funds exist.
  5. Post-Trade Update: After fills or cancellations, the bot updates its internal balance view, ensuring the next tick starts with accurate data.

This cycle repeats every tick, with the interval configurable by the user (default is 3 seconds, but can be as low as 0.5 seconds, subject to exchange rate limits).


Table: Key Elements of Reliable Balance Tracking

ChallengeAtlas LP Solution
API variabilityExchange-specific adapters, unified data model
Multiple accounts/symbolsIsolated tracking per account-symbol pair
Reserved vs. available fundsSync open orders and calculate reserved balances
API errors/data gapsStale data detection, error statuses, user alerts
User transparencyReal-time console display, daily snapshots

Best Practices for Teams Using Multi-Exchange Bots

  • Always validate API permissions: Ensure keys have only the required read and spot trading permissions—never withdrawal.
  • Monitor balances and open orders regularly: Use the console and daily snapshots to reconcile with exchange statements.
  • Respond to alerts: If the bot reports stale data or errors, investigate promptly to avoid trading on outdated information.
  • Understand exchange-specific rules: Each exchange may have unique minimum order sizes, notional values, or balance update behaviors.

Conclusion

Reliable balance tracking is foundational for safe and effective market making across multiple exchanges. By engineering for real-time synchronization, robust error handling, and user transparency, platforms like Atlas LP help teams manage risk and maintain operational control in fast-moving crypto markets.

Atlas LP supports genuine spot market making with limit orders only, and prohibits wash trading or volume manipulation. No returns, prices, volume, or listings are guaranteed.

Crypto trading involves risk. Atlas LP is software for placing and managing limit orders; it does not guarantee returns, prices, volume or listings. Follow the rules of each exchange and applicable law.

← Back to blog

Frequently asked questions

How does Atlas LP ensure balance data is accurate across multiple exchanges?

Atlas LP fetches balances, open orders, and recent fills on each tick, using exchange-specific adapters to handle API differences. It detects stale data and skips trading actions if information is outdated.

What happens if an exchange API returns an error or stale data?

If Atlas LP detects API errors or stale balance data, the bot skips trading for that tick. Persistent errors will stop the bot and notify the user to prevent trading on unreliable information.

How are funds reserved in open orders handled?

Atlas LP distinguishes between available balances and amounts locked in open limit orders. The bot only places new orders if sufficient available (not reserved) funds exist.

Can users view their balances and open orders in real time?

Yes, users can view up-to-date balances, open orders, and recent fills in the Atlas LP console. Daily asset value snapshots also support long-term monitoring.

Does Atlas LP require withdrawal permissions for API keys?

No. Atlas LP never asks for withdrawal permission. API keys only need read and spot trading permissions.

Related articles

Run your spot liquidity bot with clear controls

Connect an exchange API key, set your spread band and order levels, and monitor orders, fills and balances from one console.

Create an account