-
Notifications
You must be signed in to change notification settings - Fork 646
Open
Description
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.
Metadata
Metadata
Assignees
Labels
No labels