frankiem
Technical User
- Jan 21, 2003
- 11
I have a very large table of stock price data, which shows all the prices that occured over a year, timestamped to the nearest second. There are three type of prices -"Trade" which is the price that occured when a trade was agreed, "Ask" which is an unexecuted quote price at which a posting seller is prepared to sell, and "Bid" which is an unexecuted quote price at which a posting buyer is willing to buy. What I want to know is - how does each "Trade" price relate to the preceding "Bid" and "Ask" prices? Is it nearer the "Bid" or the "Ask"? Can anyone suggest how I could do this in SQL?
The data looks like this:
Date Time Type Price
02/03/99 09:00:32 Ask 93.51
02/03/99 09:00:37 Ask 93.53
02/03/99 09:01:14 Bid 93.47
02/03/99 09:02:02 Trade 93.48
02/03/99 09:03:44 Trade 93.51
02/03/99 09:04:03 Ask 93.54
I want to add another column which will show "Bid side" or "Ask side" for all the "Trade" events.
Frank
The data looks like this:
Date Time Type Price
02/03/99 09:00:32 Ask 93.51
02/03/99 09:00:37 Ask 93.53
02/03/99 09:01:14 Bid 93.47
02/03/99 09:02:02 Trade 93.48
02/03/99 09:03:44 Trade 93.51
02/03/99 09:04:03 Ask 93.54
I want to add another column which will show "Bid side" or "Ask side" for all the "Trade" events.
Frank