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

Negative price for barrier option #94

Open
dlvp opened this issue Apr 1, 2023 · 0 comments
Open

Negative price for barrier option #94

dlvp opened this issue Apr 1, 2023 · 0 comments

Comments

@dlvp
Copy link

dlvp commented Apr 1, 2023

Hello,
the following setup returns negative prices for european barrier calls:

import tf_quant_finance as tff
import numpy as np

n_points=10
spots = np.linspace(0.01, 0.2, n_points)
strikes = 1.9 * np.ones(n_points)
volatilities = 0.25 * np.ones(n_points)
expiries = 0.5 * np.ones(n_points)
barriers = 0.5 * np.ones(n_points)
is_barrier_down = np.array([True] * n_points)
is_knock_out = np.array([True] * n_points)
is_call_options = np.array([True] * n_points)

args = {
    "volatilities" : volatilities,
    "strikes" : strikes,
    "expiries" : expiries,
    "spots" : spots,
    "barriers" : barriers,
    "is_barrier_down" : is_barrier_down,
    "is_knock_out" : is_knock_out,
    "is_call_options" : is_call_options,
}

    
price = tff.black_scholes.barrier_price(
        **args
    )

>> price
>> <tf.Tensor: shape=(10,), dtype=float64, numpy=
array([-4.62000000e-01, -3.81777778e-01, -3.01555556e-01, -2.21341484e-01,
       -1.41989785e-01, -7.20212532e-02, -2.70513904e-02, -7.63614881e-03,
       -1.71392373e-03, -3.24709866e-04])>

The parameters are obviously contrived, but i wonder whether this is expected behavior in such tails due to numerical instabilities.

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

No branches or pull requests

1 participant