Wealth-Lab Wiki

API ChartStyles Community Components Community Indicators IndexDefinitions Knowledge Base Misc Optimizers Pending Deletion PosSizers Providers Standard Indicators TASC Traders Tips TASCIndicators Tutorial Videos Visualizers
RSS

Navigation


Quick Search
»
Advanced Search »


Open Interest for Options data

RSS

Syntax

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<OptionsData> 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

Description

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).

Example

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<OptionsData> lst = new List<OptionsData>(); if (GetGlobal(key) == null) { lst = OpenInterestForOptions.GetDataForSymbol(Bars.Symbol, OptionType.Put, dateTime); SetGlobal(key, (object)lst); } else lst = (List<OptionsData>)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.

Used under license from FMR Corp. Copyright 2008 FMR Corp. All rights reserved.


ScrewTurn Wiki. Some of the icons created by FamFamFam.