QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
Public Member Functions | List of all members
GapPayoff Class Reference

Binary gap payoff. More...

#include <ql/instruments/payoffs.hpp>

+ Inheritance diagram for GapPayoff:
+ Collaboration diagram for GapPayoff:

Public Member Functions

 GapPayoff (Option::Type type, Real strike, Real secondStrike)
 
- Public Member Functions inherited from StrikedTypePayoff
Real strike () const
 
- Public Member Functions inherited from TypePayoff
Option::Type optionType () const
 
- Public Member Functions inherited from Payoff
virtual ~Payoff ()=default
 

Payoff interface

Real secondStrike_
 
std::string name () const override
 
std::string description () const override
 
Real operator() (Real price) const override
 
void accept (AcyclicVisitor &) override
 
Real secondStrike () const
 

Additional Inherited Members

- Public Attributes inherited from Payoff
QL_DEPRECATED typedef Real argument_type
 
QL_DEPRECATED typedef Real result_type
 
- Protected Member Functions inherited from StrikedTypePayoff
 StrikedTypePayoff (Option::Type type, Real strike)
 
- Protected Member Functions inherited from TypePayoff
 TypePayoff (Option::Type type)
 
- Protected Attributes inherited from StrikedTypePayoff
Real strike_
 
- Protected Attributes inherited from TypePayoff
Option::Type type_
 

Detailed Description

Binary gap payoff.

This payoff is equivalent to being a) long a PlainVanillaPayoff at the first strike (same Call/Put type) and b) short a CashOrNothingPayoff at the first strike (same Call/Put type) with cash payoff equal to the difference between the second and the first strike.

Warning:
this payoff can be negative depending on the strikes

Definition at line 178 of file payoffs.hpp.

Constructor & Destructor Documentation

◆ GapPayoff()

GapPayoff ( Option::Type  type,
Real  strike,
Real  secondStrike 
)

Definition at line 180 of file payoffs.hpp.

Member Function Documentation

◆ name()

std::string name ( ) const
overridevirtual
Warning:
This method is used for output and comparison between payoffs. It is not meant to be used for writing switch-on-type code.

Implements Payoff.

Definition at line 186 of file payoffs.hpp.

◆ description()

std::string description ( ) const
overridevirtual

Reimplemented from StrikedTypePayoff.

Definition at line 172 of file payoffs.cpp.

+ Here is the call graph for this function:

◆ operator()()

Real operator() ( Real  price) const
overridevirtual

Implements Payoff.

Definition at line 178 of file payoffs.cpp.

◆ accept()

void accept ( AcyclicVisitor v)
overridevirtual

Reimplemented from Payoff.

Definition at line 189 of file payoffs.cpp.

+ Here is the call graph for this function:

◆ secondStrike()

Real secondStrike ( ) const

Definition at line 191 of file payoffs.hpp.

+ Here is the caller graph for this function:

Member Data Documentation

◆ secondStrike_

Real secondStrike_
protected

Definition at line 193 of file payoffs.hpp.