DEV Community

HMwork
HMwork

Posted on

Three Prices in One Second: Why the Chart Number Is Not the Number That Closes Your Position

Three Prices in One Second: Why the Chart Number Is Not the Number That Closes Your Position

Disclosure: This article was produced with AI assistance under a human-supervised research process. All figures below come straight from public exchange API endpoints and are timestamped so you can re-run the measurements yourself. This is not financial advice.

#ad — Affiliate disclosure: this publication may carry affiliate links in some articles; when present, they are marked. This particular article contains no affiliate or referral links at the time of publication.


Ask a trader what "the current price of Bitcoin" is, and they will point at the number on the chart — the price of the most recent trade. Ask an exchange's API the same question, and you often get three different numbers back in a single row. They sit side by side in the same response, at the same instant, and they are not equal.

We measured this live on two independent exchanges on 2026-11-20, using nothing but free, key-less public endpoints.

The measurement

At 02:00:43.774 UTC, Bybit's public v5 tickers endpoint (/v5/market/tickers?category=linear&symbol=BTCUSDT) returned for the BTC perpetual:

  • lastPrice — 61,551.20
  • markPrice — 61,560.90
  • indexPrice — 61,591.22

Three numbers, one second apart on the same row. The chart price (lastPrice) and the index price differ by 40.02 USD, roughly 6.5 basis points — a gap of the same order of magnitude as the maker/taker fee many traders spend hours comparing.

Seconds later, at 02:00:44–45 UTC, OKX's public endpoints returned the same picture for BTC-USDT-SWAP:

  • markPx (from /api/v5/public/mark-price) — 61,560.9
  • last (from /api/v5/market/ticker) — 61,573.9

Here is the part that made us run the measurement twice: OKX's mark price (61,560.9) matched Bybit's mark price (61,560.90) to within a single tick, even though the two venues' last trade prices differed by 22.7 USD. Each exchange's own tape tells a slightly different story about where Bitcoin "just traded." Their mark prices tell nearly the same one. That is consistent with what a mark price is supposed to be: a venue-computed reference anchored to a broad cross-market index, not a record of what happened to print last on that specific order book.

What the documentation actually says

Both venues list these fields in their public API documentation. Bybit's market tickers documentation (bybit-exchange.github.io/docs/v5/market/tickers, fetched 2026-11-20, HTTP 200) enumerates lastPrice, indexPrice and markPrice as distinct response fields. OKX's API v5 documentation (okx.com/docs-v5, fetched 2026-11-20, HTTP 200) goes a step further and states, in the definition of an account-level PnL field, in plain words:

"Calculated using mark price (not last trade price)"

Read that again. The exchange's own documentation says the profit-and-loss figure the platform computes for you is based on the mark price — explicitly not the last traded price you see on the chart. A free public endpoint (/api/v5/public/mark-price) exists solely to expose this number.

Worth being honest about the limits: neither documentation page publishes the full internal formula for how each venue composes its index or adjusts its mark. We are not going to guess at formula internals. What is verifiable is narrower and still useful — (1) each venue returns multiple distinct price fields, (2) the venue's own docs say its calculations use the mark price rather than the last trade price, and (3) the mark prices of two independent venues sit close together while their trade tapes diverge.

The gap is not constant

We re-ran the exact same calls about half a minute later (02:01:15–19 UTC). The market had dropped roughly 85 USD in the meantime, and the relationships had shifted:

Field First fetch Second fetch
Bybit last 61,551.20 61,466.10
Bybit mark 61,560.90 61,466.62
Bybit index 61,591.22 61,494.43
OKX mark 61,560.9 61,460.9
OKX last 61,573.9 61,464.1

In the first snapshot, Bybit's mark sat 9.70 above its last price. In the second, it was 0.52 above. The index stayed about 28–30 USD above the mark both times (a basis effect specific to that moment in the perpetual market). The takeaway is uncomfortable but important: the distance between "the chart number" and "the settlement number" is not a fixed offset you can learn and forget. It breathes with the market, second by second.

Why this is the mechanism behind "my price never got there"

A familiar complaint reads: "My stop or liquidation level was at X, the chart never touched X, yet my position closed." The three-price structure above is part of why that complaint can be literally true and still be explained: derivative venues publish their own rules for which price their engines watch, and the documentation quoted above shows at least one major venue explicitly calculating positions on the mark price rather than the chart price. A brief spike on one venue's own tape may move last without moving mark; a fast cross-market move may pull mark through your level while your chart price lags behind it.

We are not claiming any specific venue liquidates on any specific field beyond what its published documentation says. The honest, general advice: every venue's contract specifications and help pages define which price its funding calculations and forced-liquidation engine use. Read that definition once, before you ever need it — because the number you watched all day may not be the number that decided your outcome.

Verify it yourself

No account, no key, no SDK needed:

  • Bybit: GET https://api.bybit.com/v5/market/tickers?category=linear&symbol=BTCUSDT — watch lastPrice, markPrice, indexPrice in one row.
  • OKX: GET https://www.okx.com/api/v5/public/mark-price?instId=BTC-USDT-SWAP and GET https://www.okx.com/api/v5/market/ticker?instId=BTC-USDT-SWAP — compare markPx with last.
  • Documentation: https://bybit-exchange.github.io/docs/v5/market/tickers and https://www.okx.com/docs-v5/

Two small traps when you do: field names differ across venues (lastPrice vs last, markPrice vs markPx), and quote conventions differ — cross-venue number comparisons only mean something after you align symbol type, tick size and timestamp. A measurement is a snapshot; every figure in this article was captured inside a two-minute window on 2026-11-20 and the market has moved since.

This post is for education about public market data only. It is not financial advice, not a trading recommendation, and not a judgment about which venue is better. Rates, prices and specifications change constantly — verify official sources before relying on any number.


AI-assisted content notice: the text above was drafted with AI assistance from first-party API measurements taken by the publisher's automated research tooling, with the cited endpoints and documentation URLs listed for independent verification. Always verify official sources.

Top comments (0)