I have been trying to find exact information on how stock prices are determined but still I haven't found any exact mathematical formulas how it happens. Wikipedia states:
When prospective buyers outnumber sellers, the price rises. Eventually, sellers attracted to the high selling price enter the market and/or buyers leave, achieving equilibrium between buyers and sellers. When sellers outnumber buyers, the price falls. Eventually buyers enter and/or sellers leave, again achieving equilibrium.
That still doesn't tell how the price is determined. The formulas must exist, because prices can be followed real time? I'll give a simple example. Let's consider that there is a Company X and parties A, B and C and there exists 6000 stocks in public market.
At moment 1
Current stock price: 100€
Stocks held:
Party A: 2000 stocks -> value = 2000*100€ = 200 000€
Party B: 3000 stocks -> value = 3000*100€ = 300 000€
Party C: 1000 stocks -> value = 1000*100€ = 100 000€
At moment 2
Party C wants to by 1000 stocks at price 110€ and Party B wants to sell 1000 stocks at price 120€. How is the correct price in the middle determined exactly? Is it just by negotiating or is there a formula to determine it?
In any case, let's then consider that the agreement is in the middle and agreed price is 115€ and transaction is made.
The most important question is: What is the the global stock price after such transaction?
At moment 3
Current stock price: NEW_STOCK_PRICE
Stocks held:
Party A: 2000 stocks -> value = 2000*NEW_STOCK_PRICE = ?
Party B: 2000 stocks -> value = 2000*NEW_STOCK_PRICE = ?
Party C: 2000 stocks -> value = 2000*NEW_STOCK_PRICE = ?
How is the NEW_STOCK_PRICE calculated and what is its value?
For instance in Yahoo Finance (during writing this) Microsoft is valued for 30.56. Where does that number come from?