Welcome to the Traders Laboratory Forums.
Automated Trading Black box systems, strategy automation, algorithmic trading, etc...

Reply
Old 05-07-2010, 04:11 PM   #1

Join Date: May 2010
Location: Albany, NY
Posts: 18
Ignore this user

Thanks: 9
Thanked 0 Times in 0 Posts

Interactive Brokers API - Market Scanners

I receive the following output when calling reqScannerSubscription:
Code:
Market data farm connection is OK:ibdemo
HMDS data farm connection is OK:demohmds
Historical Market Data Service query message:no items retrieved
It seems the connection is fine, but no items are retrieved. If I perform a scan for the same criteria in the TWS graphical interface, I do get results. Any ideas?

Here's my code:
Code:
EClientSocket client = new EClientSocket(this);
client.eConnect("", 7496, 0);
ScannerSubscription filter = new ScannerSubscription();
filter.numberOfRows(10);
filter.instrument("STK");
filter.locationCode("STK.US");
filter.scanCode("MOST_ACTIVE");
client.reqScannerSubscription(13, filter);
daveyjones is offline  
Reply With Quote
Old 05-08-2010, 05:02 AM   #2

Join Date: Aug 2008
Location: Globex
Posts: 18
Ignore this user

Thanks: 280
Thanked 14 Times in 7 Posts

Re: Interactive Brokers API - Market Scanners

Although many people that use IB and the API visit this forum, you might be better off using the Interactive Brokers API Forum for detailed questions like that.

Best wishes,
TB
TrueBalance is offline  
Reply With Quote
Old 05-08-2010, 09:06 AM   #3

Join Date: May 2010
Location: Albany, NY
Posts: 18
Ignore this user

Thanks: 9
Thanked 0 Times in 0 Posts

Re: Interactive Brokers API - Market Scanners

Thanks for that link. I was aware that IB had a forum, but I assumed it's content would be included in my Google search. They must not allow caching of their forum. Anyways, I'm not actually an IB member yet (I don't have the $10,000 minimum balance), so I couldn't actually post my question, but I did search through the forum and I finally found the solution.

It's actually a bug (which hasn't been fixed for several years). For some reason, the value for averageOptionVolumeAbove automatically gets set to Integer.MAX_VALUE. This needs to be set to 0 (or some other reasonable value) in order for the scanner to work. I adjusted my code accordingly and it worked just fine. Here is the working code:

Code:
EClientSocket client = new EClientSocket(this);
client.eConnect("", 7496, 0);
ScannerSubscription filter = new ScannerSubscription();
filter.numberOfRows(10);
filter.instrument("STK");
filter.locationCode("STK.US");
filter.scanCode("MOST_ACTIVE");
filter.averageOptionVolumeAbove(0);
client.reqScannerSubscription(0, filter);
daveyjones is offline  
Reply With Quote

Reply

Thread Tools
Display Modes Help Others By Rating This Thread
Help Others By Rating This Thread:


All times are GMT -4. The time now is 11:04 AM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.