|
3 | 3 | <head> |
4 | 4 | <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
5 | 5 | <meta http-equiv="X-UA-Compatible" content="IE=9"/> |
6 | | -<meta name="generator" content="Doxygen 1.12.0"/> |
| 6 | +<meta name="generator" content="Doxygen 1.13.2"/> |
7 | 7 | <meta name="viewport" content="width=device-width, initial-scale=1"/> |
8 | 8 | <title>QuantLib: BermudanSwaption.cpp</title> |
9 | 9 | <link rel="stylesheet" href="/styles/fonts.css" type="text/css"> |
|
34 | 34 | <tr style="height: 56px;"> |
35 | 35 | <td id="projectalign" style="padding-left: 0.5em;"> |
36 | 36 | <div id="projectname"><a href="https://www.quantlib.org">QuantLib</a>: a free/open-source library for quantitative finance |
37 | | - <div id="projectnumber">Reference manual - version 1.36</div> |
| 37 | + <div id="projectnumber">Reference manual - version 1.37</div> |
38 | 38 | </div> |
39 | 39 | </td> |
40 | 40 | </tr> |
41 | 41 | </tbody> |
42 | 42 | </table> |
43 | 43 | </div> |
44 | 44 | <!-- end header part --> |
45 | | -<!-- Generated by Doxygen 1.12.0 --> |
| 45 | +<!-- Generated by Doxygen 1.13.2 --> |
46 | 46 | <script type="text/javascript"> |
47 | 47 | /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */ |
48 | 48 | var searchBox = new SearchBox("searchBox", "search/",'.html'); |
|
98 | 98 | <div class="contents"> |
99 | 99 | <p>This example prices a bermudan swaption using different models calibrated to market swaptions. The calibration examples include Hull and White's using both an analytic formula as well as numerically, and Black and Karasinski's model. Using these three calibrations, Bermudan swaptions are priced for at-the-money, out-of-the-money and in-the-money volatilities.</p> |
100 | 100 | <div class="fragment"><div class="line"><span class="comment">/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */</span></div> |
| 101 | +<div class="line"></div> |
101 | 102 | <div class="line"> </div> |
102 | 103 | <div class="line"><span class="preprocessor">#include <ql/qldefines.hpp></span></div> |
103 | 104 | <div class="line"><span class="preprocessor">#if !defined(BOOST_ALL_NO_LIB) && defined(BOOST_MSVC)</span></div> |
|
161 | 162 | <div class="line"> </div> |
162 | 163 | <div class="line"> std::cout << i+1 << <span class="stringliteral">"x"</span> << swapLengths[j]</div> |
163 | 164 | <div class="line"> << std::setprecision(5) << std::noshowpos</div> |
164 | | -<div class="line"> << <span class="stringliteral">": model "</span> << std::setw(7) << io::volatility(implied)</div> |
| 165 | +<div class="line"> << <span class="stringliteral">": model "</span> << std::setw(7) << <a class="code hl_function" href="group__manips.html#gac402ef7c87f63f7c603ee87210b5750c" title="output volatilities as percentages">io::volatility</a>(implied)</div> |
165 | 166 | <div class="line"> << <span class="stringliteral">", market "</span> << std::setw(7)</div> |
166 | | -<div class="line"> << io::volatility(swaptionVols[k])</div> |
| 167 | +<div class="line"> << <a class="code hl_function" href="group__manips.html#gac402ef7c87f63f7c603ee87210b5750c" title="output volatilities as percentages">io::volatility</a>(swaptionVols[k])</div> |
167 | 168 | <div class="line"> << <span class="stringliteral">" ("</span> << std::setw(7) << std::showpos</div> |
168 | | -<div class="line"> << io::volatility(diff) << std::noshowpos << <span class="stringliteral">")\n"</span>;</div> |
| 169 | +<div class="line"> << <a class="code hl_function" href="group__manips.html#gac402ef7c87f63f7c603ee87210b5750c" title="output volatilities as percentages">io::volatility</a>(diff) << std::noshowpos << <span class="stringliteral">")\n"</span>;</div> |
169 | 170 | <div class="line"> }</div> |
170 | 171 | <div class="line">}</div> |
171 | 172 | <div class="line"> </div> |
|
178 | 179 | <div class="line"> <a id="_a2" name="_a2"></a><a class="code hl_class" href="class_quant_lib_1_1_date.html" title="Concrete date class.">Date</a> todaysDate(15, February, 2002);</div> |
179 | 180 | <div class="line"> <a id="_a3" name="_a3"></a><a class="code hl_class" href="class_quant_lib_1_1_calendar.html" title="calendar class">Calendar</a> calendar = <a id="_a4" name="_a4"></a><a class="code hl_class" href="class_quant_lib_1_1_t_a_r_g_e_t.html" title="TARGET calendar">TARGET</a>();</div> |
180 | 181 | <div class="line"> <a class="code hl_class" href="class_quant_lib_1_1_date.html" title="Concrete date class.">Date</a> settlementDate(19, February, 2002);</div> |
181 | | -<div class="line"> Settings::instance().evaluationDate() = todaysDate;</div> |
| 182 | +<div class="line"> <a class="code hl_function" href="class_quant_lib_1_1_singleton.html#ab7455b7e1235d292c444095842349291">Settings::instance</a>().evaluationDate() = todaysDate;</div> |
182 | 183 | <div class="line"> </div> |
183 | 184 | <div class="line"> <span class="comment">// flat yield term structure impling 1x5 swap at 5%</span></div> |
184 | 185 | <div class="line"> <span class="keyword">auto</span> flatRate = ext::make_shared<SimpleQuote>(0.04875825);</div> |
|
203 | 204 | <div class="line"> floatingLegConvention);</div> |
204 | 205 | <div class="line"> <a id="_a10" name="_a10"></a><a class="code hl_class" href="class_quant_lib_1_1_schedule.html" title="Payment schedule.">Schedule</a> fixedSchedule(startDate,maturity,<a id="_a11" name="_a11"></a><a class="code hl_class" href="class_quant_lib_1_1_period.html">Period</a>(fixedLegFrequency),</div> |
205 | 206 | <div class="line"> calendar,fixedLegConvention,fixedLegConvention,</div> |
206 | | -<div class="line"> DateGeneration::Forward,<span class="keyword">false</span>);</div> |
| 207 | +<div class="line"> <a class="code hl_enumvalue" href="struct_quant_lib_1_1_date_generation.html#a11fcd51ef86118f65e603c1474377a78ae204c9c3e62b1e9a6b60e40cd05256c5">DateGeneration::Forward</a>,<span class="keyword">false</span>);</div> |
207 | 208 | <div class="line"> <a class="code hl_class" href="class_quant_lib_1_1_schedule.html" title="Payment schedule.">Schedule</a> floatSchedule(startDate,maturity,<a class="code hl_class" href="class_quant_lib_1_1_period.html">Period</a>(floatingLegFrequency),</div> |
208 | 209 | <div class="line"> calendar,floatingLegConvention,floatingLegConvention,</div> |
209 | | -<div class="line"> DateGeneration::Forward,<span class="keyword">false</span>);</div> |
| 210 | +<div class="line"> <a class="code hl_enumvalue" href="struct_quant_lib_1_1_date_generation.html#a11fcd51ef86118f65e603c1474377a78ae204c9c3e62b1e9a6b60e40cd05256c5">DateGeneration::Forward</a>,<span class="keyword">false</span>);</div> |
210 | 211 | <div class="line"> </div> |
211 | 212 | <div class="line"> <span class="keyword">auto</span> swap = ext::make_shared<VanillaSwap>(</div> |
212 | 213 | <div class="line"> type, 1000.0,</div> |
|
328 | 329 | <div class="line"> <span class="comment">// ATM Bermudan swaption pricing</span></div> |
329 | 330 | <div class="line"> </div> |
330 | 331 | <div class="line"> std::cout << <span class="stringliteral">"Payer bermudan swaption "</span></div> |
331 | | -<div class="line"> << <span class="stringliteral">"struck at "</span> << io::rate(fixedATMRate)</div> |
| 332 | +<div class="line"> << <span class="stringliteral">"struck at "</span> << <a class="code hl_function" href="group__manips.html#gac63ea3dad10259db3764c7d15a61cde5" title="output rates and spreads as percentages">io::rate</a>(fixedATMRate)</div> |
332 | 333 | <div class="line"> << <span class="stringliteral">" (ATM)"</span> << std::endl;</div> |
333 | 334 | <div class="line"> </div> |
334 | 335 | <div class="line"> std::vector<Date> bermudanDates;</div> |
|
368 | 369 | <div class="line"> <span class="comment">// OTM Bermudan swaption pricing</span></div> |
369 | 370 | <div class="line"> </div> |
370 | 371 | <div class="line"> std::cout << <span class="stringliteral">"Payer bermudan swaption "</span></div> |
371 | | -<div class="line"> << <span class="stringliteral">"struck at "</span> << io::rate(fixedOTMRate)</div> |
| 372 | +<div class="line"> << <span class="stringliteral">"struck at "</span> << <a class="code hl_function" href="group__manips.html#gac63ea3dad10259db3764c7d15a61cde5" title="output rates and spreads as percentages">io::rate</a>(fixedOTMRate)</div> |
372 | 373 | <div class="line"> << <span class="stringliteral">" (OTM)"</span> << std::endl;</div> |
373 | 374 | <div class="line"> </div> |
374 | 375 | <div class="line"> <a class="code hl_class" href="class_quant_lib_1_1_swaption.html" title="Swaption class">Swaption</a> otmBermudanSwaption(otmSwap,bermudanExercise);</div> |
|
403 | 404 | <div class="line"> <span class="comment">// ITM Bermudan swaption pricing</span></div> |
404 | 405 | <div class="line"> </div> |
405 | 406 | <div class="line"> std::cout << <span class="stringliteral">"Payer bermudan swaption "</span></div> |
406 | | -<div class="line"> << <span class="stringliteral">"struck at "</span> << io::rate(fixedITMRate)</div> |
| 407 | +<div class="line"> << <span class="stringliteral">"struck at "</span> << <a class="code hl_function" href="group__manips.html#gac63ea3dad10259db3764c7d15a61cde5" title="output rates and spreads as percentages">io::rate</a>(fixedITMRate)</div> |
407 | 408 | <div class="line"> << <span class="stringliteral">" (ITM)"</span> << std::endl;</div> |
408 | 409 | <div class="line"> </div> |
409 | 410 | <div class="line"> <a class="code hl_class" href="class_quant_lib_1_1_swaption.html" title="Swaption class">Swaption</a> itmBermudanSwaption(itmSwap,bermudanExercise);</div> |
|
449 | 450 | <!-- start footer part --> |
450 | 451 | <hr class="footer"/><address class="footer"><small> |
451 | 452 | Generated by <a href="http://www.doxygen.org/index.html">Doxygen</a> |
452 | | -1.12.0 |
| 453 | +1.13.2 |
453 | 454 | </small></address> |
454 | 455 | </body> |
455 | 456 | </html> |
0 commit comments