Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

same IV and greeks for all puts and calls #16

Open
buckrogerss opened this issue Aug 8, 2023 · 1 comment
Open

same IV and greeks for all puts and calls #16

buckrogerss opened this issue Aug 8, 2023 · 1 comment

Comments

@buckrogerss
Copy link

buckrogerss commented Aug 8, 2023

using py_vollib_vectorized.api.price_dataframe on a dataframe with separated put and call rows, I get identical values for IV and all greeks for the same strike using this code:

    py_vollib_vectorized.api.price_dataframe(df, flag_col='putCall', underlying_price_col='underlying', strike_col='strikePrice', 
                                             annualized_tte_col='yearsToExpiration', riskfree_rate_col='riskfree', price_col='mid', 
                                             model='black_scholes', inplace=True)

this is the resulting dataframe:

putCall	bid	ask	mid	strikePrice	underlying	riskfree	yearsToExpiration	IV	delta	gamma	theta	rho	vega
c	10.9	11.75	11.325	320	330.5	0.05628	0.009998644	0.295633059	0.869912166	0.021662616	-0.319891087	0.027614338	0.069914516
c	8.1	9.7	8.9	322.5	330.5	0.05628	0.009998644	0.255320828	0.840031264	0.028832294	-0.323066229	0.02686937	0.080358425
c	6.75	7	6.875	325	330.5	0.05628	0.009998644	0.250937862	0.759211322	0.037553558	-0.406136786	0.024401107	0.102887507
c	5.05	5.2	5.125	327.5	330.5	0.05628	0.009998644	0.250810611	0.654893962	0.04445565	-0.479879727	0.021128867	0.121760934
c	3.55	3.7	3.625	330	330.5	0.05628	0.009998644	0.248345739	0.538257409	0.048384716	-0.509033454	0.01742454	0.131234044
c	2.4	2.43	2.415	332.5	330.5	0.05628	0.009998644	0.245168038	0.416486845	0.048155586	-0.485743472	0.013521562	0.128936795
c	1.48	1.59	1.535	335	330.5	0.05628	0.009998644	0.244567854	0.302309547	0.043167275	-0.420750648	0.009836511	0.115277751
c	0.92	0.99	0.955	337.5	330.5	0.05628	0.009998644	0.247850054	0.208801732	0.035067308	-0.336931764	0.006804493	0.094883334
c	0.57	0.58	0.575	340	330.5	0.05628	0.009998644	0.251753959	0.137681226	0.026449765	-0.249229534	0.004492274	0.072683235
p	0.57	0.6	0.585	320	330.5	0.05628	0.009998644	0.295633059	0.869912166	0.021662616	-0.319891087	0.027614338	0.069914516
p	0.89	0.92	0.905	322.5	330.5	0.05628	0.009998644	0.255320828	0.840031264	0.028832294	-0.323066229	0.02686937	0.080358425
p	1.39	1.45	1.42	325	330.5	0.05628	0.009998644	0.250937862	0.759211322	0.037553558	-0.406136786	0.024401107	0.102887507
p	2.13	2.21	2.17	327.5	330.5	0.05628	0.009998644	0.250810611	0.654893962	0.04445565	-0.479879727	0.021128867	0.121760934
p	3.1	3.25	3.175	330	330.5	0.05628	0.009998644	0.248345739	0.538257409	0.048384716	-0.509033454	0.01742454	0.131234044
p	4.4	4.6	4.5	332.5	330.5	0.05628	0.009998644	0.245168038	0.416486845	0.048155586	-0.485743472	0.013521562	0.128936795
p	6.05	6.25	6.15	335	330.5	0.05628	0.009998644	0.244567854	0.302309547	0.043167275	-0.420750648	0.009836511	0.115277751
p	7.95	8.8	8.375	337.5	330.5	0.05628	0.009998644	0.247850054	0.208801732	0.035067308	-0.336931764	0.006804493	0.094883334
p	10.05	10.95	10.5	340	330.5	0.05628	0.009998644	0.251753959	0.137681226	0.026449765	-0.249229534	0.004492274	0.072683235

I may be dumb and this is a black scholes limitation or something, but in practice, this is of course inaccurate

@buckrogerss
Copy link
Author

adding that if you use, for example, the 320 call and put values with the individual vectorized_implied_volatility, vectorized_delta, vectorized_gamma, etc functions, the call/put values are not identical, as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant