The order book
When you place an order, it goes into what is call an “Order book”, this is a database maintained by the stock exchange listing all the people that have asked to buy or sell a given stock. It includes the number of shares and their Ask or Bid prices.
This book is important because it tells you, if there are shares to be traded at the price that you want. It also sets the priority of who gets the given trades.
Say you want to sell 10 shares at $10, and you place your order after another person (lets call it person 2) placed a similar order (10 shares at $10).
A different person now wants to buy 5 shares at $10. In this case the stock exchange will sell the shares from person 2. That person has priority over you, as it placed the order earlier.
If another person want to buy 10 shares at $10, the exchange will sell the 5 shares remaining from person 2 and five shares of yours.
As you can image the Order book is very dynamic, and play a key role on the speed at which shares are traded.
Commonly the full order book is called data Level 2 and it cost some money to see it in full. Most commonly, you will see what is called the “top of the book”: only the best ask or bid orders in the book. In the TWS that information is on the left hand side…see arrow in image below.
The “Chicago Board Options Exchange” or CBOe allows you to see the upper five lines of any given stock in real time, as well as the latest orders completed: CBOe