DEV Community

Cover image for From Order Book Data to Liquidity Walls: Building BASTION
Dragomir Dikov for J.Labs

Posted on

From Order Book Data to Liquidity Walls: Building BASTION

Raw order book data is easy to collect.

Turning it into something a quantitative model, trading system, or AI application can actually reason about is a different problem.

That was one of the ideas behind BASTION — a new JungleTrade product designed to transform cryptocurrency market depth into structured liquidity-wall data.

The Problem

An order book gives us a snapshot of supply and demand across price levels:

  • bids below the current market price
  • asks above the current market price
  • quantities available at each level

At first glance, finding a liquidity wall might seem straightforward: find the largest orders.

But that approach quickly becomes problematic.

Liquidity is distributed differently across markets and snapshots. A quantity that is significant under one market condition may be completely ordinary under another.

There is also another problem:

Not every large visible order represents meaningful liquidity.

Orders can appear, disappear, or be repositioned. Some may represent genuine trading interest, while others may potentially be associated with spoofing behavior.

So instead of asking:

"Where are the largest orders?"

we wanted to ask:

"Where is liquidity statistically concentrated?"

A Multi-Method Approach

There is no single statistical definition of a liquidity wall.

For that reason, BASTION analyzes the same order book using four complementary approaches.

1. Peak Detection

Peak Detection searches for local concentrations of liquidity relative to neighboring price levels.

This provides a structural view of where liquidity forms noticeable local maxima within the order book.

2. Z-Score Analysis

Z-Score analysis looks at liquidity relative to its statistical distribution.

Price levels with unusually high liquidity can therefore be identified based on how far they deviate from typical observations.

3. Interquartile Range Analysis

The IQR approach provides another way of identifying unusually large liquidity concentrations without relying on the same assumptions as Z-Score analysis.

This gives us an additional perspective on potential outliers in market depth.

4. Kernel Density Estimation

KDE approaches the problem differently.

Instead of considering liquidity only at individual price levels, it allows us to examine where liquidity forms areas of concentration across the price dimension.

This is particularly useful when liquidity is distributed across several nearby levels rather than concentrated in a single order.

Why Use Multiple Methods?

Because they are answering slightly different questions.

A local peak is not necessarily a statistical outlier.

A statistical outlier is not necessarily located inside a broader area of liquidity concentration.

Rather than deciding that one definition is universally correct, BASTION exposes several analytical perspectives on the same underlying market depth.

The resulting levels can then be compared or incorporated into downstream analytical systems.

Before the Analysis: Spoofing Detection

There is another important step.

Before analyzing liquidity concentrations, BASTION applies spoofing-order detection intended to reduce the influence of potentially deceptive order activity.

This matters because simply detecting an unusually large order and calling it a liquidity wall can produce misleading results.

The objective is not to claim that every suspicious order can be identified perfectly.

Instead, spoofing detection becomes another filtering layer in the pipeline before the statistical analysis is performed.

Conceptually, the process looks like this:

Market Depth

Bid / Ask Order Book

Spoofing Detection

Liquidity Analysis

Peak | Z-Score | IQR | KDE

Structured Liquidity Levels

From Liquidity to Support and Resistance

Once liquidity concentrations have been identified, they can provide additional context for potential support and resistance.

Bid-side concentrations may indicate areas where significant buying liquidity exists below the current market price.

Ask-side concentrations may indicate areas where significant selling liquidity exists above it.

But there is an important distinction:

BASTION does not treat these levels as deterministic price predictions.

They are observations about the current structure of market liquidity.

The market can change.

Orders can move.

Liquidity can disappear.

That makes the output more useful as structured market information than as a simple "price will bounce here" signal.

Making the Output Machine-Readable

This was an important design consideration for us.

The output shouldn't only be something displayed on a chart.

Once liquidity structures are represented consistently, they can become inputs for other systems:

  • quantitative research pipelines
  • algorithmic trading models
  • execution analysis
  • trading dashboards
  • market regime models
  • AI agents

This creates an interesting progression:

Raw market depth → structured liquidity → quantitative intelligence

For example, instead of only asking where liquidity walls exist at a particular moment, we can begin asking how those structures evolve through time.

Do liquidity levels persist?

Do they migrate?

Does their relationship with market price change?

Can changes in liquidity structure help identify transitions between different market regimes?

Those questions move beyond BASTION itself, but BASTION provides structured data that can be used to investigate them.

Try BASTION

We made the UI version of BASTION completely free to explore and it does not require registration.

You can experiment with the different analytical methods and inspect how they identify liquidity structures from market depth:

https://jungletrade.ai/en/marketplace/M3

For developers interested in working with the data programmatically, BASTION is also available through the JungleTrade API.

We are continuing to explore how order book structure can be transformed into useful inputs for quantitative models and AI-driven financial systems.

Feedback from developers working with market data, trading systems, quantitative finance, or market microstructure is very welcome.

Top comments (0)