[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 781
  • Last Modified:

Stock Market algorythm

Does anyone know where I can find information about the kinds of algorythms used to determine current prices on the stock market?  

For example, the more people that want to buy a stock, the higher the price goes.  But how does the algorythm work that determines how high the prices goes?  Why does the stock rise to $1 instead of $1.10?

I'm working on a game that will have a market-like component.  As players buy weapons, the price of the weapons will increase for other players and likewise if lots of players sell off, then the price needs to drop.  I have a few ideas, but I'd really like to model it after a real market as much as possible?

3 Solutions
Hi spuerman,
There isn't a single algorithm to determine what price a company's stock goes for.  It's based upon what people are willing to pay.  If people want to get rid of their stock in a company, it's likely because the company is doing something wrong, and the people expect their stock value to fall for reasons unrelated to stock availability.  Also, ignoring economic influences (market share, etc.) and just treating the stock exchange as its own independent free-market system, you can simulate it using supply-and-demand.  The greater the available supply of the stock, the less bargaining power the owner of a set of shares has when he wants to sell.  Hence, the lower the price.  The opposite is true, as well.

Of course, to get even a semi-realistic simulation, you need to simulate market influences external to the exchange.  In other words, stock prices need to frequently go up and down regardless of the sort of volume that company's stocks are seeing in the exchange.  And, even further, that fluctuation needs to spur action in the exchange.

The fact that there's no set algorithm for determining stock prices is what makes it so problematic to play the stock market.  If there were a set algorithm, it'd be much easier to score big, because it would be much more deterministic.

Nobody's ever come up with a foolproof method for simulating stocks.  Play around with it.  Even better, get on one of the stock exchange simulation games online (go to google and search for "stock market simulation".  The entire first page will be free stock market games that allow you to trade shares using the prices set in the real exchange), and run your simulation with real stocks and real trading volume, and tweak it until it starts working reasonably well.

Then play the market with it and get rich.  (c:
The best information you can get is (I think they call it) Level 2 information - which is the details of (1) the Price that a Seller has posted that he is prepared to sell for (2) the price that a Buyer of the shares buys them for.  This is factual information because this is the value that the Shares changed hands for.  The price you often see advertised is what the Seller would *like* to sell the Shares for, which could be artificially high.

Several companies offer this information, but you need a means to interpret it to produce an investment strategy.

gives details on Level 2 data
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

spuermanAuthor Commented:
so are you saying that there are literally people that just sit around & bid on what they are willing to pay for each stock out there & that the current price is based on that?  I had assumed there was some kind of algorythm so that everytime someone bought a stock, it would effectively raise the price while selling the stock would lower it.
Nope.  It's a free market system.  Prices are based on a compromise between what the owner wants to get and what the buyer wants to pay.  There are economic issues that make stocks more desirable to have (dividends paid by the company, annual growth percentage, stability, etc.), but ultimately, a share is only worth as much as you can get someone to pay for it.
(This all relates to the UK market)

There are "tipster" journals you can buy which give analysis on why you should buy a particular share.  Being a cynic I'm sure that Dealers subscribe to these journals themselves and artificially hike the prices on these shares and wait for the demand to roll in.  If it doesn't then they modify their prices downwards accordingly.  Similarly when there is *speculation* of a takeover, the price of the Target company may go sky-high to align with the price that the predator company will pay for the company, which will reflect in the new worth of the Target Company Shares.  There is quite often no basis at all to assume that something will happen.  

...and we haven't mentioned conventional Put and Get or Traded Options yet.  A good way to make money in a falling (bear) market.

The barometer that a lot of people use to determine the outlook of the economy, prospects, optimism/pessimism is the price of Gilt Edged Securities.  Others use various Indicators - leading or laggard - to determine mood.  Read Investors Chronicle, which is a weekly publication.
forget the stock market back to your original question

>>I'm working on a game that will have a market-like component.  As players buy weapons, the price of the weapons will increase for other players and likewise if lots of players sell off, then the price needs to drop.  

this will give you a go, its pure theory with a bit of real life mixed into it

the stock market is a bad sample to take your cue from, you better start with some economic theory and add the complexity later

stock market is not only people willing to pay prices but also able to pay them, so liquidity is the most important basic factor you need to take into account, since this is lagging central banking behaviour you still have to look at the real economy for cues about how much money will be around to play the stock market

in real life you live in a village with no grocery store
since you got a car you're willing to make the ride to town and buy surplus goods for people asking for them
then you come and sell them in the village with a small profit because you calculate

in the stock market you buy google at 380 and it goes to 410 because of gamblers around you
one day the FED decides to turn off the liquidity tap, the initial reaction is not bad google closes at 390
markets overnight react badly and the USD sells off
google opens at 360

stockmarkets have larger external unknowns then normal market behaviour outside of that so for your game i would dismiss the stock market because its a world on its own

the best markets to watch for some relation to real life bid-ask behaviour are the commodities and then you should exclude precious metals those are the domain of the same forces as the stock market liquidity driven

look at wheat, whool, sugar, coffee or cotton markets if you really want to base your game on financial markets, those markets incorporate pricing models that include weather, shortage and oversupply factors

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now