Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can calculate the American put option's vega,rho? #2016

Open
hwypengsir opened this issue Jul 9, 2024 · 3 comments
Open

How can calculate the American put option's vega,rho? #2016

hwypengsir opened this issue Jul 9, 2024 · 3 comments

Comments

@hwypengsir
Copy link

The QuantLib's version in my os:

import QuantLib as ql
ql.__version__
'1.34'

All the arguments related to the put option:

settlementDate = ql.Date(11, ql.July, 2019)
maturity = ql.Date(19, ql.July, 2019)
stock = 0.28
strike = 0.5
riskFreeRate = 0.05
volatility = 1.7

The other part of price valuation:

calendar = ql.UnitedStates(ql.UnitedStates.NYSE)
dayCounter = ql.Actual365Fixed(ql.Actual365Fixed.Standard)
ql.Settings.instance().evaluationDate = todayDate
AmericanExercise(earliestDate, latestDate, payoffAtExpiry=False)
AmericanExercise = ql.AmericanExercise(todayDate,maturity)
optionType = ql.Option.Put    
payoff = ql.PlainVanillaPayoff(type=optionType, strike=strike)
AmericanOption = ql.VanillaOption(payoff=payoff,exercise=AmericanExercise)

underlying = ql.SimpleQuote(stock)
underlyingH = ql.QuoteHandle(underlying)
flatRiskFreeTS = ql.YieldTermStructureHandle(
    ql.FlatForward(
        settlementDate, riskFreeRate, dayCounter))
flatVolTS = ql.BlackVolTermStructureHandle(
    ql.BlackConstantVol(
        settlementDate, calendar,
        volatility, dayCounter))
bsProcess = ql.BlackScholesProcess(
    s0=underlyingH,
    riskFreeTS=flatRiskFreeTS,
    volTS=flatVolTS)
 
steps = 200
binomial_engine = ql.BinomialVanillaEngine(bsProcess, "crr", steps)
AmericanOption.setPricingEngine(binomial_engine)

The put option's price:

print("Option value =", AmericanOption.NPV())
Option value = 0.22013426651607249

Other Greeks(Delta,Gamma,theta)value:

print("Delta value  =", AmericanOption.delta())
Delta value  = -0.988975537620728
print("Gamma value  =", AmericanOption.gamma())
Gamma value  = 0.5635976654806573
print("Theta value  =", AmericanOption.theta())
Theta value  = -0.03899648147441449

It can't get American put option's vega,rho:

print("Theta value  =", AmericanOption.theta())
Theta value  = -0.03899648147441449
>>> print("Vega value   =", AmericanOption.vega())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/debian/mydoc/lib/python3.11/site-packages/QuantLib/QuantLib.py", line 17245, in vega
    return _QuantLib.OneAssetOption_vega(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: vega not provided
>>> print("Rho value    =", AmericanOption.rho())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/debian/mydoc/lib/python3.11/site-packages/QuantLib/QuantLib.py", line 17249, in rho
    return _QuantLib.OneAssetOption_rho(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: rho not provided

The AmericanOption contains vega and rho:

'vega' and 'rho' in dir(AmericanOption)
True

Why 'vega' and 'rho' are not provided in runtime?
How can calculate the American put option's vega,rho?
Are there other python libs can work for American BS model?

Copy link

boring-cyborg bot commented Jul 9, 2024

Thanks for posting! It might take a while before we look at your issue, so don't worry if there seems to be no feedback. We'll get to it.

@lballabio
Copy link
Owner

Hi—unlike European options, which use analytic formulas and can provide all Greeks, American options use a finite-differences numerical method which can't provide vega and rho. You can calculate them by bumping and repricing, as shown in https://www.youtube.com/watch?v=MgUlBB59Ll0.

@klausspanderen
Copy link
Contributor

klausspanderen commented Aug 11, 2024

Hi,
the BjerksundStenslandApproximationEngine supports all kinds of greeks for American options. It is only an approximation but usually a pretty good one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants