#include <ored/portfolio/tradestrike.hpp>
Definition at line 30 of file tradestrike.hpp.
◆ StrikePrice
◆ Type
◆ TradeStrike() [1/4]
◆ TradeStrike() [2/4]
Definition at line 35 of file tradestrike.cpp.
38 else
40}
boost::variant< StrikeYield, StrikePrice > strike_
QuantLib::Real value() const
◆ TradeStrike() [3/4]
TradeStrike |
( |
const QuantLib::Real & |
value, |
|
|
const std::string & |
currency |
|
) |
| |
◆ TradeStrike() [4/4]
TradeStrike |
( |
const QuantLib::Real & |
value, |
|
|
QuantLib::Compounding |
compounding |
|
) |
| |
Definition at line 46 of file tradestrike.cpp.
48}
const QuantLib::Compounding & compounding()
◆ value()
QuantLib::Real value |
( |
| ) |
const |
◆ type()
◆ currency()
Definition at line 119 of file tradestrike.cpp.
119 {
120 QL_REQUIRE(
type_ ==
Type::Price,
"TradeStrike currency only valid when Strike type is Price");
122}
std::string currency() const
StrikePrice & strikePrice() const
◆ compounding()
const QuantLib::Compounding & compounding |
( |
| ) |
|
Definition at line 124 of file tradestrike.cpp.
124 {
125 QL_REQUIRE(
type_ ==
Type::Yield,
"TradeStrike currency only valid when Strike type is Yield");
127}
StrikeYield & strikeYield() const
QuantLib::Compounding compounding
◆ strikePrice()
◆ strikeYield()
◆ setValue()
void setValue |
( |
const QuantLib::Real & |
value | ) |
|
Definition at line 129 of file tradestrike.cpp.
129 {
132 } else {
134 }
135}
void setValue(const QuantLib::Real &value)
◆ setCurrency()
void setCurrency |
( |
const std::string & |
currency | ) |
|
Definition at line 137 of file tradestrike.cpp.
137 {
138 QL_REQUIRE(
type_ ==
Type::Price,
"TradeStrike currency only valid when Strike type is Price");
140}
void setCurrency(const std::string ¤cy)
◆ fromXML()
void fromXML |
( |
XMLNode * |
node, |
|
|
const bool |
isRequired = true , |
|
|
const bool |
allowYieldStrike = false |
|
) |
| |
Definition at line 50 of file tradestrike.cpp.
50 {
52 if (dataNode) {
53
55 QL_REQUIRE(allowYieldStrike, "StrikeYield not supported for this trade type.");
62 } else {
66 else {
67
68
71 }
74 }
75 } else {
76
78 if (!s.empty()) {
82 }
83 }
84}
void fromXMLNode(XMLNode *node)
static Real getChildValueAsDouble(XMLNode *node, const string &name, bool mandatory=false, double defaultValue=0.0)
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
static XMLNode * getChildNode(XMLNode *n, const string &name="")
Compounding parseCompounding(const string &s)
Convert text to QuantLib::Compounding;.
rapidxml::xml_node< char > XMLNode
◆ toXML()
Definition at line 86 of file tradestrike.cpp.
86 {
89
90 auto sp = QuantLib::ext::get<StrikePrice>(
strike_);
91 node = doc.allocNode("Strike", boost::lexical_cast<std::string>(sp.valueString()));
92 } else {
93 node = doc.allocNode("StrikeData");
95
97 } else {
101 subNode = doc.allocNode("StrikeYield");
104 } else {
106 subNode = doc.allocNode("StrikePrice");
107 sp.toXMLNode(doc, subNode);
108 }
110 }
111 }
112 return node;
113}
void toXMLNode(XMLDocument &doc, XMLNode *node)
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
static void appendNode(XMLNode *parent, XMLNode *child)
std::string to_string(const LocationInfo &l)
◆ empty()
const bool empty |
( |
| ) |
const |
Definition at line 142 of file tradestrike.cpp.
142 {
143 try {
144 return value() == Null<Real>();
145 } catch (...) {
146 return true;
147 }
148}
◆ strike_
◆ type_
◆ onlyStrike_
◆ noStrikePriceNode_
bool noStrikePriceNode_ = false |
|
private |