Skip to content

Commit

Permalink
Merge pull request #1351.
Browse files Browse the repository at this point in the history
Documenting the SviSmileSection
  • Loading branch information
lballabio committed Apr 22, 2022
2 parents aca86a2 + aa83c00 commit 0573421
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ql/experimental/volatility/svismilesection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ namespace QuantLib {

void SviSmileSection::init() {
QL_REQUIRE(params_.size() == 5,
"svi expects 5 parameters (a,b,sigma,rho,s,m) but ("
"svi expects 5 parameters (a,b,sigma,rho,m) but ("
<< params_.size() << ") given");
detail::checkSviParameters(params_[0], params_[1], params_[2], params_[3],
params_[4]);
}

Real SviSmileSection::volatilityImpl(Rate strike) const {
Volatility SviSmileSection::volatilityImpl(Rate strike) const {

Real k = std::log(std::max(strike, 1E-6) / forward_);
Real totalVariance = detail::sviTotalVariance(params_[0], params_[1], params_[2],
Expand Down
12 changes: 12 additions & 0 deletions ql/experimental/volatility/svismilesection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,23 @@ namespace QuantLib {
class SviSmileSection : public SmileSection {

public:
//! \name Constructors
//@{
/*! @param timeToExpiry Time to expiry
@param forward Forward price corresponding to the expiry date
@param sviParameters Expects SVI parameters as a vector composed of a, b, sigma, rho, m
*/
SviSmileSection(Time timeToExpiry, Rate forward, std::vector<Real> sviParameters);
/*! @param d Date of expiry
@param forward Forward price corresponding to the expiry date
@param sviParameters Expects SVI parameters as a vector composed of a, b, sigma, rho, m
@param dc Day count method used to compute the time to expiry
*/
SviSmileSection(const Date& d,
Rate forward,
std::vector<Real> sviParameters,
const DayCounter& dc = Actual365Fixed());
//@}
Real minStrike() const override { return 0.0; }
Real maxStrike() const override { return QL_MAX_REAL; }
Real atmLevel() const override { return forward_; }
Expand Down

0 comments on commit 0573421

Please sign in to comment.