# 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
• 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!

-
You can't. Your incoming data looks like the day's closing price. There is no way to derive the quotes from that. – chrisaycock Nov 15 '13 at 16:07
@chrisaycook, frequency are not by day, but every transaction exchanged, multiple elements per second. – BlackMamba Nov 15 '13 at 16:09
@chrisaycook: i'm finding some solution to recreate from that stream some order book, or when it is not possible then maybe some estimation? – BlackMamba Nov 15 '13 at 16:11
If you don't know what the quotes are, then you can't recreate the quotes. The trades don't tell you anything. There could be hidden liquidity. The bids and asks could have moved around a lot. Etc. You can't just recreate the quotes given a list of trades. – chrisaycock Nov 15 '13 at 16:12
@chrisaycock: you can put that comment into answer then I accept. – BlackMamba Nov 15 '13 at 23:18

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.

-