Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Simple 'Sanity Check' For Algos?

I see algos posted with returns in the 100s and 1000s of % which is great as it shows new users are joining up and - like me - learning.

But wouldn't a simple sanity check just be to add this:

record(Cash=context.portfolio.cash)  

as the last line in handle_data? If an algo is going massively into -ve cash in order to make massive returns it needs a rethink, surely? Daniel did some very nice work here on limiting leverage which I really want to start using. I'm not suggesting this should be in every beginning algo but some basic check would be sensible. Any thoughts?

P.

3 responses

Peter,
You bring up a great point. Leverage is a double edged sword and that should be dealt very carefully. Thank you for pointing this out.

Maji

Hello Peter,

It ends up being a bit more complicated than just looking at cash, for an algo that uses shorting/margin. But if the algo is designed to be long only and cash goes negative, then it is a sure sign that something is amiss. In addition to Daniel, "Dennis C" also did some work in this area, but I have not dug into it fully.

I figure that Quantopian will eventually have to sort out how to manage this, since Interactive Brokers will be setting limits. I wonder if they'll be sending info./warnings to the Quantopian API?

Grant

Hello,

Any short positions would add to the cash position so a long/short algo with -ve cash is even worse.

P.