Contents
Alternative Data
CBOE
CBOE
Introduction
CBOE publishes daily exports of their most popular indexes which QuantConnect caches for easy deployment. The indexes are centered on their volatility products, and start in 2004.
The VIX index is an up to the minute estimate of how the market expects the volatility to be over the following 30 days, calculated based on the bid-ask spread of SPX options.
Usage
Requesting Data
To add CBOE data to your algorithm use the AddData()
system to request the data. As with all datasets, you should
save a reference to your symbol for easy use later in your algorithm. For detailed documentation on using custom data
see Importing Custom Data.
// Daily OHLC for VIX Index since 2004. var vix = AddData<CBOE>("VIX").Symbol;
# Daily OHLC for VIX Index since 2004. vix = self.AddData(CBOE, "VIX").Symbol
Accessing Data
Data can be accessed via the Slice events. Slice delivers the unique events to your algorithm as they happen. We recommend saving the symbol object when you add the data for easy access to slice later. Data is available in daily resolution. You can see an example of the slice accessor in the code below.
using QuantConnect.Data.Custom.CBOE; namespace QuantConnect.Algorithm.CSharp { public class CBOEAlgorithm : QCAlgorithm { public override void Initialize() { SetStartDate(2019, 1, 1); // Daily OHLC for VIX Index since 2004. AddData<CBOE>("VIX"); } public override void OnData(Slice data) { // Accessing via Slice event var vix = data.Get<CBOE>(); foreach (var volatility in vix.Values) { Log($"Value: {volatility.Value}"); } } } }
from QuantConnect.Data.Custom.CBOE import * class CBOEAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2019, 1, 1) # Daily OHLC for VIX Index since 2004. self.AddData(CBOE, "VIX") def OnData(self, data): # Accessing via Slice event vix = data.Get(CBOE) for volatility in vix.Values: self.Log(f"Value: {volatility.Value}")
All custom data has the properties Time
, Symbol
, and Value
.
Historical Data
You can request historical custom data in your algorithm using the custom data Symbol object. To learn more about historical data requests, please visit the Historical Data documentation. If there is no custom data in the period you request, the history result will be empty. The following example gets daily ohlc for vix index since 2004. historical data using the History API.
// Request 60 days of daily ohlc for vix index since 2004. history with the vix Symbol var history = History<CBOE>(vix, 60, Resolution.Daily);
# Request 60 days of daily ohlc for vix index since 2004. history with the vix Symbol history = self.History(CBOE, vix, 60, Resolution.Daily)
About the Provider
In 1993, Cboe Global Markets introduced the Cboe Volatility Index® (VIX® Index), which was originally designed to measure the market's expectation of 30-day volatility implied by at-the-money S&P 100® Index (OEX® Index) option prices. The VIX Index soon became the premier benchmark for U.S. stock market volatility. It has been regularly featured in the Wall Street Journal, Barron's and other leading financial publications, as well as on business news shows, where the VIX Index is often referred to as the "Fear Index."
