There must be a simple way to calculate a stock price from the current option prices and code that in AFL.

By simple I am thinking no greeks or volatility, like calculating the curve generated by the strike and bid-ask prices points. Reverse calculating a binomial or Black -Scholes model seems over kill.

Once the curve's mathematical formula is created it can be used to calculate the stock price.

As an astronomer I know this is done all the time to determine focus. The focuser is moved in 'steps' (strike) and the half flux diameter (HFD)(bid-ask) of the star is measured. Each HFD, step pair is plotted and (math happens here) generates a curve. Once generated, the focuser moves how ever many steps to the curves lowest value. Voila your telescope is focused.

Can option to stock prices be focused the same way? I think 'math happens here' is the question. What is the math to generate the curve's formula from points in AFL?

Thank you, I realize that Black-Scholes is the standard model however I am not researching option potentials.

My need is to calculate the stock price based on a specified option price. What math calculation/code creates this curve? With the curves formula you can calculate any other point on that curve.

I do not know whether a Polynomial regression, a Cubic Hermite spline, or something else works, although I believe a Linear regression does not.

My hope is someone here does know the math/code to do this.

As an aside: I do not believe market makers use Black-Scholes if you consider this: "Market makers determine the option theoretical price by organizing a package of asset into a risk-free position and then finding the current value of that package based on the current interest rate."

There is no way to do this unless you know things like implied volatility of the option contract. Otherwise it will be a futile academic exercise. You might be able to get close to the underlining price with synthetic calculations. You could be way off unless you use the appropriate bid and offer prices as well.

there is the max pain theory where.
investopedia:
"According to the maximum pain theory, the price of an underlying stock tends to gravitate towards its "maximum pain strike price"—the price where the greatest number of options (in dollar value) will expire worthless."

The idea is that they will push the underlying (near expiration of the options) towards the price that most options will be worthless when they expire.

Currently (or I calculated it on the 8th) I get for ES mini options on futures, expiration 9/20/2024, 5400, see (bottom chart):

I appreciate all your responses. Thank you. Please understand this use of options has nothing to do with options trading. Try to not think options but math. I want calculate the stock price from the options price.

Mentioned previously were Polynomial regression , Cubic... that use known points, strike and Bid/Ask, to calculate the curve that represents all price points. I do not know the math well enough to choose an appropriate method. I am asking for this math/code. I am sure someone here knows the math.

Yes, I know the math and you can't derive a stock price from the option price. You can come close if you use synthetic calcs, for this you would need both the put and the call.

Do yourself a favor and grab yourself a copy of Sheldon Natenberg's book - Option Volatility and Pricing: Advanced Trading Strategies and Techniques, 2nd Edition or even 1st Edition.

Sean,
What do you mean close and synthetic calcs. I think that is all I am looking for. Aren't both put and call available market data?

To be clear I am not option trading in the traditional sense. I use options as surrogate stock and stay as far away as possible from greeks and volatility. I have traded this way with success. I appreciate the book suggestion.

I really doubt if you can calculate stock price from the options price RELIABLY
due to the following challenges:

Volatility and Interest Rates: Accurate estimates of volatility and the risk-free rate are essential for precise calculations. Implied volatility can vary significantly, affecting the derived stock price.

American Options: Most options traded in the US are American options, which can be exercised at any time before expiration. This makes the direct application of the put-call parity relationship more complex.

Market Liquidity: Options with low liquidity may have prices that do not accurately reflect the true market value, leading to unreliable stock price derivation.

Oh God...
Keep in mind these assume same exercise price and expiration. Also, you are suppose to use the appropriate bid/offer depending on the long (Buying) or short (selling) of each. Which brings up the following issue, if you are using historical prices, not sure how you can do this, because even on a 1 minute bar (assuming all 3 have a price bar, i.e., "Traded") the close of each of the synthetic equivalents' last tick within that one minute will usually not be at the same time across all "Equivalents". So it really should be calculated real time using inside bid/offers.

Synthetic Equivalents:

Synthetic Long Underlying = Long Call + Short Put
Synthetic Short Underlying = Short Call + Long Put

Synthetic Long Call = Long Underlying + Long Put
Synthetic Short Call = Short Underlying + Short Put

Synthetic Long Put = Short Underlying + Long Call
Synthetic Short Put = Long Underlying + Short Call

