Gamestudio Links
Zorro Links
Newest Posts
folder management functions
by VoroneTZ. 04/16/24 11:18
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
LPDIRECT3DCUBETEXTUR
E9

by Ayumi. 04/12/24 11:00
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 04/11/24 14:56
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
7 registered members (VoroneTZ, 11honza11, ricky_k, Nymphodora, rki, 7th_zorro, Volkovstudio), 433 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
11honza11, ccorrea, sakolin, rajesh7827, juergen_wue
19045 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
Bug with option expirations #484721
12/06/21 16:27
12/06/21 16:27
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
Here is the log for Workshop8 script (w smaller WEEKS) with Zorro-provided data:
Quote
[2460: Mon 21-05-24 15:40:00] 54200 0 1072/712 (419.19)
[SPY::SC46025] Place 1 Call 20210526 417.0 100@2.98 Unl 419.17 at 15:40:00 Mon
[SPY::SP46026] Place 1 Put 20210526 422.0 100@3.18 Unl 419.17 at 15:40:00 Mon

[2461: Tue 21-05-25 15:40:00] 54185 -15.00 1072/714 (418.31)
[SPY::SC46025] Expired ITM 1 Call 20210526 417.0 100@418.33: +165 Unl 418.33 at 15:40:00 Wed
[SPY::SP46026] Expired ITM 1 Put 20210526 422.0 100@418.33: -51.50 Unl 418.33 at 15:40:00 Wed

[2462: Wed 21-05-26 15:40:00] 54313 0 1073/713 (419.01)
The price of an underlying at expiration is taken 1 day earlier.

Last edited by Zheka; 12/06/21 16:27.
Re: Bug with option expirations [Re: Zheka] #484722
12/06/21 16:50
12/06/21 16:50
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
Same goes for Z13 system:
Quote
[2193: Thu 21-04-15 15:40:00] 217250 +34725 104/19 (415.94)
[SPY::SC15522] Expired ITM 15 Call 20210416 410.0 1500@415.90: -5617 at 15:40:00 Fri
[SPY::SP15523] Expired OTM 15 Put 20210416 414.0 1500@415.90: +39923 at 15:40:00 Fri

[2194: Fri 21-04-16 15:40:00] 251552 0 104/19 (417.26)

Re: Bug with option expirations [Re: Zheka] #484737
12/07/21 12:37
12/07/21 12:37
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
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/21 15:03
12/07/21 15:03
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
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/21 15:18.
Re: Bug with option expirations [Re: Zheka] #484755
12/07/21 17:24
12/07/21 17:24
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria
EOD = underlying price at market close
Expiration = underlying price at ExpiryTime

Maybe this helps? Both are in the historical data and normally different. Also, EOD price is normally adjusted, expiration price is unadjusted.

Re: Bug with option expirations [Re: Zheka] #484757
12/07/21 17:32
12/07/21 17:32
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
I must be really missing something. Would really appreciate if you could please point out a line in my post above where I go wrong?

SPY options expire at the market close at the day of expiry, so for an option expiring on Wed, SPY close price on Wed is the one used for settlement.

This price - the unadjusted SPY daily close price - is taken by Zorro from a "*.t8" file.

Is this correct?

Workshop8 - my first example - specifically has "History="*.t8" - so Zorro is only aware of unadjusted SPY prices..

Last edited by Zheka; 12/07/21 17:53.
Re: Bug with option expirations [Re: Zheka] #484765
12/08/21 15:13
12/08/21 15:13
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
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/21 15:52
12/08/21 15:52
Joined: Jul 2017
Posts: 783
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 783
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.

But here is the log again:
Quote
[2461: Tue 21-05-25 15:40:00] 54185 -15.00 1072/714 (418.31)
[SPY::SC46025] Expired ITM 1 Call 20210526 417.0 100@418.33: +165 Unl 418.33 at 15:40:00 Wed
[SPY::SP46026] Expired ITM 1 Put 20210526 422.0 100@418.33: -51.50 Unl 418.33 at 15:40:00 Wed

[2462: Wed 21-05-26 15:40:00] 54313 0 1073/713 (419.01)
418.33 is not the price on Wed, it is the price on Tue(!), 1 day earlier.

Attached Files optiions_20210526.PNG
Last edited by Zheka; 12/08/21 16:19.
Re: Bug with option expirations [Re: Zheka] #484769
12/08/21 17:22
12/08/21 17:22
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
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/21 20:32
12/08/21 20:32
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria
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.

Page 1 of 3 1 2 3

Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1