开云体育

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

Re: Error: 1 321 Error validating request.-'bW' : cause - Please enter a local symbol or an expiry

Nick
 

开云体育

That's because there are a zillion ways to calculate continuous futures prices and the continuous contract price may be far from the actual futures contract price. If you trade based on continuous futures you're trying to navigate Chicago with a map of Detroit.


On 3/13/2022 7:30 PM, dent wrote:

Uh OH just found this



```

Continuous futures are available from the API with TWS v971 and higher. Continuous futures cannot be used with real time data or to place orders, but only for historical data.

```


On 3/13/22 18:28, 闯ü谤驳别苍 Reinold via groups.io wrote:
No problem. has an overview of most (if not all) SecTypes as well as the contract object fields you want to set to properly describe the instrument you are interested in.


Re: Error: 1 321 Error validating request.-'bW' : cause - Please enter a local symbol or an expiry

 

开云体育

Excellent I will get on that immediately, seems like a GREAT solution and thank you so much for taking the time.

cp


On 3/13/22 18:51, 闯ü谤驳别苍 Reinold via groups.io wrote:

We do use CONTFUT with real time data, But not directly.

As a matter of practice we follow this work flow:

  • Make a sparse contract object that describes the instruments we are interested in (such as ES, GLOBEX, CONTFUT)
  • Use reqContractDetails to request a complete contract object from IBKR
  • Use the complete contract object for all API calls that require contracts

For CONTFUT contracts, reqContractDetails returns the contract for the actual current front-month future (such as ESH2 today). That contract has a SecType of FUT and reqMktData is happy.

闯ü谤驳别苍


Re: Error: 1 321 Error validating request.-'bW' : cause - Please enter a local symbol or an expiry

 

We do use CONTFUT with real time data, But not directly.

As a matter of practice we follow this work flow:

  • Make a sparse contract object that describes the instruments we are interested in (such as ES, GLOBEX, CONTFUT)
  • Use reqContractDetails to request a complete contract object from IBKR
  • Use the complete contract object for all API calls that require contracts

For CONTFUT contracts, reqContractDetails returns the contract for the actual current front-month future (such as ESH2 today). That contract has a SecType of FUT and reqMktData is happy.

闯ü谤驳别苍


Re: Error: 1 321 Error validating request.-'bW' : cause - Please enter a local symbol or an expiry

 

开云体育

Uh OH just found this



```

Continuous futures are available from the API with TWS v971 and higher. Continuous futures cannot be used with real time data or to place orders, but only for historical data.

```


On 3/13/22 18:28, 闯ü谤驳别苍 Reinold via groups.io wrote:

No problem. has an overview of most (if not all) SecTypes as well as the contract object fields you want to set to properly describe the instrument you are interested in.


Re: Error: 1 321 Error validating request.-'bW' : cause - Please enter a local symbol or an expiry

 

No problem. has an overview of most (if not all) SecTypes as well as the contract object fields you want to set to properly describe the instrument you are interested in.


Re: Error: 1 321 Error validating request.-'bW' : cause - Please enter a local symbol or an expiry

 

开云体育

Hi jurgen

I think you've spotted the flaw in my cunning plan. I hadn't AND when I did it I got

```

Error: 1 321 Error validating request.-'bW' : cause - Please enter a valid security type
```

?I didn't know that security type existed so I'm going to go through the code to see if I can actually send that. Thanks for the headsup on CONTFUT.

cp



On 3/13/22 18:10, 闯ü谤驳别苍 Reinold via groups.io wrote:

Are you setting SecType = "CONTFUT" somewhere ?

闯ü谤驳别苍


Re: Error: 1 321 Error validating request.-'bW' : cause - Please enter a local symbol or an expiry

 

Are you setting SecType = "CONTFUT" somewhere ?

闯ü谤驳别苍


Error: 1 321 Error validating request.-'bW' : cause - Please enter a local symbol or an expiry

 

I want to get continuous futures and don't want to mess around with expiration et al. Basically what I see in the TWS watchlist.

I tried

reqMktData 

with 
Symbol  = "ES"
Exchange = "GLOBEX"
Currency = "USD"

and got the error in the subject line. Is there ANY variant of reqMktData that might work OR do I have to resort to reqRealTimeBars and pick the last bar?

No point in posting code as I am writing in julia. The calls to the TWS api are populated the same so ANY help would be appreciated.

thanks

and got the error in the subject line.


Re: bunch of reqMktData requests for options

 

Do you also get the message that they will stop the support for older versions after 31st March 2022? I'm still unsure what this actually means. It could be that starting from this day, this client will not work anymore. It could also mean that they would just don't process any tickets regarding this version anymore.

So hopefully, they will fix it asap.


Re: bunch of reqMktData requests for options

 

