• 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.OptionAtBOX(), 5, 85, null);
  • client.calculateImpliedVolatility(5001, ContractSamples.OptionAtBOX(), 5, 85, null);
  • '** Calculating implied volatility ***
    client.calculateImpliedVolatility(5001, ContractSamples.NormalOption(), 5, 85, Nothing)
    '** Canceling implied volatility ***
    client.cancelCalculateImpliedVolatility(5001)
  • m_pClient->calculateImpliedVolatility(5001, ContractSamples::NormalOption(), 5, 85, TagValueListSPtr());
  • 1  self.calculateImpliedVolatility(5001, ContractSamples.OptionAtBOX(), 5, 85, [])

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.OptionAtBOX(), 0.22, 85, null);
  • client.calculateOptionPrice(5002, ContractSamples.OptionAtBOX(), 0.22, 85, null);
  • '** Calculating option's price ***
    client.calculateOptionPrice(5002, ContractSamples.NormalOption(), 0.22, 85, Nothing)
    '** Canceling option's price calculation ***
    client.cancelCalculateOptionPrice(5002)
  • m_pClient->calculateOptionPrice(5002, ContractSamples::NormalOption(), 0.22, 85, TagValueListSPtr());
  • 1  self.calculateOptionPrice(5002, ContractSamples.OptionAtBOX(), 0.22, 85, [])

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, double impliedVolatility, double delta, double optPrice, double pvDividend, double gamma, double vega, double theta, double undPrice)
    {
    Console.WriteLine("TickOptionComputation. TickerId: "+tickerId+", field: "+field+", ImpliedVolatility: "+impliedVolatility+", Delta: "+delta
    +", OptionPrice: "+optPrice+", pvDividend: "+pvDividend+", Gamma: "+gamma+", Vega: "+vega+", Theta: "+theta+", UnderlyingPrice: "+undPrice);
    }
  • public class EWrapperImpl implements EWrapper {
    ...
    @Override
    public void tickOptionComputation(int tickerId, int field,
    double impliedVol, double delta, double optPrice,
    double pvDividend, double gamma, double vega, double theta,
    double undPrice) {
    System.out.println("TickOptionComputation. TickerId: "+tickerId+", field: "+field+", ImpliedVolatility: "+impliedVol+", Delta: "+delta
    +", OptionPrice: "+optPrice+", pvDividend: "+pvDividend+", Gamma: "+gamma+", Vega: "+vega+", Theta: "+theta+", UnderlyingPrice: "+undPrice);
    }
  • Public Class EWrapperImpl
    Implements EWrapper
    ...
    Public Sub tickOptionComputation(tickerId As Integer, field 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 & ", ImpliedVolatility: " & impliedVolatility &
    ", Delta: " & delta & ", OptionPrice: " & optPrice & ", pvDividend: " & pvDividend & ", Gamma: " & gamma &
    ", Vega: " & vega & ", Theta: " & theta & ", UnderlyingPrice: " & undPrice)
    End Sub
  • class TestCppClient : public EWrapper
    {
    ...
    void TestCppClient::tickOptionComputation( TickerId tickerId, TickType tickType, double impliedVol, double delta,
    double optPrice, double pvDividend,
    double gamma, double vega, double theta, double undPrice) {
    printf( "TickOptionComputation. Ticker Id: %ld, Type: %d, ImpliedVolatility: %g, Delta: %g, OptionPrice: %g, pvDividend: %g, Gamma: %g, Vega: %g, Theta: %g, Underlying Price: %g\n", tickerId, (int)tickType, impliedVol, delta, optPrice, pvDividend, gamma, vega, theta, undPrice);
    }
  • 1 class TestWrapper(wrapper.EWrapper):
    ...
    1  def tickOptionComputation(self, reqId: TickerId, tickType: TickType,
    2  impliedVol: float, delta: float, optPrice: float, pvDividend: float,
    3  gamma: float, vega: float, theta: float, undPrice: float):
    4  super().tickOptionComputation(reqId, tickType, impliedVol, delta,
    5  optPrice, pvDividend, gamma, vega, theta, undPrice)
    6  print("TickOptionComputation. TickerId:", reqId, "TickType:", tickType,
    7  "ImpliedVolatility:", impliedVol, "Delta:", delta, "OptionPrice:",
    8  optPrice, "pvDividend:", pvDividend, "Gamma: ", gamma, "Vega:", vega,
    9  "Theta:", theta, "UnderlyingPrice:", undPrice)
    10