本文整理汇总了Java中net.finmath.montecarlo.interestrate.products.SwaptionSimple类的典型用法代码示例。如果您正苦于以下问题:Java SwaptionSimple类的具体用法?Java SwaptionSimple怎么用?Java SwaptionSimple使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SwaptionSimple类属于net.finmath.montecarlo.interestrate.products包,在下文中一共展示了SwaptionSimple类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCalibrationItem
import net.finmath.montecarlo.interestrate.products.SwaptionSimple; //导入依赖的package包/类
private CalibrationItem createCalibrationItem(double exerciseDate, double swapPeriodLength, int numberOfPeriods, double moneyness, double targetVolatility, ForwardCurveInterface forwardCurve, DiscountCurveInterface discountCurve) throws CalculationException {
double[] fixingDates = new double[numberOfPeriods];
double[] paymentDates = new double[numberOfPeriods];
double[] swapTenor = new double[numberOfPeriods + 1];
for (int periodStartIndex = 0; periodStartIndex < numberOfPeriods; periodStartIndex++) {
fixingDates[periodStartIndex] = exerciseDate + periodStartIndex * swapPeriodLength;
paymentDates[periodStartIndex] = exerciseDate + (periodStartIndex + 1) * swapPeriodLength;
swapTenor[periodStartIndex] = exerciseDate + periodStartIndex * swapPeriodLength;
}
swapTenor[numberOfPeriods] = exerciseDate + numberOfPeriods * swapPeriodLength;
// Swaptions swap rate
double swaprate = moneyness + getParSwaprate(forwardCurve, discountCurve, swapTenor);
// Set swap rates for each period
double[] swaprates = new double[numberOfPeriods];
Arrays.fill(swaprates, swaprate);
/*
* We use Monte-Carlo calibration on implied volatility.
* Alternatively you may change here to Monte-Carlo valuation on price or
* use an analytic approximation formula, etc.
*/
SwaptionSimple swaptionMonteCarlo = new SwaptionSimple(swaprate, swapTenor, SwaptionSimple.ValueUnit.VOLATILITY);
// double targetValuePrice = AnalyticFormulas.blackModelSwaptionValue(swaprate, targetVolatility, fixingDates[0], swaprate, getSwapAnnuity(discountCurve, swapTenor));
return new CalibrationItem(swaptionMonteCarlo, targetVolatility, 1.0);
}
示例2: createCalibrationItem
import net.finmath.montecarlo.interestrate.products.SwaptionSimple; //导入依赖的package包/类
private CalibrationItem createCalibrationItem(double weight, double exerciseDate, double swapPeriodLength, int numberOfPeriods, double moneyness, double targetVolatility, String targetVolatilityType, ForwardCurveInterface forwardCurve, DiscountCurveInterface discountCurve) throws CalculationException {
double[] fixingDates = new double[numberOfPeriods];
double[] paymentDates = new double[numberOfPeriods];
double[] swapTenor = new double[numberOfPeriods + 1];
for (int periodStartIndex = 0; periodStartIndex < numberOfPeriods; periodStartIndex++) {
fixingDates[periodStartIndex] = exerciseDate + periodStartIndex * swapPeriodLength;
paymentDates[periodStartIndex] = exerciseDate + (periodStartIndex + 1) * swapPeriodLength;
swapTenor[periodStartIndex] = exerciseDate + periodStartIndex * swapPeriodLength;
}
swapTenor[numberOfPeriods] = exerciseDate + numberOfPeriods * swapPeriodLength;
// Swaptions swap rate
double swaprate = moneyness + getParSwaprate(forwardCurve, discountCurve, swapTenor);
// Set swap rates for each period
double[] swaprates = new double[numberOfPeriods];
Arrays.fill(swaprates, swaprate);
/*
* We use Monte-Carlo calibration on implied volatility.
* Alternatively you may change here to Monte-Carlo valuation on price or
* use an analytic approximation formula, etc.
*/
SwaptionSimple swaptionMonteCarlo = new SwaptionSimple(swaprate, swapTenor, SwaptionSimple.ValueUnit.valueOf(targetVolatilityType));
// double targetValuePrice = AnalyticFormulas.blackModelSwaptionValue(swaprate, targetVolatility, fixingDates[0], swaprate, getSwapAnnuity(discountCurve, swapTenor));
return new CalibrationItem(swaptionMonteCarlo, targetVolatility, weight);
}