Back to Community
Another way to get the VIX data in a strategy

Hi.
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?

4 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.
Disclaimer

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(  
    columns={  
        'my_dataset': cboe_vix.vix_open.latest  
    },  
    screen=cboe_vix.vix_open.latest.notnull()  
)

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

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')  
    schedule_function(Rebalance,date_rules.every_day(),time_rules.market_open(minutes=1))  

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!

Hieu

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  
my_slice=cboe_vix.vix_open.latest[symbol('SPY')]  
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!

Hieu