开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Same code not work for Hong Kong stock options


 

The following code works fine for US stock options, like TSLA, KO...etc., but the same code (just changed stock code, exchange, currency and strike price) resulted in Error 200, reqId 227: No security definition has been found for the request. Have I missed anything? Any idea would be appreciated. Thanks


 

Sorry, here is the code :

from ib_async import *

ib = IB()

ib.connect('127.0.0.1', 7497)

ticker = '941'

ccy = 'HKD'

exchange = 'SEHK'

expiry = '20240627'

strike = 75

leg1 = Option(ticker, expiry, strike, 'C', exchange=exchange, currency=ccy)

leg2 = Option(ticker, expiry, strike, 'P', exchange=exchange, currency=ccy)

ib.qualifyContracts(leg1, leg2)

ib.sleep(4)

combo_legs = [

? ? ComboLeg(conId=leg1.conId, ratio=1, action='BUY'),

? ? ComboLeg(conId=leg2.conId, ratio=1, action='BUY')]

combo_contract = Contract(symbol=ticker, secType='BAG', currency=ccy, exchange=exchange, comboLegs=combo_legs)

order = LimitOrder('BUY', 1, 0.7)

trade = ib.placeOrder(combo_contract, order)

ib.sleep(3)

ib.disconnect()


 

I'm also getting the 200 error via API. When placing the order via GUI it gives a friendlier message informing me that my account is ineligible to trade the contract; due to sanctions requirements!??!

And, like you, I'm not having any problems with options on other exchanges that I've tried (e.g. CDE, ASX).

So I'm left wondering... did this just start happening on the 12th? Because it seems possible that, even though on SEHK, are somehow having a ripple effect.