Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Suppose you ignored any sensible advice ...

... and behaved like this. If you couldn't afford to lose a couple thousand, you'd deserve every bit of what happens to you in 2009. If you could, however, you might find yourself able to afford a lot of goats and chickens.

Edit:

For reference, this employs a median reversion strategy (with the median taken over a 60 day history), and it trades every 15 days. It weighs heavily (50%) the stock with the single largest (percentage-wise) negative deviation from its 60-day median, and maintains a 10% position in the stock with the largest positive deviation from its 60-day median.

3 responses

I suspect your leverage is well beyond 1.

In any case, per the help page:

before_trading_start(context, data)

Optional. Called daily prior to the open of market. Orders cannot be placed inside this method. The primary purpose of this method is to use Pipeline to create a set of securities that your algorithm will use.

So maybe something was changed in Q2?

I couldn't tell you. However, it's not unusual for software to be undocumented or, even, anti-documented.

The problem here is that you have selected the stock pool based on hindsight.

If you had a forumla for selecting the stock pool, it might actually be an acceptable algo.