3

This is a very basic question, and I apologize if this is the incorrect space to ask about the subject of mathematics applied to computational output of price for stocks; however, I am wondering how 'depth charts' are meant to be read, and more importantly, how do computers calculate the price of a specific stock at any given time.

The reason I am asking is due to the fact that the time for which a price is updated is quite variable. Now, I know that this is dependent upon the activity of trading - however, it appears that some stocks may have a bidding and asking price in the depth chart (or a ton of these really) on either side - yet there are sometimes stand offs between the two prices that appear to last longer than other trades.

Therefore, I have a hypothesis that the time for the system to accept a bidding or asking price as the new price is dependent upon the difference between these two by some time constant, and the price is labeled as the one with a higher number of volume.

Unfortunately, I have absolutely no idea about economics or finance at all. So, I have no idea how reasonable this idea would be.

Another reason for asking this is based on trying to understand predictions of the stock market. Is this something that is part of the basics of those predictions?
For instance, if it appears by the depth chart that there are a lot more (by integration) buys than sells (with similar absolute values of the derivative of volume wrt price), I would assume this would push the price up over the long term. Yet, if the this derivative was offset, the short term drive would be towards that of a steeper slope?

For instance, here we see a depth chart wherein what I have described would lead to (with no other actors in the system) would shift almost immediately from 15,168 to 15,180 then moving likely back to ~1570 or so although its difficult to do the integration and subtract by looking at it.

enter image description here

I hope this question makes a bit of sense and will be useful to others as a source of information from the answers.


To summarize the main questions are:

1. Given a sea of buy and sell prices and volumes over a stream of time, how is a price determined between the gap of highest buy and sell? what equation?

2. What causes stalling in the time for trades to occur?

2 Answers 2

3

The graphs you see are not computations of a price, but just the collection of bids and asks from different market participants shown on a chart.

Analogy

Imagine you went to a flea market where there was a bunch of the same objects on the table. One one side you had more than two people all willing to sell the same object, and on the other side you had people standing there willing to buy at a certain price.

Normally that would be a free-for-all with people talking over each other trying to negotiate, but if it were an exchange, they would be subject to some rules:

  • The buyer bidding the highest price goes first.
  • The seller with the lowest offer goes first.

Suddenly you would end up with a much more ordered market. If the best (highest bidding) buyer was willing to pay what the best (lowest priced) seller was willing to accept, a trade would occur - they would shake hands, exchange money for product then leave, leaving the next best bidder and next best seller. If neither was willing to budge then they would just be standing there facing each other off until one of them was willing to budge or someone else came along buying at a higher price or selling at a lower price.

The Chart

The chart you see is just that, the representation of the people (or algorithms) with buy (limit) orders in the market, and people (or algorithms) with sell (limit) orders in the market. The horizontal axis is the price, and the vertical axis is the quantity (the total items willing to be purchased at that price).

If someone comes along and sells a lot, the bids disappear and a wider gap forms, and vice versa.

  1. Given a sea of buy and sell prices and volumes over a stream of time, how is a price determined between the gap of highest buy and sell? what equation?

Typically the last traded price is used. Sometimes when there is not much activity (e.g. the security has not traded for the day) the midpoint is used as an indicator, or the previous day's closing price. That's if a single price is quoted. Often people will quote two - the bid/ask. The best bid, and the best ask.

  1. What causes stalling in the time for trades to occur?

It comes down to market demand and supply. Is someone willing to flinch and sell at the best bid or lower (or worse - "at the market") or is someone so desperate to sell that they are willing to buy at the best offer or higher (or worse - "at the market"); or does one of the sides get tired and just cancels his or her limit order.

In the case of Bitcoin (which the graph looks like it is), it is likely people are arbitraging different currencies, so as currencies fluctuate or prices vary on different bitcoin exchanges, they trade the corresponding Bitcoin to make arbitrage profits. Or it could be that a miner just received a few bitcoin and needs to sell it straight away to pay his power bill, etc. Many participants would have many reasons to do a trade straight away.

