Commit e6dd791d authored by Imanol Pérez's avatar Imanol Pérez Committed by GitHub
Browse files


parent 2e640539
# MonteCarlo and Arima for stock selection
See an article about the code on <a href="">tulipQuant</a>.
The idea of the trading algorithm will be the following:
<li>Given a day, for each stock of a certain index, select the best ARIMA model for this stock.</li>
......@@ -76,12 +78,10 @@ The code is quite straightforward. The whole code is available on GitHub, or in
So, is this strategy better than the buy-and-hold strategy? Since the code is <em>really</em> slow, I wasn't able to run it for a big period of time. I only backtested it with data from the end of 2014, to nowadays. The returns are shown in the following chart:
<div style="text-align: center;"><img src="" alt="arima" width="467" height="356" class="alignnone size-full wp-image-89" /></div>
<div style="text-align: center;"><img src=""/></div>
The strategy behaved really well, and in this period the cumulative return was 1399.08%, which is really impressie. I did test it with some other small periods, and the returns were equally impressive. I was not able to test it for long periods, due to the speed of the code. However, if someone wants to test it, he is welcome to share the results obtained.
I have uploaded an <a href="">Excel spreadsheet</a> with the returns of this strategy in this time period.
<h1>The whole code</h1>
In order to improve speed a little bit, instead of considering all the stocks that are obtained with the function <code>stockSymbols()</code>, it just selects a few of them randomly. Also, <code>stockSymbols()</code> returns a list of stocks that exist <i>now</i>, but many of them didn't exist a few years ago. So the code could be improved a lot.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment