• C#
  • Java
  • VB
  • C++
  • Python
Contact us
Option Greeks

Market data related to options

The option greek values- delta, gamma, theta, vega- are returned by default following a reqMktData() request for the 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.

MODEL_OPTION_COMPUTATION also returns model implied volatility.

Note that to receive live greek values it is necessary to have market data subscriptions for both the option and the underlying contract.

  • //Requesting data for an option contract will return the greek values
    client.reqMktData(1002, ContractSamples.OptionWithLocalSymbol(), string.Empty, false, false, null);
  • //Requesting data for an option contract will return the greek values
    client.reqMktData(1002, ContractSamples.OptionWithLocalSymbol(), "", false, false, null);
  • 'Requesting data for an option contract will return the greek values
    client.reqMktData(1005, ContractSamples.USOptionContract(), String.Empty, False, False, Nothing)
  • //Requesting data for an option contract will return the greek values
    m_pClient->reqMktData(1013, ContractSamples::USOptionContract(), "", false, false, TagValueListSPtr());
  • 1  # Requesting data for an option contract will return the greek values
    2  self.reqMktData(1013, ContractSamples.OptionWithLocalSymbol(), "", False, False, [])
    3  self.reqMktData(1014, ContractSamples.FuturesOnOptions(), "", False, False, [])
    4 

The Implied Volatility of an underlying based on its current option prices is returned in tick 24. See Available Tick Types

The IB 30-day volatility is the at-market volatility estimated for a maturity thirty calendar days forward of the current trading day, and is based on option prices from two consecutive expiration months.

Calculating option prices and historical volatility

The implied volatility for an option given its price and the price of the underlying can be calculated with the function IBApi.EClient.calculateImpliedVolatility

  • client.calculateImpliedVolatility(5001, ContractSamples.OptionWithLocalSymbol(), 0.5, 55, null);
  • client.calculateImpliedVolatility(5001, ContractSamples.OptionWithLocalSymbol(), 0.6, 55, null);
  • '** Calculating implied volatility ***
    client.calculateImpliedVolatility(5001, ContractSamples.OptionWithLocalSymbol(), 0.5, 55, Nothing)
    '** Canceling implied volatility ***
    client.cancelCalculateImpliedVolatility(5001)
  • m_pClient->calculateImpliedVolatility(5001, ContractSamples::OptionWithLocalSymbol(), 0.5, 55, TagValueListSPtr());
  • 1  self.calculateImpliedVolatility(5001, ContractSamples.OptionWithLocalSymbol(), 0.5, 55, [])

Alternatively, given the price of the underlying and an implied volatility it is possible to calculate the option price using the function IBApi.EClient.calculateOptionPrice

  • client.calculateOptionPrice(5002, ContractSamples.OptionWithLocalSymbol(), 0.6, 55, null);
  • client.calculateOptionPrice(5002, ContractSamples.OptionWithLocalSymbol(), 0.5, 55, null);
  • '** Calculating option's price ***
    client.calculateOptionPrice(5002, ContractSamples.OptionWithLocalSymbol(), 0.6, 55, Nothing)
    '** Canceling option's price calculation ***
    client.cancelCalculateOptionPrice(5002)
  • m_pClient->calculateOptionPrice(5002, ContractSamples::OptionWithLocalSymbol(), 0.6, 55, TagValueListSPtr());
  • 1  self.calculateOptionPrice(5002, ContractSamples.OptionWithLocalSymbol(), 0.6, 55, [])

