I am trying to make a stock market that is affected by players but can’t figure out how.
If I make it to where a share is bought and the price goes up, people would be able to buy and sell over and over and continuously make money. I can’t wrap my head around how I could make it work.
For example, there are two shares each worth 50% of a company and let’s say the company is worth $1. The share price would be 50¢. If “Bob” buys a share, the company would be worth $1.50 making a share worth 75¢. He could then sell that share profiting him 25¢. As a consequence though, the company would only be worth 75¢. This would mean it would be a constant spiral downward until the company reaches $0.
I know this isn’t how the stock market would work because it doesn’t benefit the company at all but it is the only thing I can think of.
A general explanation of how buying and selling shares affects the market would be great. This is the only part of the stock market I struggle to understand.
About this post
- Posted
- Archived
- Score
- 4 · 100% up
- Kind
- Text
- ID
- hwbamo
5 comments
Hi, I am an economist that makes games for fun.
This is a fairly complex topic that people model in social sciences.
It is supply and demand. The benefit from owning stocks comes from the expected dividends plus any expected appreciation in value.
Then you have to make demand curves for that. The supply function is easy because the supply of stocks is fixed. At any given time, there are X amount of shares out there.
Your model on it is fundamentally incorrect.
To model this you would need to understand net present value and how valuations are done. If you do this, you got a job on Wall St.
I don't think you're going to find a graceful, clean, simple solution to a complex theme like the stock market. My suggestions below are not based on knowledge of how the real stock market works, but how a simplified one may work in a game.
If I had to, I'd give each company a dollar value for how much it was worth. CompanyA might be $100 and CompanyB might be $100 each with 100 possible shares. Assign each a volatility, or a daily fluctuation value they're worth per game day. You could tie this into world events, or even have triggers tied to player actions.
Player buys 10 shares of CompanyA at $1.00 each. Company A isn't worth more, but if the player then takes actions that benefit CompanyA, the stock price would go up as CompanyA became worth $134 instead of $100. Then the player can sell the stock for $1.34 each.
Maybe the player royally screws over CompanyB. CompanyB is now worth $37. Player buys 50 shares at $0.37 each. Player then works to increase CompanyB in the market, bringing it up to $90 in value, and can then sell their shares for $0.90 each.
In my retirement funds, I can choose to simply let the fund manage my money and select simplified investments. Low risk, low return. Medium risk, medium return, high risk, high return. Companies might have the same characteristics, with player actions increasing or decreasing values more substantially, or making it harder to affect the company's value.
I just wouldn't tie the Company value directly to the player's investment - because as you've said, it creates an over-simplified and/or easy to exploit system. There should be some risk and reward.
I have no idea myself, but have you taken a look at games like Eve: Online, Black desert online, and archage? They all have economies driven by players and you can probably simplify some of their systems to their essences, or just see how they manage external influences from the players.
Context would be helpful. Obviously, modeling a "real" market is going to be tricky. It should be easy enough to fake, as long as Players can't see the underlying data.
Your example shows a complete misunderstanding of anything resembling an actual market, at least with current laws and regulations (sure Companies in the 1800s would just write up new stock slips to dillute ones they sold).
So lets just look at a super simple, more realistic example:
Bill owns a company and wants to invest in a new factory. Lacking necessary funds up front, and instead of going to a bank to get a loan he'll have to pay back with interest he decides to sell part of his company.
He divides his company into 10,000 shares, each share representing ownership of .01% of the company.
Bill takes out an add in the paper saying "I'm selling 4,900 shares each representing .01% of my company for $100 a piece. Take part in this once in a lifetime chance to own a piece of Bills Company (BLC)!". Bill hopes to raise $490k from this sale.
Let's just assume he finds people to buy all 4,900 of his shares for his asking price of $100 a piece.
At this point, the BLC's net valuation is the total value of ALL shares, which is (10,000 shares) * ($10k) = $1mil. BLC has $490k in cash to invest in the company, and Bill still owns 5,100 stock currently valued at $510k.
From this point forward, there are only 10,000 shares of BLC. Bill cannot issue more stocks, because there are laws and regulations preventing it, and it makes sense that the investors would not agree to that as it would dilute their stakes. (In the real world, there are ways to change the total number of stocks, but we'll ignore all that)
We'll also assume every investor has full rights to sell their shares however they wish, and that somehow BLC got publicly listed on a stock exchange somewhere.
All this was setup to understand what shares represent, the market you want to model starts now.
Let's pretend that next week, more potential investors are interested in buying a share of BLC. They can "place an order" at the stock exchange to purchase a stock, and specify the price they're willing to pay. All the current investors are still happy with their purchase, excited to see their investments grow, and aren't interested in selling. So to persuade someone to sell, one hopeful new investor, Ted, starts offering more money. Buy orders start going out for $101. $102. $104. One of the current investors, Sue, likes her new stock in BLC, but she's not sure it's worth more than $104. She decides to put a Sell order in for $105. Ted then offers $105, and the stock exchange ensures that the money and stock transfer between the Ted and Sue. The transaction is complete, Ted is the new owner of 1 share of BLC, and Sue is happy she now has $105 for her $100 investment. Bill and his company were not involved in the trade at all. There are still 10,000 stocks each worth 0.01% stake in BLC.
Backing up a bit, in addition to facilitating that the transaction between Ted and Sue went through and the money and stock were exchanged, the stock exchange also publicly announces all buy and sell orders. So everybody saw Ted's order to buy at $101, $102, $104, and ultimately at $105 just as they saw Sue's order to sell at $105, and the final posting of the transaction of 1 stock sold for $105.
The day ends without any other transactions. At the close of the stock exchange, the last price one of Bill's company stocks sold was for $105. The closing price for a stock at Bill's company is now $105. This is the price printed in the newspaper "BLC: $105.00". Bill siting at home reading the paper, is pleased to learn his company BLC is now valued at $1.05mil.
The next day, some BLC investors see the current price of $105 for the stock, and decide they'd like to cash out now. 3 of them independently put sell orders out for $105. New investors looking for a deal, start offering $103, $102, $103.50. One of the current investors decides they'd like to cash out now and lowers their price, and sells for $103.50. The ticker now shows "BLC: $103.50". The other two sellers still want to sell and take a quick payout, and lower their price to $103. Another transaction occurs at $103, and the ticker now reads "BLC: $103".
All the investors watching the ticker and seeing it going down from $105 to $103 start to get worried that this is a larger trend. Some more of them decide to get out now while they can still turn a profit. They put sell orders for $102, $101, $100. $102 sells. A buyer seeing a good deal offers $100, and another sale occurs for $100. Panic ensues with investors, and people start selling for $99, $98. Meanwhile, people see a potentially good deal since this stock was originally valued at $100 just days ago, so sales start going up again, $99, $100. After a bit of back and forth, the day ends with "BLC: $101".
The next day, a wealthy investor decides they want to buy 10 shares of BLC. They can't just decide to buy 10 for the last price of $101, they have to make an offer like everyone else. As they want to move on this quickly, they put an initial buy offer out for 10 shares for $103. They find 3 buyers at that price, and there's no more movement. So they increase their offer to $104, and get another 2. To get their final 10th share, the price has now gone up to $106. In reality, since offers are public, it was a dumb move to advertise they intended to buy 10 shares up front. A smarter investor would have broken their offers up to conceal their intentions, however it does showcase how buying can have an effect. Similarly, selling large quantities can drive the price down.
This goes on for a few months, and it's time for BLCs first financial report. Turns out they did better than expected and the new factory is ahead of schedule. Good news all around, looks like BLC is growing quicker than anticipated. Stock prices starts going up $107, $108, $111. Some investors think people got a little over excited, the news wasn't that great, and decide to cash out while it's over inflated. The stock goes back down some $109, $108. It settles at $108 for awhile, and someone decides they want in after all, and buys at $109. This happens to trigger another rally, $110, $112, $114, $113, $115, $116!. Since no one is quite sure how the financial news of BLC actually translates to how profitable it will be in 6 months, 1 year or 5 years, and everyone is largely playing off of what they think the company is worth, and what everyone else thinks the company is worth, there can be periods of quick rising and falling of prices. Meanwhile others are trying to cash out at the top, and get in at the bottom, without knowing where they are, which causes the ups and downs you see on a stock through-out the day. BLC is now worth $1.16mil which pleases Bill greatly. 16% growth in just a few months!
To model the final ticker prices for a game, as long as you don't expose the underlying data for determining the value of a company, you could literally just RNG the ups and downs entirely within some arbitrary threshold.
If you want to tie it into player(s) buying/selling to some extent, you could feed in current trend (+ or -) as a weight into the RNG. If it's going up, it's more likely to continue going up. If it's going down, more likely to go down. Possibly tie in the rate of change as well, so faster it's going up, the better chance it continues going up. Then, to prevent a positive feedback loop sending the price to 0 or infinity, put some weighted RNG that acts as a counter-balance and pushes the price back towards some historical average with increased weighting the further the delta between present and historical price (however, the longer the price stays above the historical average, the more the historical average will be skewed upwards, establishing a long term + trend.)
You can add in some RNG AI buy/sell orders, orders from other players, weight it against trends in other stocks (for the macro market), and get as crazy complicated as you want, but I think a simple weighted RNG that follows local trends while constraining them to keep them local should work relatively well once you figure out some good values for constants and weights. Depending on your desired mechanic, you could also incorporate events (bankruptcy, lawsuits, buyouts, etc.) that drastically cause the stock price to swing well beyond normal buy/sell orders.
If I had to, I'd give each company a dollar value for how much it was worth.