Maybe you are confusing EOD and underlying prices? Otherwise, for checking if a historical price is right or wrong, open the .t6 and .t8 files and compare. Options expire at the most recent underlying price, not at the EOD price.
Re: Bug with option expirations
[Re: Zheka]
#484746 12/07/2115:0312/07/2115:03
If by "EOD prices" you mean "EOD option prices" - then no, I am not looking at them for an EXPIRED option. I am looking at the price of an underlying in *.t8 file at the time of option expiration.
Have a look at the log snippet above:
- expiry date is 2021-04-16 (Fri, eod) - the price of an underlying on Fri, eod is 417.26
- yet Zorro calculates P&L based off 415.90 - which is a underlying price on Thu, the day before.
You can confirm this more evidently in the first log snippet (from Workshop8):
- the sold 417 Call has a time value of 2.98+(417-419.17) = 0.81 - the price of SPY at expiration on Wed, eod is 419.01. - the P&L after expiration is 0.81 + (419.01-419.17) = 0.65 or $65 per 100 shares.
- yet Zorro books +$165 - which means it really calculates as the log states - based off 418.33 - the price of SPY the day before.
Last edited by Zheka; 12/07/2115:18.
Re: Bug with option expirations
[Re: Zheka]
#484755 12/07/2117:2412/07/2117:24
All prices in a backtest are read from historical data.
The prices printed at any bar are from the files that you set up with the "History" variable. If that was a .t8 file, it's the first, highest, lowest, and last underlying price of that bar.
The underlying price at which an option expires is the last underlying price of that particular option in the t8 file. As you can easily see in the log, it is not identical to the prices printed at bars.
So if you don't trust a certain price, look into that .t8 file and check the prices.
Re: Bug with option expirations
[Re: jcl]
#484768 12/08/2115:5212/08/2115:52
Pls look at the attached prices from a .t8 file: the last existing price of an underlying on 05-26-2021 is 419.04 - which is the settlement price of options expiring same day.
Thanks for the screenshot. I see that the underlying price is indeed taken from the previous, not from the last bar. So you have been right all the time. I'll check if there is a reason for that, and will post here when I know what the problem is.
Re: Bug with option expirations
[Re: Zheka]
#484773 12/08/2120:3212/08/2120:32
I can already tell you what the reason probably is, ExpiryTime is 12 UTC by default and at that time, the most recent underlying is the price from the previous bar and not from market close because that would be in the future.
That makes sense for intrabar selling but not for expiration. So I think it should be changed, zheka is right, for expiration the market close price should be used regardless of ExpiryTime.