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

Add support for negative rates on barrier options. #2

Merged
merged 1 commit into from
Apr 27, 2015

Conversation

mwmiller
Copy link
Contributor

Instead of flooring to zero as done in the pricing module, here we need
a very small value to avoid similar divide by 0 problems. For this,
we use the "SMALL_VALUE_MU" which seems tailor-made for the purpose.

Also, some cleanup and rationalization of the test file to make it
easier to understand both the source and output. Plus, of course, adding
a couple test cases for the improved functions.

All of the values seem reasonable to the untrained eye.

cc: @junbon @rakshit-binary @kavehmz @jy-binary

NB: the travis tests may fail if Binaries v1.22 is not yet widely available. This will not be merged until tests pass, but no further code changes are expected to make that happen.

Edit to add: tests pass, so I guess you can ignore the above.

Instead of flooring to zero as done in the pricing module, here we need
a very small value to avoid similar divide by 0 problems. For this,
we use the "SMALL_VALUE_MU" which seems tailor-made for the purpose.

Also, some cleanup and rationalization of the test file to make it
easier to understand both the source and output. Plus, of course, adding
a couple test cases for the improved functions.

All of the values seem reasonable to the untrained eye.
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 9e034e6 on negative_rates into * on master*.

@mwmiller
Copy link
Contributor Author

Anybody have any feedback on this? It's a set of nearly identical changes as those to the pricing formulae.

@rakshit-deriv
Copy link

So essentially for greeks, since we can't floor them to zero, we are limiting these to a SMALL_VALUE_MU, right ? It looks fine to me.

@mwmiller
Copy link
Contributor Author

since we can't floor them to zero, we are limiting these to a SMALL_VALUE_MU

Correct. Since it's used in multiple places in both distributions (and the numbers came out "right"), I decided to stick with convention. For the record, the value is (currently?) set to 1e-10.

I'll get this out and into the system today if possible.

mwmiller added a commit that referenced this pull request Apr 27, 2015
Add support for negative rates on barrier options.
@mwmiller mwmiller merged commit 8f13ccb into master Apr 27, 2015
@mwmiller mwmiller deleted the negative_rates branch April 27, 2015 09:41
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 this pull request may close these issues.

None yet

3 participants