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

#include <ored/marketdata/strike.hpp>

+ Inheritance diagram for DeltaStrike:
+ Collaboration diagram for DeltaStrike:

Public Member Functions

 DeltaStrike ()
 Default constructor. More...
 
 DeltaStrike (QuantLib::DeltaVolQuote::DeltaType deltaType, QuantLib::Option::Type optionType, QuantLib::Real delta)
 Explicit constructor. More...
 
- Public Member Functions inherited from BaseStrike
virtual ~BaseStrike ()
 
virtual void fromString (const std::string &strStrike)=0
 Populate the Strike object from strStrike. More...
 
virtual std::string toString () const =0
 Write the Strike object to string. More...
 

Inspectors

QuantLib::DeltaVolQuote::DeltaType deltaType_
 
QuantLib::Option::Type optionType_
 
QuantLib::Real delta_
 
class boost::serialization::access
 Serialization. More...
 
QuantLib::DeltaVolQuote::DeltaType deltaType () const
 Return the delta type. More...
 
QuantLib::Option::Type optionType () const
 Return the option type. More...
 
QuantLib::Real delta () const
 Return the delta level. More...
 
void fromString (const std::string &strStrike) override
 
std::string toString () const override
 
bool equal_to (const BaseStrike &other) const override
 Override in derived classes to compare specific Strikes. More...
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Additional Inherited Members

virtual bool equal_to (const BaseStrike &other) const =0
 Override in derived classes to compare specific Strikes. More...
 

Detailed Description

Strike implementation where the strike is described by a delta type, an option type and a delta level.

Definition at line 101 of file strike.hpp.

Constructor & Destructor Documentation

◆ DeltaStrike() [1/2]

Default constructor.

Definition at line 58 of file strike.cpp.

58: deltaType_(DeltaVolQuote::Spot), optionType_(Option::Call) {}
QuantLib::DeltaVolQuote::DeltaType deltaType_
Definition: strike.hpp:139
QuantLib::Option::Type optionType_
Definition: strike.hpp:140

◆ DeltaStrike() [2/2]

DeltaStrike ( QuantLib::DeltaVolQuote::DeltaType  deltaType,
QuantLib::Option::Type  optionType,
QuantLib::Real  delta 
)

Explicit constructor.

Member Function Documentation

◆ deltaType()

DeltaVolQuote::DeltaType deltaType ( ) const

Return the delta type.

Definition at line 63 of file strike.cpp.

63{ return deltaType_; }
+ Here is the caller graph for this function:

◆ optionType()

Option::Type optionType ( ) const

Return the option type.

Definition at line 65 of file strike.cpp.

65{ return optionType_; }
+ Here is the caller graph for this function:

◆ delta()

Real delta ( ) const

Return the delta level.

Definition at line 67 of file strike.cpp.

67{ return delta_; }
QuantLib::Real delta_
Definition: strike.hpp:141
+ Here is the caller graph for this function:

◆ fromString()

void fromString ( const std::string &  strStrike)
overridevirtual

Populate DeltaStrike object from strStrike.

The strStrike is expected to be of the form DEL / Spot|Fwd|PaSpot|PaFwd / Call|Put / DELTA_VALUE. An exception is thrown if strStrike is not of this form and cannot be parsed properly.

Implements BaseStrike.

Definition at line 69 of file strike.cpp.

69 {
70
71 // Expect strStrike of form: DEL / Spot|Fwd|PaSpot|PaFwd / Call|Put / DELTA_VALUE
72 vector<string> tokens;
73 boost::split(tokens, strStrike, boost::is_any_of("/"));
74 QL_REQUIRE(tokens.size() == 4, "DeltaStrike::fromString expects 4 tokens.");
75 QL_REQUIRE(tokens[0] == "DEL", "DeltaStrike::fromString expects 1st token to equal 'DEL'.");
76
77 deltaType_ = parseDeltaType(tokens[1]);
78 optionType_ = parseOptionType(tokens[2]);
79 delta_ = parseReal(tokens[3]);
80}
Real parseReal(const string &s)
Convert text to Real.
Definition: parsers.cpp:112
Option::Type parseOptionType(const std::string &s)
Convert text to QuantLib::Option::Type.
Definition: parsers.cpp:481
DeltaVolQuote::DeltaType parseDeltaType(const std::string &s)
Convert text to QuantLib::DeltaVolQuote::DeltaType.
Definition: parsers.cpp:763
+ Here is the call graph for this function:

◆ toString()

string toString ( ) const
overridevirtual

Writes the DeltaStrike object to string.

The string representation of the DeltaStrike object is of the form DEL / Spot|Fwd|PaSpot|PaFwd / Call|Put / DELTA_VALUE.

Implements BaseStrike.

Definition at line 82 of file strike.cpp.

82 {
83
84 // Write string of form: DEL / Spot|Fwd|PaSpot|PaFwd / Call|Put / DELTA_VALUE
85 ostringstream oss;
86 oss << "DEL/" << deltaType_ << "/" << optionType_ << "/" << to_string(delta_);
87 return oss.str();
88}
std::string to_string(const LocationInfo &l)
Definition: ast.cpp:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ equal_to()

bool equal_to ( const BaseStrike other) const
overrideprotectedvirtual

Override in derived classes to compare specific Strikes.

Implements BaseStrike.

Definition at line 90 of file strike.cpp.

90 {
91 if (const DeltaStrike* p = dynamic_cast<const DeltaStrike*>(&other)) {
92 return deltaType_ == p->deltaType() && optionType_ == p->optionType() && close(delta_, p->delta());
93 } else {
94 return false;
95 }
96}
DeltaStrike()
Default constructor.
Definition: strike.cpp:58

◆ serialize()

template void serialize ( Archive &  ar,
const unsigned int  version 
)
private

Definition at line 296 of file strike.cpp.

296 {
297 ar& boost::serialization::base_object<BaseStrike>(*this);
298 ar& deltaType_;
299 ar& optionType_;
300 ar& delta_;
301}

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Serialization.

Definition at line 143 of file strike.hpp.

Member Data Documentation

◆ deltaType_

QuantLib::DeltaVolQuote::DeltaType deltaType_
private

Definition at line 139 of file strike.hpp.

◆ optionType_

QuantLib::Option::Type optionType_
private

Definition at line 140 of file strike.hpp.

◆ delta_

QuantLib::Real delta_
private

Definition at line 141 of file strike.hpp.