I am trying to merge two or more financial time series. For example,

fts1 = TimeSeries[
   FinancialData["WMT", "Close", {{2010}, {2015}, "Month"}]];
fts2 = TimeSeries[
   FinancialData["TGT", "Close", {{2010}, {2015}, "Month"}]];
fts3 = TimeSeries[
   FinancialData["VZ", "Close", {{2010}, {2015}, "Month"}]];

I have been able to merge them using TimeSeriesThreadas

allfts = TimeSeriesThread[{#[[1]], #[[2]], #[[3]]} &, {fts1, fts2, 

I am looking for more ways to merge these financial time series. More robust ways to merge more financial time series (over 100 time series) would be very useful. What I mean by robust is that if I could download multiple financial time series and merge them together at one time, instead doing in two steps as shown here. Thanks for your time.


It's simply

TimeSeriesThread[# &, {fts1, fts2, fts3}]


TimeSeries@TimeSeriesThread[# &,
  Map[FinancialData[#, "Close", {{2010}, {2015}, "Month"}] &, {"WMT", "TGT", "VZ"}]]
  • $\begingroup$ @ eldo thanks. Sometimes, being occasional user of Ma makes me look stupid. Thanks again and I hope more answers will follow $\endgroup$
    – ramesh
    Dec 30 '15 at 1:48
  • $\begingroup$ I was going to go for TimeSeriesThread[Identity, {fts1, fts2, fts3}] but it is essentially the same as what you have provided so I'll skip posting. (+1) $\endgroup$
    – Edmund
    Dec 30 '15 at 1:49
  • $\begingroup$ @ eldo thank you so much for your time especially for revised answer. I tried to use your code as follows allfts = TimeSeries@ TimeSeriesThread[# &, Map[FinancialData[#, "Close", {{2010}, {2015}, "Month"}] &, {"AAPL", "BA", "IBM", "BMW.DE", "DIS", "R", "PEP", "BRBY.L", "AXP", "BTI"}]]; For some reason, I got error massage. Any help would be greatly appreciated when you get a chance. $\endgroup$
    – ramesh
    Dec 30 '15 at 6:03
  • $\begingroup$ The problem here is that you have stocks from different exchanges. Bank holidays in Germany or UK are different from those in the US. Consequently, the dates become inhomogeneous. Any solution would be non-trivial, and you should pose a new question. $\endgroup$
    – eldo
    Dec 30 '15 at 12:50
  • $\begingroup$ @ramesh With TemporalData, your dates/times need not be the same. $\endgroup$
    – kale
    Dec 30 '15 at 17:30

Don't forget about TemporalData. It serves a lot of the same purposes as TimeSeries. The docs even say it "represents a collection of paths".

TemporalData[{fts1, fts2, fts3}]

To plot:


Mathematica graphics

  • $\begingroup$ @ kale Thanks for your time. $\endgroup$
    – ramesh
    Dec 30 '15 at 5:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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