开云体育

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

Re: reqMktData callbacks are missing data with gateway 10.30 and 10.31 sporadically, works fine with 10.19 and older gateways/TWS

 

Thanks Daniel,
?
Just to be clear the problem is not that I am not receiving the callbacks at all. The problem is that I am receiving not entire set of? the data I expect for some of the contracts (always random which contracts will be missing some data). Sometime it is bid which is missing, sometimes ask, sometimes last etc. bit random misses. And everytime I check gateway log for the request I had issues with It is clear that that piece of data is not there (say I see that for req 123456 I get bid, ask, volume but not a last value etc.).?
?
First off: note that `Contract.primaryExch` is not the same as `Contract.Exchange`. You might be constructing invalid Contract objects.?
I am 99.99% it is not the contract issue, as I am getting most of data,?
?
Moreover, today I was experimenting with unsubscribing/subscribing for data for a contract which at this point was missing data (my definition of "missing" is that after subscription I didn't receive all of ["bid", "ask", "last", "volume", "last_timestamp", "high", "low"] within 20 seconds at least once, typically one or two would be missing), and 100% of time I was receiving the data after a second subscription. So contract part is very likely fine.?
?
Possible issues:
1: make sure you comply with the max 50 requests per second pacing violation. I don't know if you'll receive an error message if that's your case.
2: error code 10197 "No market data during competing session": if you're pulling reqMktData and at the same time visualizing the data in TWS, you might get this error and hence not receive an eWrapper callback.?
Yes, I monitor error codes. no such errors. As for pacing, it used to be needed but SDK I believe build it in and there is an option ?setConnectOptions("+PACEAPI"), which I use for several years now on top of own pacer anyway (just ot be safe, remember first versions were glitchy). And typically pacing errors result that you don't get any data at all. which is not current case.?
?
About reqMktData: just for fun I checked my code and out and yesterday I made 54.000 calls to it, all received a callback except few
Great stats, :) it used to be like this for me up and including gateway 10.19.?
  1. what is your definition of "received"? are you looking for say "last" only or a bit wider scope like I mentioned above?
  2. What version of gateway/TWS are you using (not API) ?? Gateway 10.19 and older work fine for me (and have been for 5 years), yet once I switch gateway to 10.30 or 10.31 I immediately start seeing issues.?
AJ


Re: No definition for SPX option using LocalSymbol

 

Thanks.?
I've already tried using US format like SPXW ?241218C05945000 but for some reason it still couldn't find the contract.?
I just tried again and it seems to work now.?


Re: No definition for SPX option using LocalSymbol

 

Yes, I mentioned that I can use TradingClass to separate monthly and weekly options. The problem is that it is supposed to be generic method that I could use to form a contract for any security type, SPX index option, QQQ stock option, ES futures option. In this case, it is not clear what I should provide in the TradingClass property.?
?
If there is a strict rule that defines how TradingClass needs to be set, e.g. symbol name + expiration type = SPXW, then I could use TradingClass instead of LocalSymbol but I haven't seen any docs describing how to set TradingClass depending on SecType. LocalSymbol does define specific format for all type of options, it is more generic, so I decided to go with it.?


Re: No definition for SPX option using LocalSymbol

 

开云体育

The Contract Inspector shows you the actual local symbol to use. US options and European options have different local symbol formats: you’ve tried to use the European format for a US option.

?

The local symbol you need is:

?

SPXW? 241218C05945000

?

which is probably in your screenshot, except it’s too small and fuzzy to read.

?

Richard

?

?

From: [email protected] <[email protected]> On Behalf Of Andy Sanders via groups.io
Sent: 19 December 2024 05:16
To: [email protected]
Subject: [TWS API] No definition for SPX option using LocalSymbol

?

Could somebody advise why I'm getting "No security definition" error for a contract with this local symbol : C SPX 20241218 5945 W

?

Security: SPX index

Strike: 5945

Side: Call?

Expiration: 2024-12-18?

Type: Weekly

?

Trying to send order to buy and sell SPX index options. When I set separate contract properties such as strike, symbol, expiration, currency, and exchange, place order request returns error "ambiguous definition" because API returns the same expiration date for monthly and weekly options.?

?

?

There are several ways to make contract definition for option unique, e.g. using TradingClass or LocalSymbol properties. When I try to use LocalSymbol I get error "No security definition found"

?

Example of local symbol that I used : C SPX 20241218 5945 W

Format mentioned in the docs : ?

?


Re: reqMktData callbacks are missing data with gateway 10.30 and 10.31 sporadically, works fine with 10.19 and older gateways/TWS

 

Hi AJN.?

First off: note that `Contract.primaryExch` is not the same as `Contract.Exchange`. You might be constructing invalid Contract objects.?

