-
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
initial commit #22
base: master
Are you sure you want to change the base?
initial commit #22
Conversation
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 What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
Joerg, could you please follow one of the links above and sign the Contributor License Agreement (CLA)? |
I signed it!-- Diese Nachricht wurde von meinem Android Mobiltelefon mit GMX Mail gesendet.Am 24.02.20, 11:02 schrieb googlebot <notifications@github.com>:
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
It's possible we don't have your GitHub username or you're using a different email address on your commit. Check your existing CLA data and verify that your email is set on your git commits.
Corporate signers
Your company has a Point of Contact who decides which employees are authorized to participate. Ask your POC to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the Google project maintainer to go/cla#troubleshoot (Public version).
The email used to register you as an authorized contributor must be the email used for the Git commit. Check your existing CLA data and verify that your email is set on your git commits.
The email used to register you as an authorized contributor must also be attached to your GitHub account.
ℹ️ Googlers: Go here for more info.
—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
Hi Cyril, I have done it already. But forgot to reply to the bot. Best regards, Jörg -- Diese Nachricht wurde von meinem Android Mobiltelefon mit GMX Mail gesendet.
Am 24.02.20, 14:07 schrieb cyrilchim <notifications@github.com>:
Joerg, could you please follow one of the links above and sign the Contributor License Agreement (CLA)?
—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.
|
There was a problem hiding this 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.
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 |
There was a problem hiding this comment.
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.
from __future__ import absolute_import | ||
from __future__ import division | ||
from __future__ import print_function |
There was a problem hiding this comment.
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
normal = tfp.distributions.Normal( | ||
loc=tf.zeros([], dtype=forwards.dtype), scale=1) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 | ||
------- |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, add discount_rates
This is the first draft for the SABR model we discussed