# How to calculate sigma in order to calculate delta? [closed]

I am calculating option delta using py_vollib.black_scholes

from py_vollib.black_scholes.greeks.analytical import delta

if option_type == 'call':
delta_calc = delta('c', S, K, t, r, sigma)
elif option_type == 'put':
delta_calc = delta('p', S, K, t, r, sigma)


How do I calculate the sigma? Do I need the closing process of the underlying for one year?

Please keep in my mind, I am a python programmer and I do not understand the math behind it.

• I am not familiar with py_vollib.black_scholes. Are the functions you call the option prices or the delta? 2 different things. Feb 18 at 18:35
• I second @AIRacoon's comment. I would be surprised if BS() would be delta.a quick Google search suggests there delta() implemented to do just this Feb 18 at 18:59
• Sigma is IV and you cannot use historical vol. See here for details. Feb 18 at 19:02
• Sigma is the volatility of the underlying based on mathworks.com/help/symbolic/… σ is the standard deviation of continuously compounded annual returns of the stock, which is called volatility.
– Titu
Feb 18 at 19:58
• It explains how to find IB if you scroll down in the MATLAB link you provided. Feb 19 at 0:04

Do you have the price of the option and the other variables? The sigma is commonly known as implied volatility, which is another way of quoting the option price. Usually it is listed alongside the price of the option and its other variables.

If it is not listed, you can also solve for sigma numerically by using a root finding approach such as SOLVER in Excel or Newton's method coded out (or by using packages).

• Most of the examples, I saw. People set sigma as 0.2 or 0.3. σ is the standard deviation of continuously compounded annual returns of the stock, which is called volatility. I am thinking of doing something like this and pass daily returns for a year. Am I thinking right? import numpy as np import math returns = [0.05, 0.03, -0.02, 0.08, -0.01, 0.13, -0.06] def annualized_volatility(returns): returns_np = np.array(returns) std_daily = returns_np.std() * np.sqrt(252) return std_daily sigma = annualized_volatility(returns) print(sigma)
– Titu
Feb 18 at 20:32
• You are using historical volatility, which is not correct. Feb 18 at 20:47
• How do the option chain prices get calculated? How do the brokers calculate sigma when there is no volume? Don't they use historical data? The problem I am to solve is this but the mods considered it a duplicate. quant.stackexchange.com/questions/78389/…
– Titu
Feb 19 at 23:24

You need, for each point of the implied volatility surface, the relative quote from option market:

from py_vollib_vectorized import vectorized_implied_volatility

quotes: np.ndarray = np.array([5.0,10.])
s0: float = 100
tau: np.ndarray = np.array([0.1,0.2])
strike: np.ndarray = np.array([105.0,110.])
risk_free_rate: float = 0.02

# \$_implied_volatilities_for_puts
vectorized_implied_volatility(quotes, s0, strike, tau, risk_free_rate, 'p').values

• And how does it help me evaluate delta? I have the option price, but not the delta. Can I reverse calculate?
– Titu
Feb 19 at 23:26
• Sigma in this case is not a number estimated from historical data, instead is an implied volatility estimated from market expectations. Implied volatility and options premiums move together since as markets expects more (less) volatility for the underlying process, it will reflects in option markets as an increase (decrease) in implied volatilities -> hence, in option premium -> hence, in time value of the option. Feb 27 at 14:12