Refactor Delistings Processing (#6059)
Regression Tests / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
* Move processing of delistings to Brokerage * Deal with case that exchange is not open on OptionSymbol.ID.Date * Refactor solution to use DelistingNotification event * Adjust some regression expected liquidation time * Mark some todos on deprecated functions * Update expected liqudation time for Py regressions * Update regressions that have been validated * Use HandlePositionAssigned for assignment orders * Update regressions * Update some missed unit tests; remove one that is already covered by regression * Cleanup deprecated backend functions * nit - small cleanup adjustment * Post rebase fix * Address review * Minor tweak to py regression
This commit is contained in:
@@ -28,6 +28,7 @@ class BasicTemplateOptionsDailyAlgorithm(QCAlgorithm):
|
||||
self.SetStartDate(2015, 12, 23)
|
||||
self.SetEndDate(2016, 1, 20)
|
||||
self.SetCash(100000)
|
||||
self.optionExpired = False
|
||||
|
||||
equity = self.AddEquity(self.UnderlyingTicker, Resolution.Daily)
|
||||
option = self.AddOption(self.UnderlyingTicker, Resolution.Daily)
|
||||
@@ -56,3 +57,17 @@ class BasicTemplateOptionsDailyAlgorithm(QCAlgorithm):
|
||||
|
||||
def OnOrderEvent(self, orderEvent):
|
||||
self.Log(str(orderEvent))
|
||||
|
||||
# Check for our expected OTM option expiry
|
||||
if orderEvent.Message == "OTM":
|
||||
|
||||
# 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:
|
||||
raise AssertionError("Algorithm did not process the option expiration like expected")
|
||||
|
||||
Reference in New Issue
Block a user