public static void generateSabrData(PrintStream out) throws IOException {
double mu;
double strike;
double price;
double impliedVolatilityPct;
SABRExtrapolationRightFunction sabrExtra;
BlackImpliedVolatilityFormula implied = new BlackImpliedVolatilityFormula();
BlackFunctionData blackData = new BlackFunctionData(FORWARD, 1.0, 0.0);
out.println("Mu\tPrice\tStrike\tImpliedVolPct");
for (int i = 0; i < MU_VALUES.length; i++) {
mu = MU_VALUES[i];
sabrExtra = new SABRExtrapolationRightFunction(FORWARD, SABR_DATA, CUT_OFF_STRIKE, TIME_TO_EXPIRY, mu);
for (int p = 0; p <= N_PTS; p++) {
strike = CUT_OFF_STRIKE - RANGE_STRIKE + p * 4.0 * RANGE_STRIKE / N_PTS;
EuropeanVanillaOption option = new EuropeanVanillaOption(strike, TIME_TO_EXPIRY, true);
price = sabrExtra.price(option);
impliedVolatilityPct = implied.getImpliedVolatility(blackData, option, price) * 100;
out.format("%4.0f\t%1.10f\t%1.10f\t%1.10f%n", mu, price, strike, impliedVolatilityPct);
}
}
}