The cornerstone of your analysis and quantitative trading algorithms are data. There are lots of different ways how to do it in R (depending of what your investment instruments are). Today I am going to download data from finance.yahoo which are stock prices of companies included in S&P 500 index.
First of all, we have a list of S&P 500 companies saved in this csv file. I have removed one or two tickers.
1 2 3 4 5 6
Then we have to specify the start date and make a loop to download all the data for every company in the list.
1 2 3 4 5 6 7 8
I am loading quantlib, tseries and timeDate libraries for easier manipulation of data and because I am going to utilize them in the future posts.
I have encountered a strange problem several times when the provided URL couldn't be read. Have you had the same problem?