I'm trying to compute greeks by myself for some historical data. I'm able to get the greeks computed most of the time, but sometimes they just fail to be computed. Looking at the data, I think the failure often happens when the option is deep ITM/OTM and the bid/ask spread is large. The algorithm simply couldn't find a solution for the BSM process. I used the average of bid and ask as the option price. I'm curious that, if any of you have computed greeks, what you used as the option price. I feel that the average of bid and ask may be problematic because it not only can result in the above issue, but also is less meaningful for options with wide bid/ask spreads. Maybe two sets of greeks should be computed for bid and ask, respectively? However, I haven't seen that from my broker.

You have made an error. The normal process is using BSM, which works. For option price, the MID (BID+ASK)/2 is customary for liquid options (and most that are not so liquid). -- The greeks are computed with respect to time. Using an average option price makes no sense if you are computing greeks. You should double check what you are doing. If you are looking for precision in your greeks, the process requires some marshaling of the chains.

Thanks! I'm using quantlib to do the computation, which asks me a few option parameters for input, including the strike, expiration, option price, dividend rate, and interest rate. What should I use here as the option price instead of the MID? I do have the option chains. But I'm computing greeks for each option in the chains individually. Did you mean to compute greeks for all options in the chains somehow globally? How can I go about that?

As the prior respondent already told you, focus on the most liquid options -- near the monies for active names. As you get father from the money you will start to see worthless pricing, .00- .50 and such. Of course you won't get reliable Greeks from such prices.

You may wish to consider, that a BID value < some number (depending on your requirements for precision) will infer the MID price may not be representative of a "reasonable value"! This may also suggest that attempts to derive Greeks for that specific strike in isolation of the rest of the chain is like "Russian roulette with all chambers loaded" -> No good outcome. Note, that providing proper interest, dividend, time, and value for underlying price may not be as clear as you may think! (I am guessing, here; perhaps prematurely) I am "Assuming" you are using the model to extract the implied Volatility, then inject that, with other values to arrive at your Greeks, (YES?) If you are serious, you may wish to produce Volatility surface plots of the IV you compute, then observe visually to see if blatant flaws may exist. If done correctly, you will have clean curves without step functions, or multiple slope inflections. (3-D graphs of all chains/strikes, can be illuminating) for each specific underlying. My interest is only in SPX, and may be able to compare notes with you, for SPX option info.

Like others have said, illiquid options have unreliable pricing of greeks. It makes sense since, illiquid options also generally correlate with illiquid stock pricing and generally just an unreliable stock price. You can't price options correctly if the stock price itself is too unpredictable because of the low liquidity factor. Only speculative option traders populate these markets, and they are all in it for gamma. Therefore trying to calculate greeks is a waste of time and pointless, there will rarely be any information for arbitrage opportunities. Deep in the money and out of the money options will also have unreliable greeks. Deep in the money the Delta is so high that all other greeks are essentially worthless since greeks are generally factors of extrinsic value not intrinsic value and Deep in the money is almost all intrinsic value. Deep out of the money is all extrinsic value, however you come into the problem of low liquidity and the probabilities that go into option pricing become skewed because of the lack of data. Essentially you are approaching the unknown unknowns of option pricing. The only time some of these deep otm options ever have intrinsic value is through Black Swan events which by definition are unpredictable. At this point you can come up with greeks but they will be all worthless, not worth even paying attention to. I'd say at deep otm or itm the only viable factor is Implied volatility in relation to the rest of the strikes.

I don't know if this is what you are looking for: You can calculate greeks yourself using the B-S model with Excel. B-S allows you to calculate option premiums when the other parameters are known: underlying, strike, IV, time to expiry, risk free rate, dividend rate. You can also calculate IV when the premium is known but that involves an iterative process and for that you can use VBA programing in Excel. Unless you have historical IV for the particular strike, or the historical option price, you cannot calculate historical greeks. If they are not available, calculating historical option greeks involves guess work on historical IV. I find using historical volatility of the underlying a reasonable approximation for historical IV. I know B-S is just an approximation but for what I want to do it is a reasonable approximation. Hope this helps.

Thanks for the suggestions. I will focus on near the money options for greeks computation. I think the existing computation for them is reasonable. I always wonder how my broker (or any other similar service) manages to compute greeks reliably for the entire chain. Maybe they use some smoothing method, like the one suggested above.

Yes, your assumption was right. And yes, some parameters besides the price are not trivial to set, such as the interest rate and dividend rate. But since I was mostly interested in studying short-term relative changes in greeks, I just set some constants there (e.g., 1%) and hopefully it's not going to change the trend that much.

Most brokers and in general most option trading software will try to fit a curve through the implied vol points at each maturity and use the fitted point for calculations. These curves can sometimes have parameters to try to fix the problem of deep OTM values. (You should ignore all ITM vols btw and stick to OTM only). If you don't want to do that you have to just ignore the points where you get bad greeks. If you do a google search you can see how ivolatility.com do this for example.