开云体育

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

Re: TWS API returns "Error: 0 200 No security definition has been found for the request" in reqMktData() for INDEX

 

Is there a way via the API (or even elsewhere) to get a list of all indices available on IB? I was looking for the ICESEMI index but was unable to find it.


Re: TWS API returns "Error: 0 200 No security definition has been found for the request" in reqMktData() for INDEX

 

开云体育

You can't use SMART for indexes. The exchange for the ES index is GLOBEX.

?

From: [email protected] <[email protected]> On Behalf Of Tareq Naushad
Sent: 08 March 2022 10:57
To: [email protected]
Subject: [TWS API] TWS API returns "Error: 0 200 No security definition has been found for the request" in reqMktData() for INDEX

?

Hi,
I am trying to pull real-time data for some INDEX in a Python based project, I write the following code to pull the data:??
```
contract = Contract()
contract.symbol = "ES"
contract.secType = "IND"
contract.exchange = "SMART"
contract.currency = "USD"
reqMarketDataType(1)
reqMktData(2, contract, "", False, False, [])
```

But it always returns?"Error:? 0? ?200? ?No security definition has been found for the request".

Does anyone know what's wrong with my code?

- Thanks
Tareq


TWS API returns "Error: 0 200 No security definition has been found for the request" in reqMktData() for INDEX

 

Hi,
I am trying to pull real-time data for some INDEX in a Python based project, I write the following code to pull the data:??
```
contract = Contract()
contract.symbol = "ES"
contract.secType = "IND"
contract.exchange = "SMART"
contract.currency = "USD"
reqMarketDataType(1)
reqMktData(2, contract, "", False, False, [])
```

But it always returns?"Error:? 0? ?200? ?No security definition has been found for the request".

Does anyone know what's wrong with my code?

- Thanks
Tareq


Futures Ratio Bag

 

When amending my code to a non-standard combo (such as simultaneously Buying 2 futures contracts).....I receive an error message not authorized to trade?
Code that works:

vix1_contract = Contract()
vix1_contract.symbol = "VIX"
vix1_contract.secType = "FUT"
vix1_contract.exchange = "CFE"
vix1_contract.currency = "USD"
vix1_contract.lastTradeDateOrContractMonth = "20220315"
vix1_contract.primaryExchange = "CFE"
?
ib.qualifyContracts(vix1_contract)
?
vix2_contract = Contract()
vix2_contract.symbol = "VIX"
vix2_contract.secType = "FUT"
vix2_contract.exchange = "CFE"
vix2_contract.currency = "USD"
vix2_contract.lastTradeDateOrContractMonth = "20220420"
vix2_contract.primaryExchange = "CFE"
?
ib.qualifyContracts(vix2_contract)
?
contract = Contract()
contract.symbol = vix1_contract.symbol
contract.secType = "BAG"
contract.currency = 'USD'
contract.exchange = 'CFE'
?
leg1 = ComboLeg()
leg1.conId = vix1_contract.conId
leg1.ratio = 1
leg1.action = "SELL"
leg1.exchange = 'CFE'
print(vix1_contract)
print(vix2_contract)
leg2 = ComboLeg()
leg2.conId = vix2_contract.conId? ? ? ?#DBK MAR 15 2019 C
leg2.ratio = 1
leg2.action = "BUY"
leg2.exchange = 'CFE'
?
contract.comboLegs = []
contract.comboLegs.append(leg1)
contract.comboLegs.append(leg2)
?
limit_price = -1.7
Code (amended) that doesn't work:
........
leg1 = ComboLeg()
leg1.conId = vix1_contract.conId
leg1.ratio = 1
leg1.action = "BUY"? ? ?#changed from SELL
leg1.exchange = 'CFE'
print(vix1_contract)
print(vix2_contract)
leg2 = ComboLeg()
leg2.conId = vix2_contract.conId? ? ? ?#DBK MAR 15 2019 C
leg2.ratio = 1
leg2.action = "BUY"
leg2.exchange = 'CFE'
?
contract.comboLegs = []
contract.comboLegs.append(leg1)
contract.comboLegs.append(leg2)
?
limit_price = 65.05
------------------------------------------------
Error Message: " Rejected by the system.? No trading permissions for the product."


historical market data pacing violations are back?!

 

So far so good, no hist data pacing violations - 10 am New York Time.

Let's keep our fingers crossed.

@skee__bum - maybe you did shake their tree enough!

Be Well,
Lou Dudka


Undocumented updateAccountValue() keys

 

These keys I seem to be missing from the docs ():

NLVAndMarginInReview
Guarantee
Guarantee-C
Guarantee-S
PhysicalCertificateValue
PhysicalCertificateValue-C
PhysicalCertificateValue-S
TotalDebitCardPendingCharges
TotalDebitCardPendingCharges-C
TotalDebitCardPendingCharges-S

Could they be added?


Cheers,

.mm


Re: Reqpositions for 1 account

 

It worked! Thanks!!!


Re: historical market data pacing violations are back?!

 

