Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Learning Fun: Monkey Throwing Darts

I am learning Quantopian and quantitative investing in general. I did this simple "monkey throwing darts" algorithm to teach myself the basics of pipelines and reading backtest results, and thought I'd share for your amusement. It puts 100% of the portfolio in a random stock every day.

3 responses

Interesting. Same algo but doesn't keep accumulating stocks and maintains leverage of 1 (about). Note results will be different every time its run because of the use of the random function.

Another pipeline approach, selling before buying and then targeting just buying with available cash (considering there can be partial sells). Plus PvR and track_orders. When cash goes below zero you'll see it's because the buy happens at a higher price (a minute later) than the price when ordered.

When using a random number generator, I recommend getting into the habit of setting a fixed seed. This way, for a given set of settings (start/end dates, capital, etc.) the algo will return the same result every time. As I understand, Quantopian requires this for live algos (but I'm not sure exactly why).