About reqMktData: just for fun I checked my code and out and yesterday I made 54.000 calls to it, all received a callback except few, like ~50, because of the reason #2 mentioned below.?

Possible issues:
1: make sure you comply with the max 50 requests per second pacing violation. I don't know if you'll receive an error message if that's your case.
2: error code 10197 "No market data during competing session": if you're pulling reqMktData and at the same time visualizing the data in TWS, you might get this error and hence not receive an eWrapper callback.?

Note I'm in C# API 10.15.2.0 - no capacity to test on another version at?the moment.

Hope it helps.?


On Wed, Dec 18, 2024 at 9:09?PM ajn via <andrei.jefremov=[email protected]> wrote:
I created a second version where I removed all code which is not absolutely necessary It is roughly 150 line of code which one easily sees comparing Program.py from samples to Program_get_bid.py. As per first post: The file is part of \samples\Python\Testbed?extract provided python.zip in that folder Then, run (or even better run from debugger and step)
Program_get_bid.py -f symbols.csv -m REALTIME --data-lines 75 --loops 5 --port 4001
?
There is 3 new functions left. Main entry , runs the test in the loop
?
Actual code subscribing to data. making sure the datalines limit is not exceeded. And knowing that Subscription is expensive I typically run 65% of line limit. I.e. for test accounts where I have only 100 lines I would run 65 max. So we never run into "max data lines limit reached" error.?
?
monitor_not_done is called after each subscription and stops new subscribtions once we reach the limit or (finalize = True) simply waits until all subscriptions returned the data or Timed out.
?
The wrappers are easier described by comparison to Program.py the original test app. Really all wrappers do is saving incoming data
?
and there is unsubscribing bit which is driven by wrappers (here on example of error), if all data is present the cancel is called and sets "sentCancelMktData" which gives signal to test loop that one received all the data
?
That is pretty much it.?
?



--
Daniel


Re: reqMktData callbacks are missing data with gateway 10.30 and 10.31 sporadically, works fine with 10.19 and older gateways/TWS

 

On Wed, Dec 18, 2024 at 08:09 PM, ajn wrote:

where I removed all code which is not absolutely necessary It is roughly 150 line of code which one easily sees comparing Program.py from samples to Program_get_bid.py.

Pull it out and make it stand alone. Get rid of ALL SUPERFLUOUS things like colorization constants... or no one will want to help you.


Re: No definition for SPX option using LocalSymbol

 

For SPX OPT you have to set up `Contract.TradingClass` as `SPX` for monthlies?and `SPXW` for daily/weekly?expiration. Do not define `LocalSymbol`. For naked SPX options, just do `Symbol`, `SecType`, `Exchange`, `Currency`, `TradingClass`, `Strike`, `Right` and `LastTradeDateOrContractMonth`.
Good luck,
Daniel.

On Thu, Dec 19, 2024 at 6:16?AM Andy Sanders via <arteinvolo=[email protected]> wrote:
Could somebody advise why I'm getting "No security definition" error for a contract with this local symbol : C SPX 20241218 5945 W
?
Security: SPX index
Strike: 5945
Side: Call?
Expiration: 2024-12-18?
Type: Weekly
?
Trying to send order to buy and sell SPX index options. When I set separate contract properties such as strike, symbol, expiration, currency, and exchange, place order request returns error "ambiguous definition" because API returns the same expiration date for monthly and weekly options.?
?
?
There are several ways to make contract definition for option unique, e.g. using TradingClass or LocalSymbol properties. When I try to use LocalSymbol I get error "No security definition found"
?
Example of local symbol that I used : C SPX 20241218 5945 W
Format mentioned in the docs : ?
?



--
Daniel


Re: Entry that triggers OCO with TP and SL

 

Create 3 separate orders.
TP and SL orders will have property "OrderId" that should be the same as the main order ID.?
The first two orders will have property "Transmit" set to false, the last one is true.?
?


No definition for SPX option using LocalSymbol

 

Could somebody advise why I'm getting "No security definition" error for a contract with this local symbol : C SPX 20241218 5945 W
?
Security: SPX index
Strike: 5945
Side: Call?
Expiration: 2024-12-18?
Type: Weekly
?
Trying to send order to buy and sell SPX index options. When I set separate contract properties such as strike, symbol, expiration, currency, and exchange, place order request returns error "ambiguous definition" because API returns the same expiration date for monthly and weekly options.?
?
?
There are several ways to make contract definition for option unique, e.g. using TradingClass or LocalSymbol properties. When I try to use LocalSymbol I get error "No security definition found"
?
Example of local symbol that I used : C SPX 20241218 5945 W
Format mentioned in the docs : ?
?


API dev available

 

Hello, all, I am available for API dev work if anyone needs an extra hand


Re: reqMktData callbacks are missing data with gateway 10.30 and 10.31 sporadically, works fine with 10.19 and older gateways/TWS

 

