Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Hoping I'm on to something here. What do you guys think?

Takes a 10 day average from 200-190 days ago per security in universe. If the current price is greater then that average, counts that stock as a match. Keeps a 100 day history of the percentage of securities that successfully matched. If the current percentage of securities that matched is greater than the average of the last 100 and greater than 30% then this set of matches becomes the portfolio and are ordered largest to smallest on how much greater their current price is from the 10 day average. If any of that makes sense.

3 responses

You might be onto something, low beta, up during '08, good looking curve springing upward quickly, that's good.

Now the bad news: The chart and seemingly respectable return isn't really what's happening, it isn't fair to an investor if you have one (if you'll allow me to inject a hypothetical for the community), since the algo started with his $50K and profited $233,507 (467% shown) however it spent $568,475 of his money to get there for only 41.1% return. It appears to be over 10x that. It is actually less than 1/3 of the benchmark, more info. The metrics & chart disregard/ignore margin/borrowing/negative cash, that's the way it's done currently. On the other hand the beta is probably even better than what you see. First time I've seen over 4000 stocks processed.

You're doing the right thing to chart capital used (or just cash) and leverage, however there's a point where capital_used shows 7x while leverage shows only 2x. I don't understand how that's possible and suggest Q might want to look into it. (It doesn't appear to be merely spike/smoothing in the custom chart).

Trying to keep the leverage below 1 seems to be my kryptonite, so I switched to trying to keep it below 3 (just based off the contest rules). I was hoping the 568k dip was due to leverageing to above three at the end there with 467% of the original 50k in capital, so a total of 700500 to work with at that point. I would really like to find out how to keep this algo from going over 1 leverage though. If anyone has any pointers, I would appreciate it.

The def for canceling orders per stock, ok. The other would not work though, replace with one of these. It would have canceled the sells in risk_off(), maybe reverse the order on those.