Hi!
I am back-testing a trading strategy on the members of a stock index. I have historical stock price date for every years. I would like to merge these time-series objects. My problem is that the index constituents are not the same , therefore I could not simple rbind them. Merging is not an option as well, because it creates separate columns for the same stocks from different years. Could someone suggest me a solution?
Here is an example of my problem:
xts1:
AAPL AMZ AA AXP
11/01/2020 100 85 90 70
12/01/2020 105 70 80 90
xts2:
AAPL AM AXP BA
01/01/2021 108 75 80 50
02/01/2021 110 60 70 60
final xts:
AAPL AMZ AA AXP BA
11/01/2020 100 85 90 70 NA
12/01/2020 105 70 80 90 NA
01/01/2021 108 75 NA 80 50
02/01/2021 110 60 NA 70 60