I often see questions like "Given this payoff graph (example below), construct a portfolio that replicates it." I want to know if there is an efficient method/algorithm to find the individual pieces that comprise it (long/short puts/calls/stock).

Iron Butterfly

So to pose this more mathematically, given profit and loss function below where $x$ is the stock price at expiration and given that each option type has a fixed premium (not necessarily the same, but maybe an easy assumption to start with), can you efficiently recreate this from individual options?

$$ P(x)= \begin{cases} p_0(x), & x \le \beta_0 \\ p_1(x), & \beta_0 \le x \le \beta_1 \\ \qquad. \\ \qquad. \\ \qquad. \\ p_n(x), & \beta_{n-1} \le x \le \beta_n \\ \end{cases} $$

We know that each $p_i(x)$ is either constant or linear and every basic option type has a function associated with it. For example shorting one call with strike price k and premium p gives the function: $$ \begin{cases} p, & x \le k \\ -x+k+p, & x \ge k \\ \end{cases} $$

  • $\begingroup$ I would first consider a piecewise payoff. It sounds like you could possibly formulate this as a linear program. $\endgroup$
    – gt6989b
    Feb 27, 2014 at 23:33
  • $\begingroup$ could you perhaps change the title to "Algorithmical repilcation of a profit and loss function using different options" - or "Algorithm to find the porfolio composition for a given PNL function" - Your question is much more generic and useful than the title suggests :) $\endgroup$ Feb 28, 2014 at 9:31

2 Answers 2


Assume $p_i(x)$ is a payoff of one particular option. You can try to reproduce the diagram using a bunch of options with strikes on the breakpoints (underlying is useless, because its payoff can always be modelled by buy&sell of a certain call and put). Then you can create a system of k equations with n unknowns (number of each kind of option). All other things can be fixed, such as strikes are at breakpoints; everything over ATM will be calls, everything below will be puts.

$\sum w_i p_i(X) = Y$

where $X$ is a breakpoint and $Y$ is return at $X$; $w_i$ are coefficients you are trying to find. In addition, you will need two points anywhere to the right from the rightmost breakpoint and one to the left from the leftmost one, otherwise you are not fixing the slopes of the far OTM tails. All in all, this is a system of linear equations (because $p_i(X)$ is either 0, or some linear return if an option is ITM) and as such should be easy to solve. As an additional parameter, to account for cash you can add another same variable to each of the equations - this will basically shift PnL up or down.

The problem is the system described above won't always have solutions. To ensure you'll always have one in general, you will have to either include both puts and calls for each of the breakpoints, or add the underlying. This will likely produce infinite number of solutions, but that's relatively easy to handle. I'm quite sure many standard PnL's will be resolvable without this amendment.

  • $\begingroup$ Actually this problem is not about options it is about approximation of a function (the pay out) by a set of basis functions (the calls.) It is (as you say) pure linear algebra. You even do not need Puts and Calls. If you permit long and short positions only Calls and Cash are sufficient. Solutions are unique if your replicating instruments are linear independent. In many cases the space of functions you would like to replicate will be of infinite dimension. But the case of piecewise linear functions with a finite number of breakpoints is entirely straightforward. $\endgroup$
    – g g
    Feb 28, 2014 at 14:26
  • $\begingroup$ @gg You do need puts. If left tail of PnL has slope different from 0, it can't be replicated by only calls & cash. Otherwise, yes, the number of instruments I suggest is more than needed, however I'd be careful about claiming how much is enough, this is a topic for a short research which is probably hard to fit in this Q&A format. $\endgroup$
    – sashkello
    Feb 28, 2014 at 23:09
  • $\begingroup$ Hmm, why do you need puts? Let $S$ be the underlying and $K$ any strike level. Then the pay-out of the put is $max(K - S, 0)$ which is equal to $K - S + max(S - K, 0)$ which is a portfolio consisting of $K$ long cash, short the underlying (i.e. one call with strike zero), and long a call with strike $K$. $\endgroup$
    – g g
    Mar 3, 2014 at 13:08
  • $\begingroup$ @gg Yes, I mean you need either underlying or both puts and calls. Edited... $\endgroup$
    – sashkello
    Mar 3, 2014 at 22:07

You can find an exact algorithm with a step-by-step explanation here: https://www.dropbox.com/s/t4fq067kzx26mhw/project_paper.pdf

As you can see from the URL it is an archived document because the original site is unfortunately long gone and the tool referenced in the paper with it :-(

But it should be helpful anyway to understand what is going on.

Notice to the owner of the paper: I put up this paper because it is no longer available on the web and it is a great piece of work. If you are the owner and have a problem with that: Please contact me and I will delete it immediately - Thank you

  • 1
    $\begingroup$ Since link-only answers are discouraged, I'd suggest you add some important points from paper, especially considering that links tend to go dead in time. $\endgroup$
    – sashkello
    Feb 28, 2014 at 23:10
  • $\begingroup$ @sashkello: Thank you for your comment, in general I agree with your points but in this case I think it won't add much value to rephrase the steps of the algorithm here because they are really well explained in the paper - plus: this link won't go dead because it is the archived version already (I tried to explain that in my answer). $\endgroup$
    – vonjd
    Mar 1, 2014 at 7:52
  • $\begingroup$ The link don´t work for me: "Page cannot be crawled or displayed due to robots.txt". Any idea how to get past this? $\endgroup$
    – sets
    Mar 4, 2014 at 9:54
  • $\begingroup$ @sets: This is really strange... I don't know what happened... trying to fix it... come back to you later! Thank you for letting me know. $\endgroup$
    – vonjd
    Mar 4, 2014 at 10:31
  • 1
    $\begingroup$ @sets: New link should work now - thank you again for notifying me. $\endgroup$
    – vonjd
    Mar 4, 2014 at 11:10

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.