This project aims to optimize the expected utility of terminal wealth using a single-asset Black Scholes model. The goal is to implement and analyze a neural network-based hedging strategy that maximizes utility under different utility functions.
As a model the standard single-asset Black scholes model is used
over a period of 1 year, initial value
The objective it to optimise the expected utility of the terminal wealth
The key is to implement a new loss function
via a custom loss function. Since the correct values for
We are going to analyse the performance of the algorithm for the following hedges:
-
$U(x) = \log(x)$ , log-utility. -
$U(x) = x^p$ for$p = 0.5,$ power utility. -
$U(x) = \frac{1−e^{−\alpha x}}{\alpha}$ for$\alpha = 0.005$ , exponential utility.
In our model, we used P-dynamics with a positive drift. It shall be noted that the drift parameter has a big influence on the hedging behavior of the model. If the drift was negative, the neural network (NN) would learn to (short-)sell the asset immediately, recognizing it as a risk (because of the volatility) with negative return.
We decided to restrict the hedge NN to return only hedge ratios between 0 and 1 by using tangens hyperbolicus (tanh
) as the activation function for the output (sigmoid
or other functions could work as well). This can have an economic interpretation: we do not want our model to short-sell or to buy more than 100% of the asset. Despite this constraint, the results remain meaningful and interpretable.
We can see from the plots below that all three utility functions are concave, which implies risk aversion. This means that the marginal utility decreases as wealth increases, and that the negative impact of losses on the utility is larger than the positive impact of gains of the same magnitude.
Since the functions are all concave, we expect similar hedging behavior, despite their different degrees of concavity - function (1) is the most concave and function (3) the least concave.
def U1(x):
return tf.math.log(x)
def U2(x):
return tf.math.sqrt(x)
def U3(x):
return tf.math.divide(tf.math.subtract(tf.constant(1, dtype=tf.float32), tf.math.exp(tf.math.multiply(tf.constant(-0.005, dtype=tf.float32), x))), tf.constant(0.005, dtype=tf.float32))
Since we only consider a single asset (and no derivative written on it), we define the payoff function simply as the final value of the asset price path.
# Define loss functions
def L1(y_true, y_predict):
return tf.reduce_mean(-U1(y_predict - y_true))
def L2(y_true, y_predict):
return tf.reduce_mean(-U2(y_predict - y_true))
def L3(y_true, y_predict):
return tf.reduce_mean(-U3(y_predict - y_true))
Our results indicate that the wealth distribution of our 3 NNs are (nearly) the same, because they used (almost) the same hedging strategy!
Setup cost (NN): 100.0
Test data analysis:
Standard deviation (NN L1 Loss): 21.55
Mean sample error (NN L1 Loss): 108.41
Standard deviation (NN L2 Loss): 21.55
Mean sample error (NN L2 Loss): 108.41
Standard deviation (NN L3 Loss): 21.55
Mean sample error (NN L3 Loss): 108.41
We can see that the hedging strategy seems to be the same for all utility functions, namely buy and hold (the hedge ratio is 1 at any point in time). This makes sense: an (average) return of
As mentioned in the beginning, the