Options & Greeks
Introduction
The option greek values- delta, gamma, theta, vega- are automatically requested by EClient.reqMktData() when requesting data for an option. See Available Tick Types
Tick types “Bid Option Computation” (#10), “Ask Option Computation” (#11), “Last Option Computation” (#12), and “Model Option Computation” (#13) return all Greeks (delta, gamma, vega, theta), the underlying price and the stock and option reference price when requested.
The implied volatility for an option given its price and the price of the underlying can be calculated with the function EClient.calculateImpliedVolatility.
Given the price of the underlying and an implied volatility it is possible to calculate the option price using the function EClient.calculateOptionPrice.
After the request, the option specific information will be delivered via EWrapper.tickOptionComputation.
Request Market Data
EClient.reqMktData(reqId, contract, genericTickList, snapshot, regulatorySnapshot, mktDataOptions)
Greeks are requested automatically when pulling market data for an Options contract. Users that do not have a valid Market Data Subscription for the underlying contract will receive an error that Market Data Is Not Subscribed. This error can be ignored if Greeks are not wanted.
Request identifier for tracking data.
Contract object used for specifying an instrument.
Comma separated ids of the available generic ticks.
Set to True for snapshot data with a relevant subscription or False for live data.
Set to True for a paid, regulatory snapshot or False for live data.
Internal use only.
Python
Java
C++
C#
VB.NET
Receiving Options Data
EWrapper.tickOptionComputation(tickerId, field, tickAttrib, impliedVolatility, delta, optPrice, pvDividend, gamma, vega, theta, undPrice)
Receives option specific market data. This method is called when the market in an option or its underlier moves. TWS’s option model volatilities, prices, and deltas, along with the present value of dividends expected on that options underlier are received.
the request’s unique identifier.
Specifies the type of option computation. Pass the field value into TickType.getField(int tickType) to retrieve the field description. For example, a field value of 13 will map to modelOptComp, etc. 10 = Bid 11 = Ask 12 = Last
0 – return based, 1- price based.
the implied volatility calculated by the TWS option modeler, using the specified tick type value.
The option delta value.
The option price.
The present value of dividends expected on the option’s underlying.
The option gamma value.
The option vega value.
The option theta value.
The price of the underlying.
Python
Java
C++
C#
VB.NET
Calculate Option Price
EClient.calculateOptionPrice(reqId, contract, volatility, underPrice, optionPriceOptions)
Calculates an option’s price based on the provided volatility and its underlying’s price.
Request identifier used to track data.
The Contract object for which the depth is being requested
Hypothetical volatility.
Hypothetical option’s underlying price.
Internal use only. Send an empty tag value list.
Python
Java
C++
C#
VB.NET
Calculating Implied volatility
EClient.calculateImpliedVolatility(reqId, contract, optionPrice, udnerPrice, impliedVolatilityOptions)
Calculate the volatility for an option. Request the calculation of the implied volatility based on hypothetical option and its underlying prices.
Request identifier used to track data.
The Contract object for which the depth is being requested
Hypothetical option price.
Hypothetical option’s underlying price.
Internal use only. Send an empty tag value list.
<Tabs>

