Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Can we use 'record' function to plot portfolio equity?

From the documentation I see we can use 'record' to plot stock data, such as moving averages. Can we also use 'record' function to plot portfolio equity? I'm hoping so, as this would be an easy way to see at a glance if one's algo was leveraging beyond reasonable levels to generate the huge % gains one sometimes gets when conducting our 'in silico' experiments.

I tried record(context.portfolio.positions_value) but it returned a runtime error.

3 responses

You can track leverage with
record('Leverage', context.account.leverage)

The reason why you had an error is that the record function needs something to label what it's recording. There are two formats, the one above is
record('what you want it to be labeled', what_to_record)
If you type in "record(" in the IDE, and hover your cursor over it. The IDE will guide you through it.

Calvin =]

Thank you, Calvin. Very helpful.