Sorry for my late reply, But I've opened several tickets about it.
The IB development is investigating it.?
Hope they will patch it soon.
I opened my first tickets about this issue more than 2 years ago.
We still use TWS 9.73 as it was the last release before the 'regression/bug' was introduced in their code.


Re: OCA Group Orders being placed, and executed, but the stop loss orders or Take profit order are not being cancelled after one of the bracket orders are executed

Nick
 

Probably because you are not placing a bracket order, you're just sending 3 independent orders.

See bracket order info here:

On 3/13/2022 8:46 AM, alcatrazam wrote:
Hey everyone, so I am placing the bracket orders, they are going to IB, being placed, and executed, but once one part is triggered, the remaining ordered is hanging, and not being canceled, then my python program crashes as it sees the remaining fragment of the order.


OCA Group Orders being placed, and executed, but the stop loss orders or Take profit order are not being cancelled after one of the bracket orders are executed

 

Hey everyone, so I am placing the bracket orders, they are going to IB, being placed, and executed, but once one part is triggered, the remaining ordered is hanging, and not being canceled, then my python program crashes as it sees the remaining fragment of the order.

Anyone have any suggestions why this is happening?

? take_profit = stop_loss = None
? ? ? ? if order.asset.right == "CALL":
? ? ? ? ? ? take_profit = price + self.call_take_profit
? ? ? ? ? ? stop_loss = price - self.call_stop_loss
? ? ? ? elif order.asset.right == "PUT":
? ? ? ? ? ? take_profit = price + self.put_take_profit
? ? ? ? ? ? stop_loss = price - self.put_stop_loss
?
? ? ? ? if order.side == "buy":
? ? ? ? ? ? self.last_filled_price = price
? ? ? ? ? ? if take_profit is not None and stop_loss is not None:
? ? ? ? ? ? ? ? tp_order = self.create_order(
? ? ? ? ? ? ? ? ? ? order.asset,
? ? ? ? ? ? ? ? ? ? order.quantity,
? ? ? ? ? ? ? ? ? ? "sell",
? ? ? ? ? ? ? ? ? ? limit_price=take_profit,
? ? ? ? ? ? ? ? )
? ? ? ? ? ? ? ? stop_order = self.create_order(
? ? ? ? ? ? ? ? ? ? order.asset,
? ? ? ? ? ? ? ? ? ? order.quantity,
? ? ? ? ? ? ? ? ? ? "sell",
? ? ? ? ? ? ? ? ? ? stop_price=stop_loss,
? ? ? ? ? ? ? ? )
? ? ? ? ? ? ? ? self.submit_orders([tp_order, stop_order])

--
Allan in Toronto.


Re: Time to Fill Orders During Paper Trading

 

I'm glad I found this post.? It surely is still happening in March 2022.? Sometimes my futures order will fill under a second.? Other times, it can take 10-15 minutes to fill, even in the middle of the day (i.e., not after hours).


Re: How Can I Locate Hard to Borrow Shares to Short with TWS API?

 

This may get you part of the way .. see release notes under version 974:
https://www.interactivebrokers.com/en/index.php?f=24356


How Can I Locate Hard to Borrow Shares to Short with TWS API?

 

Does anyone have insight as to how you can locate HTB shares to short on TWS API? My main strategy involves shorting small caps which requires locating shares to short and can be done manually with a number of brokers, but I have yet to figure out how to locate shares to short do using a broker api like tws or another api.



Re: Market data lines

 

I already tried it since I have a German QWERTZ layout. Unfortunately, it didn't work.

However, I found the solution: I changed my keyboard layout to US QWERTY and now it works! I guess that the QWERTZ based layout could also work theoretically, but maybe this keyboard here is not able to detect four or more keys pressed simultaneously.


Re: reqMktdata SPX call

 

开云体育

thank you Jurgen

great help as always.

cp


On 3/11/22 09:44, 闯ü谤驳别苍 Reinold via groups.io wrote:

Under "File -> Global Configuration -> API -> Settings"
  • Enable "Create API message log"
  • Enable "Include market data in API log file"
Log files are stored encrypted so you would use "Account -> Diagnostics -> API Logs" to view or export them.

闯ü谤驳别苍

On Fri, Mar 11, 2022 at 08:50 AM, dent wrote:

Which logs should I be looking at please?? I use TWS desktop running on Linux. I just want to make sure I'm looking at the right ones.


Re: Market data lines

 

I don't know how it's on a US keyboard but on the keyboard I'm using I have to press shift-0 for a = sign. So CTRL, Alt, = becomes CTRL, Alt, shift, 0. Can this be the problem?


Re: TwsActiveX class not registered run-time error '-2147221164 (80040154)

 

Hi Daniel:? Were you ever able to fix this?? I'm getting the same error.
Thanks,
Martin


Re: Market data lines

 

I have the exact same problem, nothing happens when I press this combination. Is there another way to see the number of subscribed market data lines??