OTM option excerise orders improvements (#6767)
Research Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled

* Set fill price to zero in OTM exercise orders.

Improved the OTM exercise orders message.

* Update regression algorithms and unit tests

* Add IsInTheMoney property to OrderEvent

* Update SerializedOrderEvent

* Properly setting the option exercise order price to strike price or zero

* Minor changes

* Minor changes
This commit is contained in:
Jhonathan Abreu
2022-12-06 13:30:40 -04:00
committed by GitHub
parent 6b2dfb6b8c
commit 41a730bc68
51 changed files with 382 additions and 111 deletions
@@ -57,16 +57,16 @@ class BasicTemplateOptionsDailyAlgorithm(QCAlgorithm):
def OnOrderEvent(self, orderEvent):
self.Log(str(orderEvent))
# Check for our expected OTM option expiry
if orderEvent.Message == "OTM":
if "OTM" in orderEvent.Message:
# Assert it is at midnight 1/16 (5AM UTC)
if orderEvent.UtcTime.month != 1 and orderEvent.UtcTime.day != 16 and orderEvent.UtcTime.hour != 5:
raise AssertionError(f"Expiry event was not at the correct time, {orderEvent.UtcTime}")
self.optionExpired = True
def OnEndOfAlgorithm(self):
# Assert we had our option expire and fill a liquidation order
if not self.optionExpired: