Cannot update limit price of Combo order
See original GitHub issueHi, I have no problem creating and cancelling a limit combo order. However, whenever I try to modify the price, I’m getting
Error 105, reqId 5: Order being modified does not match original order.
Here is a code snippet for reproducing the issue:
from ib_insync import *
import datetime
import logging
def update_order(ib):
spxw_contracts = [
Option('SPX', '20220617', 1100, 'P', 'SMART', tradingClass='SPXW'),
Option('SPX', '20220617', 1000, 'P', 'SMART', tradingClass='SPXW'),
]
spxw_contracts = ib.qualifyContracts(*spxw_contracts)
combo = Contract(
secType='BAG',
symbol='SPX',
exchange='SMART',
currency='USD',
tradingClass='SPXW',
comboLegs=[
ComboLeg(
conId=spxw_contracts[0].conId,
ratio=1,
action='SELL',
exchange='SMART'),
ComboLeg(
conId=spxw_contracts[1].conId,
ratio=1,
action='BUY',
exchange='SMART'),
])
order = LimitOrder(action='BUY', totalQuantity=1, lmtPrice=-1.45, orderRef='spread_p_0.02_sto')
trade = ib.placeOrder(combo, order)
ib.sleep(5)
order.lmtPrice = -1.40
trade = ib.placeOrder(combo, order)
ib.sleep(10)
print(trade)
ib = IB()
ib.connect('127.0.0.1', 4001, clientId=37)
util.logToConsole(logging.DEBUG)
update_order(ib)
Even if I commented out the line of order.lmtPrice = -1.40
I still got the error message.
I’m using
ib_insync:
0.9.70
(this is also replicable in0.9.66
) tws_gateway:10.15
(this is also replicable in10.12
)
Any thoughts? Thanks!
Issue Analytics
- State:
- Created a year ago
- Comments:5
Top Results From Across the Web
Combo orders with stock and option legs. - IB Knowledge Base
Please note that although it is possible that both orders will be executed simultaneously at the combo price, there is no guarantee of...
Read more >Limit Order: What It Is, How It Works & Examples - Seeking Alpha
Tip: A limit order guarantees a specified maximum price for purchases or a specified minimum price for sells. Trade execution, however, may not ......
Read more >If a Stop-Limit Is Reached, Will It Always Sell? - Investopedia
In short, a stop-limit order doesn't guarantee you will sell, but it does guarantee you'll get the price you want if you can...
Read more >Order Approving a Proposed Rule Change to Add a ... - SEC.gov
When the price of a D-Limit order is adjusted, the order will receive a new time priority. If multiple D-Limit orders are adjusted...
Read more >Stock Order Types and Conditions: An Overview
A limit order is an order to buy or sell a stock with a restriction on the maximum price to be paid or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@4everlove , comment/remove the line specifying tradingClass=‘SPXW’ for the BAG contract
@volconst 's solution works
Here’s my code: