Log in to see Cloud of Tags

Wealth-Lab Wiki

Open Interest for Options data



public enum OptionType {Call, Put}

public class OptionsData { string Symbol, DateTime LastTradeDate, double Strike, double LastPrice, int Volume, double OpenInterest, double IV }

public static List GetDataForSymbol(string symbol, OptionType type, DateTime dt)

Parameter Description

symbolSymbol to get the options data
typeOptionType.Call or OptionType.Put
dtAn expiration date in the future


For a given U.S. stock symbol, retrieves the option specific data (such as last trade date, strike, last price, volume, open interest and implied volatility) for a specified expiry date in the future and option type (call or put).


using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using Community.Components;

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { ClearDebug(); var dateTime = NextOptionExpiryDate(Bars.Count - 1); var key = Bars.Symbol + ";" + OptionType.Put + ";" + dateTime; PrintDebug(key); List lst = new List(); if (GetGlobal(key) == null) { lst = OpenInterestForOptions.GetDataForSymbol(Bars.Symbol, OptionType.Put, dateTime); SetGlobal(key, (object)lst); } else lst = (List)GetGlobal(key);

PrintDebug("Symbol" + "\t" + "Last Trade" + "\t" + "Strike" + "\t" + "Last Price" + "\t" + "Volume" + "\t" + "Open Interest" + "\t" + "IV"); foreach (var t in lst) PrintDebug(t.Symbol + "\t" + t.LastTradeDate + "\t" + t.Strike + "\t" + t.LastPrice + "\t" + t.Volume + "\t" + t.OpenInterest + "\t" + string.Format("Value: {0:P2}.", t.IV / 100d)); } } }

Important Disclaimer: The information provided by Wealth-Lab is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.  The owner of Wealth-Lab.com assumes no liability resulting from the use of the material contained herein for investment purposes. By using this web site, you agree to the terms of this disclaimer and our Terms of Use.

ScrewTurn Wiki. Some of the icons created by FamFamFam.