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?


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.


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.

  • 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 Dec 10 '17 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 Dec 10 '17 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 Dec 10 '17 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 Dec 10 '17 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 Dec 10 '17 at 3:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.