public static void Main() { Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY"); var optionsApi = new OptionsApi(); string symbol = "AAPL"; // string | The option symbol, corresponding to the underlying security. string expiration = "2019-03-18"; // string | The expiration date of the options contract string type = null; // string | The option contract type. (optional) decimal?strike = null; // decimal? | The strike price of the option contract. This will return options contracts with strike price equal to this price. (optional) decimal?strikeGreaterThan = null; // decimal? | The strike price of the option contract. This will return options contracts with strike prices greater than this price. (optional) decimal?strikeLessThan = null; // decimal? | The strike price of the option contract. This will return options contracts with strike prices less than this price. (optional) string moneyness = null; // string | The moneyness of the options contracts to return. 'all' will return all options contracts. 'in_the_money' will return options contracts that are in the money (call options with strike prices below the current price, put options with strike prices above the current price). 'out_of_they_money' will return options contracts that are out of the money (call options with strike prices above the current price, put options with strike prices // below the current price). 'near_the_money' will return options contracts that are $0.50 or less away from being in the money. (optional) decimal?pageSize = 100; // decimal? | The number of results to return (optional) (default to 100) try { ApiResponseOptionsChain result = optionsApi.GetOptionsChain(symbol, expiration, type, strike, strikeGreaterThan, strikeLessThan, moneyness, pageSize); List <OptionChain> chain = result.Chain; Console.WriteLine(chain.Count + " results found for " + symbol + "!"); chain.ForEach(delegate(OptionChain chain_link) { Option option = chain_link.Option; OptionPrice price = chain_link.Price; Console.WriteLine(); Console.WriteLine("-----------------------------------------------------------------------------------"); Console.WriteLine("OPTION"); Console.WriteLine("ID: " + option.Id); Console.WriteLine("Code: " + option.Code); Console.WriteLine("Ticker: " + option.Ticker); Console.WriteLine("Expiration: " + option.Expiration); Console.WriteLine("Strike: " + option.Strike); Console.WriteLine("Type: " + option.Type); Console.WriteLine(); Console.WriteLine("PRICE"); Console.WriteLine("Date: " + price.Date); Console.WriteLine("Close: " + price.Close); Console.WriteLine("Close bid: " + price.CloseBid); Console.WriteLine("Close ask: " + price.CloseAsk); Console.WriteLine("Volume: " + price.Volume); Console.WriteLine("Volume bid: " + price.VolumeBid); Console.WriteLine("Volume ask: " + price.VolumeAsk); Console.WriteLine("Trades: " + price.Trades); Console.WriteLine("Open interest: " + price.OpenInterest); Console.WriteLine("Open interest change: " + price.OpenInterestChange); Console.WriteLine("Next day open interest: " + price.NextDayOpenInterest); Console.WriteLine("Implied volatility: " + price.ImpliedVolatility); Console.WriteLine("Implied volatility change: " + price.ImpliedVolatilityChange); Console.WriteLine("Delta: " + price.Delta); }); } catch (Exception e) { Debug.Print("Exception when calling OptionsApi.GetOptionsChain: " + e.Message); } }
public static void Main() { Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY"); var optionsApi = new OptionsApi(); string symbol = "AAPL"; // string | The option symbol, corresponding to the underlying security. string after = null; // string | Return option contract expiration dates after this date. (optional) string before = null; // string | Return option contract expiration dates before this date. (optional) try { ApiResponseOptionsExpirations result = optionsApi.GetOptionsExpirations(symbol, after, before); List <string> expirations = result.Expirations; Console.WriteLine(expirations.Count + " option expirations found for " + symbol + "!"); Console.WriteLine(); expirations.ForEach(delegate(string expiration) { Console.WriteLine(expiration); }); } catch (Exception e) { Debug.Print("Exception when calling OptionsApi.GetOptionsExpirations: " + e.Message); } }
public static void Main() { Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY"); var optionsApi = new OptionsApi(); string identifier = "AAPL190318C00300510"; // string | The Intrinio ID or code of the options contract to request prices for. string startDate = null; // string | Return option contract prices on or after this date. (optional) string endDate = null; // string | Return option contract prices on or before this date. (optional) decimal?pageSize = 100; // decimal? | The number of results to return (optional) (default to 100) string nextPage = null; // string | Gets the next page of data from a previous API call (optional) try { ApiResponseOptionPrices result = optionsApi.GetOptionsPrices(identifier, startDate, endDate, pageSize, nextPage); List <OptionPrice> prices = result.Prices; Option option = result.Option; Console.WriteLine("*** OPTION ***"); Console.WriteLine("ID: " + option.Id); Console.WriteLine("Code: " + option.Code); Console.WriteLine("Ticker: " + option.Ticker); Console.WriteLine("Expiration: " + option.Expiration); Console.WriteLine("Strike: " + option.Strike); Console.WriteLine("Type: " + option.Type); Console.WriteLine(); Console.WriteLine(prices.Count + " options prices for " + identifier + "!"); Console.WriteLine("-----------------------------------------------------------------------------------------------------"); Console.WriteLine(); prices.ForEach(delegate(OptionPrice price) { Console.WriteLine(); Console.WriteLine("Date: " + price.Date); Console.WriteLine("Close: " + price.Close); Console.WriteLine("Close bid: " + price.CloseBid); Console.WriteLine("Close ask: " + price.CloseAsk); Console.WriteLine("Volume: " + price.Volume); Console.WriteLine("Volume bid: " + price.VolumeBid); Console.WriteLine("Volume ask: " + price.VolumeAsk); Console.WriteLine("Trades: " + price.Trades); Console.WriteLine("Open interest: " + price.OpenInterest); Console.WriteLine("Open interest change: " + price.OpenInterestChange); Console.WriteLine("Next day open interest: " + price.NextDayOpenInterest); Console.WriteLine("Implied volatility: " + price.ImpliedVolatility); Console.WriteLine("Implied volatility change: " + price.ImpliedVolatilityChange); Console.WriteLine("Delta: " + price.Delta); }); } catch (Exception e) { Debug.Print("Exception when calling OptionsApi.GetOptionsPrices: " + e.Message); } }
public static void Main() { Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY"); var optionsApi = new OptionsApi(); string symbol = "AAPL"; // string | The option symbol, corresponding to the underlying security. string type = "put"; // string | The option contract type. (optional) decimal?strike = null; // decimal? | The strike price of the option contract. This will return options contracts with strike price equal to this price. (optional) decimal?strikeGreaterThan = null; // decimal? | The strike price of the option contract. This will return options contracts with strike prices greater than this price. (optional) decimal?strikeLessThan = null; // decimal? | The strike price of the option contract. This will return options contracts with strike prices less than this price. (optional) string expiration = null; // string | The expiration date of the option contract. This will return options contracts with expiration dates on this date. (optional) string expirationAfter = null; // string | The expiration date of the option contract. This will return options contracts with expiration dates after this date. (optional) string expirationBefore = null; // string | The expiration date of the option contract. This will return options contracts with expiration dates before this date. (optional) decimal?pageSize = null; // decimal? | The number of results to return (optional) (default to 100) string nextPage = null; // string | Gets the next page of data from a previous API call (optional) try { ApiResponseOptions result = optionsApi.GetOptions(symbol, type, strike, strikeGreaterThan, strikeLessThan, expiration, expirationAfter, expirationBefore, pageSize, nextPage); List <Option> options = result.Options; Console.WriteLine(options.Count + " options found for " + symbol + "!"); options.ForEach(delegate(Option option) { Console.WriteLine(); Console.WriteLine("ID: " + option.Id); Console.WriteLine("Code: " + option.Code); Console.WriteLine("Ticker: " + option.Ticker); Console.WriteLine("Expiration: " + option.Expiration); Console.WriteLine("Strike: " + option.Strike); Console.WriteLine("Type: " + option.Type); }); } catch (Exception e) { Debug.Print("Exception when calling OptionsApi.GetOptions: " + e.Message); } }
public void Init() { instance = new OptionsApi(); }