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)
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)); } } }