R
Ruby Quiz
The three rules of Ruby Quiz:
1. Please do not post any solutions or spoiler discussion for this quiz until
48 hours have passed from the time on this message.
2. Support Ruby Quiz by submitting ideas as often as you can:
http://www.rubyquiz.com/
3. Enjoy!
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
I'm a member of a local stock club. For those of you not familiar with such
clubs, they're just a group of people who pool resources (primarily knowledge,
research time, and finances) to purchase stocks.
My particular club makes use of a lot of technology for information and
communication. A recent request was a tool to practice investing. This is
especially helpful to inexperienced members. The idea is that they can pretend
to purchase a few stocks (preferably after studying their choices!) and then see
how they do over time.
This week's Ruby Quiz is to build this simple tool.
Here's a sample run to get the ideas flowing:
$ ./portfolio
Buy (symbol shares/dollars): PIXR $1000
You purchased 23 shares of PIXR for $991.53.
Buy (symbol shares/dollars): GOOG 3
You purchased 3 shares of GOOG for $887.55.
Buy (symbol shares/dollars):
+--------+--------+-----------+----------------+---------------+-----------+
| Symbol | Shares | Buy Price | Buy Date | Current Price | Gain/Loss |
+--------+--------+-----------+----------------+---------------+-----------+
| GOOG | 3 | $ 295.85 | 07/25/05 19:53 | $ 295.85 | $ 0.00 |
+--------+--------+-----------+----------------+---------------+-----------+
| PIXR | 23 | $ 43.11 | 07/25/05 19:53 | $ 43.11 | $ 0.00 |
+--------+--------+-----------+----------------+---------------+-----------+
Later, I can see how my shares are doing:
$ ./portfolio
+--------+--------+-----------+----------------+---------------+-----------+
| Symbol | Shares | Buy Price | Buy Date | Current Price | Gain/Loss |
+--------+--------+-----------+----------------+---------------+-----------+
| GOOG | 3 | $ 295.85 | 07/25/05 19:53 | $ 293.29 | $ -7.68 |
+--------+--------+-----------+----------------+---------------+-----------+
| PIXR | 23 | $ 43.11 | 07/25/05 19:53 | $ 43.44 | $ 7.59 |
+--------+--------+-----------+----------------+---------------+-----------+
Don't feel tied to this exact display or interface. Some interesting ideas
might be to show historical data before asking a user to confirm their choice,
or plot changes over regular intervals instead of just showing the initial and
current prices. If you think of something else, go for it.
I think this is a great quiz for beginners wanting to learn more about Ruby's
standard library. If that describes you, I encourage you to give it a try.
(Hint: Many web sites offer stock data, all you need do is figure out how to
get it...)
1. Please do not post any solutions or spoiler discussion for this quiz until
48 hours have passed from the time on this message.
2. Support Ruby Quiz by submitting ideas as often as you can:
http://www.rubyquiz.com/
3. Enjoy!
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
I'm a member of a local stock club. For those of you not familiar with such
clubs, they're just a group of people who pool resources (primarily knowledge,
research time, and finances) to purchase stocks.
My particular club makes use of a lot of technology for information and
communication. A recent request was a tool to practice investing. This is
especially helpful to inexperienced members. The idea is that they can pretend
to purchase a few stocks (preferably after studying their choices!) and then see
how they do over time.
This week's Ruby Quiz is to build this simple tool.
Here's a sample run to get the ideas flowing:
$ ./portfolio
Buy (symbol shares/dollars): PIXR $1000
You purchased 23 shares of PIXR for $991.53.
Buy (symbol shares/dollars): GOOG 3
You purchased 3 shares of GOOG for $887.55.
Buy (symbol shares/dollars):
+--------+--------+-----------+----------------+---------------+-----------+
| Symbol | Shares | Buy Price | Buy Date | Current Price | Gain/Loss |
+--------+--------+-----------+----------------+---------------+-----------+
| GOOG | 3 | $ 295.85 | 07/25/05 19:53 | $ 295.85 | $ 0.00 |
+--------+--------+-----------+----------------+---------------+-----------+
| PIXR | 23 | $ 43.11 | 07/25/05 19:53 | $ 43.11 | $ 0.00 |
+--------+--------+-----------+----------------+---------------+-----------+
Later, I can see how my shares are doing:
$ ./portfolio
+--------+--------+-----------+----------------+---------------+-----------+
| Symbol | Shares | Buy Price | Buy Date | Current Price | Gain/Loss |
+--------+--------+-----------+----------------+---------------+-----------+
| GOOG | 3 | $ 295.85 | 07/25/05 19:53 | $ 293.29 | $ -7.68 |
+--------+--------+-----------+----------------+---------------+-----------+
| PIXR | 23 | $ 43.11 | 07/25/05 19:53 | $ 43.44 | $ 7.59 |
+--------+--------+-----------+----------------+---------------+-----------+
Don't feel tied to this exact display or interface. Some interesting ideas
might be to show historical data before asking a user to confirm their choice,
or plot changes over regular intervals instead of just showing the initial and
current prices. If you think of something else, go for it.
I think this is a great quiz for beginners wanting to learn more about Ruby's
standard library. If that describes you, I encourage you to give it a try.
(Hint: Many web sites offer stock data, all you need do is figure out how to
get it...)