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

Consistent argument names for dividends across option pricing models #50

Closed
alembcke opened this issue May 16, 2021 · 3 comments · Fixed by #51
Closed

Consistent argument names for dividends across option pricing models #50

alembcke opened this issue May 16, 2021 · 3 comments · Fixed by #51

Comments

@alembcke
Copy link
Contributor

Argument names for dividends across different option pricing models appear to be different, with no obvious reason for the difference. For example, tff.black_scholes.option_price takes in continuous_dividends, while tff.black_scholes.option_price_binomial takes in dividend_rates.

If there is no reason for the difference, then I would suggest changing dividend_rates to continuous_dividends, as tff.black_scholes.approximations.adesi_whaley also takes continuous_dividends. This would make it easier to write reusable code independent of the pricing model used.

What do others think of this? If everyone agrees to this change, then I can make it and submit the pull request.

@cyrilchim
Copy link
Contributor

Hi Alex,

Thanks for noticing that. This is indeed an oversight. Would you like to send a PR ensuring that dividend_rates is used across the library instead of continuous_dividends. This is more aligned with discount_rates. For discrete dividends we would use something like dividend_dates and dividends.

A gracious way to rename the parameter is to use a deprecation warning for continuous_dividends, e.g., see here

Here is a simple concrete example:

from tensorflow.python.util import deprecation 

@deprecation.deprecated_args(None, "z is deprecated. Use y instead", "z")
def fn(x, y=None, z=None):
  p = deprecation.deprecated_argument_lookup("y", y, "z", z)
  return x + p

User can either use y or z but a deprecation warning is thrown for z. In the future version we remove z

Please let me know if you would like to send a PR which would be very much appreciated.

Thanks!
Cyril

@alembcke
Copy link
Contributor Author

Hi Cyril,

Sure, I will work on this PR. I agree with using dividend_rates across the option pricing models. I also agree that including a deprecation decorator is the right way to go about such a change, so will include that in my PR. I will let you know if I have any questions.

Regards,
Alex

@cyrilchim
Copy link
Contributor

Thank you Alex! This is now merged.

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

Successfully merging a pull request may close this issue.

2 participants