File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed
Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -2369,19 +2369,22 @@ def adjust_prices(self) -> None:
23692369 order .lmtPrice
23702370 ) == np .sign (updated_price ):
23712371 console .print (
2372- f"[green]Resubmitting order for { contract .symbol } "
2372+ f"[green]Resubmitting { order . action } { contract . secType } order for { contract .symbol } "
23732373 f" with old lmtPrice={ dfmt (order .lmtPrice )} updated lmtPrice={ dfmt (updated_price )} "
23742374 )
23752375 order .lmtPrice = float (updated_price )
23762376
2377- if contract .secType == "BAG" :
2378- # for some reason, these fields need to be cleared
2379- # when modifying an existing BAG (combo) order
2380- # in-place (janky)
2381- order .algoStrategy = ""
2382- order .algoParams = []
2383- order .tif = ""
2384- order .account = ""
2377+ # For some reason, we need to create a new order object
2378+ # and populate the fields rather than modifying the
2379+ # existing order in-place (janky).
2380+ order = LimitOrder (
2381+ order .action ,
2382+ order .totalQuantity ,
2383+ updated_price ,
2384+ orderId = order .orderId ,
2385+ algoStrategy = order .algoStrategy ,
2386+ algoParams = order .algoParams ,
2387+ )
23852388
23862389 # put the trade back from whence it came
23872390 self .trades [idx ] = self .ib .placeOrder (contract , order )
You can’t perform that action at this time.
0 commit comments