# Classic Order Flow
Source: https://docs.marketlens.app/classic-order-flow
Order book heatmaps and trades profiles on multi-exchange data.
Order book **heatmaps** and **trades / volume profiles** are proven ways to read order flow. Most of them were built years ago for **one market at a time**, so multi-venue crypto needs care: how you **group** prices, how you **sum** venues, and what you can still tell apart per exchange.
MarketLens keeps those classic tools and adapts them to **multi-market** selection.
See also: [Unified order flow](/unified-order-flow), [L2 order book](/order-book).
## Heatmap
Order book **heatmaps** were popularized by Bookmap around **2014–2016** and remain the standard way to see resting limit orders evolve through time: each column is a snapshot of the book, and color intensity marks larger size.
MarketLens extends that idea with **native multi-market** support. Below: an aggregated heatmap for BTC/USD **spot** across Binance, Bybit, Coinbase, OKX, Kraken, and Bitfinex.
Color intensity highlights interesting sizes. Settings (thresholds, scales, themes) help you focus on the liquidity that matters for your workflow.
### Price grouping
Book data is first **bucketed** by a chosen price step into **non-overlapping** groups. Bids and asks use opposite edges so the spread stays clean:
* **Bids** group **down** (toward lower prices)
* **Asks** group **up** (toward higher prices)
**Example** with a **\$10** step: several raw asks and bids collapse into a few cells (sizes add inside each cell).
Each heatmap cell’s **vertical center** sits on the **price level** it represents (for example the 1230 and 1240 markers on the scale).
### Multi-exchange aggregation
After each venue is grouped the same way, the heatmap **always aggregates** across the selected exchanges. There is no per-venue layer in the heatmap: one cell, one value for the whole selection.
Sizes are **signed**: **bids positive**, **asks negative**. Cells are summed with that sign:
* Same side across venues **adds** (two bids in one cell → larger positive total)
* Mixed sides **net out** (bid on one venue, ask on another in the same cell → a **bid/ask delta**, not two stacks drawn on top of each other)
## Trades profile
**Volume profile** (total volume by price, without splitting buy and sell) was already common for years. MarketDelta’s Footprint® charts (around **2003**) popularized the next step: the same price ladder **inside each bar**, with **aggressive buys and sells** shown separately. Other platforms use other names for that idea. On MarketLens it is **trades profile**.
A **trades profile** shows **aggressive buy and sell volume at each price level inside a bar** — who hit the book, not who was resting (that is the heatmap).
| Tool | What it shows |
| -------------- | -------------------------------------------------- |
| Heatmap | Resting limits over time |
| Trades profile | Aggression inside the bar (buys vs sells at price) |
| Volume profile | Total volume at price (buys + sells) |
A core UI goal is to **read size without staring at digits**. Each price level is a horizontal bar whose **length is proportional to size** on a shared scale across the profile.
### Display modes
| Mode | What each level shows |
| -------------------------- | ---------------------------------------------- |
| **Trades profile** | Buys and sells **separately** |
| **Delta** | **Buys − sells** (imbalance) |
| **Volume profile** | **Buys + sells** (total volume) |
| **Volume profile (delta)** | Same imbalance idea on a volume-profile layout |
A **volume profile** is total size at each level (**buys + sells**), often drawn as bars from one side. **Delta** is **buys − sells** per level.
### Price grouping
Auction analysis **inside** candles needs **stable** buckets. Unlike the heatmap’s bid-down / ask-up edges, trades profile levels are **always grouped down** into **half-open** intervals so every trade lands in exactly one bucket (left edge **inclusive**, right edge **exclusive**).
**Example** with a **\$10** step: a print at **1239.9** goes to the **1230** bucket; a print at **1240.0** goes to **1240**.
### Multi-exchange aggregation
Trades profiles work on **executed volume** only (no signed bid/ask book cancellation). You can either:
1. **Aggregate** — sum size at each level (and each side, when buys and sells are separate) across the selected exchanges, or
2. **Show per exchange** — draw venues as separate bars/segments at the same levels.
In the separate view, **hover** a venue to highlight only that exchange’s sizes so you can compare without leaving multi-market mode.
## References in product
* [Unified order flow](/unified-order-flow) — limits and markets in one visual space
* [L2 order book](/order-book) — live multi-market depth
* [Tape](/tape) — aggressive prints as a visual stream
# Futures Markets
Source: https://docs.marketlens.app/futures-markets
Delivery futures and perpetual futures — leverage, long/short, open interest, basis, funding, index and mark price.
## Delivery futures
Delivery futures originated from a practical need: organise **dated deliveries** of physical goods at **pre-agreed prices** — and later evolved into a main tool for pure price speculation, including **perpetual** markets (below).
On futures markets the venue (or a linked **clearing house**) stands in the middle of obligations between parties. On a **physical delivery** future, one side takes the obligation to **receive** a defined amount of goods (e.g. oil) at a defined price on a defined date; the other side takes the obligation to **deliver** on the same terms. Day to day, each side holds a **contract** on the exchange’s books — not a warehouse receipt.
Contract holders can **close** before expiry by trading out — turn the contract back into money. If the market price has moved since they entered, that close settles as **cash profit & loss (P\&L)** relative to entry, without completing physical delivery.
| Market move | Side expecting to **receive** | Side expecting to **deliver** |
| --------------- | -------------------------------------------- | ----------------------------- |
| **Price rises** | Closing is **profitable** (exit above entry) | Closing is **loss-making** |
| **Price falls** | Loss-making | **Profitable** |
People who only want to earn from price going up or down do not need physical delivery. Futures markets adapted to that demand as a more efficient alternative to **margin spot** (borrow the asset or cash and trade inventory). The two sides got standard names — **long** and **short** — and orders use the same language.
* **Long** — you stand to gain if price **rises** (aligned with the side that would **receive** delivery).
* **Short** — you stand to gain if price **falls** (aligned with the side that would **deliver**).
**Where the words come from:** In 19th‑century US stock and commodity markets, a trader who did not yet hold what they had sold was said to be **short** of it — *short* as in *lacking* (they owed the good or shares to their broker). The opposite side, holding or expecting the asset, was **long**. The labels stuck for futures even though the product is a contract, not a borrowed stock. (The *practice* of betting on a fall is older — e.g. Isaac Le Maire and VOC shares around 1609 — but the long/short *words* in this sense show up mid‑1800s.)
To take a side you **open** a long or a short. That open commitment is a **position** until you **close** it (the early-exit trade above).
A pure price **position** can be held with **leverage**: a smaller stake controls a larger **notional**, so the same price move produces larger profit or loss — and a higher chance of wipeout. Futures typically allow **higher leverage than margin spot** because you are not financing ownership of the asset (or borrowing it to short). You post a **performance bond** (**margin**): a fraction of notional against adverse moves. The venue (via clearing) **marks to market** and can **liquidate** underwater positions before losses exceed that bond. Margin spot still funds inventory or a stock/coin borrow, so lenders and borrow markets cap how far leverage can go. Either way: more leverage → more liquidation risk.
| | Futures | Margin spot (simplified) |
| ----------------------- | ------------------------------------ | --------------------------------------------- |
| **What you hold** | A **contract** position | The **asset** (or cash) on margin |
| **Go long** | **Open** a long position | Acquire the asset (maybe with borrow) |
| **Go short** | **Open** a short position | Borrow the asset and sell it (or venue short) |
| **Borrow the asset?** | **No** for a standard short | Often **yes** for a short |
| **Ongoing borrow fee?** | **No** for holding the future itself | Often **yes** while short or leveraged |
| **Leverage** | Via **margin** on the contract | Via **borrowed** funds / stock |
**Matching interests** works like [spot](/spot-markets): **limit** and **market** orders meet on an **order book**. On futures, an order expresses an interest to **open** or **close** a **long** or **short** — four combinations (e.g. “I want to go long” is long interest). A **position** is what remains after fills: long if you opened long and have not fully closed; short if you opened short and have not fully closed. None of that is buying or selling the underlying the way spot does.
**Open interest (OI)** is the total size of **outstanding** long (and matching short) contracts market-wide — always equal on both sides. **Volume** is how much **traded** (every match counts).
| Trade (one match) | OI | Volume |
| -------------------------------------------------- | ----------------- | ----------------- |
| New **long** + new **short** | **+** traded size | **+** traded size |
| Close **long** + close **short** | **−** traded size | **+** traded size |
| Close **short** + open **short** (short transfers) | **no change** | **+** traded size |
| Close **long** + open **long** (long transfers) | **no change** | **+** traded size |
Futures are a **zero-sum** game among traders (fees aside): what one side earns in P\&L, the other loses.
Venues charge **fees** on open/close. Typical crypto futures maker/taker fees are often on the order of **a few basis points** (e.g. \~0.01%–0.05% of notional — check each venue). Holding a dated future itself usually has **no extra daily fee** (perpetuals add **funding** — below).
## Price convergence and basis
A **delivery** future’s price can trade **above or below** the underlying for most of its life — free float within arbitrage bounds. As **expiry** approaches, the contract is pulled toward the underlying: **convergence**.
**Why:** at expiry the contract becomes the underlying (delivery or cash settlement). Any leftover gap is arbitrage — sell rich futures against spot, or buy cheap futures and reverse. Earlier, **carry** (storage, financing, etc.) can justify a wider basis; near expiry that room shrinks to nearly nothing.
**Basis** is that gap — roughly futures price minus underlying (spot or index) price. Venues may say premium or discount instead.
### Manipulation protection
(index and mark prices. older tradfi exchanges and modern binance)
Last traded price on a single futures book can **spike**. Spot on the same underlying (no leverage, real inventory) is usually **more stable**. Liquidating or settling everyone off one futures wick is **unfair vs that spot reality** — and gameable if last trade alone runs margin.
Traditional futures markets used settlement committees, closing ranges, and later **index-style** references. Modern venues (including crypto exchanges such as Binance) publish:
| Price | Role |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Index price** | Reference for the **underlying** — often a basket of spot prices across venues so one thin book cannot alone define “fair” spot |
| **Mark price** | Fair value for **unrealized P\&L and liquidations** — usually blends index with the contract market so a single last-trade spike does not unfairly liquidate |
| **Last / mid** | What is trading on **this** book right now |
Index and mark are the main **anti-manipulation** tools for margin and liquidations on both dated futures and perps.
### Linear vs inverse
Futures also differ by **how margin and P\&L are denominated** — common language in crypto; the same idea exists wherever contracts are cash-margined vs coin-margined.
**Linear** (quote-margined): margined and settled in a **quote** currency (often USDT / USD). P\&L is in dollars for a given move; profit for a long scales roughly linearly with size × price change. Example style: **BTCUSDT**.
**Inverse** (base- / coin-margined): margined and settled in the **underlying** (e.g. BTC), often **quoted in USD**. You post coin as margin; wins and losses are more or less coin. P\&L in coin is **not linear** in price the way quote P\&L is (settlement ties to the inverse of price). Classic example: **BTCUSD** coin-margined contracts.
| | Linear | Inverse |
| ----------------- | ------------------ | -------------------------------------- |
| **Margin** | Quote (e.g. USDT) | Base / coin (e.g. BTC) |
| **P\&L unit** | Quote | Base |
| **P\&L vs price** | \~Linear in quote | Nonlinear in coin |
| **Typical name** | BTCUSDT, ETHUSDT | BTCUSD (coin-margined) |
| **Why use it** | Simple dollar P\&L | Stay in the asset; no quote stablecoin |
Both can be **delivery** or **perpetual**. Linear vs inverse is settlement currency and P\&L shape; delivery vs perpetual is expiry and how price is anchored (basis vs funding).
## Perpetual futures
Delivery futures are awkward for pure continuous speculation: you must **roll** when the contract expires, and **basis** can wander until convergence.
A **perpetual** has **no expiry** — continuous exposure, high leverage, and a **funding** mechanism that keeps it near the underlying without delivery.
The modern **perpetual swap** was popularized in crypto by **BitMEX** in **2016**. Non-expiring futures have older academic roots (e.g. Shiller, 1992), and earlier experiments existed; BitMEX-style design is what most people mean by “perps” today. In many traditional markets, **dated futures** still dominate; in crypto, **perpetuals** usually carry most derivatives volume.
There is no expiry to force **convergence**. Instead:
1. **Index** defines the target underlying value
2. **Funding** pays between longs and shorts so the perp is pushed toward that target
3. **Mark** still protects liquidations from last-trade noise
**Funding** is a periodic payment **between longs and shorts** (not primarily an exchange fee):
* If the perp trades **rich** (above target), **longs typically pay shorts**
* If the perp trades **cheap** (below target), **shorts typically pay longs**
That replaces delivery-date basis squeeze with continuous peer transfers. Trading fees still apply on each fill; holding a perp may cost or earn **funding** depending on the rate and your side. Mark remains especially important because there is no single final settlement day for every position.
## In MarketLens
Venues MarketLens covers list **spot**, **linear** and **inverse** perps, and **delivery** contracts side by side. Multi-market views can mix those types — see [classic order flow](/classic-order-flow) and [L2 order book](/order-book). Related series: [Metrics](/metrics) (volume, OI, funding).
See also: [Spot markets](/spot-markets), [Prediction markets](/prediction-markets).
# HIP-4 (WIP)
Source: https://docs.marketlens.app/hip-4
Hyperliquid prediction markets with dual yes/no order books.
HIP-4 markets on Hyperliquid use dual **yes/no** order books. MarketLens treats them with the same tools as other markets, with special support for the two-book structure.
Mechanics overview: [Prediction markets](/prediction-markets). Official spec: [HIP-4: Outcome markets](https://hyperliquid.gitbook.io/hyperliquid-docs/hyperliquid-improvement-proposals-hips/hip-4-outcome-markets).
*Product screenshots and usage notes to come.*
# Documentation
Source: https://docs.marketlens.app/index
Why MarketLens was created, market concepts, and product features.
MarketLens exists because modern financial markets have changed, and there is room for better ways to **see** data. We observed a few recurring problems and built the product around solutions that became our core UI principles:
* **Single-market orientation** → **Native multi-market** support
* **Presentations that depend on reading numbers** → **Visually measurable** views where object size (length, height) encodes value
* **Color as the main encoder of magnitude** → Color mainly for **attention**; size for **comparison**
Docs cover **how tools work** and **how to read them**. Pitch and product overview live on the [marketing site](https://marketlens.app). Market data is always free.
## Market concepts
| Page | Topic |
| ----------------------------------------- | ----------------------------------------------- |
| [Spot Markets](/spot-markets) | Limit and market orders, the book, and trades |
| [Futures markets](/futures-markets) | Delivery & perps: leverage, OI, basis, funding |
| [Prediction markets](/prediction-markets) | Dual Yes/No books, prices from 0 to 1, matching |
## Product
| Page | Topic |
| -------------------------------------------- | ------------------------------------------------ |
| [Unified order flow](/unified-order-flow) | Multi-market limit and market flow in one visual |
| [Classic order flow](/classic-order-flow) | Heatmaps and trades profiles |
| [L2 order book](/order-book) | Multi-market depth |
| [Trades (Tape)](/tape) | Visual market tape |
| [Metrics](/metrics) | Volume, CVD, OI, funding, liquidations |
| [Scripting (WIP)](/scripting) | Lenscript — custom series on multi-market data |
| [Liquidations, TP & SL](/liquidations-tp-sl) | Hyperliquid open liquidity: liqs, TP, SL |
| [L4 order book](/l4-order-book) | Individual Hyperliquid orders, wallet-tagged |
| [HIP-4 (WIP)](/hip-4) | Prediction markets on Hyperliquid |
| [Trading (WIP)](/trading) | Chart execution, wallet, and agents |
## Elsewhere
* [Order flow product page](https://marketlens.app/order-flow/)
* [Hyperliquid product page](https://marketlens.app/hyperliquid/)
* [Open the app](https://marketlens.app/markets/)
# L4 Order Book
Source: https://docs.marketlens.app/l4-order-book
Hyperliquid L4 depth — each resting order, wallet-tagged, zoomable like L2.
**Hyperliquid** is the first major venue to expose essentially **all trading activity** as open data. MarketLens runs a Hyperliquid node and records streams in real time so those layers can sit next to multi-exchange analytics on the same chart.
Most public feeds stop at **aggregated** depth. Hyperliquid can go deeper: **individual resting orders**, each tied to a **wallet address**. That is what we call **L4** in MarketLens.
## Market data depth levels
| Level | What you get |
| ------ | ----------------------------------------------------------------------------------------------------------------- |
| **L1** | Best bid and best ask (top of book only) |
| **L2** | Size **aggregated by price** — total size at each level, no order identity |
| **L3** | Individual **orders** at each price (order ID / size), without a stable public wallet link in the usual CEX sense |
| **L4** | Individual resting orders **plus who** — on Hyperliquid, each order is tied to a **wallet address** |
In short: **L2** answers “how much sits at this price?” **L4** answers “how is that size stacked, and which wallets are behind it?”
One large resting order and many small ones can look the same on L2. L4 shows the **composition** of the level.
## L4 in MarketLens
The L4 view draws **each resting order** as its own visual unit (not only a single bar for the whole price level).
* **Hover** an order to **inspect** it (size, price, and related fields)
* Same interaction model as [L2](/order-book): the book is **zoomable** and **draggable** (pan) so you can move through price levels at the detail you need
## Wallets and external tools
Because each order is address-tagged, L4 is a natural bridge into Hyperliquid wallet tooling.
* **Wallet labels / database** — MarketLens uses address metadata from [cryexc HL addresses](https://cryexc.josedonato.com/hl-addresses) where available, so known or labeled wallets are easier to recognize in the book
* **Wallet inspector** — **click** an order to open a deeper look in **[HyperTracker](https://hypertracker.io/)** (wallet / activity inspector for that address)
Those links turn “size at a level” into **who is providing that liquidity**, without leaving the order-flow workflow.
See also: [L2 order book](/order-book), [Liquidations, TP & SL](/liquidations-tp-sl), [Trading](/trading), [Hyperliquid product page](https://marketlens.app/hyperliquid/).
# Liquidations, TP & SL
Source: https://docs.marketlens.app/liquidations-tp-sl
Three more kinds of Hyperliquid liquidity: liquidations, take profits, and stop losses — exchange-native, not models.
**Hyperliquid** is the first major trading venue to open up essentially **all trading activity** as data. MarketLens runs a Hyperliquid node and **records interesting streams in real time** so those layers can sit next to multi-exchange order flow on the same chart.
Conceptually, **liquidation levels**, **take profits**, and **stop losses** are similar to an **order book**: they describe **pending liquidity** at prices away from the market. If price gets there, something may fill, fire, or force-close. The classic book is only one kind of liquidity. On Hyperliquid you get **three more**.
These are **exchange-native** levels from open data — not speculative “liquidation heatmap” models.
## Liquidations
Many tools try to **estimate** liquidation levels: how much size would be forced out if price hits a level. With Hyperliquid you can see liquidations **as they actually are**, from venue data.
A **liquidation** is a **forced order**:
| Open interest | Where levels sit | Forced flow when hit |
| ------------- | -------------------- | -------------------- |
| **Longs** | **Below** the market | Forced **sells** |
| **Shorts** | **Above** the market | Forced **buys** |
That forced flow is often read as **fuel for continuation**: a move into a dense liquidation zone can accelerate as bankrupt positions are closed the wrong way relative to the move.
**Levels vs fills:** this page is about **open** Hyperliquid liquidation **liquidity** (where risk sits if price gets there). **Executed** liquidations across venues (forced buy/sell prints, bar metrics, scripting) are documented under [Metrics → Liquidations](/metrics#liquidations).
## Take profits and stop losses
Many venues support **trigger orders**: when price reaches a level, the venue places a child order. That child may be a **market** order (immediate aggression) or a **limit** order (rests as a **bid** or **ask**). Hyperliquid is the first venue that exposes where those resting **take-profit** and **stop-loss** interests sit, so they can be drawn like liquidity — not guessed.
### Direction by type and side of the market
| Type | Above the market | Below the market |
| --------------- | ----------------- | ----------------- |
| **Take profit** | **Sell** interest | **Buy** interest |
| **Stop loss** | **Buy** interest | **Sell** interest |
What that interest **becomes** when the trigger fires depends on the child order:
| Trigger fires as… | Effect |
| --------------------- | ----------------------------------------- |
| **Market** sell / buy | Immediate aggressive flow (hits the book) |
| **Limit** sell | Becomes an **ask** (resting offer) |
| **Limit** buy | Becomes a **bid** (resting bid) |
So a take profit **above** the market is always **sell-side** intent, but it may print as a market sell **or** sit as an ask. A take profit **below** is always **buy-side** intent (market buy or bid). Stops flip the same way: stops **above** are buy-side (market buy or bid); stops **below** are sell-side (market sell or ask).
**How to read them (roughly):**
* **Take profits** often act like **resistance / support** — interest that may lean against the move when price arrives (especially if the child is a limit that rests)
* **Stop losses** often act like **fuel for continuation** — triggered flow in the direction of the break (especially market children)
### Take profits
### Stop losses
## Four kinds of liquidity (summary)
| Layer | What it is |
| ----------------- | ------------------------------------------------- |
| **L2 order book** | Resting limit bids and asks |
| **Liquidations** | Forced closes if price reaches leverage risk |
| **Take profits** | Triggered interest that locks in gains |
| **Stop losses** | Triggered interest that caps losses / can cascade |
See also: [L4 order book](/l4-order-book), [Trades (Tape)](/tape), [Trading](/trading), [Hyperliquid product page](https://marketlens.app/hyperliquid/).
# Metrics
Source: https://docs.marketlens.app/metrics
Basic metrics from exchange data — volume, volume delta, CVD, open interest, funding rates, and liquidations.
**Metrics** in MarketLens sit next to order flow. Some are **derived** from public raw streams (e.g. volume and CVD from trades); others are **fetched as-is** from the venue (e.g. open interest, funding) because the exchange never publishes the finer grain you would need to rebuild them.
That split comes from how open market data has always been. Years ago feeds were scarce and closed: a full **trade** stream was often unavailable, so venues offered **volume** as a ready-made series — and even that was hard to get, which made volume unusually powerful. Access is broader today, but exchanges still **limit** what they ship: order books are typically **L2** with **capped depth**; futures **trades** usually do not say whether a fill **opens or closes** a position, so **open interest** arrives as a separate, less frequent series instead of something you can reconstruct trade by trade.
The long trend is more openness. Venues keep exposing richer public data; at the extreme, **Hyperliquid** publishes effectively the full market state for anyone to use.
This page covers the basic set. Custom series: [Scripting](/scripting).
## Volume and volume delta
**Volume** is total **executed size** over a bar or window. MarketLens builds it from the **raw trade** stream; the useful work is **normalizing units** for multi-market views.
Venues may report size in **contracts**, **base**, or **quote**. MarketLens normalizes those prints into **base** or **quote** (contracts are translated into the same unit system). Spot, linear, and inverse futures can share one multi-market view. You can **switch base ↔ quote** in the UI; series follow that choice.
**Volume delta** is buy volume minus sell volume in those same units:
$$
\text{volume delta} = V_{\text{buy}} - V_{\text{sell}}
$$
**Buy** / **sell** here follow the venue’s **aggressor** (taker) side on each print: which side crossed the book.
Both series are summed into the current timeframe after unit normalization.
**Volume** and **volume delta** are usually drawn as a **histogram** under the chart (one column per time step):
* **Volume** — stacked bars: **green** buy volume, **red** sell volume; together they are total volume (activity intensity).
* **Volume delta** — signed bars: **green** when net buy, **red** when net sell.
## CVD (cumulative volume delta)
**CVD** is the **running sum** of volume delta over time:
$$
\mathrm{CVD}_t = \mathrm{CVD}_{t-1} + \text{volume delta}_t
$$
Also derived from **raw trades**. Volume delta is “this bar’s net buy vs sell”; CVD is the **path** of that net over the session or chart.
### Absorption and divergences
Traders often read CVD against **price**:
* **Absorption** — price stalls or reverses while CVD keeps pushing one way (net buy or sell volume “eaten” by passive size, or the move fails to progress).
* **Bullish divergence** — price makes a **lower** low, CVD a **higher** low (selling pressure weakens vs price).
* **Bearish divergence** — price makes a **higher** high, CVD a **lower** high (buying pressure weakens vs price).
These are **interpretations**, not guarantees. CVD only measures **signed buy/sell volume** from trades; it does not see resting book changes unless you combine it with other tools ([order book](/order-book), [classic order flow](/classic-order-flow)).
## Open interest
**Open interest (OI)** is a **futures** metric: total **open positions** (outstanding contract interest). Background: [Futures markets](/futures-markets) (including how trades can raise, lower, or leave OI unchanged while **volume** always rises).
MarketLens can show OI in **base** or **quote** units (same unit switch as volume and other size series). What each **exchange originally publishes** varies: base only, quote only, or both. **Inverse** products often report a **contract count**, which MarketLens stores as **quote** (contracts × multiplier). **Linear** products more often report **base**.
### Per-venue (original exchange data)
| Exchange | Linear / USDT-style | Inverse / coin-margined |
| ---------------------------- | ------------------- | ------------------------------- |
| **Binance** (+ Aster linear) | **Base** only | **Quote** only |
| **Bybit** | **Both** | **Both** |
| **OKX** | **Both** | **Both** |
| **Hyperliquid** | **Base** only | — |
| **Bitget** | **Base** only | **Base** only |
| **HTX** | **Base** only | **Base** only |
| **Bitstamp** | **Both** | — |
| **Coinbase** (INTX) | **Base** only | — |
| **BitMEX** | **Base** | **Quote** |
| **Deribit** | **Base** | **Quote** (USD-settled inverse) |
| **KuCoin** | **Base** | **Quote** |
| **Gate.io** | **Base** | **Quote** when BTC-settled |
| **MEXC futures** | **Base** | **Quote** |
| **Lighter** | **Quote** only | — |
| **Bitfinex** | **Base** only | — |
### Converting base ↔ quote
When the venue does not publish both units, MarketLens can still **display** the other by converting with a current price. That conversion is **not exact**:
* OI is a **stock** of open contracts built up over many prices and times
* A single **spot or mark** multiplier is only an approximation of “notional at risk”
* Venue formulas, contract multipliers, and inverse vs linear design also matter
Treat converted OI as **illustrative** for scale and multi-market comparison — not as the exchange’s official other unit. When both are published, prefer the venue’s own figures.
## Funding rates
**Funding** is how **perpetual** futures stay near the underlying without expiry — periodic payments between longs and shorts. Mechanics: [Futures markets](/futures-markets) (funding, index, mark).
On the chart, funding is a **time series** of the rate (or predicted rate) the venue publishes. How **jumpy** or **smooth** it looks depends on how each venue builds the rate from **premium** — not a single global formula.
* **Smoother** (e.g. Binance) — premium is averaged over the funding interval with **more weight on later samples**, so short blips fade out.
* **Jumpier** (e.g. Hyperliquid) — premium is averaged in a **short equal-weight window**. A sharp premium move can step the rate, and drop out again when that sample leaves the window — so the line jumps even when price is quiet.
## Liquidations
A **liquidation** is a **forced order**: the venue closes a leveraged position when margin is insufficient. That close still prints as **buy or sell aggression** against the book — not optional trading.
| Position closed | Forced order | Usual pressure on price |
| --------------- | --------------- | ----------------------------------- |
| **Long** | Forced **sell** | **Down** — forced selling hits bids |
| **Short** | Forced **buy** | **Up** — forced buying lifts offers |
So large long-liquidation clusters often read as **bad for price** (forced supply); short-liquidation clusters as **supportive** for a squeeze up. Cascades matter more than single prints: a drop into long liqs can add more sells, which can push price further and trigger more longs.
This is **executed** liquidation flow (what the exchange reports as forced closes). It is **not** the same as open **liquidation levels** on Hyperliquid (pending risk if price reaches a level) — see [Liquidations, TP & SL](/liquidations-tp-sl).
### What MarketLens shows
Bar metrics use the same shape as trade volume:
| Series | Meaning | Color |
| -------------- | ------------------------------- | --------------- |
| **Short liqs** | Forced **buys** (shorts closed) | **Green** (buy) |
| **Long liqs** | Forced **sells** (longs closed) | **Red** (sell) |
| **Total** | Short + long liq size | — |
**Coloring** matches volume: force sells are sells → **red**; force buys → **green**. That tracks how forced selling usually hurts price and forced covering usually helps it.
Units follow the same **base / quote** switch as volume. Multi-market views **sum** liquidation size (like volume), not like OI.
### Coverage: who publishes “all” liquidations?
Venues differ in **how complete** public liquidation data is.
| Completeness | Venues | What that means |
| -------------------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| **All liquidations** | **Bybit**, **Hyperliquid**, **Lighter** | Public data is intended to include **every** forced close. |
| **Not complete** | **Binance** (+ Aster) | For each symbol, only the **largest** liquidation within each **1000ms** is pushed. |
| | **OKX** | Each contract shows at most **one order per second**. This data **doesn’t represent the total** number of liquidations on OKX. |
MarketLens charts what the venue publishes. On **Bybit** / **Hyperliquid** / **Lighter**, that is the full forced-flow story. On **Binance** / **OKX**, it is a **sampled** feed — useful for activity and direction, not for counting every forced close.
### Price and original size by venue
| Venue | Price on the print | Original size |
| --------------------- | ------------------------------- | ----------------------------------------------------------- |
| **Binance** (+ Aster) | Liquidation / force-order price | Linear: **both** base & quote; inverse: **both** after mult |
| **Bybit** | **Bankruptcy** price | Linear: **base**; inverse: **quote** |
| **OKX** | **Bankruptcy** price | Linear: **base**; inverse / coin-margined: **quote** |
| **Hyperliquid** | **Trade** (fill) price | **Both** base and quote |
| **Lighter** | Trade price | **Both** size and USD |
When only one unit is published, MarketLens can still show the other via **× / ÷ price**. For Binance / Bybit / OKX that price is often a **bankruptcy / liquidation** reference, not last trade — so the converted unit is **approximate**. Prefer the unit the venue actually reported when exact size matters.
## Multi-market
When several markets are selected, metrics follow the same multi-market rules as the rest of the product: series can be shown **per market** or **aggregated** where that is well-defined (e.g. sum volume, sum liquidations). OI and funding stay **per contract** — summing OI across different underlyings or venues needs care; prefer comparing series side by side when units or contracts differ.
Hover a market in the **markets list** to **highlight** that market’s data in the metrics (and related multi-market views).
See also: [Futures markets](/futures-markets), [Trades (Tape)](/tape), [Scripting](/scripting), [Liquidations, TP & SL](/liquidations-tp-sl) (Hyperliquid open levels).
# L2 Order Book
Source: https://docs.marketlens.app/order-book
Visual multi-market depth — bar chart order book, zoom, and aggregation.
Plain order books are as old as **limit orders**: a list of resting bids and asks. As electronic trading matured, **order book visualizations** became common — usually tables or DOMs built around a single venue.
A typical **tabular order book** is centered on the **mid price** ((best bid + best ask) / 2), with extra columns such as recent size changes.
Another popular form is the **DOM** (depth of market). It often keeps a **stable price axis** instead of re-centering every update, so bids and asks move on a fixed ladder — which makes the ongoing auction easier to feel.
Those presentations still tend to:
* stay **tabular**
* rely heavily on **reading numbers**
* work poorly for **multi-market aggregation** (there is no single mid price anymore)
MarketLens’s L2 view is designed to address that.
## Single-market order book
An L2 book is still a list of **price and size** pairs for bids and asks. Drawn **vertically**, that becomes two horizontal bar charts facing each other so you can tell sides apart and see the **bid/ask fight** at a glance.
| Axis | Role |
| ------------ | ------------------------------------------------------------- |
| **Left Y** | Bid price ladder (price increases upward) |
| **Right Y** | Ask price ladder — same range as the left, ticks on the right |
| **Bottom X** | Bid size, growing **left → right** |
| **Top X** | Ask size, growing **right → left** |
Top and bottom size scales match (one shared size scale, read from opposite edges). Left and right price scales match (one price range).
* **Bids** grow from the **left** (left Y + bottom size axis)
* **Asks** grow from the **right** (right Y + top size axis)
Bar **length** is proportional to size on that shared scale.
## Automatic grouping
The book is interactive — **zoomable and pannable**. **Price grouping** adapts to the selected zoom level so you can move from fine ticks to coarser buckets without leaving the view.
## Multi-market
On a traditional table or DOM, aggregating several markets is awkward: there is no single mid price to center on, and columns do not merge cleanly.
A visual book with **bids and asks on opposite sides** makes multi-market aggregation natural: sizes at the same (grouped) price add into the same bars.
**Hover** a market in the markets panel to highlight only that venue’s contribution.
## Recent executed orders
DOMs add extra columns for trades executed in a recent window (for example the last minute) — rolling buy/sell activity at price. The visual order book can show that activity in the same space as resting depth.
See also: [L4 order book](/l4-order-book), [Tape](/tape), [Classic order flow](/classic-order-flow).
# Prediction Markets
Source: https://docs.marketlens.app/prediction-markets
How binary outcome markets differ from spot and futures: dual books, prices as probabilities, and matching.
Prediction markets exist because people want to bet **“X will happen”** or **“X will not happen.”** The idea is simple; the implementation is less obvious and often misunderstood.
Spot and perpetual markets quote prices that can run freely upward (with exchange-specific rules). A pure “will this happen?” bet needs a **fixed probability scale**: 0% to 100%. Venues map that to money as **\$0.00 to \$1.00** per share.
[Polymarket](https://docs.polymarket.com/concepts/prices-orderbook), [Kalshi](https://docs.kalshi.com/getting_started/orderbook_responses), and Hyperliquid [HIP-4](https://hyperliquid.gitbook.io/hyperliquid-docs/hyperliquid-improvement-proposals-hips/hip-4-outcome-markets) binary markets all work the same way at the economic level. Each outcome has **two tokens**: **Yes** and **No**.
## Token creation
Like futures, these markets are **zero-sum** among traders: what one side gains, the other loses (fees aside).
At the start there are **no** Yes or No tokens. You can always **create a pair** by locking **\$1** of collateral (for example USDC on Hyperliquid): that mints **1 Yes + 1 No**. The reverse is a **merge**: return one Yes and one No, unlock \$1.
There is always the **same number** of Yes tokens as No tokens in existence, because they are only born and destroyed as pairs. That outstanding count is **open interest**.
A user’s **position** is simply the tokens they hold (and the mark value of those tokens). When the market **settles**, one side wins: Yes pays out near \$1 and No near \$0, or the reverse. Locked collateral is paid to winners.
## Order books and matching
Each token is a separate asset with its **own** order book. The books are **linked**: they can **cross-match**. That link is what makes prediction-market order flow different from a normal single-asset spot book.
**Limit** and **market** orders work as on spot (a market order is an aggressive take). What differs is **which counterparty** you can hit. There are four useful combinations:
**Example (mint across books):**
1. User A rests a **bid to buy Yes at 0.60**.
2. User B sends a **market buy No**.
3. If there is no better **No ask** than **0.40** (= 1 − 0.60), B can match **across books** against A: a new Yes+No pair is created from \$1. A gets Yes, B gets No. Open interest rises by 1.
Yes interest at **p** is economically the same as No interest at **1 − p**. Engines still apply **priority** (for example HIP-4’s price–side–time rule when both sides sit at the same merged level).
## Merged order book
Economically, Yes and No are **one** market expressed twice. A bid to buy Yes at **p** is the same commitment as an offer to sell No at **1 − p** (and the duals for the other three corners). HIP-4 states that merge rule explicitly; Kalshi’s API can return **only bids** on Yes and No and still describe the full market, because a Yes bid implies a No ask at one minus that price.
### Why merge for reading
If you keep two native books, “where is size?” is split across two price axes that run in opposite directions. Flipping **No** prices with **p → 1 − p** puts everything on a **single Yes-odds axis**:
* No **asks** land on the same levels as Yes **bids**
* No **bids** land on the same levels as Yes **asks**
* Depth at one economic level can be **summed**: Yes resting interest plus flipped No resting interest
That merged ladder is what venues and tools mean by a **merged order book**. Matching still respects priority rules (for example HIP-4’s price–side–time at a shared level); the merge is how you **see** and **aggregate** liquidity, not a different asset.
### How MarketLens shows it
MarketLens treats HIP-4 (and the same binary model) as an **aggregated order book that evolves over time**, not as two unrelated tickers you must eyeball side by side.
To put Yes and No on one chart:
1. Take the **No** book.
2. **Reverse** every No price: **p → 1 − p**.
3. Map sides so flipped No lines up with Yes (No asks with Yes bids, No bids with Yes asks).
4. **Stack / sum** size at each shared level.
That aligned history is what you see in **both** order-flow modes:
| Mode | What you get on prediction markets |
| ----------------------------------------- | -------------------------------------------------------------------- |
| [Unified order flow](/unified-order-flow) | Merged Yes+No liquidity over time in the unified limit/market visual |
| [Classic order flow](/classic-order-flow) | Same merged book as heatmap / trades-profile history |
So when you read “size at 0.62” on a MarketLens prediction market, that level can include Yes interest posted at 0.62 **and** No interest that was posted at 0.38 and flipped. Cross-book mint and merge flow still print as trades; the merge is how resting depth is drawn as one coherent market.
## References
* [HIP-4: Outcome markets (Hyperliquid)](https://hyperliquid.gitbook.io/hyperliquid-docs/hyperliquid-improvement-proposals-hips/hip-4-outcome-markets)
* [Polymarket: Prices & order book](https://docs.polymarket.com/concepts/prices-orderbook)
* [Kalshi: Orderbook responses (Yes/No reciprocity)](https://docs.kalshi.com/getting_started/orderbook_responses)
# Scripting (WIP)
Source: https://docs.marketlens.app/scripting
Lenscript — custom metrics on multi-market data.
**Lenscript** is MarketLens’s scripting language for derived series on the same multi-market feeds you use in the UI.
## Overview
Write a script, run it, plot it next to built-in metrics and order flow.
*Editor walkthrough and mental model to come.*
## Language reference
Full language reference will live here or on linked subpages once the surface is stable.
*Reserved.*
## Examples
*Starter scripts to come.*
# Spot Markets
Source: https://docs.marketlens.app/spot-markets
Limit and market orders, the order book, and trades on centralized venues.
Let’s explore how centralized exchanges function by examining the [BTC/USDT spot trading pair on Bybit](https://www.bybit.com/en/trade/spot/BTC/USDT). This pair allows users to exchange Bitcoin (BTC) for Tether (USDT) and vice versa.
## Order Types
An exchange is a service that provides two basic operations:
* **Limit Order**: "I want to buy (or sell) a specific amount of an asset at a set price (or better) sometime in the future."
* **Guarantees**: The execution price (you’ll get your specified price or better).
* **Doesn’t Guarantee**: Execution timing or if the order will be filled.
* **Market Order** says: "I want to buy (or sell) a specific amount of an asset right now at the best available price."
* **Guarantees**: Immediate execution.
* **Doesn’t Guarantee**: The exact price
## Order Book and Trades
To implement this process exchanges maintain order books, a list of all active limit orders waiting to be matched. Let’s walk through the process step by step, starting with an empty order book:
1. **User A places a buy limit order** for 1 BTC at 96,500 USDT.
* This is a **bid** (a limit order to buy).
* The order book now looks like this:
| **Price (USDT)** | **Amount (BTC)** |
| ---------------- | ---------------- |
| 96,500 (Bid) | 1 BTC |
2. **User B places a market sell order** for 0.5 BTC.
* The exchange matches this with User A’s bid.
* **Trade**: User B sells 0.5 BTC to User A at 96,500 USDT.
* Updated order book:
| **Price (USDT)** | **Amount (BTC)** |
| ---------------- | ---------------- |
| 96,500 (Bid) | 0.5 BTC |
3. **User C places a sell limit order** for 5 BTC at 96,600 USDT.
* This is an **ask** (a limit order to sell).
* Note: Bids must be below the lowest ask (96,600), and asks must be above the highest bid (96,500), unless they’re meant to match immediately.
* Updated order book:
| **Price (USDT)** | **Amount (BTC)** |
| ---------------- | ---------------- |
| 96,600 (Ask) | 5 BTC |
| 96,500 (Bid) | 0.5 BTC |
4. **More users add orders**, creating a deeper order book:
| **Price (USDT)** | **Amount (BTC)** |
| ---------------- | ---------------- |
| 96,700 (Ask) | 2 BTC |
| 96,600 (Ask) | 5 BTC |
| 96,500 (Bid) | 0.5 BTC |
| 96,400 (Bid) | 3 BTC |
5. **User D places a market buy order** for 6 BTC.
* The order is filled from the lowest asks first:
* 5 BTC at 96,600 USDT = 5 × 96,600 = 483,000 USDT.
* 1 BTC at 96,700 USDT = 1 × 96,700 = 96,700 USDT.
* **Total Cost**: 483,000 + 96,700 = 579,700 USDT.
* Updated order book:
| **Price (USDT)** | **Amount (BTC)** |
| ---------------- | ---------------- |
| 96,700 (Ask) | 1 BTC |
| 96,500 (Bid) | 0.5 BTC |
| 96,400 (Bid) | 3 BTC |
6. **Trades are recorded** with timestamps for transparency:
* Trade 1: 5 BTC at 96,600 USDT.
* Trade 2: 1 BTC at 96,700 USDT.
In the trading ecosystem, users who place **limit orders** are often referred to as **market makers**or **liquidity providers**. These participants contribute to the market by adding depth to the order book, offering to buy or sell at specific prices, which other traders can then match. Conversely, users who place **market orders** are known as **market takers**. By executing trades immediately at the best available prices, they remove liquidity from the order book, reducing the depth of available orders.
It’s that simple! The order book continuously evolves as users place and cancel limit orders or execute market orders, driving the trading process on centralized exchanges.
# Trades (Tape)
Source: https://docs.marketlens.app/tape
Truly visual tape.
A list of recent **trades** (executed fills) is often called the **tape**. The name comes from older markets: before the 1960s, prices were sent by telegraph and printed on a physical ticker tape.
Electronic trading moved the tape to screens and added fields such as **side** and **size**, but the usual layout stayed the same: a **list or table**.
On older, slower venues a human could still scan trades per minute. Modern markets — especially crypto — produce far more prints, so a pure table becomes hard to use. Filters (minimum size, group by price) help, but they still lean on reading numbers.
A **histogram** of total size per time bucket (as in the TradingLite example above) shows intensity, but it **hides price**.
MarketLens aims at a **visual tape** that still reads like a tape — size and price together, without a wall of rows.
## Single market
Following the principle that **values should be visually measurable**, each trade is a **stripe** (bar) whose **length is proportional to size**.
The **order book** next to the tape provides a natural size reference: the same **N pixels** on the tape and on the book mean the same size **S** (shared size scale).
* **X (price)** is shared with the book; each stripe sits at its trade price
* **Green** stripes are buys, **red** are sells (depends on the selected color scheme)
* **Large trades** are drawn as **stripes separated by a tiny gap**, so big prints stay readable as stacked segments instead of one solid block
* **Time** on the right is **non-linear** and shows how much size traded and how quickly activity clusters
## Multiple markets
Aggregation is straightforward: trades from all selected markets are drawn on the same view.
Time is not continuous print-by-print across venues. Prints are **synchronized into time slices** (groups) — **1 second** on screen — so multi-market activity stays readable.
**Hover** a market in the markets list to highlight only that venue’s trades on the tape.
## Liquidations
**Liquidations** are forced trades on **futures** markets when a position is closed because the account can no longer meet margin (bankruptcy / liquidation process on that venue).
MarketLens marks them with a **fire** icon. If size is large enough, a **stripe** is drawn for the liquidation as well.
Venues **report liquidation prices differently**:
| Venue | What they report | How it looks |
| ------------------- | --------------------------------------------------------------------- | ------------------------------------------------------- |
| Binance, Bybit, OKX | **Bankruptcy price** — the price at which the position would be wiped | Liquidations can sit **away from** the last trade price |
| Hyperliquid | Price of the **trade that executed the liquidation** | Liquidations **align** with the trade stream |
See also: [L2 order book](/order-book), [Unified order flow](/unified-order-flow).
# Trading (WIP)
Source: https://docs.marketlens.app/trading
Chart execution on Hyperliquid — wallet, agents, order types, privacy.
Place market, limit, and stop orders (plus SL/TP) from the chart on Hyperliquid.
## Wallet and agents
How connection and agents work in MarketLens.
*Content to come.*
## Order types
What you can place from the chart.
*Content to come.*
## Privacy
Orders stay yours — what that means in practice.
*Content to come.*
See also: [Liquidations, TP & SL](/liquidations-tp-sl), [Hyperliquid product page](https://marketlens.app/hyperliquid/).
# Unified Order Flow
Source: https://docs.marketlens.app/unified-order-flow
Multi-market limit and market orders in one visual space — MarketLens's order flow view.
If you’ve read [Spot Markets](/spot-markets), then you know what limit and market orders are. Order flow is the flow of these orders over time. Order flow analysis is finding patterns in that data. For example, large limit orders may appear in the book and seem to protect a price level, then pull as price approaches.
There are many ways to visualize order flow. You can read about some of them on the [blog](https://blog.marketlens.app/designing-analytics-and-trading-platform-for-modern-financial-markets). MarketLens features a new way specially designed for multiple markets - **Unified Order Flow**. This page walks through it.
## Limit Orders
Order Book is a list of bids and asks. Each bid and ask is a pair of a target price level and a quantity of an asset. Some exchanges use the terms “size” and “amount” as alternatives to “quantity”.
Let’s explore what we see in an example of [Binance SOL/USDT perpetual futures](https://www.binance.com/futures/SOLUSDT), which has a minimum price step of 0.01 and we have price aggregation - 0.1
The whole space is broken into price ranges, for example, a price range from 134.2 (visible on the right scale) to 134.3 (marker is not shown for compactness). The space inside these ranges shows bar charts. Bars extending upward from the bottom of the range are bids for the lower bound (134.2 in the example) and bars extending downward from the top of the range are asks for the upper bound (134.3). **Every bar is the last bid or ask** **quantity** within the selected timeframe (1m in the example).
**The heights of the bars are uniform** - N pixels represent the same quantity according to the **quantity scale** in any place on the screen. Color intensities of the bars are here to visuallly distinguish different ranges and bring attention to bigger quantities, where color intensities match those on the quanaity scale legend.
**The Price Scale,** on the other hand, is not uniform - pixel heights between levels may vary depending on vertical space needed to fit bids and asks inside ranges. This may seem unusual; however, from our point of view, it reflects the fact that **price levels are not equally important**and when large quantities separate them it’s logical for them to be distant.
Additionally, this chart shows classic Price Candles, according to the non-uniform price scale.
## Market Orders
The chosen presentation gives an advantage by easily showing market orders, which is not possible on heatmaps.
It’s the same SOL/USDT chart with 15s timeframe selected. Here, you can see how market orders cut through limit orders.
This bar shows that during that 15 seconds, market orders took almost all limit orders at the price of 129.0.
A quick glance at quantity legend let us see that the bid was \~78K SOL and \~68K quantities were taken by market orders.
Market orders are colored red for market sells and green for market buys; they have solid color and no gradient compared to limited orders to bring attention to them.
Additionally, please take a look at volume bars; they have approximately the same heights as the corresponding market orders, as they belong to the same uniform space of order quantities.
## Multiple Markets
Data from multiple markets can be easily combined in a uniform quantity space. Below, you can see Binance and Bybit BTC/USDT perpetual futures shown at the same time. Bids and asks are layered within ranges. Only limit orders are shown for simplicity.
Any selected symbol can be highlighted separately.
Market orders are aggregated the same way.