Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Well I think I made a mistake

I changed the weights of my leverages from +- 0.5 to +-1 and I think I broke it

1 response

When you set the leverage to 1 or -1, the type of that variable is an integer.

The result of the code on line 125 would be an integer as well, for example: -1/40 = -0.025, but because the result will be an integer, the actual outcome becomes -1. So instead of ordering 40 securities at -0.025, you're ordering 40 securities at -1.

When you look at your actual leverage in the graph you see values between 2 and 100+. Slightly too much to be tradeable ;)

Quick solution: Just change the 1 and -1 to 1.0 and -1.0