-
Notifications
You must be signed in to change notification settings - Fork 581
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
Time decay of American options #43
Comments
Hi, You are absolutely right that a gradient on the expiry will do the trick for computing theta. Taking as an example, the vanilla option, you can do this: volatilities = np.array([0.25, 0.35])
forwards = np.array([100.0, 5.0])
strikes = np.array([100.0, 5.1])
def value_fn(t):
return tff.black_scholes.option_price(
volatilities=volatilities,
strikes=strikes,
expiries=t,
forwards=forwards)
expiries = tf.constant(np.array([0.25, 1.0]))
theta = -tff.math.fwd_gradient(value_fn, expiries)
price = value_fn(expiries)
print(f"Price: {price}, Theta: {theta}")
# Prints: Price: [4.98353381 0.65265898], Theta: [-9.95409642 -0.34663542] Same logic will work with the American options. Regarding the question about different expiries for the American options (or for anything on the grid), there are two options:
Apply a vector rescaling to the time t so that [tau1, tau2] = t / [T1, T2]. With this rescaling the options expire at time 1 in both tau1 and tau2. You need to account for this rescaling in the equation above so they become:
These are now solvable using the batching of the backward solver (tff.math.pde.fd_solvers.solve_backward as in the example you referred to) by setting the coefficients of the PDE appropriately. You can see that this corresponds to rescaling the volatilities by (sigma_i -> sigma_i * Sqrt(T_i)) and the rates by (r_i -> r_i * T). You impose the boundary conditions at time = 1. This logic can be generalized to more than two options. I think it will be valuable to wrap this procedure (i.e. the rescaling) for pricing a batch of American options with varying expiries as a function in the library (perhaps, under tff.black_scholes.american_option). Thanks for bringing this up! It would be great if you could send a PR with your example when you are ready. |
Hello and thanks for the library!
I am working on an integration of TFF into one of my option trading strategies and trying to figure out several practical aspects, such as IV determination and finding greeks. After reading through all issues and discussions I have a working notebook which expands the American option example (using PDE) and includes volatility estimation and (most of) greeks using
tff.math.fwd_gradient
. There are still some questions about gridding to manage batches with significantly different strikes, but I think I'll manage, maybe even to an extent I can do a PR for that example...One thing I cannot comprehend yet is the time decay and time aspects overalls. How would you recommend to approach theta estimation? Should I try
fwd_gradient
onexpiry
? Related question is how to manage options with significantly different time to expiration? The example states that volatility term has to be adjusted - not sure I understand it.The text was updated successfully, but these errors were encountered: