I have for some time been thinking I'd like to work up a game of sorts that involves a List of names. These names could be anything, but for the sake of discussion let's say it's celebrities. The game is essentially like a stock market and each ListEntry has an associated stock Price. If every BourseMember decides to purchase the stock of a given ListEntry, an algorithm should cause the Price of that ListEntry to soar. If every BourseMember sells the stock of that ListEntry, the price should plummet to near zero.
Rather than relying on actual market dynamics for this game, where people propose a stock price and the actual haggling and purchase actions dictate a price, I'd prefer if we just automatically adjust the price up or down to make the game simpler. I.e., every BourseMember has the option to buy or sell a given stock at its current price and the prices are automatically adjusted up or down for each buy/sell action.
I also want BourseMembers to be able to introduce new ListEntry items to the list. Ignoring for a moment the prospect of duplicate entries or other uniqueness concerns, I think it would be reasonable to assign a starting value to each new ListEntry, say $100. The BourseMember who introduces the new ListEntry will obviously have the first opportunity to buy the stock. Perhaps they can enter some text into a PressRelease that is automatically distributed to BourseMembers. If nobody else buys the stock of that ListEntry, the BourseMember who introduced it would ideally be punished by the stock price sinking. If others buy the stock, its price should increase with each buy action.
I'm imagining extremely simple data structures at the moment, and for starters only want the stock prices to fluctuate based on the enthusiasm of the BourseMember community, with no external real-life inputs. Perhaps something like this:
BourseMember
- id
- username
- hashed_password
- cash
ListEntry
- id
- name
- stock_price
- total_shares_circulating
- creation_datetime
BourseMemberStock
- id
- bourse_member_id
- list_entry_id
- purchase_price
- shares_purchased
- purchase_datetime
ListEntryPriceHistory
- id
- list_entry_id
- price
- snapshot_datetime
Might the community have any suggestions about algorithms or data structures? Seems to me that any price changes driven by purchase or sale activity should depend on the number of shares purchased, the number of shares in circulation, and the number of bourse members, but I can't quite imagine any effective formulas.