Hacker News new | past | comments | ask | show | jobs | submit login
Stock Option Pricing Inference (thomasvilhena.com)
103 points by tcgv 60 days ago | hide | past | web | favorite | 16 comments

The ad hoc method of parameter estimation used here needs some explaining. It looks like the author is trying to minimize the distance between the two lines on the y-axis which is not traditionally how you fit parameters to a distribution and will lead to weird results.

Notice that if you estimated a Gaussian the traditional way: by just computing mean and sample variance you do get wider tails caused by a higher variance estimate. Likewise the estimations for the Cauchy are definitely off using this technique (and precisely because of the Cauchy's infinite/undefined variance you shouldn't use the mean, like the author does, to estimate the center of the distribution).

Since the author uses mean for the estimate and sample sd in the other code I'm confused why this isn't used as the estimate for the variance in the guassian? If you want to demonstrate some sort of numerical optimization it would be better to use a correct, more standard technique like minimizing the negative log likelihood of the data given the parameters.

On top of all this there's very unnecessary amounts of superfluous R code in here. With rnorm and rcauchy there's no need to role your own sampling function

Hi, I'm the author, thanks for the feedback!

> The ad hoc method of parameter estimation used here needs some explaining

I tried to imitate a "least squares regression" actually. I confess I wasn't sure if this was the most appropriate approach. I will run the analysis again using the more standard technique you suggested and compare the results.

> Since the author uses mean for the estimate and sample sd in the other code I'm confused why this isn't used as the estimate for the variance in the guassian?

The mean value from the density estimate was used for fitting both the Gaussian and Cauchy models because they are symmetric functions, in an attempt to reduce this one-dimensional (single variable) fitting error.

Later on the mean is removed when estimating prices since I was assuming a driftless stochastic process for the underlying stock.

Is this what you mean by "log normalization"? https://www.spec2000.net/08-normalization.htm

I haven't read much further, perhaps you make it explicit later on.

I took the natural logarithm of the stock's daily returns. Then when estimating option prices I performed the reverse operation:

> exp(1) ^ dist[["x"]]

In this link you can find more information: - https://www.google.com/amp/s/quantivity.wordpress.com/2011/0...

OK well that is not commonly called "log normalization". It is called "using log returns".

Fixed that, thanks! (should take effect in a while)

Hi again,

So I ran the analysis again using the standard MLE technique you suggested and got the following results:

- Gaussian Model: σ = 0.0473

- Cauchy Model: σ = 0.1443

Quite an improvement from the original least squares regression approach I used!

You can find the updated plots below:

- [Probability Distributions] https://imgur.com/da8dRzm

- [Option prices chart] https://imgur.com/5hey110

For reference, I just updated the code and plots in the article. I also did some minor changes to the text and fixed an issue with the generation of random samples, which had a small impact in the estimations.

Left some notes at the end describing these changes, along with a reference to the original version.

Note that the author is pricing European options, not American options. The standard BSM formula is for European options, not American. If anyone wants to dive deep into a lot of the different models out there, check out The Complete Guide to Option Pricing Formulas by Espen Haug(1).

His site has some wonderful material too(2). I especially like his ‘Exotic Option Fantasy Land’(3)


(1) https://www.amazon.com/Complete-Guide-Option-Pricing-Formula...

(2) http://www.espenhaug.com/articles.html

(3) http://www.espenhaug.com/manhat.html

Thanks for the interesting link to Espen Haug!

For non-financial engineers, there is a subtle difference between the two option flavors. Holders of an American option can exercise their right to buy/sell the underlying asset at any time while European option holders can only exercise at expiration date.

Got worried when I saw the Gaussian approximation but I’m glad to see the author’s evaluation.

> Despite the fact that the Gaussian distribution is widely used in fianacial models, it has some well known pitfalls, namely its inability to encompass fat tails observed in historical market data. As a result it will fail accurately describe extreme volatilty events, which can lead to possibly underpriced options.

Given that he is looking at one stock over a period of 6 months where AFAIK nothing particularly unusual happened, I highly doubt any "extreme volatility events" were relevant.

Cool stuff. What's hindering you from making money at this point?

I just started a job implementing asset pricing algorithms for energy contracts similar to what you did, even though a bit more involved (using stochastic dynamic programming and quite complex models for coming up with price paths).

Being completely new to trading I naturally wondered what the catch is, i.e. why I couldn't employ the same techniques for making private profits. Shoot me a mail if you'd like to discuss ideas ;)

> Cool stuff. What's hindering you from making money at this point?

Thanks! That's the goal in the long term.

Besides being a spare-time endeavour, I believe I'm still in the learning phase, studying different statistical finance concepts and techniques, making experiments like this one, assessing the results.

Then the next step I think is to come up with some strategies, perform backtests with historical data and build a real-time automated trading infrastructure.

I have a few friends working in Investment Banks but they're more into traditional portfolio management than automated trading, so they don't help much.

I will organize my thoughts and shoot you a mail once a get the time!

This is a fantastic post, and it looks like this blog is full of fantastic posts. When I have some time I'm definitely going to play around with that code.

Thanks for that, I appreciate it!

Applications are open for YC Summer 2020

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact