public void theta() { double priceFutures = METHOD_FUTURE.price(CALL_JB_147.getUnderlyingFuture(), ISSUER_SPECIFIC_MULTICURVES); double expiry = CALL_JB_147.getExpirationTime(); double volatility = BLACK_SURFACE_EXP_STRIKE.getZValue(expiry, STRIKE_147); double rate = -Math.log( ISSUER_SPECIFIC_MULTICURVES .getMulticurveProvider() .getDiscountFactor(CALL_JB_147.getCurrency(), CALL_JB_147.getExpirationTime())) / CALL_JB_147.getExpirationTime(); double thetaCallExpected = BlackFormulaRepository.theta( priceFutures, STRIKE_147, CALL_JB_147.getExpirationTime(), volatility, CALL_JB_147.isCall(), rate); double thetaCallComputed = METHOD_OPT.theta(CALL_JB_147, BLACK_EXP_STRIKE_BNDFUT); assertEquals( "BondFuturesOptionMarginSecurityBlackFlatMethod: theta", thetaCallExpected, thetaCallComputed, TOLERANCE_DELTA); }
public void delta() { final double priceFutures = METHOD_FUTURE.price(CALL_JB_147.getUnderlyingFuture(), ISSUER_SPECIFIC_MULTICURVES); final EuropeanVanillaOption option = new EuropeanVanillaOption( STRIKE_147, CALL_JB_147.getExpirationTime(), CALL_JB_147.isCall()); final double expiry = CALL_JB_147.getExpirationTime(); final double volatility = BLACK_SURFACE_EXP_STRIKE.getZValue(expiry, STRIKE_147); double df = ISSUER_SPECIFIC_MULTICURVES .getMulticurveProvider() .getDiscountFactor(JBM5_DEFINITION.getCurrency(), CALL_JB_147.getExpirationTime()); final BlackFunctionData dataBlack = new BlackFunctionData(priceFutures, df, volatility); final double[] priceAD = BLACK_FUNCTION.getPriceAdjoint(option, dataBlack); final double deltaCallExpected = priceAD[1]; final double deltaCallComputed = METHOD_OPT.delta(CALL_JB_147, BLACK_EXP_STRIKE_BNDFUT); assertEquals( "BondFuturesOptionPremiumSecurityBlackBondFuturesMethod: delta", deltaCallExpected, deltaCallComputed, TOLERANCE_DELTA); final double deltaPutComputed = METHOD_OPT.delta(PUT_JB_147, BLACK_EXP_STRIKE_BNDFUT); assertEquals( "BondFuturesOptionPremiumSecurityBlackBondFuturesMethod: delta", deltaCallExpected - deltaPutComputed, df, TOLERANCE_DELTA); }
public void priceFromCurves() { final double priceFutures = METHOD_FUTURE.price(CALL_JB_147.getUnderlyingFuture(), ISSUER_SPECIFIC_MULTICURVES); final double priceExpected = METHOD_OPT.priceFromUnderlyingPrice(CALL_JB_147, BLACK_EXP_STRIKE_BNDFUT, priceFutures); final double priceComputed = METHOD_OPT.price(CALL_JB_147, BLACK_EXP_STRIKE_BNDFUT); assertEquals( "BondFuturesOptionPremiumSecurityBlackBondFuturesMethod: underlying futures price", priceExpected, priceComputed, TOLERANCE_RATE); }
public void putCallParity() { final double priceFutures = METHOD_FUTURE.price(CALL_JB_147.getUnderlyingFuture(), ISSUER_SPECIFIC_MULTICURVES); final double priceCallComputed = METHOD_OPT.price(CALL_JB_147, BLACK_EXP_STRIKE_BNDFUT); final double pricePutComputed = METHOD_OPT.price(PUT_JB_147, BLACK_EXP_STRIKE_BNDFUT); double df = ISSUER_SPECIFIC_MULTICURVES .getMulticurveProvider() .getDiscountFactor(JBM5_DEFINITION.getCurrency(), CALL_JB_147.getExpirationTime()); assertEquals( "BondFuturesOptionPremiumSecurityBlackBondFuturesMethod: put call parity price", priceCallComputed - pricePutComputed, (priceFutures - STRIKE_147) * df, TOLERANCE_RATE); }