Also, consider that these theoretical relationships exist due to Arbitrage opportunities, HOWEVER, this does not need to be true in extreme volatility, due to catalysts and lack of liquidity. Also, these can become dislodged and not Arb'ed out because either the underlying, or the options lack liquidity etc. If an option has a spread of 1 full handle spread due to lack of liquidity, then what? Careful with this stuff, as some relationships may be more accurate at or near expiration...

Arbitrage Strategies:

Conversion = Long Underlying + Synthetic Short Underlying
= Long Underlying + Short Call + Long Put

Reverse Conversion = Short Underlying + Synthetic Long Underlying
= Short Underlying + Long Call + Short Put

My advice, just get yourself the stock's price! LOL

Bottom line is that these synthetic positions "Should Behave" similarly, but they don't have to! Sometimes one will be more expensive than the other. You can use these identities to see if there is some miss-pricing and/or what order you should place, as well as at what price et al.

I am finding most of the responses are about trading options or how to trade options. I have tried to say I do not use options in the traditional sense or as many replies and concerns indicate.

To be more explicit. When I use options, the trades are short, in the order of two days. The expiries used particularly ignore theta and vega. In my trading and testing they have little to no significance. In addition, the calculation I seek is not to make trades, but as part of an exit filter.

I believe everyone can agree, knowing a curve's formula lets you find any set of points on that curve. We can also agree a curve's formula can be derived using sets of points. If there is another way please let me know.

I am looking for the math calculation/code that best represents the option and stock price relationship at the moment of the trade. I do not have the math background to say which may work best. I have found this works by generating curves in Excel. I am looking for a better way than Excel. Perhaps there are several ways. I am sure I will test any and all. The worst that can happen is it doesn't work and I won't use it.

Addressing the 'trading options' concerns many have expressed: the influences of theta and vega that do exist are filtered and render in all but the extremes, insignificant. Fortunately the extremes lean in favor of the trades. I also use other mitigation.

I appreciate all your concerns and learn from them. I sincerely believe no-one here wants me to loose money. Thank you.

With all due respect, I have no idea what you are talking about at this point. You talk about a curve without explaining what the curve is and how it is calculated, yet you say you have it implemented in excel?

Additionally, I have not spoke about trading options, but rather tried to address your question on how to get/extrapolate the underlying stock price from the option price. If you want stock and the price relationship to one of it's specific options, at time of trade, then get the stock price, get the option price and then choose the option pricing model of your flavor (as there are many) and calculate the option sensitivities/Greeks. These will represent all the stock and option price relationships you could want. And by all means if you have a working "Curve" as you call it, that has what you want and it exists in Excel, then covert it to afl.

FYI, you have an issue speaking in, expressing your thoughts in plain simple understandable English and explaining what you are doing.

The 'Oh God' is the best comment so far. I thought that was what you meant when you said synth's but it is best to be clear.

I do not trade anything near expiration. Volatility, although it can be a headache, favors my trades. I only use ATM options.

You read my last reply, thanks. The curve is defined by the strike (x) and option (y) prices. If you take these pairs they plot an exponential like curve. Excel explanations are even worse than my English. I did just find undocumented coding for Excel curves.

The math I am referring to is: Polynomial regression, Cubic Hermite spline, Catmull-Rom spline ... I do not know any of these and there are many more. I don't want to just pick one.

My dilemma is, market makers use one process for option's theoretical pricing, other calculations, e.g. Black-Scholes, are used to flesh out the option's possible values. Using all this to determine the original and existing stock price seems to compound error. Isn't there a more direct way; i.e. curves?

I am learning, particularly in this forum, simple and direct is better, yet I often fall short.

Thanks! Looks like I have a few things to work on.

American options only, traded ATM, short enough, and far enough from expiry to generally ignore option variances that evolve over volatility, interest rates, and time, in other words;

they do not trade like options, why treat them like options?

the original 'stock to option' price relationship exists, why not use it?

I understand this will not work for options trading. My point and experience is, this is not option trading.

To original question, "Calculate stock price from options price" or 'how to define this relationship?'. The data points, strike (x) and bid/ask (y), plot a curve. With a formula for the curve, you can find any other point on that curve.

Why? The prices are in steps. How do you find prices in between these steps?
Answer: Pick a options price on the curve and get the strike price at those coordinates.

Advantages; simplicity, directness, the stock price leads the option price, and the stock price is generally more stable. Any or all of these MAY help to define a reasonable exit. Test, test, test...

My goal is to find an appropriate method, formula, code, to define the relationship.

I must admit this reply may have been more appropriate as my first question.