8
  • Thank you for the reply! Is someone willing to flinch and sell at the best bid or lower -- this is the meat of my question. How is the "willing to flinch" factor taken into account? For example, if the buyer wants $5 and seller wants $5.00001, I would assume the transaction would occur, perhaps using an average of the two. But if the buyer wants $5 and seller wants $1000, the transaction probably shouldn't occur. The problem is I don't see how the computer makes this determination, since a calculation must occur to resolve the transaction or not. I haven't seen any "sell at $5+-0.4"
    – chase
    Commented Dec 10, 2017 at 2:15
  • 1
    Neither. Either the buyer or the seller has to actually modify or cancel his order for his bid or offer for a trade or change in price to occur. It really comes down to the psychology of the participant. If it is an algorithm it can wait forever. If it is a buyer in a hurry because he has something else to do, he might modify his order straight away. You could potentially model it as a poisson distribution... there are a lot of papers on market psychology. The seller might see the buyer is keen so increases his price, etc.
    – xirt
    Commented Dec 10, 2017 at 2:54
  • 1
    The price participants are willing to pay, and how soon they want to transact is the indication of demand, and the price participants are willing to sell is an indication of supply. They maintain an equilibrium.
    – xirt
    Commented Dec 10, 2017 at 2:58
  • My understanding is that >90% of trades are performed by algorithms rather than humans; So, what you're implying is that the buying program ($a_buy$) likely uses the passage of time without a transaction ($t_stand$) as a variable to determine the selling algorithm's ($a_sell$) willingness to budge factor ($\epsilon (t_stand)$)? I don't see how the market could move at the rate in which it does based on human activity, or without some actions from $a_sell$ or $a_buy$ without it. Although, again, I am exceedingly uneducated (obviously) within this domain.
    – chase
    Commented Dec 10, 2017 at 3:08
  • 1
    All algorithms I have seen will wait literally forever to buy or sell at their best price. Only if other parameters change that cause them to re-evaluate the price will result in a price change. Ultimately an algorithm is just a trader's 'recipe' written down and implemented in a computer program.
    – xirt
    Commented Dec 10, 2017 at 3:19
2

Okay, I realize this is an old post, but I'll throw in some comments about how professionals use depth charts, in case some readers find this information useful.

The key idea that you have to understand is:

Market orders match against limit orders.

What you see in the depth charts are limit orders on the book in the form of bids and asks. When you see a trade, it is someone sending in a market order to lift the ask or to hit the bid.

Suppose you are a whale that needs to get out of his position of 100 bitcoins.

What will your fill price be if you send in a large market order all at once?

It turns out that you can calculate your predicted fill just by accumulating the bids from the highest bid lower, until you accumulate 100 bitcoins. In fact, in Binance, if you mouse-over the bid side of the chart (the left-hand side that's green), you will see a yellow number on the x-axis that shows you a price and a yellow number on the y-axis that shows you the quantity. If you keep moving the mouse left until you see 100 on the y-axis, you can read the price on the x-axis, and that will be your fill price if you send in a market sell order of 100 bitcoins.

Of course, this is all predicated on the book not fluctuating by the time you send in your monster market sell. Now, one of the reasons institutions get upset at algo traders is, there are often phantom bid-ask orders that only show up for a fraction of a second and disappear. Given this false information, the depth chart becomes less useful.

Suppose we have a valid book. Then our whale can now use this information to decide if:

  1. He wants to send in one large market order - read the depth chart to guesstimate the fill price.
  2. He wants to break down his sell of 100 BTC into a bunch of limit orders (insert asks onto the order book).
  3. He wants to sell his 100 bitcoins to a block trader, a professional who will buy the entire 100 bitcoins at a price that is higher than 1. The block trader will hold on to the 100 BTC in his inventory and typically sell it back out onto the market slowly, using algorithmic trading programs.

So the depth chart has some utility value, but is there any predictive value?

Most people believe that walls on the depth chart reveals supports (bids) and resistances (asks) that are hard to break through, as a kind of repulsive effect.

In fact, I've read a study that institutions actually wait for very thick order book before sending in a large market order. That means those walls may actually attract prices rather than repel them.

This also explains the practice of pump and dump where manipulators will send in a medium size market buy into a thinly traded market to pump up prices and take out sell stops, which will send prices even higher. Retail buyers will also add fuel to the fire as they FOMO in. With more buying interest the bid wall becomes thicker as more prudent buyers will try to put in limit orders instead of market orders. Alas, this is when the whale unloads his 100 BTC sell order onto the market. You can clearly see this kind of activity in the bitcoin charts as a small spike up with moderate volume and then a large spike down with heavier volume.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .