Hi Eugene, Cone
Fidelity users can get option prices directly in WL pro and since you have the Black Scholes formula already coded in, it might be useful to provide a method to compute the implied volatility by back solving for volatility.....
Size:
Color:
Size:
Color:
Eugene
Thanks as always ...this is a good start point...I will try to work off it and if I get it to work, I will share my code....
Size:
Color:
Here's a quick-n-dirty something I came up with.. seems to work. Requires Community.Components.
Instructions:1. Assumes that you have Fidelity data. Option format: -SYMyyMMdd[P/C]strike
2. Click on the underlying symbol and adjust parameters
3. If your data provider cannot request real option data, then enter it manually for double actualOptionPrice (about line 42) and comment out the previous
DataSeries optionPr statement.
CODE:
Please log in to see this code.
Size:
Color:
Hmmm, seems to only work for Calls.. need to fix a bug for Puts.
--- update ---
Fixed above now.
Size:
Color:
thanks Cone let me try your solution...many thanks
Size:
Color:
Hi Cone
I tested on Disney stock for the Oct 18 135 Call and 130 Put and there seems to be issue...maybe the algorithm is finding some other root...In both cases it shows the IV as -1...
Size:
Color:
Fixed above. I added a correction for a dividend paid in the future before expiry too (script only works for Fidelity Wealth-Lab Pro).
I found one case that didn't make sense at first: -PFE191018P40 - the Pfizer Oct 40 Put.
PFE Strike: 40
-PFE191018P40
Days to Exp: 23
Synth Price: 4.11
Real Price: 3.15
Hist Vol: 18.9
Hit limit <- This means that changing implied volatility isn't sufficiently affecting pricing
Impl Vol: 17.7
In this case, PFE closed yesterday at 35.90 - that gives the 40 Put AT LEAST a value of $4.10, however the actual price is returned to be $3.15. Digging into it, that's because this option last traded on 9/13/2019 - when PFE was trading closer to $37. Consequently, in this case you cannot really calculate the implied volatility "today" because you don't have a recent price.
The procedure could be modified to find the implied volatility on the last day the option traded, but let's call it "good for now" ;)
Size:
Color:
Cone it is perfectly possible for IV to be less than HV and pro option traders who mostly sell options like to sell when IV is higher...so even if the price was same in this case $37, IV can be than HV...and that is when there is a risk on the sell side if the underlying were to move quickly in the opposite direction...thanks for your help
Size:
Color:
Hi Cone,
I made a little modification to your code to search for options at diffrerent strike price expressed as a % of the EOD closing price...it works great and I am going to use this to find options for entire data sets...one issue I have is that when ever it does not find a symbol, it throws an exception...now when I press enter or click OK the msg goes away and code continues...However since I want to do this over many stocks it becomes tedious to press ENTER all the time...can you suggest some code to take care of this small issue
CODE:
Please log in to see this code.
In the code above I have commented the code that I am not able to get to work (Line 64 and three lines below)
//// This part of the code does not seem to work
attached is the run time message I get whenever it does not find a symbol in Fidelity...how do I get rid of the message and continue with code?
Size:
Color:
You have to request a valid strike. There is no 222 Oct Put for AAPL, only 220 or 225, etc.
Don't slide the "slider", instead click it and enter a strike increment that will always return a valid strike for the stock that you're testing. AAPL, for example, only strikes every $5, whereas QQQ does every $1. Especially after recent splits, stocks may strike every $2.50 or another decimal value.
Incidentally, the code chooses the strike just above the last-trade price. You can modify "double strike = ... " as you like.
Size:
Color:
Size:
Color:
"Database provider by MS123 (Eugene)" solved it :-)
Size:
Color:
If you installed it as a workaround following an observation from
this thread, then it's really amusing. :) But whatever works for you is fine with me!
Size:
Color:
I did not have the guts to put the AutoIT script on my workstation ;-)
Size:
Color: