My project is about a volatily surface built from a Black and Scholes class. If we don't have the volatility, we have to find the implied volatility and then use that to have the volatility surface.
I have a HW of a volatility surface on C++. I have already started but instead of improving my program has lots and lots of errors. Instead of having my program done from someone else, I would like to have a tutor who can work with me in order to solve those errosr and get the program running.
I have already started but I have many errors and I think it's not working properly.
Enclosed is what I have done so far. This is a project in groups so a classmate sent his files:
* QuantLib
* Calendar
* date
* exception
* FavFive
* yieldcurve
* FixedIncome
* Interpolation
* Number_theory
* strings
My files are:
1. BlackScholes including the greeks that are already in the program. In this class, time is the time at which the option starts, this is useful for the forward starting options
2. Normaldist
3. VolSurface
So, what I have to do is to focus on MY files, trying not to change too much the other ones.
Some of the problems I had:
* When I compiled the code and had tests on main I got many errors saying there were undefined reference methods.
* It would be also helpful to get a program that reads from a .txt file all the info and builds the vol surface (enclosed is an example of how the data is).
* Black and Scholes class:
- It would be better to have a Newton Raphson algorithm to find the implied volatility and that the implied volatility is a method by itself.
* The Black and Scholes and Vol Surf classes are supposed to call the yieldcurve class to use the interest rates for the valuation of the asset. Even though I was working at the beginning with time and expiration as doubles, I prefer to have actual dates: MMDDYYYY as appears in the date class. There might be also methods in the class that use the time as doubles in case we need it but for building the volatility surface I think it's more useful to have the actual calendar date (date and calendar have some useful functions that do that but it's good that BlackScholes and VolSurf classes incorporate those methods in case the user inputs time and expiration as doubles).
I didn't really understand my friend's code for calendar and date classes but there are some good examples in main.
For the volatility surface, I wanted to apply a quadratic interpolation, so I called the interpolation class. There is an example in main:
INT.SetSpline(2,0) -> This is the default case for that quadratic interpolation
Please include tests in main to check that the code runs correctly and also to make sure I understand how it works.
According to the project, the volatility object should offer the following methods
Variance (S, K, t) variance at time t for underlying S, strike K
Volatility(S, K, t) volatility at time t for underlying S, strike K
Forward Volatility (S, K, t, T) volatility at time t (time t from now) and period T (expiration) for underlying S, strike K
Plots of the volatility surface that offer the option of the specific date (i.e. monthly expirations from Dec2010 until Mar2012) or T=0 to T=2 years from today and specific strikes (ie K= 180, K = 200, etc) or (from S/K=0.3 to S/K=2)
If you think my BlackScholes and volSurf should be redesigned and changed drastically, please feel free to do it as long as I can understand the code and it's not very advanced for me to understand it. The best thing is to be able to have a matrix or a vector of vectors that my classmates can call if they need the Volatility(S,K,T). In case we agree on the price, design and deadline. Let me know if you need to change files other than 1,2,3.
I'm sorry if the explanation was too long, but in the end I think it wouldn't be that complex if I was better at programming on C++.
No comments:
Post a Comment