Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Why am i getting such a high return?

I am new to this forum thing so sorry if I do it wrong, but I do not understand why it is showing such high returns. I think it is because of the initial capital, but i do not know how to keep it from going over the max. Thank you for your help.

1 response

You keep ordering 50 shares of those securities, meaning after a while you're buying more shares than you have capital for. This results in your leverage becoming > 1.

Add this to the end of your order function to record the leverage and you'll see that's it's probably going out of control: record(leverage = context.account.leverage)

Think about reworking your code to use order_percent() instead.

Hope this helps