OpenBB-finance / OpenBB

Investment Research for Everyone, Everywhere.
https://openbb.co
Other
30.13k stars 2.8k forks source link

[Bug] Large Difference in Options Greeks Values Between Sources. #3779

Closed deeleeramone closed 1 year ago

deeleeramone commented 1 year ago

The two values are not even in the ballpark, for the same option.

Screenshot 2022-12-14 at 8 32 32 PM

deeleeramone commented 1 year ago

Another set of values are returned from greeks which are completely different.

Screenshot 2022-12-14 at 9 05 39 PM

jmaslek commented 1 year ago

Another set of values are returned from greeks which are completely different.

Screenshot 2022-12-14 at 9 05 39 PM

This is expected when you consider put vs call. call delta - put delta is close to 1 for all those and the difference between the rest is consistent with IV diff.

The massive difference between sources is not and was supposed to be fixed with a recent PR. I have a hypothesis that I will test out.

jmaslek commented 1 year ago

So I did find one bug. The chains command is still using .seconds instead of .total_seconds. That will have a large impact on the greeks shown via chains. And actually looking at this, the greeks from chains -source Tradier are close to greeks.

Do note IV varies between everywhere. At the time of writing, for 12/16 398 call for SPY has the following IV: .29 at tradier, .23 on nasdaq and .18 on yf). That will impact the calculations a whole lot.

When calculating, we can do better on the dte by adding 16 hours to the expiry date (since the option expires at 4pm), but this wont have a big impact since convert this to yearly yearly.

deeleeramone commented 1 year ago

For the same call, after market close

YF: 0.2441481 Tradier: 0.290037 Nasdaq: This column does not exist.

northern-64bit commented 1 year ago

Tradier: We do no calculations it just retrieves the data from their api. So that one is correct unless Tradier calculates it wrongly.

YFinance: For the calculations we currently use a fixed risk free rate at 0.03, which changes the results a bit. There's also the issue mentioned by @jmaslek that it uses seconds instead of total_seconds.

Nasdaq: No calculations done on our side, just gets the data from the api (no greeks)

My pr #3812 should fix these mentioned issues.

jmaslek commented 1 year ago

Tradier: We do no calculations it just retrieves the data from their api. So that one is correct unless Tradier calculates it wrongly.

YFinance: For the calculations we currently use a fixed risk free rate at 0.03, which changes the results a bit. There's also the issue mentioned by @jmaslek that it uses seconds instead of total_seconds.

Nasdaq: No calculations done on our side, just gets the data from the api (no greeks)

My pr #3812 should fix these mentioned issues.

Note I fixed the total seconds issue in #3792. The rf rate should probably be an input variable as well. Has a very small impact, as its an overall exp(-r*T)