QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
DiscretizedSwap Class Reference

#include <discretizedswap.hpp>

+ Inheritance diagram for DiscretizedSwap:
+ Collaboration diagram for DiscretizedSwap:

Public Member Functions

 DiscretizedSwap (const VanillaSwap::arguments &args, const Date &referenceDate, const DayCounter &dayCounter)
 
 DiscretizedSwap (const VanillaSwap::arguments &args, const Date &referenceDate, const DayCounter &dayCounter, std::vector< CouponAdjustment > fixedCouponAdjustments, std::vector< CouponAdjustment > floatingCouponAdjustments)
 
void reset (Size size) override
 
std::vector< TimemandatoryTimes () const override
 
- Public Member Functions inherited from DiscretizedAsset
 DiscretizedAsset ()
 
virtual ~DiscretizedAsset ()=default
 
Time time () const
 
Timetime ()
 
const Arrayvalues () const
 
Arrayvalues ()
 
const ext::shared_ptr< Lattice > & method () const
 
void initialize (const ext::shared_ptr< Lattice > &, Time t)
 
void rollback (Time to)
 
void partialRollback (Time to)
 
Real presentValue ()
 
void preAdjustValues ()
 
void postAdjustValues ()
 
void adjustValues ()
 

Protected Member Functions

void preAdjustValuesImpl () override
 
void postAdjustValuesImpl () override
 
- Protected Member Functions inherited from DiscretizedAsset
bool isOnTime (Time t) const
 

Private Member Functions

void addFixedCoupon (Size i)
 
void addFloatingCoupon (Size i)
 

Private Attributes

VanillaSwap::arguments arguments_
 
std::vector< TimefixedResetTimes_
 
std::vector< TimefixedPayTimes_
 
std::vector< CouponAdjustmentfixedCouponAdjustments_
 
std::vector< boolfixedResetTimeIsInPast_
 
std::vector< TimefloatingResetTimes_
 
std::vector< TimefloatingPayTimes_
 
std::vector< CouponAdjustmentfloatingCouponAdjustments_
 
std::vector< boolfloatingResetTimeIsInPast_
 

Additional Inherited Members

- Protected Types inherited from DiscretizedAsset
enum class  CouponAdjustment { pre , post }
 
- Protected Attributes inherited from DiscretizedAsset
Time time_
 
Time latestPreAdjustment_
 
Time latestPostAdjustment_
 
Array values_
 

Detailed Description

Definition at line 34 of file discretizedswap.hpp.

Constructor & Destructor Documentation

◆ DiscretizedSwap() [1/2]

DiscretizedSwap ( const VanillaSwap::arguments args,
const Date referenceDate,
const DayCounter dayCounter 
)

Definition at line 36 of file discretizedswap.cpp.

◆ DiscretizedSwap() [2/2]

DiscretizedSwap ( const VanillaSwap::arguments args,
const Date referenceDate,
const DayCounter dayCounter,
std::vector< CouponAdjustment fixedCouponAdjustments,
std::vector< CouponAdjustment floatingCouponAdjustments 
)

Definition at line 46 of file discretizedswap.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ reset()

void reset ( Size  size)
overridevirtual

This method should initialize the asset values to an Array of the given size and with values depending on the particular asset.

Implements DiscretizedAsset.

Definition at line 97 of file discretizedswap.cpp.

+ Here is the call graph for this function:

◆ mandatoryTimes()

std::vector< Time > mandatoryTimes ( ) const
overridevirtual

This method returns the times at which the numerical method should stop while rolling back the asset. Typical examples include payment times, exercise times and such.

Note
The returned values are not guaranteed to be sorted.

Implements DiscretizedAsset.

Definition at line 102 of file discretizedswap.cpp.

◆ preAdjustValuesImpl()

void preAdjustValuesImpl ( )
overrideprotectedvirtual

This method performs the actual pre-adjustment

Reimplemented from DiscretizedAsset.

Definition at line 123 of file discretizedswap.cpp.

+ Here is the call graph for this function:

◆ postAdjustValuesImpl()

void postAdjustValuesImpl ( )
overrideprotectedvirtual

This method performs the actual post-adjustment

Reimplemented from DiscretizedAsset.

Definition at line 140 of file discretizedswap.cpp.

+ Here is the call graph for this function:

◆ addFixedCoupon()

void addFixedCoupon ( Size  i)
private

Definition at line 184 of file discretizedswap.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addFloatingCoupon()

void addFloatingCoupon ( Size  i)
private

Definition at line 199 of file discretizedswap.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ arguments_

VanillaSwap::arguments arguments_
private

Definition at line 53 of file discretizedswap.hpp.

◆ fixedResetTimes_

std::vector<Time> fixedResetTimes_
private

Definition at line 54 of file discretizedswap.hpp.

◆ fixedPayTimes_

std::vector<Time> fixedPayTimes_
private

Definition at line 55 of file discretizedswap.hpp.

◆ fixedCouponAdjustments_

std::vector<CouponAdjustment> fixedCouponAdjustments_
private

Definition at line 56 of file discretizedswap.hpp.

◆ fixedResetTimeIsInPast_

std::vector<bool> fixedResetTimeIsInPast_
private

Definition at line 57 of file discretizedswap.hpp.

◆ floatingResetTimes_

std::vector<Time> floatingResetTimes_
private

Definition at line 58 of file discretizedswap.hpp.

◆ floatingPayTimes_

std::vector<Time> floatingPayTimes_
private

Definition at line 59 of file discretizedswap.hpp.

◆ floatingCouponAdjustments_

std::vector<CouponAdjustment> floatingCouponAdjustments_
private

Definition at line 60 of file discretizedswap.hpp.

◆ floatingResetTimeIsInPast_

std::vector<bool> floatingResetTimeIsInPast_
private

Definition at line 61 of file discretizedswap.hpp.