Skip to content
All library documents

Why Trade Logs Cannot Reconstruct Bid and Ask Quotes

Article Quant Q&A · Author: Svisstack

Summary

A transaction record gives the execution price, size, and time, but it does not identify the bid and ask that were available around that trade. The same recorded price can arise from different quote changes: a buyer may have consumed the ask, or the ask may have been exhausted and the next trade may have hit the bid after quotes moved.

The examples also show that trades may execute against hidden liquidity, so the displayed spread may not explain the recorded price. The central lesson is that trades and quotes are distinct data streams; one cannot reliably derive one from the other. The examples establish the ambiguity, but do not offer a reconstruction method. To obtain bid and ask prices, a researcher needs quote data; even quote changes alone cannot distinguish executions from cancellations.

Key ideas

  • A trade’s price, size, and timestamp do not uniquely determine the prevailing bid and ask.
  • Repeated trades at one price can reflect different sides of the market after quotes change.
  • Hidden liquidity can produce trade prices that do not match displayed quotes.
  • Quote changes alone also cannot reveal whether liquidity disappeared through trades or cancellations.

Tags

Full text
# How to convert trasaction log to bid-ask ticks


# How to convert trasaction log to bid-ask ticks












I have data from exchange in transaction log format that indicating:

- price

- volume

- timestamp

That element indicating that timestamp transaction was made on price of size volume.

My question is how to convert that feed into tick-by-tick based data including:

- timestamp

- ask price

- bid price

- volume

That element indicating that timestamp transaction was made of size volume, and after that prices buy/sell prices are on level ask price and bid price for create future transaction.

Thanks for help!

## Answer by chrisaycock (score 4, accepted)

https://quant.stackexchange.com/a/9467

Trades don't indicate the quote. Consider a market like this:

```
bid     ask
100.01  100.02
```

You see a trade for `100.02`. Then you see another trade for `100.02`. This second trade could have been taking more from the ask. However, if the earlier trade had wiped-out the ask, then the quotes may have been updated to

```
bid     ask
100.02  100.03
```

I.e., the second trade took from the bid. But since all you saw was `100.02`, you don't know whether is was from the bid or ask.

On top of that, an illiquid stock could have been displayed at

```
bid     ask
100.01  100.05
```

A trade for `100.02` would have been against hidden liquidity and you would never know.

So in conclusion, trades cannot be used to derive quotes. They are two different pieces of information. (Conversely, quotes cannot be used to derive trades, since disappearing liquidity may indicate either trades or cancelations, and you'd have no way of knowing.) If you want quotes, then you have to get quote data.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.