Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Another way to get the VIX data in a strategy

I got a strategy that uses the VIX data from Quandl, but now I'm getting this warning:
ZiplineDeprecationWarning: Quandl datasets stopped updating on Quantopian on May 30, 2020. Quandl data prior to May 30, 2020 is still available for use on Quantopian; however, the dataset has stopped updating.

Does anybody know the best and simple way to change the Quandl to get the VIX data in an algo?

6 responses

Hi Sergey,

The best source of VIX data is directly from CBOE and you can use the Self-Serve feature to upload the data including adding a live updating component via google sheets, leveraging IMPORTDATA to programmatically update the data from CBOE on an hourly basis.

Since Vix is not a supported asset in the quantopian universe, we can leverage SPY as a known symbol and broadcast the self-serve dataset values to other assets in pipeline (if needed) using the tips in Self serve data without access to symbols.

There are some other formatting issues and requirements that need to be addressed with the raw CBOE data, this google sheet details all the steps necessary to cleanup the raw data for self-serve, including renaming columns, adding the missing symbol column and filtering the data for use as a live public url.

If you want quick access:

  1. This worksheet link will give you the full (up-to-date) historical CBOE data (it will auto-download a file CBOE_VIX - Historical full data.csv)
  2. follow the instructions in Step 9, Using https://docs.google.com/spreadsheets/d/e/2PACX-1vRZd5_kjV9wTc6-AR6MxMJG3tDaGnJQ4KjZqn3NwwOjolCc_uXeOYk2WG8NE_uw9_MFUYK_FfUvcf2T/pub?gid=0&single=true&output=csv as the Public Url
  3. Don't forget to adjust your pipelines to access the raw data from the asset SPY and broadcast if needed using the link above. The raw column names will be identical to the original Quandl ones.

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Hi Chris,

I tried to follow the Steps but was not able to figure out how to use the uploaded custom data. I can see the data was uploaded in Research:

from quantopian.pipeline import Pipeline  
from quantopian.research import run_pipeline  
from quantopian.pipeline.data.user_5915411cde5cfc72f641f655 import cboe_vix

pipe = Pipeline(  
        'my_dataset': cboe_vix.vix_open.latest  

df = run_pipeline(pipe, '2004-01-02', '2020-07-17')  

But not sure how to get it work on IDE.

I used to get VIX from quandl as follows:

class GetVIX(CustomFactor):  
    window_length = 1

    def compute(self, today, assets, out,  slice):  
        out[:] = slice

def initialize(context):  
    # only using the pipe for VIX currently  
    context.spy = sid(8554)  

    The_Pipe = Pipeline()  
    attach_pipeline(The_Pipe, 'The_Pipeline')  
    #get VIX at market open  
    The_Pipe.add(GetVIX(inputs=[cboe_vix.vix_open]), 'VixOpen')  

def before_trading_start(context, data):

    # The Pipeline Output  
    The_Output       = pipeline_output('The_Pipeline')  
    context.VIXprice = The_Output["VixOpen"].iloc[0] # VIX at market open  

Any way to re-purpose this code to work with the custom data by just replacing the import statement:

from quantopian.pipeline.data.user_5915411cde5cfc72f641f655 import cboe_vix  

Please advise.

Thank you!


Hi Hieu,

Any way to re-purpose this code to work with the custom data by just replacing the import statement:

Yes, however the datasets are different types so you need to take into account the details provided in the post Self serve data without access to symbols. The original Quandl dataset is macro data that can be broadcast vs Self-Serve which is asset mapped and needs to be sliced first in order to broadcast.

The easiest two line solution is to slice the Self-Serve dataset to the SPY asset you used to asset map originally:

# Here we pass our slice using the original SPY asset  
The_Pipe.add(GetVIX(inputs=[my_slice]), 'VixOpen')  

Note: symbol is required for use in the IDE, symbols('SPY') in research

Hope this helps

Hi Chris,

Your two line solution worked beautifully!

Thank you!


Hi Chris or Sergey

Could you please copy a backtest example (complete code with print and record) to get vix data from cboe using this function?
I am a beginner and I have a hard time switching from fetch_cvs/pre_func to pipeline/selve_serve.

Thanks in advance, I will appreciate very much.


Hi Chris,

I was able to successfully create a new custom VIX dataset using your instructions.

I'm trying to access the VIX data in Research so used the following code to create the Pipeline:

from quantopian.pipeline import Pipeline  
from quantopian.research import run_pipeline  
from quantopian.pipeline.data.user_5f31b36b9740db0014f72b41 import cboe_vix

pipe = Pipeline(  
        'vix_close': cboe_vix.vix_close.latest  

cboe_vix = run_pipeline(pipe, '2019-01-02', '2020-09-18')  

I'm trying to apply a slice so I can broadcast the data using the following code:


However, I receive the following error when I run this:

TypeError: Cannot convert input to Timestamp  

Please advise. I need to be able to access the dates for each VIX closing price so I can plot.