Advertisement

Stock market AI

Started by January 14, 2002 09:27 PM
53 comments, last by medovids 22 years, 10 months ago
I want to make a stock market game but I am not sure how to make the AI for it. When do the prices go up and when do they go down, how much do they go up by or how much do they go dowm by?
My recommendation would be to get a book on investment economics, macro-economics, stocks and investments, etc. If you know enough about the subject of you game the AI becomes simple.
Advertisement
the stock market is very complex... even the "experts" who invest and talk about it don''t really have a clue. if they did, they''d all be rich and the stick market would lose it''s blackjack appeal (at least as far as i am concerned). so, no matter how deep into the subject you delve, there will still be a big chunk of random thrown in there.

--- krez (krezisback@aol.com)
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
Scientific American had an article a couple of years back related to mandelbrot sets and stock market patterns. Depending on exactly what you want to do with the data, you might be able to generate data using some of these techniques (?)
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
hmm, this is probably off topic, but i recall hearing about a person who used neural nets, or perhaps another type of AI, to analyze the stock market and try to predict what will happen next (in order to make money). from what ive heard (and we should all know about rumors) he did pretty well.

anyway, just a story i heard, i dont even know if its true. lol


 - jeremiah
 http://fakemind.com
- jeremiah http://fakemind.com
To sum up, the stock price will change based on what people are willing to pay for it. If people want it, they will be willing to buy it for more than it is currently listed... assuming someone is willing to unload it. If you want to sell, and no one is buying, you may have to sell it for less and the price would then fall. How much? That depends on the who is willing to pay/part with what amount. It''s all an excercise in human psychology and perception. Model it? Woo hoo... that''s a rough one. Feel free to contact me (my email is dead until Wed. 16th) if you would like some more input on this.

Dave Mark
Intrinsic Algorithm Development

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

Advertisement
I suspect we would need to ask the questions...

Are the players going to be involved in buying and selling? If so, how many players? Do you want their transactions to affect the price? Are you going to be creating outside stimuli like economic indicators or company press releases? Those certainly affect the perception of a company''s future and therefore its price. We need more info on what it is you are trying to do.

Dave Mark
Intrinsic Algorithm Development

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

Just thinking aloud:

I wonder how closely the game AI should model the real stock market... In the real world, you worry about real money and the consequences of your actions. This does at least two things.

1. You''re probably much more conservative than you would be in a game. (Even if you''re high risk, you''re probably higher risk in the game)

2. You''re willing to read/study a lot more than you would be willing to in a game. Reading press releases is generally fairly boring. Reading fake press releases would be extremely boring (at least for me).

Having said that, perhaps the AI should be much more wild than real economic theory. Perhaps the dynamics of market activity and price would be completely different if you were aiming for fun vs. reality.

Again, just thinking out loud...

Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
quote: Original post by Torn Space
If you just want the price to move up and down, you can do something like this for each stock:

For every day, roll d100:
0-30: stock starts a downward trend (-1% to -5% per day)
31-70: the trend continues
71-99: stock starts upward trend (+1% to +5% per day)

That''s overly simple, but it''s a good start.


Unfortunately, that would not create stock price movement which mimics the way real stock prices move. Your method would have little chance of creating double bottoms and double tops, or trendlines.

A double bottom is where a price bounces off of a particular price level where the index or stock bounced before, say three weeks ago. Such patterns look like a ''W''. The psychology of the markets create these patterns. Investors see that investors were not willing to let the price drop below a certain price before. They believe that price is a ''fair'' price. They refuse to purchase at a higher price so let it drop. It does, and then the crowd rushes in to buy where it bounced before, creating a self fulfilling bounce.

Trendlines are weird but very common. A stock price advances, and then drops about two thirds of its advance and then advances again to a new high. This will repeat for several times. At each time the price dips and advances again, you can connect these dips with a diagonally advancing straight edge. It is really uncanny.

New highs indicate strength in a stock. When a stock breaks an old high, it has destroyed the psychology of what it was previously thought to be its maximum value. Investors often buy stocks making new highs, because they have ''cleared'' the way for advancement.



___________________________________

_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses
ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.
A familiarity with the internal mechanisms of the markets would go a long way towards setting up a simulation of one. The NASDAQ uses a market maker system. Some reading on NASDAQ market makers will facilitate your understanding of them. The big board (NYSE) uses specialists. Regardless, an understanding of the bid & ask is necessary.

___________________________________

_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses
ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.

This topic is closed to new replies.

Advertisement