(* define the function to get the January data *)
cc[stock_, year_] := FinancialData[stock, {{year, 1, 1}, {year, 1, 31}}]
(* plot multiyear graphs*)
Table[DateListPlot[cc["^DJI", year], PlotStyle -> {If[First[Last[#][[2]] - First[#] [[2]] >= 0 & /@ {cc["^DJI", year]}], Green, Red]}, Joined -> True, PlotLabel -> year], {year, 1991, 2006}]
Here is DOW and NASDAQ January performance from 1991 to 2006. By comparing the first and last trading day, if it gains, the line color is green, otherwise, it is red.
DOW January Performance (1991~2006)
You see, Mathematica does come in handy sometime!
2 comments:
HI, I thought you'd be interested that you can blog directly from Mathematica using http://scientificarts.com/worklife
This would be ideal for the sort of blog you are creating here.
For a couple of examples of blogs created with this look at
http://scientificarts.com/worklife/wlfwblog/
and
http://www.luttrell.org.uk/blogs/enigmatics/
I apologize for posting this as a comment, but there wasn't a "contact" link on your blog. Let me know if you have any questions!
--David (author of A WorkLife FrameWork)
Could anyone provide me with some hints how to construct seasonal charts like in
http://www.seasonalcharts.com/
Thanks,
Holger
Post a Comment