Atlas LP
  1. Home
  2. Blog
  3. Engineering for Stale Data: How Market Making Bots Detect and Respond to Outdated Order Books

Engineering

Engineering for Stale Data: How Market Making Bots Detect and Respond to Outdated Order Books

Discover how market making bots identify stale or crossed order book data and the engineering strategies used to maintain effective and fair quoting in crypto spot markets.

Published

Introduction

In the fast-paced world of crypto spot markets, the reliability and freshness of order book data are crucial for effective market making. Automated market making bots rely on real-time data to quote fair prices, manage inventory, and provide liquidity. However, data can become stale or even crossed due to network delays, exchange outages, or API issues. Engineering robust strategies to detect and respond to outdated order book data is essential to ensure that bots do not make poor trading decisions or expose themselves to unnecessary risk.

This article explores how market making bots like those powered by Atlas LP are designed to identify stale data and maintain fair quoting, helping token projects, exchanges, and trading teams understand the technical challenges and solutions involved.

What Is Stale Order Book Data?

Order book data is considered stale when it does not reflect the current state of the market. This can happen for several reasons:

  • Network latency: Delays in data transmission between the exchange and the bot.
  • Exchange API issues: Outages or slowdowns on the exchange side.
  • WebSocket/REST failures: Disruptions in the real-time data stream.
  • Local processing lag: The bot's own processing may fall behind due to resource constraints.

Stale data can lead to mispriced orders, missed trading opportunities, or increased risk exposure. In extreme cases, bots might act on information that is several seconds (or more) out of date, which in volatile crypto markets can be critical.

Crossed Order Books: A Special Case

A crossed order book occurs when the best bid price equals or exceeds the best ask price. This is typically a data anomaly, as it implies that a trade should have already occurred to clear the overlap. Crossed books can result from:

  • Data synchronization errors
  • Exchange-side glitches
  • Incomplete or out-of-order data packets

Market making bots must be able to recognize and ignore such situations to avoid placing orders at obviously incorrect prices.

Why Data Freshness Matters for Market Making

Genuine market making means posting resting limit orders that any participant can trade against. To do this fairly and effectively, bots must:

  • Quote prices based on the latest available market data
  • Avoid quoting on outdated or anomalous information
  • Protect themselves from adverse selection and unnecessary losses

Failing to detect stale or crossed data can result in:

  • Posting orders at prices far from the true market
  • Having orders filled at unfavorable prices
  • Distorting the order book, which can harm market integrity

How Atlas LP Bots Detect Stale and Crossed Data

Atlas LP is a multi-tenant platform for running spot market making bots on supported centralized exchanges. Its engineering approach to data freshness includes:

Real-Time Data Acquisition

  • WebSocket or REST: The bot fetches the latest ticker and order book data for each tick cycle, favoring WebSocket streams for lower latency when available.
  • Tick Intervals: The bot operates on a configurable tick interval (from 0.5 seconds, default 3 seconds), ensuring frequent data updates.

Data Validation on Every Tick

Before computing and placing new orders, Atlas LP bots perform strict checks:

  • Stale Data Check: If the order book or ticker data is outdated (e.g., timestamp is too old), the bot skips the tick and does not update orders.
  • Crossed Book Check: If the best bid is equal to or higher than the best ask, indicating a crossed book, the bot also skips the tick.
  • API Verification: On bot startup and optionally during operation, the bot verifies the exchange API by checking ticker, order book, symbol rules, balances, open orders, and trades.

Conservative Order Management

  • Order Placement: The bot only places or cancels orders when data is fresh and valid. If data is stale or crossed, it waits for the next tick.
  • Order Book Seeding: If the market has no quotes, the bot seeds a buy and a sell order around the base price, but only if data is current.
  • No Market Orders: The bot uses limit orders exclusively, further reducing the risk of executing on outdated information.

Event Logging and Alerts

  • Console Sync: All open orders, recent fills, balances, and bot events are logged and visible in the console, allowing users to monitor for anomalies.
  • Telegram Alerts: Users can set up notifications if a bot has had no fills for a chosen period, which may indicate data issues or market inactivity.

Engineering Strategies for Robustness

Building a reliable market making bot requires more than just checking timestamps. Here are some engineering best practices:

1. Multiple Data Sources

Favor exchanges that provide both WebSocket and REST APIs. Use WebSocket for real-time data and REST as a fallback or for periodic verification.

2. Timestamp and Sequence Checks

Always compare the timestamp or sequence number of received data to the current system time. If the lag exceeds a threshold, treat the data as stale.

3. Graceful Degradation

If data is stale or crossed for several consecutive ticks, pause quoting and notify the user. Never place orders based on uncertain data.

4. User Controls

Allow users to stop the bot, cancel open orders, or adjust parameters if data issues are detected. Atlas LP provides these controls directly in the bot page.

5. Exchange-Specific Handling

Each exchange may have its own quirks regarding data freshness and order book structure. Engineering flexible adapters for each supported exchange helps ensure consistent behavior.

Practical Example: Atlas LP Tick Cycle

Here’s how a typical tick cycle works in Atlas LP:

  1. Fetch Data: Retrieve the latest ticker and order book for the symbol.
  2. Validate: Check that data is not stale or crossed.
  3. Compute Ladder: If data is valid, compute the desired order ladder based on the strategy parameters.
  4. Place/Cancel Orders: Place missing levels and cancel excess or mispriced orders.
  5. Sync Events: Record all actions, fills, and balances in the console.
  6. Skip on Error: If data is stale or crossed, skip the tick and try again on the next cycle.

This approach minimizes risk and ensures that the bot only acts on reliable information.

Why Genuine Market Making Requires Data Integrity

Genuine market making means providing liquidity through transparent, resting limit orders that any participant can trade against. Wash trading, self-trading, or volume manipulation are prohibited and undermine market integrity. Ensuring that orders are always based on current, accurate data is fundamental to fair and effective market making.

Conclusion

Engineering for stale data is a critical aspect of building robust, reliable market making bots. By detecting and responding to outdated or anomalous order book data, platforms like Atlas LP help ensure that liquidity provision remains fair, transparent, and effective—even in the face of network or exchange challenges.

For more on how Atlas LP approaches secure, reliable spot market making, visit our liquidity bot overview or see the full list of supported exchanges.

Atlas LP does not guarantee returns, prices, volume, or listings.

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

What is stale order book data in crypto trading?

Stale order book data refers to outdated market information that does not reflect the current state of bids and asks. This can occur due to network delays, exchange issues, or data transmission problems, and can lead to mispriced orders if not detected.

How do market making bots like Atlas LP handle stale or crossed data?

Atlas LP bots check the freshness and validity of order book and ticker data on every tick. If data is stale or the book is crossed, the bot skips the tick and does not place or cancel orders until fresh data is available.

Why is it important for bots to avoid acting on stale data?

Acting on stale data can result in placing orders at incorrect prices, increasing risk, and potentially distorting the order book. Reliable bots only quote based on up-to-date information to maintain fair and effective market making.

Can users control the bot if stale data issues persist?

Yes, Atlas LP allows users to stop the bot and cancel open orders at any time from the bot page, providing control if data issues or anomalies are detected.

Does Atlas LP guarantee profits or trading volume?

No, Atlas LP does not guarantee returns, price movements, trading volume, or listings. The platform is designed for secure, genuine market making, not for volume manipulation or guaranteed outcomes.

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