Hi,
just to get a feel for the QuandLib I tried to implement a simple call option with the Black formula. But the results won't make sense to me. underlying = 42.5; vola = 0.2390; discount_factor = 0.99; strike_price = 42.5; settlementDate(8, December, 2005); Results are: Black Value: 8.12504 Black Delta: 0.590589 Black Gamma: 0.0184494 Black Vega: 10.1256 Black Rho: 6.55746 First, the option value seems to be too high. I excepted it to be somewhere aroung 4.70 - 4.90. Second the delta should be pretty exactly 0.5?? Third isn't it necessary to pass the maturity as an argument to calculate the black value?? I guess I am using it wrong or something. Any help is appreciated. Thanks a lot in advance for your help. Cheers, Benjamin ------------------------ Here is the code I used: #include <cstdlib> #include <string> #include <stdexcept> #include <iostream> #include <ql/quantlib.hpp> using namespace QuantLib; int main(int argc, char *argv[]) { try { QL_IO_INIT Real underlying = 42.5; Real vola = 0.2390; Real discount_factor = 0.99; Real strike_price = 42.5; Date todaysDate(20, July, 2005); Settings::instance().evaluationDate() = todaysDate; Date settlementDate(8, December, 2005); DayCounter dayCounter = Actual365Fixed(); Time maturity = dayCounter.yearFraction(todaysDate, settlementDate); Option::Type option_type(Option::Call); boost::shared_ptr<StrikedTypePayoff> payoff( new PlainVanillaPayoff(option_type, strike_price)); BlackFormula Black(underlying, discount_factor, vola, payoff); std::cout << "Black Value: " << Black.value() << std::endl; std::cout << "Black Delta: " << Black.delta(underlying) << std::endl; std::cout << "Black Gamma: " << Black.gamma(underlying) << std::endl; std::cout << "Black Vega: " << Black.vega(maturity) << std::endl; std::cout << "Black Rho: " << Black.rho(maturity) << std::endl; std::cout << std::endl; std::cout << std::endl; return 0; } catch (std::exception& e) { std::cout << e.what() << std::endl; return 1; } catch (...) { std::cout << "unknown error" << std::endl; return 1; } } ------------------------- |
Discount factor seems high. If it is, then the drift of the asset price
due to an increased rate will imply a higher delta. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Benjamin Janson Sent: Tuesday, July 26, 2005 2:21 AM To: [hidden email] Subject: [Quantlib-users] Question about Black Formula results Hi, just to get a feel for the QuandLib I tried to implement a simple call option with the Black formula. But the results won't make sense to me. underlying = 42.5; vola = 0.2390; discount_factor = 0.99; strike_price = 42.5; settlementDate(8, December, 2005); Results are: Black Value: 8.12504 Black Delta: 0.590589 Black Gamma: 0.0184494 Black Vega: 10.1256 Black Rho: 6.55746 First, the option value seems to be too high. I excepted it to be somewhere aroung 4.70 - 4.90. Second the delta should be pretty exactly 0.5?? Third isn't it necessary to pass the maturity as an argument to calculate the black value?? I guess I am using it wrong or something. Any help is appreciated. Thanks a lot in advance for your help. Cheers, Benjamin ------------------------ Here is the code I used: #include <cstdlib> #include <string> #include <stdexcept> #include <iostream> #include <ql/quantlib.hpp> using namespace QuantLib; int main(int argc, char *argv[]) { try { QL_IO_INIT Real underlying = 42.5; Real vola = 0.2390; Real discount_factor = 0.99; Real strike_price = 42.5; Date todaysDate(20, July, 2005); Settings::instance().evaluationDate() = todaysDate; Date settlementDate(8, December, 2005); DayCounter dayCounter = Actual365Fixed(); Time maturity = dayCounter.yearFraction(todaysDate, settlementDate); Option::Type option_type(Option::Call); boost::shared_ptr<StrikedTypePayoff> payoff( new PlainVanillaPayoff(option_type, strike_price)); BlackFormula Black(underlying, discount_factor, vola, payoff); std::cout << "Black Value: " << Black.value() << std::endl; std::cout << "Black Delta: " << Black.delta(underlying) << std::endl; std::cout << "Black Gamma: " << Black.gamma(underlying) << std::endl; std::cout << "Black Vega: " << Black.vega(maturity) << std::endl; std::cout << "Black Rho: " << Black.rho(maturity) << std::endl; std::cout << std::endl; std::cout << std::endl; return 0; } catch (std::exception& e) { std::cout << e.what() << std::endl; return 1; } catch (...) { std::cout << "unknown error" << std::endl; return 1; } } ------------------------- ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ Quantlib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users The information contained in and accompanying this communication is for your information only. Such information is strictly confidential and is intended solely for the use of the intended recipient (s) - recipient. If you are not the intended recipient (s) of this communication, please delete and destroy all copies immediately. This is not an offer or solicitation with respect to the purchase or sale of any security. The information is based upon information that TANSTAAFL Research & Trading, L.L.C believes to be reliable. TANSTAAFL Research & Trading, L.L.C does not accept responsibility to update any opinions or other information contained in this communication. |
In reply to this post by Benjamin Janson
Benjamin Janson wrote:
> > just to get a feel for the QuandLib I tried to implement a simple > call option with the Black formula. But the results won't make sense > to me. Benjamin, the signature of the BlackFormula constructor is: BlackFormula(Real forward, DiscountFactor discount, Real variance, const boost::shared_ptr<StrikedTypePayoff>& payoff); You should pass as the first argument the forward price, and as the third argument its variance (that's where the maturity comes in.) In your code, you should replace: BlackFormula Black(underlying, discount_factor, vola, payoff); with: Real forward = underlying/discount_factor; Real variance = vola*vola*maturity; BlackFormula Black(forward, discount_factor, variance, payoff); to use the class as intended. This said, the results are still now what you expect---namely, I get: Black Value: 2.72193 Black Delta: 0.556433 Black Gamma: 0.0625584 Black Vega: 10.4325 Black Rho: 8.08392 but the above are consistent with the results on a few other calculators I checked them against. Maybe there's something else missing? For instance, did your estimate include any cost of carry? Later, Luigi ---------------------------------------- Olmstead's Law: After all is said and done, a hell of a lot more is said than done. |
Free forum by Nabble | Edit this page |