Page 1 of 1
Money Market Game
Posted: Fri Sep 24, 2010 6:13 pm
by hallsofvallhalla
I am swamped with work and have very little time to work on FS or QOC.
I do have some spare time so I was gonna make a fun little market type game for IR. Just something to goof with and we can see who can make the most money. Maybe a very simple casino game or stock market game. Nothing special, nothing flashy. I amusing this to learn some more on JS and algorithms.
Suggestions wanted...
Re: Money Market Game
Posted: Fri Sep 24, 2010 6:22 pm
by Jackolantern
How about making it a
real market game, and actually use stock ticker web services to track the real value of real stocks?

Each person could get so much virtual money to start, invest it in stocks, and then the value of their stocks could be kept in a database. Then it could just run a cron each day to update with the current value!
Code: Select all
<?php
//set up stock symbol
$symbol = "AMZN";
echo "<h1>Stock quotes for ".$symbol."</h1>";
//open URL to prepare to extract web service data
$url = 'http://finance.yahoo.com/d/quotes.csv'.'?s='.$symbol.'&e=.csv&f=sl1d1t1c10hgv';
if (!($contents = file_get_contents($url))) {
die("Failure to open ".$url);
}
//extract relevant data
list($symbol, $quote, $date, $time) = explode(',', $contents);
$date = trim($date, '"');
$time = trim($time, '"');
//display or process relevant data
echo "<p>$symbol last sold at $quote</p>";
echo "<p>Quote current as of $date at $time</p>";
echo "<p>This information retrieved from<br />$url";
?>
Re: Money Market Game
Posted: Fri Sep 24, 2010 11:36 pm
by hallsofvallhalla
that actually sounds fun! I will look into it.
I began working on a just mini game type site where we all start with same money but play games to win more. Named it First to a Million, I could add the real stocks to this.
I was also gonna have lottery every day and lots o mini games
Quick rough draft

Re: Money Market Game
Posted: Fri Sep 24, 2010 11:49 pm
by SpiritWebb
Jackolantern wrote:How about making it a
real market game, and actually use stock ticker web services to track the real value of real stocks?

Each person could get so much virtual money to start, invest it in stocks, and then the value of their stocks could be kept in a database. Then it could just run a cron each day to update with the current value!
Code: Select all
<?php
//set up stock symbol
$symbol = "AMZN";
echo "<h1>Stock quotes for ".$symbol."</h1>";
//open URL to prepare to extract web service data
$url = 'http://finance.yahoo.com/d/quotes.csv'.'?s='.$symbol.'&e=.csv&f=sl1d1t1c10hgv';
if (!($contents = file_get_contents($url))) {
die("Failure to open ".$url);
}
//extract relevant data
list($symbol, $quote, $date, $time) = explode(',', $contents);
$date = trim($date, '"');
$time = trim($time, '"');
//display or process relevant data
echo "<p>$symbol last sold at $quote</p>";
echo "<p>Quote current as of $date at $time</p>";
echo "<p>This information retrieved from<br />$url";
?>
That could make things more interesting!!
Re: Money Market Game
Posted: Sun Sep 26, 2010 6:01 pm
by Noctrine
It'd be better to use fake stocks. Because if you use real stocks you can't effect the market.
Re: Money Market Game
Posted: Sun Sep 26, 2010 8:48 pm
by Jackolantern
Noctrine wrote:It'd be better to use fake stocks. Because if you use real stocks you can't effect the market.
While that is true, using real stocks adds a much more realistic aspect to picking and choosing stocks. It just depends on how deep the game is desired to be. Using fake stocks would lend itself more to a game that people could pop in once a day and play for a couple of minute before moving on. Using real stocks would lend itself more to players who at least do a bit of market research doing the best.
EDIT: Of course "market research" sounds so boring, but for example, say you hear on a rumor website that Apple is releasing a new gadget, so you go and invest a huge amount in them before it is publicly announced, hoping that the rumor was right. Or you invest in McDonalds after seeing a news article about them re-dressing their stores to look more like cafes (which they did a couple of years ago and it re-invigorated the brand which had been slumping).
Re: Money Market Game
Posted: Sun Sep 26, 2010 9:38 pm
by hallsofvallhalla
i love the idea of using real stocks. Jack can you PM me more details on where you got the above and where I can find all the symbol listings?
Re: Money Market Game
Posted: Sun Sep 26, 2010 9:47 pm
by hallsofvallhalla
K found the symbol list, just got to figure out which ones to use and how to gather them all in one deal instead of entering each symbol.
never mind think I figured it out...rock on.
Re: Money Market Game
Posted: Sun Sep 26, 2010 9:57 pm
by Jackolantern
Awesome! Do you think you may end up showing the code for the final game? I had some ideas for some stock-related games as well

Re: Money Market Game
Posted: Sun Sep 26, 2010 10:04 pm
by hallsofvallhalla
i can yes.
I did not figure out how to truly pull all the symbols at once but to be honest I don't know that i want to deal with all the stocks. Will be too many to deal with in the beginning. Was thinking maybe 20 of the ones we know.
Anyone disagree?