Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Urgent help Needed

How can I plot volatility in Quantopian IDE?

1 response

Volatility of what? Your portfolio, SPY, individual stocks? Over what time period?

Have you had a look at the API documentation? I'd check out both the built in class AnnualizedVolatility as well as the heading: Recording and plotting variables.

class AnnualizedVolatility(*args, **kwargs)  
Volatility. The degree of variation of a series over time as measured by the standard deviation of daily returns. https://en.wikipedia.org/wiki/Volatility_(finance)

Default Inputs: zipline.pipeline.factors.Returns(window_length=2) # noqa

Parameters: annualization_factor (float, optional)  The number of time units per year. Defaults is 252, the number of NYSE trading days in a normal year.  
Recording and plotting variables  
You can create time series charts by using the record method and passing series names and corresponding values using keyword arguments. Up to five series can be recorded and charted. Recording is done at day-level granularity. Recorded time series are then displayed in a chart below the performance chart.

In backtesting, the last recorded value per day is used. Therefore, we recommend using schedule_function to record values once per day.

In live trading, you can have a new recorded value every minute.

A simple, contrived example: