flatVolatility.hpp
Go to the documentation of this file.
1 #ifndef JULIAN_FLATVOLATILITYSURFACE_HPP
2 #define JULIAN_FLATVOLATILITYSURFACE_HPP
3 
5 #include <iostream>
6 #include <string>
7 
8 namespace julian {
22  class FlatVolatility: public Volatility {
23  public:
24 
27  FlatVolatility(Date date, double volatility, SmartPointer<YearFraction> yf):
28  date_(date), volatility_(volatility), yf_(yf) {};
29 
30  double getVolatility(double K, Date T) const override;
31  double getVolatility(double K, double T) const override;
32  double getVariance(double K, Date T) const override;
33  double getVariance(double K, double T) const override;
34  Date getDate() const override;
35  void bumpVolatility(double) override;
36 
37  double getYearFraction(Date,Date) const override;
38 
39  FlatVolatility* clone() const override;
40  std::string info() const override;
41  ~FlatVolatility(){};
42 
43  friend std::ostream& operator<<(std::ostream&, FlatVolatility&);
44  private:
46  double volatility_;
48  };
49 }
50 #endif
Class implements flat volatility.
Definition: flatVolatility.hpp:22
FlatVolatility * clone() const override
Virtual copy constructor.
Definition: flatVolatility.cpp:53
double getVariance(double K, Date T) const override
Returns annualize variance.
Definition: flatVolatility.cpp:25
Definition: cadHoliday.cpp:3
std::string info() const override
Returns type of volatility surface.
Definition: flatVolatility.cpp:59
Template of deep-coping smart pointer.
Definition: smartPointer.hpp:14
The class interfaces volatility surface.
Definition: volatility.hpp:25
double volatility_
volatility level
Definition: flatVolatility.hpp:46
SmartPointer< YearFraction > yf_
Year fraction convention.
Definition: flatVolatility.hpp:47
File contains interface for volatility surface.
double getVolatility(double K, Date T) const override
Returns volatility. The same value is returned regardless of the given arguments. ...
Definition: flatVolatility.cpp:11
Class implements a date object.
Definition: date.hpp:27
Date getDate() const override
Returns the date for which curve was defined.
Definition: flatVolatility.cpp:47
void bumpVolatility(double) override
Shifts volatility by bump size provided.
Definition: flatVolatility.cpp:41
double getYearFraction(Date, Date) const override
Calculates year fraction.
Definition: flatVolatility.cpp:68
Date date_
represent the date on which the curve is valid
Definition: flatVolatility.hpp:45
FlatVolatility(Date date, double volatility, SmartPointer< YearFraction > yf)
constructor
Definition: flatVolatility.hpp:27
friend std::ostream & operator<<(std::ostream &, FlatVolatility &)
Overloads stream operator.
Definition: flatVolatility.cpp:76