Heston Model Calibration in the "Real" World with Python - S&P500 Index Options
Вставка
- Опубліковано 12 чер 2024
- The Heston model is a useful model for simulating stochastic volatility and its effect on the potential paths an asset can take over the life of an option. It's popular because of:
- easy closed-form solution for European option pricing
- no risk of negative variances
- incorporation of leverage effect
This allows for more effective modeling than the Black-Scholes formula allows due to its restrictive assumption of constant volatility.
One of the nice things about the Heston model for European option prices is that there is a semi-analytical closed-form solution once you have the characteristic function. In this video we will go through the mathematics of the characteristic funciton for European Option prices, implement this numerical integration in python and then calibrate the model to real world index option prices.
We will be using the S&P500 Index Options to calibrate the risk-neutral Heston Model. As a stochastic volatility model, the heston model can incorporate the real-world volatility smile within it's pricing dynamics.
Here I have drawn on a number of academic papers/online resources for reference:
- Heston Girsanov's Formula: quant.stackexchange.com/quest...
- Heston PDE : uwspace.uwaterloo.ca/bitstrea...
- Heston Characteristic Eq :www.maths.univ-evry.fr/pages_...
- Heston Implementation : hal.sorbonne-universite.fr/ha...
- Heston Calibration : / build-the-heston-model...
★ ★ Code Available on GitHub ★ ★
GitHub: github.com/TheQuantPy
Specific Tutorial Link: github.com/TheQuantPy/youtube...
00:00 Intro
00:45 The Mathematics Explained
09:05 Python Implementation of Semi-Analytical Solution
14:00 Real World Data - Options & Yield Curve
19:50 Heston Model Calibration
★ ★ QuantPy GitHub ★ ★
Collection of resources used on QuantPy UA-cam channel. github.com/thequantpy
★ ★ Discord Community ★ ★
Join a small niche community of like-minded quants on discord. / discord
★ ★ Support our Patreon Community ★ ★
Get access to Jupyter Notebooks that can run in the browser without downloading python.
/ quantpy
★ ★ ThetaData API ★ ★
ThetaData's API provides both realtime and historical options data for end-of-day, and intraday trades and quotes. Use coupon 'QPY1' to receive 20% off on your first month.
www.thetadata.net/
★ ★ Online Quant Tutorials ★ ★
WEBSITE: quantpy.com.au
★ ★ Contact Us ★ ★
EMAIL: pythonforquants@gmail.com
Disclaimer: All ideas, opinions, recommendations and/or forecasts, expressed or implied in this content, are for informational and educational purposes only and should not be construed as financial product advice or an inducement or instruction to invest, trade, and/or speculate in the markets. Any action or refraining from action; investments, trades, and/or speculations made in light of the ideas, opinions, and/or forecasts, expressed or implied in this content, are committed at your own risk an consequence, financial or otherwise. As an affiliate of ThetaData, QuantPy Pty Ltd is compensated for any purchases made through the link provided in this description.
I'll be doing SOA (Society of Actuary)'s QFI Quantitative Finance exam in a few weeks. this video connected the dots for me. Thanks so much!
This lecture is really deep but intuitive. If I write a research paper, it will be pleasure to cite your work.
This was amazing!! Could you go over how Heston model calibration for American options would look like, but with JUMPS added to the model, please?
Amazing! thank you so much!
You are amazing and exceptional ❤🎉
thank you so much this video help me
This is great
great walkthrough ur code thx
but still waiting for the AMERICAN Heston model!!!
A bates extension on this would be amazing and a bit easy since it only adds the jump component!
Great topic, thank you! Could you describe the dataset you had. Did you have a historical data (if yes how long) or just actual prices with maturities?
what a great video so useful to me thanks.
Can you give me a lecture on SABR model ?
thanks. Great informative video. what changes if instead of calls if need to calibrate for put prices?
Could you compare the Heston vs the Bachelier model at some point because it sounds like the Pros (aside from the Brownian vs random process between them) of Heston is similar to Bach so trying to understand the use case for model selection here, do you select the model based on the properties of the underlying instrument. Thanks.
Hello! Are you assuming the pure expectations hypothesis at 15:15 when you say you want to use the present term structure to discount at risk free?
Awesome video! I am doing a course project on this topic. Somehow I could not get to the same integrand as yours. Mine is the same as the one shown in the paper Not-so-complex logarithms in the Heston model. How did you remove the discount factor from the second part of the integrand? Also the entry before the first part that I got is e^{-r*\tau}.
I got the same thing. do you understand how did he remove the discount factor from the second part of the integrand?
How does the Heston model actually play out when used for options trading? I think it is certainly beautiful as a math person, but I have heard many say the fine-tuning of the hyper parameters make the Heston model rather cumbersome to use in practice, so many just stick with Black-Scholes, or a modified Black-Scholes or use local volatility model. Also I have wondered since we are calibrating the Heston model from a price surface which was calculated from the Black-Scholes model, how can it be a better predictor? These are just some naive questions as a beginner quant. Great video thank you for your time.
It is not a problem of prediction. The sense of using option volatility quotes to get prices with black & scholes is to consistently calibrate a model (Heston, Variance gamma, etc.) to the market. Obviously none of us will price a derivative instrument better than the market does (the investment Banks models used for this purpose are very sophisticated), so your goal is to build a model that is consistent with the market for pricing new derivatives for your bank's client , which are not listed in a ordinary market.
@@michelebellipanni2373 If I understood correctly; you’re saying it is pointless to use Heston to for vanilla options and only useful for exotic options.
If the vanilla instruments you are talking about are quoted, you'll use the realized implied- volatility and the Black & Scholes formula because it's a closed form and It works Faster (time in finance Is a very importante asset) . Heston is an amazing mathematical model and gives US much more than just a price. But obviously in all these discourses it is necessary (also in the construction of stochastic models) take a position .Let's say that the use of Heston could be convenient but It depend on the purpose. (Trading, Hedging,build new instruments,ecc..)
I don't know if I have explained myself well, I am an Italian student and I do my best with English.
@@michelebellipanni2373 Your English is great and thanks that makes sense.
Hi I'm not understand about what you mention, bj can combine to b and uj can combine to u, can you explain more further in detail, thank you!
In the parameters, how can we set a proper x0 for each of the parameters?
Can you do the same for Double Heston Model ?
I have a very important question: when the rates are negative like in Europe; can the Heston model help in pricing a European type of options?
The blackscholes or Heston model does not make the assumption of positive interest rates r > 0. So you can definitely use negative interest rates, just be aware your borrowing rate is likely different from your lending rate
Thank u can you do the same with Excell data,please?
Thank you so much for the tutorial! I have a question if you don't mind: Can the data you used be found free in yahoo finance?
Options data can be tricky, but if you find a free resource feel free to use the data of course
@@QuantPy Where can i find the data from free resource
Tried to run the Jupyter Notebook but EOD returned error message: "Only EOD data allowed for free users. Please, contact our support team"
What is the unit for Kappa in the Heston Model?
variance is unitless, and so is kappa
Awesome video, but I noticed there is a mistake in one integral form, the e^rt should be e^-rt and placed before integral.
Thanks for watching, I’ve double checked the calcs, looks ok to me - can’t tell what you mean. But if you still think there’s an error, tell me which line you think should be changed: quantpy.com.au/stochastic-volatility-models/heston-model-calibration-to-option-prices/
Thanks
@@QuantPy I think one integral formula should be changed to '$\large C(S_0, K, v_0, \tau) = \frac{1}{2}(S_0 - Ke^{-r \tau}) + \frac{1}{\pi} \int^\inf_0 \Re [ e^{-r\tau} (\frac{\varphi(\phi-i)}{i\phi K^{i\phi}} - K\frac{\varphi(\phi)}{i\phi K^{i\phi}} )] d\phi$'. I have double checked this formula with two integral form.
@@QuantPy And I have another question, some books and papers just set lambda equal to zero,but Heston original paper and your videos don't,could you explain what is the difference?
In the real world the market price of risk needs to be accounted for. There will nearly always be a difference between risk neutral value and the premium you have to pay in the market place for purchasing this product/hedge ect.
@@QuantPy So in general, I can just set lambda to be zero when I use Heston model
How can I apply this having yahoo finance as a parameter?
10:22 I do think it's Real(exp(-r*tau .... and not Real(exp(r*tau...
We divide by phi(-i) which is E(exp(x)) under the risk neutral measure which is S0 *exp(r*tau)
Easier to read rates using pandas.read_csv using the link to download CSV file
Hello Jonathan. I'm facing serious issues to replicate your code. Specially those related to download data from EodHistoricalData using my API. I can't download Options Data. Can I send you the code by email, so you can fix it?