Be a Supporter!

Credits & Info

Uploaded
Jul 27, 2011 | 6:11 AM EDT

If you liked this, check these out!


Author Comments

This is a simple simulation of one of the driving forces behind the stock market. Use it to explore how your strategies might or might not work.

Have fun.

This is my first flash game (so it's far from perfect, I know), but I would like feedback (and hints from more experienced developers). Write to: axiom at evonets dot com

Reviews


NverseMpossiblpRadoxNverseMpossiblpRadox

Rated 4.5 / 5 stars

I really have no respect for those who downrate puzzlegames because they're too stupid to solve the puzzle. This game is a puzzle. Spoiler alert, I tell you later on what you can do to.

Biggest downside of the game, and it's super-annoying: when it gets over about 20 million dollars or 20 million shares, there is a serious problem with the formatting of the number displayed. It suddenly reports it as a negative number. I can't quite get a grip on exactly what that number is. It's not a power of 2. It clearly gets past 16777216 without a problem, and in fact slightly past 20 million. Basically, when it gets to 20 million, it still stores the correct value, but it suddenly transitions to displaying it as like negative 20 million. And this repeats. Namely it subtracts some multiple of 40 or so million so that the result is always between -20 and +20 mil. So if you get up to a billion dollars, let's suppose it was 20 million exactly at the transition - it isn't, but suppose it was - it would be like 1 billion would be displayed as 0 dollars, 1.01 billion would be displayed as 10 million, and 1.03 billion would be displayed as -10 million, so if you actually play it long enough to get way up there, it will just drastically switch from positive to negative and back and the displayed amount will have almost nothing obvious to do with the number it's supposed to be displaying. Which is a pity, considering it's not really that hard to get past 20 mil. Well, it takes maybe 2 hours if you do it continuously.

That said, if you're now saying to yourself "WHAT? How could anyone get up to 20 million dollars or 20 million shares in this game? It's impossible! You can't predict if it will go up or down!" then let me tell you 2 different ways you beat this thing:

1. keep half your assets in dollars, half in shares. Simple as that. Suppose it starts at 100 per share. You start with 2000 dollars. When you put it half and half, that means you then have 1000 dollars and 10 shares. If the share price drops 20%, now your net worth is 1800 dollars, but you have 1000 dollars in cash, and that means you have too many dollars and too few shares, you should have 900 dollars and 900 dollars worth of shares. So you buy more shares. Specifically, you set the bar to 10% and hit the buy button once. In fact, set both the red and green bars to 10%, and every time the share price goes down 20% from where it was in your last transaction, you hit the buy button, and if it goes up 20% from the last transaction, you sell. Simple as that. Sure, it tends to go down under 1 dollar from its starting value which is likely to be 100 or even 1000, so you will likely start losing before you win, but you will win if you keep it up. This method has an interesting property: with every transaction, your account value in dollars may not go up, nor may your value in shares, but every single transaction will increase the product of the two. The number of shares you own, times the number of dollars you own. Every time you renormalize your assets to half and half, the product of your dollars owned and shares owned will increase. There's something to think on.

2. Observe that it never goes below 9 cents per share. I don't know if there's a limit to high it can go. I saw it get up to 7000 dollars per share. But certainly, go all in when it goes under 20 cents per share, because there's no risk. Just buy every time it's under a dollar, come back 20 minutes later, still under 1 dollar? Fine, come back later. 10 dollars per share? Katching! Sell off only half of it though again. Next time you come back, it could be 100.

3. That said, it's actually a LOT harder to LOSE your money than to make it! Try playing that way. See if you can get your account value down so low that it rounds down a fraction of a cent down to "0". It ain't easy to do that! Then if you really have time to kill, get your account value back up to the thousands and then millions from less than a cent. There's a reason why it's so much harder to do that - with no commissions and no leverage allowed (and no difference between buy and sell price), it's as hard to turn a positive-expectation game into a negative-expectation game as it is to turn a negative-expectation game into a positive one (in other words, by "hard", I mean impossible). It WOULD be impossible if you weren't all but assured that in this specific game, the parameters of the stock were such that it was bound to not fall below 9 cents and not to go up without bound. You can lose money if your goal is to do so by checking back in on the game every few minutes until you finally see it for like 10 dollars, and then sell finally when it's under 1 dollar - whereas there isn't a good foolproof systematic way that doesn't cheat like that, making use of foreknowledge of the bounds of the share price, the way there is for making money (keeping half your assets in cash, half in shares). In other words, if you try to sell a little more as it goes down and wait for it to go back up, when you eventually relent and buy it back up, it is likely to actually go up then, and if you sell it's likely to go down then and if you were trying to lose money, you will regret it. But certainly it doesn't make sense to do anything but be all in if trying to lose money. If you try to buy more as it goes up more and more so that you can sell as it's going down more and more, you'll just find you run out of money on the way up, and if you sell on the way down, you'll just find you'll run out of shares on the way down and all there will be left for you to do is buy back at an even better price than you sold it for. That is, if you didn't know it was guaranteed to be bound between certain limits of share price.

Also contrary to its detractors, I think this is actually more like the real stock market than you might realize. Sure, it's the market in a world where there is only one stock, but what I outlined where you keep half your assets in dollars and half in shares, I think is the optimal thing to do in that case. And that's for a fictitious stock where it's not any more likely to go up than down but is guaranteed to never go bankrupt. If it actually is more up than down, than maybe the thing to do would be to keep 70% of your assets in the stock and 30% in cash. If it's a failing market, maybe 70% cash, 30% stock. And what if this took place on a world with 2 stocks? Maybe 20% of your assets in the cash and 40% in each stock? Now, how could we apply what we've learned from this thought experiment to the real world? I'm thinking, you buy a bunch of stocks - companies you know ain't goin' nowhere and are here to stay, like walmart or google, maybe a few in each industry, maybe a few ETFs - but contrary to what the baby boomers will tell you, your eggs can in fact be in relatively few baskets, you'll just lose your money to commissions if you try to spread 10 thousand dollars among 30 different companies and trade them all the time - but what you do, I think, is your holdings in each one might be proportional to the square root of its market capitalization. And the constant of proportionality should be such that it adds up to maybe 80% of your account value, the other 20% being cash. In other words, if one stock's price goes up by 30%, now its market capitalization is 30% bigger, so you should have a sqrt(1.3)=1.14 times as large a holding in it, but the value of your holdings went up by 30%, not merely 14%, so you sell off the other 16%. Well, less than that, because it would also have increased your account value, so the percentage of your account value wouldn't be a whole 1.3 times bigger than before, maybe 1.25 times, so you sell off the other 11%, and you use that money to buy some that haven't done so well. And you just keep doing that for every stock you have. When the values drift off enough, maybe one goes down and another goes up, so that you're significantly off the proportionality to the square root of the market capitalization, you will find yourself selling a bit of the ones that went up and buying the ones that went down. Of course, because of the commissions, you wouldn't constantly be doing this. Just every so often. Also when you get paid a dividend by one of them, that increases your fraction of account value in the form of dollars. Though this method has one big weakness - it had damn well better be a bunch of companies that aren't going to fail. Because if you do this, you will just be buying more and more and more of one specific stock as it goes down and down and down. Of course when things fail resolutely, it's usually in one day, so it wouldn't be catastrophic even then, you wouldn't even have the opportunity to buy more and more all the way into oblivion. Also, you could be playing that game in real life a lot longer than 2 hours. Even for a company that hangs on, how long would you typically have to wait in real life for a 100 dollar a share stock to go down to 20 cents and back up to 6 dollars and back to a dollar and then back to 4 dollars? Probably like a hundred years. And even if you had a million bucks, if you renormalized your account value every year to again have everything proportional to the square root of the market capitalization, how few shares would you really be trading? You could do it a bit more easily, by selling call and put options. That would accomplish the same thing. If the price is down at expiration, the short put is assigned to you and you get a few more shares, if the price is up at expiration, the short call is assigned to you and you sell off a few. The upside of that way is, you get to keep the premium on both if the price at expiration is such that they're both out of the money. But it would be like 1 options contract worth 100 dollars as a call and 1 as a put if you had like 10 million worth of stock, this would be a really slow path to riches and you'd need a lot of damn money to start with for it to be done very precisely and with minimal risk at least, so maybe this method ain't so great after all.

All this came to me after playing this thing for a few minutes. It just goes to show, you can take something away lessons from things that others dismiss as worthless, if you look for them. It's like this time my roommate in college told me, if you resurrected Einstein and Newton and locked them together in a room together, they'd have nothing to learn from each other - to which I replied to him "you couldn't be more wrong, they'd learn more from each other than you'd ever learn in your entire life working your hardest if you lived to be 1000 years old". To which he said "yeah, I guess you're probably right". Bottom line, it's a game, and a puzzle. If you can't solve the puzzle, don't whine about how you hate the puzzle. It has a specific solution which works the best. It all comes from the fact that if a stock is equally likely to double as it is to halve, that's actually a very good bet to take (.5*2+.5*.5=1.25>1), IF you bet the right amount. And the right amount is... half your money. Then if it DOES double, now 2/3 of your money is in the stock, and you should sell off 1/3 of it so it's again half of it, and if it DOES halve, now 1/3 of your money is in the stock, and you should spend 1/3 of your remaining money buying more shares. You won't get odds that much in your favor in any casino, that's for sure.

Nice music. I wish you gave a link to where it could be found. I'd like to hear that music in other games, but it certainly does fit this well.

Thus concludes the longest review I've ever written. I know because there are under 1000 characters left. But it's a mathematical puzzle, not just a game, and it deserves a worthy and thorough examination. It's just a pity that the e-mail address in the author comments is no longer valid, I'd kind of like to let the creator know of what I learned from this game and my findings about it. But maybe someone will read this.



zorthargzortharg

Rated 4.5 / 5 stars

Take a look at the image links. No one can predict random numbers like I can, wouldn't you say? I managed to more than quintuple the capital as it was falling to less than half its starting value, with selling short not even a choice!

http://s2.postimg.org/c8prrpct5/stock_1.png
http://postimg.org/image/9emme9amt/

http://s27.postimg.org/7aiz0lern/stock_2.png
http://postimg.org/image/imvkidngf/

http://s30.postimg.org/d9dbo4vhd/stock_3.png
http://postimg.org/image/7xyf3f9el/

http://s12.postimg.org/wyewd107h/stock_4.png
http://postimg.org/image/855ccdh6x/

Or should I say, no one can predict the future like me, when it doesn't matter. Or maybe I can in any case, I'm just subconsciously a glutton for punishment. The last time I touched the real stock market, I lost 20% of my money in less than 10 minutes. Pretty impressive, wouldn't you say? USUALLY you have to at least wait until the next DAY or at least a WHILE later to manage that level of loss. But nope. It only took me 7 minutes.

Improvements for the game:

1. make selling short a possibility. And buying on margin for that matter. I know why you didn't. You didn't want to add the complication into the game of having margin calls.
2. options. Make options available. Now THAT would be fun. Call and put options. I can help you with the mathematics of it if you want.
3. make it more obvious that it's a random walk. The idiots below me commenting think it's important that more than 1 stock be available, because they don't understand what this program is doing. Throw the stupid people a bone. Also please make sure that the mathematics are done correctly. It needs to be a true random walk on a logarithmic scale. That means, if the price is 1.00, the next price a few milliseconds later should be determined by a random number with a mean of 1.00. I suggest price one timestep forward into the future is (current price)*(1-x+2*x*rand), where x is a parameter of your choice that determines the volatility, and rand is a random number generated uniform over the interval of 0 to 1. That way there won't be any way to beat the market on average. Perhaps that is what you do already. I'm suspicious that you do. But if it isn't, that's how it should be.
4. Go ahead and make more than 1 stock available maybe. It would make the display more complicated. But just to show these people that it doesn't actually make any difference. If they're smart enough to eventually get that lesson. Program various correlations between the stocks, and make the correlation matrix subject to change.
5. Put in "news releases" to accompany the changes in price. Let the "fundamentals" traders think there's something to be told from the talking heads, which make up the explanations to fit the data after the fact. You know, if by chance the stocks take a dive, a newswire will appear at the bottom of the screen that says something like "breaking news: stocks dive on bad economic report from China" or if just one takes a dive, "breaking news: XYZ corporation faces costly litigation after...." and then the explanation could be that their drug fails FDA checking if they're a pharmaceutical company, or that someone found a finger in their burgers if they're a fast food company, or that they got ahold of insider trading if they're an investment firm, or whatever, or "XYZ corporation share price down on sales less than expected". And similar stories if it's up. But make it look like something that's relevant to the future, even though it's really just a reaction to what happened already.
6. Allow limit orders. And possibly stop orders. Don't just have a big green buy button and a red sell button.
7. Allow the volatility to change. For there to be periods where it goes up and down faster. Or slower. Or not at all, when the market is closed. But not too long with that. That would be just a psychological element, it wouldn't add any utility to the simulation.
8. A pause button. Time to enter in specific orders based on the current state of things without it constantly changing super-fast.
9. Spreads and commissions. A difference between "bid" and "ask". And you also lose 5 dollars per trade. Just to make it REALLY a losing proposition. And the spread (difference between bid and ask) should be especially large with the options, if you have them.

I love the choice of music. It's PERFECT. And yes, the game is almost perfect, despite your claims to the contrary. The only one like it I've found. And it's much how I envisioned I would make it. Which is a good sign for it, ha ha.


People find this review helpful!

bard119bard119

Rated 2.5 / 5 stars

A stock market simulation could be fun, but watching just ONE stock to buy/sell is as fun as watching paint dry. You could argue that it's not a game but a stock market simulation, but you do have this entry in the 'Games' section.
I do like the supply/demand element that prevents you from making massive profits - if you go 'all in' it tends to crash, preventing you from easily raking in a fortune.
There have been many games that have a much better economic model (as far as trading goes) like Wall Street Kid and Uncharted Waters on the original NES. If I want to play something like that, I'll just bring up a ROM emulator. You need fresh elements that entice me to try something new.



UPTXUPTX

Rated 2 / 5 stars

Nice idea, but lacks content - not much happens.

And I noticed that the value basically keeps falling. I ended up not even selling due to the value dropping to 0.21$ for each stock



CanadianHungryCanadianHungry

Rated 1.5 / 5 stars

Just one stock?

- Needs economical and political events
- Needs more than one stock
- Needs different types of stocks

Multiplayer like in real life