Jump to content
  • Advertisement
Sign in to follow this  
Asphalt303

Open Market or Stock Market Game Engine

This topic is 4539 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone know of any articles or tutorials on designing an open market or stock market game engine? Specifically, I am interested in how to create liquidity in a market with a relatively small number of players. Cheers, BB

Share this post


Link to post
Share on other sites
Advertisement
Are you having trouble with the economic issues (e.g. stock market bits) or the technical issues (e.g. GUI bits)? I can't really help with economic bits because I don't know the first thing about them.

Share this post


Link to post
Share on other sites
I'm specifically interested in how to deal with the trading of "stocks" and how to deal with liquidity situations where all the traders want to sell or buy at the same time.

For example, if XYZ company develops the cure for cancer then the price of XYZ's stock will be driven up by people that want to buy the stock (a typical supply/demand curve). This of course is under the assumption that other people are willing to sell the XYZ's stock to the buyers. In the real-world, this is usually not a problem because there are millions of people buying and selling the stock.
However, an issue arises when there is a smaller pool of people buying and selling stock - let's say for this example the entire stock market is made up of 10 people. If all 10 people want to buy XYZ's stock, and there is no one willing to sell the stock, then the market freezes. With no transactions occuring, the price of the stock cannot change.
I've thought about implementing a bid/ask system where stocks are "auctioned" off - but how do you deal with one seller wanting to sell 400 shares, while there's a buyer who only wants to buy 10 shares? Does the market engine automatically allow all trades at a given price? Does the market engine act as a middle-man trader? How does the market engine ensure that it does not lose money during transactions?

So many questions...I'm really hoping that someone has implemented and documented this before.

Share this post


Link to post
Share on other sites
Perhaps you don't understand the real market correctly..

Stocks DO NOT HAVE ANY VALUE when they arent being traded.. NONE!

If nobody is willing to sell, then they have no value.
If nobody is willing to buy, then they have no value.

It is only when buyer meets seller that a price can be agreed upon.

The "price" you see in stock news is only AFTER THE FACT. A record of a past trade (the last one, usualy) that has no bearing at all on any future trades.

Share this post


Link to post
Share on other sites
I've seen and played a game (Capitalism and Capitalism Plus) that implemented a stock exchange. It wasn't multiplayer but there were a few computer players that participated in the stock exchange.

Anyway, the way they were able to keep the stock market liquid was by making all the companies have about 50% (it could be less or more) owned by public shareholders. This way the people who would want to buy or sell can buy or sell them to the public shareholders. If the public shareholders were all bought out then you would need to pay more money than usual and try to buy off the other players.

I hope this helps.

Share this post


Link to post
Share on other sites
Thanks for the reply eektor. The introduction of "public shareholders" sounds interesting. Were these "public shareholders" smart (adjusted price based on supply and demand) or dumb (always asked for the same price) players? If they were smart, how would one go about creating the AI involved? If they were dumb, how would you prevent "real" players from abusing the "public shareholders"?

I think I'd prefer the idea of removing as many artificial constraints as possible in order to let the open market evolve organically - so it'd be better not to introduce "public shareholder" bots if possible.

Share this post


Link to post
Share on other sites
I just read an interesting article about stock market liquidity

http://www.businessweek.com/magazine/content/03_44/b3856117_mz020.htm

It looks like there are special traders whose job it is to ensure market liquidity. These traders, whom I assume are working for the stock exchanges (NYSE and NASDAQ), are obligated to buy shares when prices are falling and sell shares when prices are rising.

So I guess there are artificial constraints to ensure market liquidity. The stock exchanges must lose money to ensure liquidity. I guess they make this back up through transaction service charges?

Okay, so any thoughts on how to implement the AI for computer-driven special traders?

Share this post


Link to post
Share on other sites
Since the game was about starting a company and growing it. The stock price of the company on the stock market reflected how profitable the company was and how fast it was growing.

Edit: Since the price of a stock is based on how a company is doing, you could have quarterly financial results every year and random events that happen anytime (like you said company XYZ discovered the cure for cancer). Then you could program the public shareholders to behave similar to what happens in real life. If there is bad news the stock goes down and if there is good news the stock goes back up. Over time without any news, the stock should be at the price that the company is actually worth.

I don't know exactly what you are trying to do though.

[Edited by - eektor on June 13, 2006 3:38:24 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Asphalt,

You're right in a few ways; one of the biggest problems with small companies is the illiquidity of their stock. For instance, I used to work for a tiny start-up in the UK, we had shares - just appart from VC funding rounds shares never changed hands.

The guys you are referring to are, in the UK, called 'market makers', AFAIK they are not staff of the exchange, but tend to be part of private companies - although clearly they must be approved by the exchanges. As you mentioned they help to create liquidity. There are several ways they can do this - one of which is clearly to hold shares 'long' (ie they own the stock) and sell them on. Another way - and in some ways this is the cunning bit - is that they can sell shares 'short', this means they sell to the buyer shares that they don't yet own. They will then make up their short fall by purchasing shares to deliver at a later stage. They can make a profit in various ways; firstly by having different purchasing and selling prices; they can also speculate on the future share prices.

Then there are various other questions; options (put & call - allowing the holder at some stage in the future to buy or sell shares at a price defined when the option was acquired); hedging strategies; also shares don't actually have to be sold at the exchange (although for various reasons its easier; but there would be nothing - technically - to stop you from flogging your Google shares on ebay).

Regards,

N

Share this post


Link to post
Share on other sites
Quote:
Original post by Asphalt303
I just read an interesting article about stock market liquidity

http://www.businessweek.com/magazine/content/03_44/b3856117_mz020.htm

It looks like there are special traders whose job it is to ensure market liquidity. These traders, whom I assume are working for the stock exchanges (NYSE and NASDAQ), are obligated to buy shares when prices are falling and sell shares when prices are rising.

So I guess there are artificial constraints to ensure market liquidity. The stock exchanges must lose money to ensure liquidity. I guess they make this back up through transaction service charges?

Okay, so any thoughts on how to implement the AI for computer-driven special traders?


This strategy doesnt lose money for the person making the trades (not counting taxes and broker fees) .. buying on downticks and selling on upticks is a fairly standard method of investment

And this doesnt enforce any liquidity.. it could be considered as a stabilization strategy.. which is sort of the opposite of what you want

...

Do you want the players to determine the going rate, or do you want to artificially impose a rate?

There really is no middle ground here.

Any attempt at finding a middle-ground will surely be exploitable and rampant inflation will commence unless you take steps to stop it.

Typically, an MMORPG with a "mostly player-driven" economy (see Eve-Online) must impliment the idea of a "Money Sink" in order to stop the inflation due to it not being entirely player-driven... but this forces everyone to use those exploits in order to keep up (unless they can avoid the money sink, but if they can.. its not an effective sink)

...a very vicious circle

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!