Jan 4, 2008

Play with Numbers: January Financial Market Performance

I am getting curious about the stock market during the lunch time. I like to check the January performance in the past.

(* 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)
NASDAQ January Performance (1991~2006)

You see, Mathematica does come in handy sometime!


David said...

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




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)

vJD said...

Could anyone provide me with some hints how to construct seasonal charts like in