Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
DeltaString Class Reference

Utility class for handling delta strings ATM, 10P, 25C, ... used e.g. for FX Surfaces. More...

#include <ored/utilities/strike.hpp>

+ Collaboration diagram for DeltaString:

Public Member Functions

 DeltaString (const std::string &s)
 
bool isAtm () const
 
bool isPut () const
 
bool isCall () const
 
Real delta () const
 

Private Attributes

bool isAtm_
 
bool isPut_
 
bool isCall_
 
Real delta_
 

Detailed Description

Utility class for handling delta strings ATM, 10P, 25C, ... used e.g. for FX Surfaces.

Definition at line 81 of file strike.hpp.

Constructor & Destructor Documentation

◆ DeltaString()

DeltaString ( const std::string &  s)

Definition at line 188 of file strike.cpp.

188 {
189 QL_REQUIRE(!s.empty() && (s.back() == 'P' || s.back() == 'C' || s == "ATM"),
190 "invalid delta quote, expected ATM, 10P, 25C, ...");
191 isAtm_ = s == "ATM";
192 isPut_ = !s.empty() && s.back() == 'P';
193 isCall_ = !s.empty() && s.back() == 'C';
194 if (isPut_ || isCall_) {
195 try {
196 delta_ = ore::data::parseReal(s.substr(0, s.size() - 1)) / 100.0 * (isPut_ ? -1.0 : 1.0);
197 } catch (const std::exception& e) {
198 QL_FAIL("DeltaString: can not convert call / put delta '" << s << "' to numeric value: " << e.what());
199 }
200 }
201}
Real parseReal(const string &s)
Convert text to Real.
Definition: parsers.cpp:112
+ Here is the call graph for this function:

Member Function Documentation

◆ isAtm()

bool isAtm ( ) const

Definition at line 84 of file strike.hpp.

84{ return isAtm_; }
+ Here is the caller graph for this function:

◆ isPut()

bool isPut ( ) const

Definition at line 85 of file strike.hpp.

85{ return isPut_; }
+ Here is the caller graph for this function:

◆ isCall()

bool isCall ( ) const

Definition at line 86 of file strike.hpp.

86{ return isCall_; }
+ Here is the caller graph for this function:

◆ delta()

Real delta ( ) const

Definition at line 87 of file strike.hpp.

87{ return delta_; }
+ Here is the caller graph for this function:

Member Data Documentation

◆ isAtm_

bool isAtm_
private

Definition at line 90 of file strike.hpp.

◆ isPut_

bool isPut_
private

Definition at line 90 of file strike.hpp.

◆ isCall_

bool isCall_
private

Definition at line 90 of file strike.hpp.

◆ delta_

Real delta_
private

Definition at line 91 of file strike.hpp.