本文整理汇总了C++中Tenor::NbOfMonth方法的典型用法代码示例。如果您正苦于以下问题:C++ Tenor::NbOfMonth方法的具体用法?C++ Tenor::NbOfMonth怎么用?C++ Tenor::NbOfMonth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tenor
的用法示例。
在下文中一共展示了Tenor::NbOfMonth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vanillaSwaption
UpperTriangleVanillaSwaptionQuotes::UpperTriangleVanillaSwaptionQuotes(
LMMTenorStructure_PTR lmmTenorStructure,
int lastYear,
const Tenor& fixedTenor,
const Tenor& floatingTenor,
const UpperTriangularDoubleMatrix& strikes, // 1st row and column not used like g!
const UpperTriangularDoubleMatrix& quotes) // 1st row and column not used like g!
: lmmTenorStructure_(lmmTenorStructure)
, lastYear_(lastYear)
, fixedTenor_(fixedTenor)
, floatingTenor_(floatingTenor)
, indexRatio_(fixedTenor.NbOfMonth()/floatingTenor.NbOfMonth())
, upperTriangleVanillaSwaptionQuotes_(lastYear+1, lastYear+1)
, indexMapping_gDelegate_gTransformed_(lastYear+1, lastYear+1)
{
assert(lmmTenorStructure_->get_horizon() == lastYear*indexRatio_);
assert(lastYear>1);
assert(strikes.size1() == strikes.size2() && strikes.size1() == lastYear_+1);
assert(quotes.size1() == quotes.size2() && quotes.size1() == lastYear_+1);
assert(fixedTenor.NbOfMonth() == 12 && fixedTenor.NbOfMonth()%floatingTenor.NbOfMonth() ==0);
assert(lmmTenorStructure->get_tenorType() == floatingTenor);
//! upperTriangle:
for(size_t iExpirity = 1; iExpirity<quotes.size1(); ++iExpirity) // row
{
for(size_t jTenor = 1; jTenor<quotes.size2()-iExpirity; ++jTenor) // col
{
double strike = strikes(iExpirity,jTenor);
//size_t indexStart = computeStartIndex(iExpirity);
//size_t indexEnd = computeIndexEnd(iExpirity,jTenor);
size_t indexStart = iExpirity*indexRatio_;
size_t indexEnd = indexStart + jTenor*indexRatio_;
VanillaSwap vanillaSwap(strike, indexStart, indexEnd, floatingTenor_, fixedTenor_, lmmTenorStructure);
VanillaSwaption vanillaSwaption(vanillaSwap, OptionType::OptionType::CALL);
double quote = quotes(iExpirity,jTenor);
std::pair<VanillaSwaption, double> p(vanillaSwaption, quote);
upperTriangleVanillaSwaptionQuotes_(iExpirity,jTenor) = p;
}
}
initialize_gDelegate_IndexIngTransformed();
}