After the request, the option specific information will be delivered via the IBApi.EWrapper.tickOptionComputation method:

  • public class EWrapperImpl : EWrapper
    {
    ...
    public virtual void tickOptionComputation(int tickerId, int field, int tickAttrib, double impliedVolatility, double delta, double optPrice, double pvDividend, double gamma, double vega, double theta, double undPrice)
    {
    Console.WriteLine("TickOptionComputation. TickerId: " + tickerId + ", field: " + field + ", TickAttrib: " + Util.IntMaxString(tickAttrib) + ", ImpliedVolatility: " + Util.DoubleMaxString(impliedVolatility) +
    ", Delta: " + Util.DoubleMaxString(delta) + ", OptionPrice: " + Util.DoubleMaxString(optPrice) +", pvDividend: " + Util.DoubleMaxString(pvDividend) +
    ", Gamma: " + Util.DoubleMaxString(gamma) + ", Vega: " + Util.DoubleMaxString(vega) + ", Theta: " + Util.DoubleMaxString(theta) + ", UnderlyingPrice: " + Util.DoubleMaxString(undPrice));
    }
  • public class EWrapperImpl implements EWrapper {
    ...
    @Override
    public void tickOptionComputation(int tickerId, int field, int tickAttrib, double impliedVol, double delta, double optPrice,
    double pvDividend, double gamma, double vega, double theta, double undPrice) {
    System.out.println("TickOptionComputation: " + EWrapperMsgGenerator.tickOptionComputation( tickerId, field, tickAttrib, impliedVol, delta, optPrice, pvDividend, gamma, vega, theta, undPrice));
    }
  • Public Class EWrapperImpl
    Implements EWrapper
    ...
    Public Sub tickOptionComputation(tickerId As Integer, field As Integer, tickAttrib As Integer, impliedVolatility As Double, delta As Double, optPrice As Double, pvDividend As Double, gamma As Double, vega As Double, theta As Double, undPrice As Double) Implements IBApi.EWrapper.tickOptionComputation
    Console.WriteLine("TickOptionComputation. TickerId: " & tickerId & ", field: " & field & ", TickAttrib: " & Util.IntMaxString(tickAttrib) & ", ImpliedVolatility: " & Util.DoubleMaxString(impliedVolatility) &
    ", Delta: " & Util.DoubleMaxString(delta) & ", OptionPrice: " & Util.DoubleMaxString(optPrice) & ", pvDividend: " & Util.DoubleMaxString(pvDividend) &
    ", Gamma: " & Util.DoubleMaxString(gamma) & ", Vega: " & Util.DoubleMaxString(vega) & ", Theta: " & Util.DoubleMaxString(theta) & ", UnderlyingPrice: " & Util.DoubleMaxString(undPrice))
    End Sub
  • class TestCppClient : public EWrapper
    {
    ...
    void TestCppClient::tickOptionComputation( TickerId tickerId, TickType tickType, int tickAttrib, double impliedVol, double delta,
    double optPrice, double pvDividend,
    double gamma, double vega, double theta, double undPrice) {
    printf( "TickOptionComputation. Ticker Id: %ld, Type: %d, TickAttrib: %s, ImpliedVolatility: %s, Delta: %s, OptionPrice: %s, pvDividend: %s, Gamma: %s, Vega: %s, Theta: %s, Underlying Price: %s\n",
    tickerId, (int)tickType, Utils::intMaxString(tickAttrib).c_str(), Utils::doubleMaxString(impliedVol).c_str(), Utils::doubleMaxString(delta).c_str(), Utils::doubleMaxString(optPrice).c_str(),
    Utils::doubleMaxString(pvDividend).c_str(), Utils::doubleMaxString(gamma).c_str(), Utils::doubleMaxString(vega).c_str(), Utils::doubleMaxString(theta).c_str(), Utils::doubleMaxString(undPrice).c_str());
    }
  • 1 class TestWrapper(wrapper.EWrapper):
    ...
    1  def tickOptionComputation(self, reqId: TickerId, tickType: TickType, tickAttrib: int,
    2  impliedVol: float, delta: float, optPrice: float, pvDividend: float,
    3  gamma: float, vega: float, theta: float, undPrice: float):
    4  super().tickOptionComputation(reqId, tickType, tickAttrib, impliedVol, delta,
    5  optPrice, pvDividend, gamma, vega, theta, undPrice)
    6  print("TickOptionComputation. TickerId:", reqId, "TickType:", tickType,
    7  "TickAttrib:", intMaxString(tickAttrib),
    8  "ImpliedVolatility:", floatMaxString(impliedVol), "Delta:", floatMaxString(delta), "OptionPrice:",
    9  floatMaxString(optPrice), "pvDividend:", floatMaxString(pvDividend), "Gamma: ", floatMaxString(gamma), "Vega:", floatMaxString(vega),
    10  "Theta:", floatMaxString(theta), "UnderlyingPrice:", floatMaxString(undPrice))
    11