本文整理汇总了C++中Bond::notional方法的典型用法代码示例。如果您正苦于以下问题:C++ Bond::notional方法的具体用法?C++ Bond::notional怎么用?C++ Bond::notional使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bond
的用法示例。
在下文中一共展示了Bond::notional方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: zSpread
Spread BondFunctions::zSpread(const Bond& bond,
Real cleanPrice,
const shared_ptr<YieldTermStructure>& d,
const DayCounter& dayCounter,
Compounding compounding,
Frequency frequency,
Date settlement,
Real accuracy,
Size maxIterations,
Rate guess) {
if (settlement == Date())
settlement = bond.settlementDate();
QL_REQUIRE(BondFunctions::isTradable(bond, settlement),
"non tradable at " << settlement <<
" (maturity being " << bond.maturityDate() << ")");
Real dirtyPrice = cleanPrice + bond.accruedAmount(settlement);
dirtyPrice /= 100.0 / bond.notional(settlement);
return CashFlows::zSpread(bond.cashflows(),
d,
dirtyPrice,
dayCounter, compounding, frequency,
false, settlement, settlement,
accuracy, maxIterations, guess);
}
示例2: isTradable
bool BondFunctions::isTradable(const Bond& bond,
Date settlement) {
if (settlement == Date())
settlement = bond.settlementDate();
return bond.notional(settlement)!=0.0;
}
示例3: accruedAmount
Real BondFunctions::accruedAmount(const Bond& bond,
Date settlement) {
if (settlement == Date())
settlement = bond.settlementDate();
QL_REQUIRE(BondFunctions::isTradable(bond, settlement),
"non tradable at " << settlement <<
" (maturity being " << bond.maturityDate() << ")");
return CashFlows::accruedAmount(bond.cashflows(),
false, settlement) *
100.0 / bond.notional(settlement);
}
示例4: bps
Real BondFunctions::bps(const Bond& bond,
const YieldTermStructure& discountCurve,
Date settlement) {
if (settlement == Date())
settlement = bond.settlementDate();
QL_REQUIRE(BondFunctions::isTradable(bond, settlement),
"non tradable at " << settlement <<
" (maturity being " << bond.maturityDate() << ")");
return CashFlows::bps(bond.cashflows(), discountCurve,
false, settlement) *
100.0 / bond.notional(settlement);
}
示例5: cleanPrice
Real BondFunctions::cleanPrice(const Bond& bond,
const InterestRate& yield,
Date settlement) {
if (settlement == Date())
settlement = bond.settlementDate();
QL_REQUIRE(BondFunctions::isTradable(bond, settlement),
"non tradable at " << settlement <<
" (maturity being " << bond.maturityDate() << ")");
Real dirtyPrice = CashFlows::npv(bond.cashflows(), yield,
false, settlement) *
100.0 / bond.notional(settlement);
return dirtyPrice - bond.accruedAmount(settlement);
}
示例6: atmRate
Rate BondFunctions::atmRate(const Bond& bond,
const YieldTermStructure& discountCurve,
Date settlement,
Real cleanPrice) {
if (settlement == Date())
settlement = bond.settlementDate();
QL_REQUIRE(BondFunctions::isTradable(bond, settlement),
"non tradable at " << settlement <<
" (maturity being " << bond.maturityDate() << ")");
Real dirtyPrice = cleanPrice==Null<Real>() ? Null<Real>() :
cleanPrice + bond.accruedAmount(settlement);
Real currentNotional = bond.notional(settlement);
Real npv = dirtyPrice/100.0 * currentNotional;
return CashFlows::atmRate(bond.cashflows(), discountCurve,
false, settlement, settlement,
npv);
}
示例7: yield
static Rate yield(Solver solver,
const Bond& bond,
Real cleanPrice,
const DayCounter& dayCounter,
Compounding compounding,
Frequency frequency,
Date settlementDate = Date(),
Real accuracy = 1.0e-10,
Rate guess = 0.05) {
if (settlementDate == Date())
settlementDate = bond.settlementDate();
QL_REQUIRE(BondFunctions::isTradable(bond, settlementDate),
"non tradable at " << settlementDate <<
" (maturity being " << bond.maturityDate() << ")");
Real dirtyPrice = cleanPrice + bond.accruedAmount(settlementDate);
dirtyPrice /= 100.0 / bond.notional(settlementDate);
return CashFlows::yield<Solver>(solver, bond.cashflows(),
dirtyPrice, dayCounter, compounding,
frequency, false, settlementDate,
settlementDate, accuracy, guess);
}