Reference no: EM132174949
Using R
Stock Trading System
a. Download a financial data (e.g. stock, gold, and oil price) from any web site like Yahoo finance, Google finance, quandl.com, and so on. i. You may need to figure out how to extract the data from those web sites by yourself. It's recommended to use API they provide but not parse html codes.
b. The data should be a time series data, which means x is date (1-dimension) and y is price.
c. Plot the price change using R i. plot(x,y)
d. Using linear regression and prices of last k days including current prices, predict next day's prices. For example, if k = 5, the program will predict the price of 7/10/15 with actual prices during 7/5/15 ~ 7/9/15 assuming that we do not know the price of 7/10/15 on 7/9/15. Based on your predicted price of 7/10/15, you decide to buy or sell on 7/9/15.
Of course, you will pay or earn the actual price of 7/9/15 if you buy or sell on 7/9/15.
Then, again the simulation program continually predicts the price of 7/11/15 with actual prices during 7/6/15 ~ 7/10/15. Similarly you decide to buy, sell, or do nothing on 7/10/15 based on the predicted price of 7/11/15.
e. Using the predicted prices, do trading simulation for a long-term period and returns earning rate (final balance / balance at start). For example, if you predict that the price will increase tomorrow, you may want to buy one today and sell tomorrow. The trading strategy like when to buy and sell is up to the programmer.
f. We do not consider trading fees and tax in the simulation.
g. The simulation should be performed day by day (probably using for loop) but not necessary to buy or sell every day.
h. The simulation period is up to programmer (e.g. 1/1/2013 ~12/31/2014).
i. Please also plot predicted prices as well as original prices. Include the image file for the plot in your submission.