Sep 1, 2016

On Hacking Out A Home Brew Version of Interactive Brokers Probability Lab

I trade options every now and then for a variety of reasons and I often use Interactive Brokers to execute.  They have a relatively new (late 2013) feature called the Probability Lab.  I like, but don't exactly love, their implementation and even if I did I probably would not need it to be super precise for what I personally do since I am not trying to land a manned-module on the moon,  I am just trying to sell a few options here and there and I am trying to get the expected value of my trades as high as I can get and my risk as low as I can go per dollar of return.  While they (IB) seem to have a great thing going and it is probably helpful to the people engaged in complex combination trades it sometimes bothers me that I can't extract their data to do my simple thing on my own  (I like to do things myself). So, a few weeks ago I thought I'd try to hack out my own version to see if I could even get close.  My main goal was just to see if I could do it while my secondary goal was to add another tool to the tool belt that helps me manage finite resources for my family over an uncertain future without being beholden to someone else's black box.


Here is how IB defines the Probability Lab: "Use the Probability Lab to analyze the market's probability distribution, which shows what the market believes are the chances that certain outcomes will occur… The prices of put and call options on a stock are determined by the PD but the interesting fact is that we can reverse engineer the process. Namely, given the prices of options, a PD implied by those prices can easily be derived."

So, IB uses the market prices of options to forecast a probability distribution for a particular underlying instrument for a particular expiration date.  I guess that that's fine as long as they are willing to concede that stock and option prices are not all that "probabilistically mannered" all of the time and they (prices) might exhibit a little more chaos at times than they do order and predictability.  That probably means that the prediction horizon for a particular price is maybe about five minutes rather than the weeks or months that the Lab gives the impression of pseudo-forecasting but for now let's play along with the IB game and say that this sort of thing is more helpful than not over the near term for certain circumscribed tasks. 

In their literature on this tool, IB (T. Peterffy) lays out his approach for doing this.  You can read the article here for the exact words and the exact example but the basic math they are pitching is more or less like this, if I got it right:

B = the "given" cumulative probability below the interval in question
X = the solve-for probability of the increment you are looking at
Y = the cumulative probability above the increment you are looking at
P = cost of the increment's option spread if it expires below increment, or P2 - P1 
S = incremental strike price change over increment, or S2-S1
S/2+P = ~average value at the increment if it expires in the middle
S+P = P&L if it expires above the increment

1. the "fairly priced" equation is:  B*P + X*(S/2+P) + Y *(S+P) = 0

2. the "probability must = 1" equation is: B + X + Y = 1

Supposedly this means you can, given B, solve for X which is the option-price derived pseudo-probability for price within the increment in question…if you have the data.  I used the math they provided and -- trust me, I felt at age 58 like a total dumb a**  because it took me about an hour (with a boatload of mistakes) to do the basic high school algebra to get to it -- I'm pretty sure that given B, X = -2[(B-1)*(S+P)-B*P]/S …or at least it works with their example.  That's fine as far as it goes and I'm sure they have done their homework and certainly their platform generates some pretty graphs but the problem for me (after that sad, weak victory of me over algebra) turned out not to be the math. It's that when I use their own formula and their own data (I downloaded, for example, their entire chain for SPY for Sept 16 expiration including bid/ask, last, and IV etc. for calls and put) the formulas do not work so well; it was difficult if not impossible to replicate the pretty graphs.  Since I assumed they have their own internal methods to handle weird stuff and since I did not have a ton of time and energy to try to decode why I botched it with real data I decided to see if I could wing my own Probability Distribution to, like I said, see: 1) if I could do it, and 2) to see if I could cultivate another tool to help me out in the future.  

Here is what I tried to do.  But before we start, lets be clear that I am not going to give too many details.  And that's not because I think I have some power-uber-options-weapon that I want to protect and keep secret, it's because I took a few too many liberties, a few to many innumerate leaps of faith, and I would be too embarrassed to get taken to the cleaners for some pretty bad math and assumptions if I pulled back the curtain too far.  Be forewarned.  Given that disclaimer, what I did is that I tried to use an Excel implementation of Black Scholes (BS) that I have at home to create a premium-weighted distribution of option prices given all the standard BS inputs but most importantly: underlying price, strike price, and implied vol.  With an awkward and mildly corrupt manipulation of a function of call and put premium at each strike (along with a rudimentary manipulation of downside vol) in order to project probability given the strike and IV, it seems to me that one can gin up a relatively good, if imperfect, proxy of what IB does in their lab.  Again, let's try not to look behind the curtain too much[1]. I'm sure the quants and the PhDs have better ways of doing this kind of thing but then again I am neither of those.

This is what it looks like.  In this particular case I took the following as my base assumptions:

Instrument:        SPY
Date:                 8/31/16
Expiration:        9/16/16
Current Price    218
SPY Vol:          10.58%
Vol Skew:         IB uses market data, I used a manipulator function.
                          The rule of thumb lines are pre-skew. 
IB data:             Transcribed by hand







What do I see here?  
  • In general it looks like I got pretty close. I don't know if the various manipulations I did would work well for all instruments and all conditions but there it is. How useful it will be has yet to be determined but at least I have another arrow in the quiver and I am liberated, yet again, from someone else's black box. That's worth the price of entry right there,
  • For my tasks this is probably close enough. I just want to try to optimize sold premium at a "reasonable" remove from current price. This might help. We'll see. Notwithstanding the next bullet point, it is at least easier to get a quick read on simple one and two standard deviation levels than I can in the IB tool,
  • I'm guessing that a down-and-dirty rule of thumb for standard deviation [posted here previously], given IV, is likely to be as useful as the efforts by IB or me. I still think that prediction is a dumb game but using IV and options prices to be aware of the risk of movement is probably helpful. Beware of quiescent volatility, though. That can be a killer, 
  • The IB data does a better job at skewing the distribution; I'll work on my function in that area some other day.

In a previous post I closed out with a quote from Thomas Peterffy on the need for humility in attempting to forecast future price. Let's do it again.

            Some may say that these are all very sloppy approximations. Yes, that is the nature of predicting prices; they are sloppy and there is no point in pretending otherwise. Everybody is guessing. Nobody knows. Computer geeks with complex models appear to the uninitiated to be doing very precise calculations, but the fact is that nobody knows the probabilities and your educated guess based on your understanding of the situation may be better than theirs based on statistics of past history.

With that said, I am content that my model is close enough.



-------------------------------------------------------


[1] with a readership currently standing at something around 3, one of whom is a blood relative and another of whom is probably just me clicking on my own links, the risk is low that anyone will care. I'm happy to take it offline...



1 comment:

  1. I found this very interesting. Thank you!

    ReplyDelete