Skip to content

Commit

Permalink
Use fixed vs floater swap
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio committed Mar 22, 2024
1 parent f97c6d9 commit fffcb9f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
17 changes: 6 additions & 11 deletions ql/cashflows/lineartsrpricer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,14 @@ namespace QuantLib {

swapTenor_ = swapIndex_->tenor();

Leg swapFixedLeg;
if(auto on = ext::dynamic_pointer_cast<OvernightIndexedSwapIndex>(swapIndex_)) {
onSwap_ = on->underlyingSwap(fixingDate_);
swapRateValue_ = onSwap_->fairRate();
annuity_ = 1.0E4 * std::fabs(onSwap_->fixedLegBPS());
swapFixedLeg = onSwap_->fixedLeg();
}
else {
if (auto on = ext::dynamic_pointer_cast<OvernightIndexedSwapIndex>(swapIndex_)) {
swap_ = on->underlyingSwap(fixingDate_);
} else {
swap_ = swapIndex_->underlyingSwap(fixingDate_);
swapRateValue_ = swap_->fairRate();
annuity_ = 1.0E4 * std::fabs(swap_->fixedLegBPS());
swapFixedLeg = swap_->fixedLeg();
}
swapRateValue_ = swap_->fairRate();
annuity_ = 1.0E4 * std::fabs(swap_->fixedLegBPS());
Leg swapFixedLeg = swap_->fixedLeg();

ext::shared_ptr<SmileSection> sectionTmp =
swaptionVolatility()->smileSection(fixingDate_, swapTenor_);
Expand Down
4 changes: 2 additions & 2 deletions ql/cashflows/lineartsrpricer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <ql/cashflows/couponpricer.hpp>
#include <ql/instruments/payoffs.hpp>
#include <ql/indexes/swapindex.hpp>
#include <ql/instruments/fixedvsfloatingswap.hpp>
#include <ql/math/integrals/integral.hpp>

namespace QuantLib {
Expand Down Expand Up @@ -237,8 +238,7 @@ namespace QuantLib {
annuity_;

ext::shared_ptr<SwapIndex> swapIndex_;
ext::shared_ptr<VanillaSwap> swap_;
ext::shared_ptr<OvernightIndexedSwap> onSwap_;
ext::shared_ptr<FixedVsFloatingSwap> swap_;
ext::shared_ptr<SmileSection> smileSection_;

Settings settings_;
Expand Down

0 comments on commit fffcb9f

Please sign in to comment.