I would like to use quantlib for a project to generate some volatility figures for option of equity and index. I have done some research mixed with my past working experience. Please kindly see my understandings are correct. It is a lengthy mail. Apologize if some of my understandings are not reasonable and should not ask here.
Basically, I would like to generate some graphs to plot historical volatility and implied volatility of stock / index at the same graphs.
What I can think to proceed is to
For Historical Volatility:
1. Allow the user to input the RIC code of the stock / index
2. Collect the historical closing price of the RIC from yahoo finance ( Duration can be 2 yrs or some other length )
3. To calculate the historical volatility, I have to first calculate daily return of every day by ( price - price of previous day ) / price of previous day. And then find its standard deviation across the series and use it to multiply by sqrt ( working days of the year ) <- I see people used 262 days normally. The the result would be the historical annualised volatility. I am not sure the size of the sample of the market standard to get the historical volatility. ( It seems that longer duration said 2 yrs may have more samples while 30 days may give more recent result )
4. Then the historical volatility is done and I can plot the graph with past data. It seems that for this part, I need not to use much of quantlib api because all should be got via yahoo finance api.
For implied volatility:
1. After the user select the Stock / Index, I have to find the list of its options. I have no idea how to obtain the list of options for a particular stock / index. It seems that ivolatility.com can provide this kind of data but it is not free.
2. After getting the list of options, I have to use a model to get the implied volatility of the particular day.
3. I am not sure which model I should use .. I guess Black Scholes model is the classic one but I am not sure if what are the other choices in the market that are commonly adopted
4. I have to get other variables of the model as well. Assuming I use Black Scholes model, ( What are the api that I can use with quantlib to get the option price , or model other than BS? )
- Option Price, Spot Price, Strike Price, Days to expire, dividend rate should be trival to get from the market data of yahoo finance
- I doubted how to get the riskless rate though. How do I get the possible parameters to setup the accurate yield curve? I see some companies would use deposit rates <= 1 year and par swap rate > 1 yr to create the curve, together with holiday schedule and day count convention. Is it a common way to do so? And what is the alternative? ( What are the possible APIs that can be used to generate the yield curve ? and where I can get the deposit rate and swap rate for use?)
5. After all are set, I should be able to get a volatility matrix of a specific day that I can get volatility against different strike price and against different maturity with more than one option. Should I use the ATM volatility (ie strike price same as closing price of the stock price ) and plot it against different maturity to compare with that of historical volatility?
6. If there is no matching option that the strike price is equal to the stock price, what kind of interpolation that I should use to get the corresponding volatility?
7. For the part of plotting curves, is there any tool in quantlib that can be used to plot curve? or is it better to generate the graph using some other tools like python or excel to do this task with the data series generated from quantlib?
- For the overall project, do you think the graph generated would be worth to traders or risk managers ?
- During my research I also see that the RR25 or butterfly 25 would have a meaning to the traders. Is it possible to share what are they used for? RR25 should be the the volatility for a call option that is having 25% of Delta - volatility of a put option that is having a 25% of Delta, while butterfly 25 is average of the RR25 and butterfly25 - ATM volatility
- Would it be possible to generate the butterfly25 or RR25 for this project as well?
- I think the idea should be possible very similar for FX options. Please kindly share the difference.
Thanks in advance for the information sharing and happy new year!
Thanks a lot,
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
QuantLib-users mailing list
|Free forum by Nabble||Edit this page|