# SF Option Payoff

Let's consider vanila call option. 
The corresponding payoff looks as following:

$\text{Payoff}_{vanila} = max(S_T-K,0)$

However Stochastic.Finance options have a bit of non-trivial payoff as a fraction of the supplied collateral: 

$\text{Payoff}_{SF} = \frac{\max(S_T - K, 0)}{\max(S_T - K, 0) + K}$

for every ETH supplied collateral, so that in case the collateral is 10 ETH the total payoff would be $P_{SF}$ * 10 ETH

This payoff function can be interpreted as:

$\text{Payoff}_{SF} = \begin{cases}\frac{S_T - K}{S_T} & \text{if } S_T > K \\0 & \text{if } S_T \leq K\end{cases}$

The price of the option $V$ is given by the expected value of the discounted payoff under the risk-neutral measure $\mathbb{Q}$:

$V = e^{-rT} \mathbb{E}^{\mathbb{Q}}\left[\frac{\max(S_T - K, 0)}{\max(S_T - K, 0) + K}\right]$


##### Substituting the explicit form of the payoff:

$V = e^{-rT} \mathbb{E}^{\mathbb{Q}}\left[\frac{S_T - K}{S_T} \cdot \mathbb{I}(S_T > K)\right]$

where $\mathbb{I}(S_T > K)$ is an indicator function that equals 1 when $S_T > K$ and 0 otherwise.

Let’s express the expected value in terms of the distribution of $S_T$, the stock price at time $T$ under the risk-neutral measure:

$V = e^{-rT} \int_{K}^{\infty} \frac{S_T - K}{S_T} f_{S_T}(S_T) dS_T$


##### Log-Normal Distribution of $S_T$:

Under the Black-Scholes model, the stock price $S_T$ is log-normally distributed:

$S_T = S_0 \exp\left(\left(r - \frac{\sigma^2}{2}\right)T + \sigma W_T\right)$

where $W_T$ is a standard Brownian motion under the risk-neutral measure.

The PDF of $S_T$ is:

$f_{S_T}(S_T) = \frac{1}{S_T \sigma \sqrt{2\pi T}} \exp\left(-\frac{\left(\ln\left(\frac{S_T}{S_0}\right) - \left(r - \frac{\sigma^2}{2}\right)T\right)^2}{2\sigma^2 T}\right)$


##### Rewriting the Integral:

We can now rewrite the option price as:

$V = e^{-rT} \int_{K}^{\infty} \left(1 - \frac{K}{S_T}\right) f_{S_T}(S_T) dS_T$

This can be split into two integrals:

$V = e^{-rT} \left[ \int_{K}^{\infty} f_{S_T}(S_T) dS_T - K \int_{K}^{\infty} \frac{1}{S_T} f_{S_T}(S_T) dS_T \right]$

The first integral 

$\int_{K}^{\infty} f_{S_T}(S_T) dS_T$ 

is simply the probability $\mathbb{P}^{\mathbb{Q}}(S_T > K)$, which is given by $\Phi(d_2)$ where: $d_2 = \frac{\ln\left(\frac{S_0}{K}\right) + \left(r - \frac{\sigma^2}{2}\right)T}{\sigma\sqrt{T}}$

The second integral can be expressed as:

$\int_{K}^{\infty} \frac{1}{S_T} \cdot \frac{1}{S_T \sigma \sqrt{2\pi T}} \exp\left(-\frac{\left(\ln\left(\frac{S_T}{S_0}\right) - \left(r - \frac{\sigma^2}{2}\right)T\right)^2}{2\sigma^2 T}\right) dS_T$


$= \frac{1}{\sigma \sqrt{2\pi T}} \int_{K}^{\infty} \frac{1}{S_T^2} \exp\left(-\frac{\left(\ln\left(\frac{S_T}{S_0}\right) - \left(r - \frac{\sigma^2}{2}\right)T\right)^2}{2\sigma^2 T}\right) dS_T$

Fortunatly such integral has a closed-form solution. The final formula for option price looks as following:

$\text{V}_{SF} = \exp(-rT)\left(\Phi(d_2) - \frac{1}{2}\frac{K}{S_0}\text{erfc}(\zeta)\exp\left(-(r -\sigma^2)T\right)\right)$

where: 

$\zeta = \frac{3 \sqrt{2} T \sigma^2 - 2^{3/2} T r + 2^{3/2} \ln\left(\frac{K}{S_0}\right)}{4 \sqrt{T} \sigma}$
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9