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

initial commit #22

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

initial commit #22

wants to merge 8 commits into from

Conversation

Lapsilago
Copy link

This is the first draft for the SABR model we discussed

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@cyrilchim
Copy link
Contributor

Joerg, could you please follow one of the links above and sign the Contributor License Agreement (CLA)?

@Lapsilago
Copy link
Author

Lapsilago commented Feb 24, 2020 via email

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@Lapsilago
Copy link
Author

Lapsilago commented Feb 24, 2020 via email

Copy link
Contributor

@cyrilchim cyrilchim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much, Joerg. This is a really nice commit. Could you please split it into. Let's first push Bachelier and Dawson formulas and then the SABR approximations. I will review the SABR code later.

Comment on lines 4 to 33
Created on Fri Nov 22 15:22:13 2019

'Copyright 2020 Joerg Kienitz

'Redistribution and use in source and binary forms, with or without modification,
'are permitted provided that the following conditions are met:

'1. Redistributions of source code must retain the above copyright notice,
'this list of conditions and the following disclaimer.

'2. Redistributions in binary form must reproduce the above copyright notice,
'this list of conditions and the following disclaimer in the documentation
'and/or other materials provided with the distribution.

'3. Neither the name of the copyright holder nor the names of its contributors
'may be used to endorse or promote products derived from this software without
'specific prior written permission.

'THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
'"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
'THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
'ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
'FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
'(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
'LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
'ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
'OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
'THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

@author: Joerg Kienitz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Joerg,

Could you please use the Apache 2.0 license instead?
See, e.g., here
This change will be attributed to you.

Comment on lines 36 to 38
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are using Python3 only, these are not needed. Please remove

Comment on lines 230 to 231
normal = tfp.distributions.Normal(
loc=tf.zeros([], dtype=forwards.dtype), scale=1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use tensorflow error function. See, e.g., here


## References:
[1] Kienitz, J. "Interest Rate Derivatives Explained I", Plagrave McMillan (2014) p.119
[2] https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3428994
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please wright a full reference and add a link. See, e.g., here

Default value: None which is mapped to the default name `option_price`.

Returns
-------
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove ---

is_call_options=None,
dtype = None,
name = None):
""" Compute the Bachelier price for a batch of European options.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a short note explaining that Bachelier formula comes if one assumes Brownian motion behavior instead of geometric bromwnian motion

strikes,
volatilities,
expiries,
rates,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are adding rates to black-scholes option price formula. Let's keep the names consistent.
Please call it discount_rates and also add discount_factors. Please raise an error if both supplied at the same time.




def option_price_dawson_tf(forwards,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dawson_option_price

dtype = None,
name = None):

"""Computes the Black Scholes price for a batch of European options.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please clarify what assumptions does this option price entails?

strikes,
volatilities,
expiries,
discount_factors = None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, add discount_rates

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

Successfully merging this pull request may close these issues.

None yet

3 participants