Let's have Stock S at \$100 on January and my hypothesis is S will be trading at \$150 in July.

Is there any Python/R package that I can feed with option prices from my broker and it would return the optimal call option for my hypothesis? That is, the call option that would maximise return if my hypothesis becomes true (S gets to \$150 in July).

*New to options & programming here.


1 Answer 1


I do not know of any package that can solve your problem; but it seems to be a simple problem, in the end:

Given a 'future target price' $S^*$ (say 150 in your case) and a set of call options with quotes $C_1,\ldots, C_n$ with corresponding strikes $X_1,\ldots,X_n$, find $i\in [1,n]$ such that $(S^*-X_i-C_i)/C_i$ is maximized. Assuming constant implied volatility and a Black-Scholes-Merton world, you want to find $X$ such that

$$ \begin{align} \max_{X} \Pi(X)&\equiv \frac{S^*-X-C(X)}{C(X)} \\ &= \frac{S^*-X}{C(X)}-1 \\ \Rightarrow 0 &\stackrel{!}{=}\frac{\partial \Pi}{\partial X}=\frac{-C(X)+(S^*-X)e^{-r\tau}\mathrm{N}(d_2(X))}{C(X)^2}\\ \Rightarrow C(X)&=(S^*-X)e^{-r\tau}\mathrm{N}(d_2(X))\\ &\Rightarrow S\mathrm{N}(d_1(X))-Xe^{-r\tau}\mathrm{N}(d_2(X))=S^*e^{-r\tau}\mathrm{N}(d_2(X))-Xe^{-r\tau}\mathrm{N}(d_2(X))\\ &\Rightarrow S\mathrm{N}(d_1(X))=S^*e^{-r\tau}\mathrm{N}(d_2(X)) \end{align} $$

where $d_{1/2}=\frac{\ln S-\ln X +(r\pm\frac{1}{2}\sigma^2)\tau}{\sigma\sqrt{\tau}}$. The last equation represents a univariate root finding problem.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.