Additionally, I've been trying to match executions using other parameters and have noticed the Oco parameter after an exit on session close contains the exit on session close orderId, rather than the orderId for the order that opened the position.
Dump of consecutive execution.Order objects from OnExecutionUpdate()
YM-Range4,2018-01-16,13:14:54.113,17,Execution,orderId='NT-00314-646' account='Sim101' name='2018-01-16_13:14:54.113_RSTOC_S0' orderState=Filled instrument='YM 03-20' orderAction=SellShort orderType='Market' limitPrice=0 stopPrice=0 quantity=1 tif=Gtc oco='' filled=1 averageFillPrice=25908 onBehalfOf='' id=-1 time='2018-01-16 13:14:54' gtd='2099-12-01' statementDate='2019-12-17' YM-Range4,2018-01-16,13:30:00.003,17,Execution,orderId='NT-00315-646' account='Sim101' name='Stop loss' orderState=Filled instrument='YM 03-20' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=25917 quantity=1 tif=Gtc oco='NT-00314-646' filled=1 averageFillPrice=25917 onBehalfOf='' id=-1 time='2018-01-16 13:14:54' gtd='2099-12-01' statementDate='2019-12-17' YM-Range4,2018-01-16,13:48:43.128,17,Execution,orderId='NT-00316-646' account='Sim101' name='2018-01-16_13:48:43.128_RSTOC_S0' orderState=Filled instrument='YM 03-20' orderAction=SellShort orderType='Market' limitPrice=0 stopPrice=0 quantity=1 tif=Gtc oco='' filled=1 averageFillPrice=25932 onBehalfOf='' id=-1 time='2018-01-16 13:48:43' gtd='2099-12-01' statementDate='2019-12-17' YM-Range4,2018-01-16,13:59:59.640,17,Execution,orderId='NT-00318-646' account='Sim101' name='Exit on session close' orderState=Filled instrument='YM 03-20' orderAction=BuyToCover orderType='Market' limitPrice=0 stopPrice=0 quantity=1 tif=Gtc oco='' filled=1 averageFillPrice=25926 onBehalfOf='' id=-1 time='2018-01-16 13:59:59' gtd='2099-12-01' statementDate='2019-12-17' YM-Range4,2018-01-16,16:08:51.792,17,Execution,orderId='NT-00319-646' account='Sim101' name='2018-01-16_16:08:51.792_RSTOC_S0' orderState=Filled instrument='YM 03-20' orderAction=SellShort orderType='Market' limitPrice=0 stopPrice=0 quantity=1 tif=Gtc oco='' filled=1 averageFillPrice=25929 onBehalfOf='' id=-1 time='2018-01-16 16:08:51' gtd='2099-12-01' statementDate='2019-12-17' YM-Range4,2018-01-16,16:16:35.789,17,Execution,orderId='NT-00320-646' account='Sim101' name='Stop loss' orderState=Filled instrument='YM 03-20' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=25931 quantity=1 tif=Gtc oco='NT-00318-646' filled=1 averageFillPrice=25933 onBehalfOf='' id=-1 time='2018-01-16 16:08:51' gtd='2099-12-01' statementDate='2019-12-17'
Comment