I am trying to add a holiday to my calendar in QuantLib such that my option pricing model considers this in pricing where I would expect that the time to expiry should decrease with the inclusion of a holiday, and my option reduce in price. However, when I use the .addHoliday
method it successfully adds the holiday to the Calendar, but the option price doesn't change. It seems as if the option time to expiry is used from the DayCounter object and doesn't use the Calendar. Would my interpretation here be correct and if so, how would I add a holiday such that it affects my option pricing? My expectation is that the option price decreases by the same amount as if I reduced the expiry date by a day. Example below
import QuantLib as ql
def get_option_price(add_holiday):
calculation_date = ql.Date(18, 1, 2023)
ql.Settings.instance().evaluationDate = calculation_date
expiry = ql.Date(30, 1, 2023)
spot_price = 100.
strike_price = 105.
volatility = 0.50
dividend_rate = 0
option_type = ql.Option.Call
risk_free_rate = 0.001
day_count = ql.Actual365Fixed()
calendar = ql.UnitedStates(0)
if add_holiday:
calendar.addHoliday(ql.Date(24, 1, 2023))
print(add_holiday, ql.Calendar.holidayList(calendar, calculation_date, expiry))
payoff = ql.PlainVanillaPayoff(option_type, strike_price)
exercise = ql.EuropeanExercise(expiry)
european_option = ql.VanillaOption(payoff, exercise)
spot_handle = ql.QuoteHandle(ql.SimpleQuote(spot_price))
flat_ts = ql.YieldTermStructureHandle(ql.FlatForward(calculation_date, risk_free_rate, day_count))
dividend_yield = ql.YieldTermStructureHandle(ql.FlatForward(calculation_date, dividend_rate, day_count))
flat_vol_ts = ql.BlackVolTermStructureHandle(ql.BlackConstantVol(calculation_date, calendar, volatility, day_count))
bsm_process = ql.BlackScholesMertonProcess(spot_handle, dividend_yield, flat_ts, flat_vol_ts)
european_option.setPricingEngine(ql.AnalyticEuropeanEngine(bsm_process))
print(european_option.NPV(), european_option.delta())
get_option_price(False)
get_option_price(True)
False ()
1.7305073013860064 0.3111915181849204
True (Date(24,1,2023),)
1.7305073013860064 0.3111915181849204