Skip to content

Commit

Permalink
Add qlRiskyBondEngine
Browse files Browse the repository at this point in the history
  • Loading branch information
igitur committed Oct 17, 2023
1 parent ca35626 commit f2ad4d2
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
33 changes: 33 additions & 0 deletions QuantLibAddin/gensrc/metadata/functions/pricingengines.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<include>qlo/processes.hpp</include>
<include>ql/pricingengines/blackformula.hpp</include>
<include>ql/pricingengines/blackscholescalculator.hpp</include>
<include>ql/termstructures/defaulttermstructure.hpp</include>
<include>ql/termstructures/volatility/optionlet/optionletvolatilitystructure.hpp</include>
<include>ql/termstructures/volatility/swaption/swaptionvolstructure.hpp</include>
<include>ql/pricingengines/swaption/jamshidianswaptionengine.hpp</include>
Expand All @@ -26,6 +27,7 @@
<include>qlo/processes.hpp</include>
<include>ql/pricingengines/blackformula.hpp</include>
<include>ql/pricingengines/blackscholescalculator.hpp</include>
<include>ql/termstructures/defaulttermstructure.hpp</include>
<include>ql/termstructures/volatility/optionlet/optionletvolatilitystructure.hpp</include>
<include>ql/termstructures/volatility/swaption/swaptionvolstructure.hpp</include>
<include>ql/pricingengines/swaption/jamshidianswaptionengine.hpp</include>
Expand Down Expand Up @@ -1549,6 +1551,37 @@
</ParameterList>
</Constructor>

<Constructor name='qlRiskyBondEngine'>
<libraryFunction>RiskyBondEngine</libraryFunction>
<SupportedPlatforms>
<!--SupportedPlatform name='Excel' calcInWizard='false'/-->
<SupportedPlatform name='Excel'/>
<SupportedPlatform name='Calc'/>
<SupportedPlatform name='Cpp'/>
</SupportedPlatforms>
<ParameterList>
<Parameters>
<Parameter name='DefaultCurve'>
<type>QuantLib::DefaultProbabilityTermStructure</type>
<superType>libToHandle</superType>
<tensorRank>scalar</tensorRank>
<description>default term structure object ID.</description>
</Parameter>
<Parameter name='Recovery'>
<type>double</type>
<tensorRank>scalar</tensorRank>
<description>Recovery Rate.</description>
</Parameter>
<Parameter name='DiscountingCurve'>
<type>QuantLib::YieldTermStructure</type>
<superType>libToHandle</superType>
<tensorRank>scalar</tensorRank>
<description>discounting YieldTermStructure object ID.</description>
</Parameter>
</Parameters>
</ParameterList>
</Constructor>

<Constructor name='qlJamshidianSwaptionEngine'>
<libraryFunction>JamshidianSwaptionEngine</libraryFunction>
<SupportedPlatforms>
Expand Down
12 changes: 12 additions & 0 deletions QuantLibAddin/qlo/pricingengines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <ql/pricingengines/capfloor/bacheliercapfloorengine.hpp>
#include <ql/pricingengines/swap/discountingswapengine.hpp>
#include <ql/pricingengines/bond/discountingbondengine.hpp>
#include <ql/pricingengines/bond/riskybondengine.hpp>
#include <ql/processes/blackscholesprocess.hpp>
#include <ql/pricingengines/swaption/jamshidianswaptionengine.hpp>
#include <ql/pricingengines/swaption/treeswaptionengine.hpp>
Expand Down Expand Up @@ -211,6 +212,17 @@ namespace QuantLibAddin {
QuantLib::DiscountingBondEngine(discountCurve));
}

RiskyBondEngine::RiskyBondEngine(
const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
const QuantLib::Handle<QuantLib::DefaultProbabilityTermStructure>& defaultProbabilityTermStructure,
const QuantLib::Real recoveryRate,
const QuantLib::Handle<QuantLib::YieldTermStructure>& discountCurve,
bool permanent) : PricingEngine(properties, permanent)
{
libraryObject_ = boost::shared_ptr<QuantLib::PricingEngine>(new
QuantLib::RiskyBondEngine(defaultProbabilityTermStructure, recoveryRate, discountCurve));
}

JamshidianSwaptionEngine::JamshidianSwaptionEngine(
const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
const boost::shared_ptr<QuantLib::OneFactorAffineModel>& model,
Expand Down
11 changes: 11 additions & 0 deletions QuantLibAddin/qlo/pricingengines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ namespace QuantLib {
class PricingEngine;
class Quote;
class YieldTermStructure;
class DefaultProbabilityTermStructure;
class DayCounter;
class DiscountingBondEngine;
class DiscountingSwapEngine;
Expand Down Expand Up @@ -201,6 +202,16 @@ namespace QuantLibAddin {
bool permanent);
};

class RiskyBondEngine : public PricingEngine {
public:
RiskyBondEngine(
const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
const QuantLib::Handle<QuantLib::DefaultProbabilityTermStructure>& defaultProbabilityTermStructure,
const QuantLib::Real recoveryRate,
const QuantLib::Handle<QuantLib::YieldTermStructure>& discountCurve,
bool permanent);
};

class JamshidianSwaptionEngine : public PricingEngine {
public:
JamshidianSwaptionEngine(
Expand Down

0 comments on commit f2ad4d2

Please sign in to comment.