52 Date settlement = arguments_.settlementDate;
53 Leg cf = arguments_.cashflows;
54 Date optionMaturity = arguments_.putCallSchedule[0]->date();
61 for (
Size i = 0; i < cf.size() - 1; ++i) {
62 if (!cf[i]->hasOccurred(settlement,
false)) {
63 if (cf[i]->hasOccurred(optionMaturity,
false)) {
64 income += cf[i]->amount() *
77 Date bondMaturity = arguments_.redemptionDate;
78 Date exerciseDate = arguments_.callabilityDates[0];
79 Leg fixedLeg = arguments_.cashflows;
86 DayCounter dayCounter = arguments_.paymentDayCounter;
87 Frequency frequency = arguments_.frequency;
108 false, exerciseDate);
110 Real cashStrike = arguments_.callabilityPrices[0] * arguments_.faceAmount / 100.0;
118 maturityTime-exerciseTime,
120 Volatility fwdPriceVol = yieldVol*fwdDur*fwdYtm;
127 QL_REQUIRE(arguments_.putCallSchedule.size() == 1,
128 "Must have exactly one call/put date to use Black Engine");
130 Date settle = arguments_.settlementDate;
131 Date exerciseDate = arguments_.callabilityDates[0];
133 "must have exercise Date >= settlement Date");
135 Leg fixedLeg = arguments_.cashflows;
148 Real cashStrike = arguments_.callabilityPrices[0] * arguments_.faceAmount / 100.0;
150 Option::Type type = (arguments_.putCallSchedule[0]->type() ==
158 Real embeddedOptionValue =
162 priceVol*std::sqrt(exerciseTime));
165 results_.value = npv - embeddedOptionValue;
166 results_.settlementValue = value - embeddedOptionValue;
168 results_.value = npv + embeddedOptionValue;
169 results_.settlementValue = value + embeddedOptionValue;
Black-formula callable bond engines.
Constant callable-bond volatility.
Callable-bond volatility structure.
const YieldTermStructure & discountCurve_
Cash-flow analysis functions.
const Instrument::results * results_
Actual/365 (Fixed) day count convention.
Handle< CallableBondVolatilityStructure > volatility_
Handle< YieldTermStructure > discountCurve_
void calculate() const override
Volatility forwardPriceVolatility() const
BlackCallableFixedRateBondEngine(const Handle< Quote > &fwdYieldVol, Handle< YieldTermStructure > discountCurve)
volatility is the quoted fwd yield volatility, not price vol
Constant callable-bond volatility, no time-strike dependence.
Callable-bond volatility structure.
static Real npv(const Leg &leg, const YieldTermStructure &discountCurve, bool includeSettlementDateFlows, Date settlementDate=Date(), Date npvDate=Date())
NPV of the cash flows.
static Rate yield(const Leg &leg, Real npv, const DayCounter &dayCounter, Compounding compounding, Frequency frequency, bool includeSettlementDateFlows, Date settlementDate=Date(), Date npvDate=Date(), Real accuracy=1.0e-10, Size maxIterations=100, Rate guess=0.05)
Implied internal rate of return.
static Time duration(const Leg &leg, const InterestRate &yield, Duration::Type type, bool includeSettlementDateFlows, Date settlementDate=Date(), Date npvDate=Date())
Cash-flow duration.
Time yearFraction(const Date &, const Date &, const Date &refPeriodStart=Date(), const Date &refPeriodEnd=Date()) const
Returns the period between two dates as a fraction of year.
Shared handle to an observable.
Concrete interest rate class.
Calendar for reproducing theoretical calculations.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Frequency
Frequency of events.
@ Once
only once, e.g., a zero-coupon
@ NoFrequency
null frequency
Real Time
continuous quantity with 1-year units
Real Volatility
volatility
std::size_t Size
size of a container
Real blackFormula(Option::Type optionType, Real strike, Real forward, Real stdDev, Real discount, Real displacement)
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
Calendar for reproducing theoretical calculations.