Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

The following takes the last 5 members of the Dow Jones index and plots the correlation matrix of the last 5 years of daily prices:

mem = FinancialData["^DJI", "Members"];
findata = 
  FinancialData[#, "Price", {{2007}, {2012}, "Day"}][[All, 2]] & /@ 
   mem[[-5 ;; -1]];
fincm = Correlation[Transpose@findata];

tb = Map[Item[NumberForm[#, 2], 
     Background -> 
      ColorData["TemperatureMap"][Rescale[#, {-1, 1}]]] &, fincm, {2}];
tb = Prepend[tb, mem[[-5 ;; -1]]];
tb = Join[List /@ Prepend[mem[[-5 ;; -1]], ""], tb, 2];
GraphicsGrid[tb, ImageSize -> 500, Frame -> All]

But what if I want to compare 5 specific equities instead from various listed exchanges; i.e CWC.L, CAP.PA, IFX.DE, ISYS.L and LAD.L?

Anyone?

share|improve this question

1 Answer 1

You just need to find the correct names for the equities you're interested in using, for instance :

FinancialData["*CWC*", "Lookup"]

Then you can define :

equities = {"L:CWC", "PA:CAP", "DE:IFX", "L:ISYS", "L:LAD"};

findata = FinancialData[#, "Price", {{2007}, {2012}, "Day"}][[All, 2]] & /@
equities;
share|improve this answer
    
Hi @b.gatessucks I tried to use your solution but somehow it is not working. Can you post the complete changes instead of partially stating the change in only the first two lines? There are more dependencies further along the code. Thanks –  sebastian c. Oct 28 '12 at 21:35
2  
It's because the different data sets have different length. It's up to you how you want to fix this; for instance, you can take the most recent n data points, where n is the minimum length. Alternatively you can use only data relative to the common dates, which you can get with Intersection. Make an effort and come back with a specific question if you get stuck. –  b.gatessucks Oct 29 '12 at 8:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.