I created a second version where I removed all code which is not absolutely necessary It is roughly 150 line of code which one easily sees comparing Program.py from samples to Program_get_bid.py. As per first post: The file is part of \samples\Python\Testbed?extract provided python.zip in that folder Then, run (or even better run from debugger and step)
Program_get_bid.py -f symbols.csv -m REALTIME --data-lines 75 --loops 5 --port 4001
?
There is 3 new functions left. Main entry , runs the test in the loop
?
Actual code subscribing to data. making sure the datalines limit is not exceeded. And knowing that Subscription is expensive I typically run 65% of line limit. I.e. for test accounts where I have only 100 lines I would run 65 max. So we never run into "max data lines limit reached" error.?
?
monitor_not_done is called after each subscription and stops new subscribtions once we reach the limit or (finalize = True) simply waits until all subscriptions returned the data or Timed out.
?
The wrappers are easier described by comparison to Program.py the original test app. Really all wrappers do is saving incoming data
?
and there is unsubscribing bit which is driven by wrappers (here on example of error), if all data is present the cancel is called and sets "sentCancelMktData" which gives signal to test loop that one received all the data
?
That is pretty much it.?
?


Re: reqMktData callbacks are missing data with gateway 10.30 and 10.31 sporadically, works fine with 10.19 and older gateways/TWS

 

I have implemented reqContractDetails and start constructing contract using conId I received.
so instead of this

Like this
?
It made no difference, unfortunately. still not receiving some data


Re: reqMktData callbacks are missing data with gateway 10.30 and 10.31 sporadically, works fine with 10.19 and older gateways/TWS

 

On Wed, Dec 18, 2024 at 12:08 AM, ajn wrote:

I didn't delete that IB boiler code to make the comparison obvious, if I do the app would be tiny. I can do that easily = keep only code which gets executed if that will make everyone more comfortable)

This would be greatly appreciated. If you can make the test case as small and simple as humanly possible... this will help people (esp. IBKR internal developers, who need extra help because they're mostly inept) to id and possibly fix the problem.


Re: IB's New automated trading system questionnaire

 

There are many ways you can handle this. @wordd already mentioned sending messages to slack channels, for example. All large cloud providers have services that are called something like "Simple Message Service" or so, that allow you to send messages through simple API calls.

If you want to stick with email, check how your email provider supports "SMTP for outgoing messages" and look for an SMTP library for your preferred environment. Your service provider may place various restrictions on email delivered to them by SMTP (such as SSH/TLS encryption or certificates), but generally I would expect that those do not need two-factor authentication.

For Java, for example, you'd use "JavaMail" directly or through higher level libraries such as "Apache Commons Email".

闯ü谤驳别苍

?

On Tue, Dec 17, 2024 at 11:31 PM, Frank Bell wrote:

I logged on to my account and found a must complete questionnaire about how I'm monitoring my automated api.? It wanted to know
?
1) Did I write it or is it commercial and if so the vendor?
2) Is the API completely automated?? If not to what extent it is manual?
3) How are critical errors handled (audible alert, email, text)?
4) Is it constantly monitored?
5) and more
?
Apparently it is now being required by regulators.
?
Given that, can anyone point to code that will allow me to send email/texts now that Google and Yahoo are requiring two factor authentication?? I used to send emails and texts when single factor was good enough.
?
Frank


Re: IB's New automated trading system questionnaire

 

can still work with Gmail "app passwords" if you aren't running a full MTA on your system.


Re: Entry that triggers OCO with TP and SL

 

On Tue, Dec 17, 2024 at 09:32 PM, wordd wrote:

Can't figure out how to fix the indents though.

Just fyi, you can use for code... wrap it in single backticks for code co-mingled within a line of text, and triple backticks for blocks of code. Attachments should work too (with the obvious side-effect of being separated from the message).


Re: IB's New automated trading system questionnaire

 

This doesn't exactly answer your question.. but to satisfy those requirements I'm sending a message to a slack channel then have configured that channel to alert me on any new messages. It's free and easy.


Re: Entry that triggers OCO with TP and SL

 

No prob!


Re: IB's New automated trading system questionnaire

 

Forgot to mention, C++ (2nd choice C#) two factor code for Google or Yahoo sample is preferred.


IB's New automated trading system questionnaire

 

I logged on to my account and found a must complete questionnaire about how I'm monitoring my automated api.? It wanted to know
?
1) Did I write it or is it commercial and if so the vendor?
2) Is the API completely automated?? If not to what extent it is manual?
3) How are critical errors handled (audible alert, email, text)?
4) Is it constantly monitored?
5) and more
?
Apparently it is now being required by regulators.
?
Given that, can anyone point to code that will allow me to send email/texts now that Google and Yahoo are requiring two factor authentication?? I used to send emails and texts when single factor was good enough.
?
Frank