I may have reported too soon. Suddenly, on Friday afternoon in the last hour of trading before the futures markets closed, I got multiple pacing violations messages on various futures contracts. Even though I was only requesting historical data sequentially, one contract at a time.


historical market data pacing violations are back?!

 

At about 5 pm New York Time my pacing violations seemed to stop.
Yes, markets are not yet closed, even Friday.


Re: next valid id on initial connection

 

thank you
I'll keep looking for an example?in i


Re: next valid id on initial connection

 

It depends on your definition of good.

The solution uses sleep for synchronization, so I would not call it a good solution. It does not address the mismatch between synchronous and asynchronous processing and only addresses one of the many API callback scenarios.

On the other hand, it will probably work reliably since the loop blocks your client until the nextValidId callback has taken place (as long as the sleep does not interfere with proper API background message processing).

闯ü谤驳别苍


Re: next valid id on initial connection

 

thank you for the fast reply.

honesty I got lost in i
I'm a?junior so my?knowledge is?quite?limited for now, so I'm not sure how to wait for a callback in python.
but i did find an example online?related to this?matter
is that a good solution?

? ? def nextValidId(self, orderId: int):
? ? ? ? super().nextValidId(orderId)
? ? ? ? self._next_order_id = orderId

def main():

? ? testApp = IBApi()
? ? #connect on separet thred
? ? testApp.connect("127.0.0.1", 7496,1)
? ? t = threading.Thread(target=testApp.run, daemon=True)
? ? t.start()
? ? #if connection is done continue
? ? while True:
? ? ? ? if isinstance(testApp._next_order_id, int):
? ? ? ? ? ? print("connected")
? ? ? ? ? ? break
? ? ? ? else:
? ? ? ? ? ? print("waiting for connection")
? ? ? ? ? ? time.sleep(1)

thank you so much,
Cohav


historical market data pacing violations are back?!

 

Yeah, I just checked mine and it's having the same issues.

Lou Dudka


Re: historical market data pacing violations are back?!

 

My software downloads once per day historical data for about 200 stock tickers. It does so sequentially: one at a time. I have not noticed any change in time it takes for all data to get downloaded: it takes about 6 minutes and 30 seconds to complete this task. So, if there is any pacing in place at IB's side, I'm not getting close to that limit.


Re: Converging Trailing Stop via API

Nick
 

If you are going to be monitoring the position yourself you just have to change the price on the stop order - you don't have to cancel and submit a new one.

Just send another PlaceOrder with everything the same as the original stop order except the new price. This will adjust the stop price.

You might look into IB's algo order types, they might have something that would work and then it would be handled on IB's end.

On 3/4/2022 12:05 AM, David Walker wrote:
Does anyone have experience in the mechanics of maintaining a converging trailing stop via the API?


Re: historical market data pacing violations are back?!

 

Yes, I am also experiencing the same issue since yesterday.?


Converging Trailing Stop via API

 

Does anyone have experience in the mechanics of maintaining a converging trailing stop via the API??

I mean a stop where the trailing amount is wide at the start (to give a trade space to take hold) but then progressively reduces the trailing amount once the position becomes profitable, in order to protect the profit.? So, for example, a 25% trailing stop allows the trade to established, but then is reduced to, say, 20%, 15% and a minimum (say) 10% once the trade reaches certain profitability levels.? I think some people call it a tangential trailing stop.

Theoretically, I would guess the mechanics via the API would be something like this (but looking for comment/correction!):
  • Place initial entry order and (say) 25% trailing stop order as a parent/child order
    • specify OCA group/type on the trail stop order.
  • After entry, at each new profitability level:
    • Place a new trailing stop order with a new trailing % amount and with same OCA group/type as original trail stop order.
    • Cancel the original (and any other previous) trailing stop orders.

However, I'm not 100% sure of these mechanics and have these questions in my head:
  • Can I just keep adding trailing stops (without cancelling previous ones) provided they are all part of the same OCA group, and save the cancelling step above?
  • Are there any robustness concerns with regularly cancelling and replacing orders, or having multiple trailing stops sitting in an OCA group?? I don't want any trail stops to inadvertently enter a short position, obviously.
  • Or is there a better way that I haven't considered?

I would love any comments from anyone with experience, or even just views, on this.


Re: Need "dummies" guide for interpreting accountSummary w/ margin trading

 

The most relevant parameter to look at is SMA. If that goes negative you have used too much margin and IB will start to liquidate positions near the end of the US trading day.
Some information is provided here:?


Re: historical market data pacing violations are back?!

 

I appreciate you providing a proposed solution, but no...my situation is far from that simple.


Re: historical market data pacing violations are back?!

Nick
 

Isn't it just adding a function HistPacing() before each request?

Inside HistPacing you can use a fixed delay to test things out, then move to keeping a list of the last 60 requests when you're back alive with the simple version.

It's like 5 lines of code altogether.

On 3/3/2022 7:31 PM, skee__bum via groups.io wrote:
or if I need to completely rewrite my code how it was previously.