self.get_greeks

lumibot.strategies.strategy.Strategy.get_greeks(self, asset, asset_price=None, underlying_price=None, risk_free_rate=None, query_greeks=False)

Returns the greeks for the option asset at the current bar.

Will return all the greeks available. API Querying for prices and rates are expensive, so they should be passed in as arguments most of the time.

Parameters:
  • asset (Asset) – Option asset only for with greeks are desired.

  • asset_price (float, optional) – The price of the option asset, by default None

  • underlying_price (float, optional) – The price of the underlying asset, by default None

  • risk_free_rate (float, optional) – The risk-free rate used in interest calculations, by default None

  • query_greeks (bool, optional) – Whether to query the greeks from the broker. By default, the greeks are calculated locally, but if the broker supports it, they can be queried instead which could theoretically be more precise.

Returns:

  • Returns a dictionary with greeks as keys and greek values as

  • values.

  • implied_volatility (float) – The implied volatility.

  • delta (float) – The option delta value.

  • option_price (float) – The option price.

  • pv_dividend (float) – The present value of dividends expected on the option’s underlying.

  • gamma (float) – The option gamma value.

  • vega (float) – The option vega value.

  • theta (float) – The option theta value.

  • underlying_price – The price of the underlying.

Example

>>> # Will return the greeks for SPY
>>> opt_asset = Asset("SPY", expiration=date(2021, 1, 1), strike=100, option_type="call"
>>> greeks = self.get_greeks(opt_asset)
>>> implied_volatility = greeks["implied_volatility"]
>>> delta = greeks["delta"]
>>> gamma = greeks["gamma"]
>>> vega = greeks["vega"]
>>> theta = greeks["theta"]