Last week, during a time of high volume, the strategy received twice a message (OnOrderUpdate) saying that the order had been filled. It was exactly the same order. I had never see before and I wondering how can I avoid this problem. My strategy computes internally its position and this causes problems.
See an extract of the corresponding log file below. The order in question is called O_CortoST. In red I highlighted the problem.
2021-06-16 10:59:59:374|1|16|NinjaScript strategy 'UBSTv112paramState/235080936' submitting order 2021-06-16 10:59:59:389|1|32|Order='fc03dddab6c74f9eacc0ebb19 a6635d7/K7462' Name='O_CortoST' New state='Submitted' Instrument='MES 06-21' Action='Sell' Limit price=4221 Stop price=4221 Quantity=1 Type='Stop Market' Time in force=DAY Oco='235080936_OCO_CortoRR_20210616010402_18_1' Filled=0 Fill price=0 Error='No error' Native error='' 2021-06-16 10:59:59:462|1|32|Order='1254002464/XXXX' Name='O_CortoST' New state='Accepted' Instrument='MES 06-21' Action='Sell' Limit price=0 Stop price=4221 Quantity=1 Type='Stop Market' Time in force=DAY Oco='235080936_OCO_CortoRR_20210616010402_18_1' Filled=0 Fill price=0 Error='No error' Native error='' 2021-06-16 10:59:59:462|1|32|Order='1254002464/XXXX' Name='O_CortoST' New state='Working' Instrument='MES 06-21' Action='Sell' Limit price=0 Stop price=4221 Quantity=1 Type='Stop Market' Time in force=DAY Oco='235080936_OCO_CortoRR_20210616010402_18_1' Filled=0 Fill price=0 Error='No error' Native error='' 2021-06-16 10:59:59:618|1|8|Execution='464381393408' Instrument='MES 06-21' Account='K7462' Exchange=Globex Price=4230 Quantity=1 Market position=Short Operation=Operation_Add Order='1254060868' Time='6/16/2021 11:00 AM' 2021-06-16 10:59:59:653|1|32|Order='1253281275/XXXX' Name='O_CortoRR' New state='Filled' Instrument='MES 06-21' Action='Sell' Limit price=4230 Stop price=0 Quantity=1 Type='Limit' Time in force=DAY Oco='235080936_OCO_CortoRR_20210616010402_18_1' Filled=1 Fill price=4230 Error='No error' Native error='' 2021-06-16 10:59:59:657|1|8|Execution='464381394176' Instrument='MES 06-21' Account='K7462' Exchange=Globex Price=4230 Quantity=1 Market position=Short Operation=Operation_Add Order='1253281275' Time='6/16/2021 11:00 AM' [COLOR=#e74c3c]2021-06-16 10:59:59:675|1|32|Order='1254002464/XXXX' Name='O_CortoST' New state='Filled' Instrument='MES 06-21' Action='Sell' Limit price=0 Stop price=4221 Quantity=1 Type='Stop Market' Time in force=DAY Oco='235080936_OCO_CortoRR_20210616010402_18_1' Filled=1 Fill price=4221 Error='No error' Native error=''[/COLOR] 2021-06-16 10:59:59:682|1|16|NinjaScript strategy 'UBSTv112paramState/235080936' submitting order [COLOR=#e74c3c]2021-06-16 10:59:59:694|1|32|Order='1254002464/XXXX' Name='O_CortoST' New state='Filled' Instrument='MES 06-21' Action='Sell' Limit price=0 Stop price=4221 Quantity=1 Type='Stop Market' Time in force=DAY Oco='235080936_OCO_CortoRR_20210616010402_18_1' Filled=1 Fill price=4221 Error='No error' Native error=''[/COLOR]
Comment