4

1

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 `TimeSeriesThread`

as

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

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.

@ eldo thanks. Sometimes, being occasional user of Ma makes me look stupid. Thanks again and I hope more answers will follow – ramesh – 2015-12-30T01:48:57.763

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) – Edmund – 2015-12-30T01:49:26.450@ 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. – ramesh – 2015-12-30T06:03:09.963

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. – eldo – 2015-12-30T12:50:59.550

@ramesh With TemporalData, your dates/times need not be the same. – kale – 2015-12-30T17:30:12.160

@kale That's simply not true. Also with

`TemporalData`

you get Lengths of`61`

(Europe) and`60`

(USA) – eldo – 2015-12-30T18:13:47.390`TemporalData[FinancialData[#, "Close", {{2010}, {2015}, "Month"}] & /@ {"AAPL", "BA", "IBM", "BMW.DE", "DIS", "R", "PEP", "BRBY.L", "AXP", "BTI"}]`

works perfectly.`%["PathLengths"]`

gives`{60, 60, 60, 61, 60, 60, 60, 61, 60, 60}`

. – kale – 2015-12-30T19:20:01.923Yes, it works, and that is dangerous, because the paths have different lengths, i.e. the dates don't correspond. – eldo – 2015-12-30T19:43:49.230

@eldo We'll agree to disagree, but since

`TemporalData`

keeps all times (since we fed it dates for each series) you can still use those dates via`td["TimeList"]`

. – kale – 2015-12-30T21:19:11.873Good feedbacks. I wonder why we cannot merge time series with different length assigning ' NA' or 'Missing' to those series which do not have values to certain dates. I remember, it is very easy in other program such as R. – ramesh – 2015-12-31T16:42:50.940

I'll try to answer that next year - have a nice party :) – eldo – 2015-12-31T16:56:54.963