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?



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]] & /@
  • $\begingroup$ 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 $\endgroup$ Oct 28, 2012 at 21:35
  • 2
    $\begingroup$ 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. $\endgroup$ Oct 29, 2012 at 8:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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