google / tf-quant-finance

High-performance TensorFlow library for quantitative finance.
Apache License 2.0
4.55k stars 576 forks source link

Pricing formulas for Barrier options under Black-Scholes #7

Closed cyrilchim closed 4 years ago

cyrilchim commented 5 years ago

Formulas for pricing a Barrier option under Black-Scholes model is of interest. (See, e.g., Section 26.9 of Hull(2018), Options, Futures, and Other Derivatives, 9th edition).

The module implementing this method should live under tf_quant_finance/volatility/barrier_option.py. It should support both puts (up-and-in put, down-and-out put) and calls (down-in call, up-and-out call). Tests should be in barrier_option_test.py in the same folder.

Patil2099 commented 5 years ago

@cyrilchim Can I work on this?

cyrilchim commented 5 years ago

Hi Pankaj! Thanks for reaching out!

Yes, I'm assigning the issue to you. Please follow Google Python and TensorFlow Probability style guides. Will update with the internal one once it is published.

As a guidance, please familiarize yourself with option_price and binary_price implementations so that it is easier for you to get started.

Please reach out if you have any issues.

cyrilchim commented 4 years ago

@Patil2099 Could you please let us know if there is any progress on this?

saxena-ashish-g commented 4 years ago

@DevarakondaV

You might find this paper useful (around page 20).

DevarakondaV commented 4 years ago

@saxena-ashish-g I think I can implement this. I'll give it a shot since @Patil2099 hasn't responded.

cyrilchim commented 4 years ago

Reassigned to @DevarakondaV . Thanks!

DevarakondaV commented 4 years ago

Is it expected that the model executes in both graph and eager mode?

cyrilchim commented 4 years ago

Yes, we expect that the user is able to build a graph

cyrilchim commented 4 years ago

Thanks, Vishnu! This is now merged.

DevarakondaV commented 4 years ago

Hey @cyrilchim no problem! Just to let you know that I haven't committed the changes for xla compatibility yet. Additionally, I was still looking at this. Not sure if you still want me to continue with it?

saxena-ashish-g commented 4 years ago

Vishnu,

That (my comment about the dividends) is relatively minor so don't worry about it if you haven't already put in time. We will fix it at a later point. If you already have a fix, then please feel free to send another pr and we will merge it.

Cheers, Ashish

On Sun, 7 Jun 2020, 17:59 Vishnu Devarakonda, notifications@github.com wrote:

Hey @cyrilchim https://github.com/cyrilchim no problem! Just to let you know that I haven't committed the changes for xla compatibility yet. Additionally, I was still looking at this https://github.com/google/tf-quant-finance/pull/31#discussion_r435117425. Not sure if you still want me to continue with it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/google/tf-quant-finance/issues/7#issuecomment-640248328, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFRDBQRAGSLXBXSRGQOMXVLRVPBPFANCNFSM4IVSFCWQ .

DevarakondaV commented 4 years ago

@cyrilchim and @saxena-ashish-g, I'll put in the pull request as soon as I can!

cyrilchim commented 4 years ago

To add to what Ashish says, if you have an XLA test, please feel free to send a change as that would be useful.