Name_________________ net-id _______ Name_________________ net-id _______ Name_________________ net-id _______ Name_________________ net-id _______
Snarf class-work stockstufff to work with these problems, see code here.
The class has been hired to test the random number generator in Python and to find trends in how some stocks trade over time. In particular we need to run two tests:
If the simulated coins are tossed and diagrammed as "HTTTHHTTHHHHTT" then there is a run of three tails and a run of four heads. Find all such runs of length three.
Class answers are the same in the code below because the random number seed is set to 1.
We have stock data code that uses the Yahoo
Finance API to get data for any stock. The code gets all data for
a stock, e.g., open, high, low, volume, etc., but just reports
closing price and volume for the stock. The data is given in a
list of tuples (a tuple is just like a list, but it's immutable,
it can't change --- and uses parentheses in display instead of
brackets). Here's the list returned by the call
data = getWebData("GOOG", "20120913", "20121009")
[ ('2012-09-13', 706.04, 2659000), ('2012-09-14', 709.68, 2618500), ('2012-09-17', 709.98, 1508300), ('2012-09-18', 718.28, 2066800), ('2012-09-19', 727.5, 3098300), ('2012-09-20', 728.12, 2907400), ('2012-09-21', 733.99, 6359100), ('2012-09-24', 749.38, 3563800), ('2012-09-25', 749.16, 6058500), ('2012-09-26', 753.46, 5672900), ('2012-09-27', 756.5, 3931100), ('2012-09-28', 754.5, 2783500), ('2012-10-01', 761.78, 3168000), ('2012-10-02', 756.99, 2790200), ('2012-10-03', 762.5, 2208300), ('2012-10-04', 768.05, 2454200), ('2012-10-05', 767.65, 2735900), ('2012-10-08', 757.84, 1958600), ('2012-10-09', 744.09, 3003200)]
data
in the format above.