Sign in to follow this  

Open Market or Stock Market Game Engine

This topic is 4200 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
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
Whoa, this is getting quite complicated quickly.
Thanks for the comments Anonymous Poster and Rockoon1.

In my game concept I wanted to make use of an "open market" in order to determine the "true" value of certain items. Since the World Cup is currently on, let's use a football(soccer) example.
If you wanted to determine the value of a footballer you could set-up a stock market for all footballers with each footballer having say 1-million shares available. You could then give 1000 of your closest friends (the traders) 20-million "fantasy-dollars" each to buy and sell shares of each football player in order to make up their own "dream team".
Footballers would accumulate points throughout the World Cup for goals scored, assists, etc. Traders would try to maximize their points by buying and selling Football player shares. During the period that a trader owned shares in a footballer, they would receive the number of points that the footballer generated multiplied by the number of shares they owned of that footballer.
The trader with the most points at the end of the World Cup would win.

I think the theory behind "open market" is pretty straight-forward: Let supply and demand dictate the true value of goods, or in this case footballers.
However, there are issues when the pool of traders is not large enough and the market becomes iliquid. e.g. Everyone wants to buy shares in Ronaldinho, and no one wants to sell.

The idea of introducing "money sinks", "market makers", "short-selling", "long-selling", and "public shareholder" is interesting, however it seems a little more complicated than i'd like, just to implement a simple "open market" game such as the football one described above.

Share this post


Link to post
Share on other sites
I've thought about this problem in my own game.

I think it gets easier in RPG style kind of games, because it is easier to calculate the true value of an item.

My idea was to add merchants into the market, and give them very simple trading rules to ensure that a player will always find someone to trade with.

So, on the "Sword" sell side, you could have the smith who sells his swords at a very high price.

On the "iron" buy side, you have the same smith who buys iron at a ridiculously low price.

On the "iron" sell side, you have the miner, who sells iron at a given price.

On the sword buy side, you have the bum, who crushes swords to sell recuperation iron (and therefore buys swords under their raw metal value).

This way, a lonely player can always find someone to sell or buy his goods. The price is just very bad! As more players come in, and replace the merchants, the miners, etc, your prices get more interesting for everyone, and float freely inside the boundaries made by the non playing traders, who play the role of market makers.

Of course, this would need some tweaking, but at least, it allows prices to float, while providing liquidity.

Share this post


Link to post
Share on other sites
Quote:
Original post by Asphalt303
I think the theory behind "open market" is pretty straight-forward: Let supply and demand dictate the true value of goods, or in this case footballers.
However, there are issues when the pool of traders is not large enough and the market becomes iliquid. e.g. Everyone wants to buy shares in Ronaldinho, and no one wants to sell.


I think that is the "right" way to do it. Artificially controlling prices or volume will not work. The traders' actions will no longer affect on the prices in any meaningful way.

Anyway, in your example, why wouldn't someone want to sell shares of Ronaldinho -- if the offer was good enough? What do traders get out of owning the shares? Maybe they could benefit more by selling them at a high price. In your example, you get points depending on how well the football player is doing. If Ronaldinho is doing well, a lot of people might want to own his shares, but a smart trader would know that for 1 Ronaldinho he could buy 10 lesser players that would give him more points overall. If Ronaldinho is doing poorly, a lot of people might want to sell, but a smart trader would know that Ronaldinho will eventually do better and he could buy him now at a low price.

Finally, if your game is really about trading shares of football players, you should look at fantasy sports games. What you have described is very similar, except that you trade players directly instead of trading shares.

Share this post


Link to post
Share on other sites

This topic is 4200 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this