softwarespartan / IB4m

Interactive Brokers API for Matlab
GNU General Public License v2.0
62 stars 21 forks source link

Error using MarketDepthExample (line 94) #1

Open tradward opened 9 years ago

tradward commented 9 years ago

First of all, great job, thx.

I got the following error while testing MarketDepthExample. Is it because I am using the demo account, which may not have depth available and thus empty buffer ?

MarketDepthExample added interface method: TWSNotification notification listener has been added Server Version:76 TWS Time at connection:20150711 19:07:41 CST -1 2104 Market data farm connection is OK:ibdemo

-1 2104 Market data farm connection is OK:ibdemo

-1 2106 HMDS data farm connection is OK:demohmds

-1 2106 HMDS data farm connection is OK:demohmds

0 10092 Deep market data is not supported for this combination of security type/exchange

0 10092 Deep market data is not supported for this combination of security type/exchange

ans =

 0

Error using MarketDepthExample (line 94) Java exception occurred: org.apache.commons.collections.BufferUnderflowException: The buffer is already empty

at org.apache.commons.collections.buffer.BoundedFifoBuffer.get(BoundedFifoBuffer.java:260)
softwarespartan commented 9 years ago

Hi Polluxus

Indeed. Double check your Market Data subscriptions in the IB account management page. Market Depth is a "premium" data feed on NYSE, NASDAQ, etc.

The Apache Commons circular buffer does not like it if buffer.get() method is called when buffer.size() = 0. I should have written the docs with an "if buf.size() ~=0; buf.get(); end" but was try to keep the example code clean.

This error on the buffer is a little obnoxious and admittedly not very idiomatic of MATLAB. I might try and wrap that get on an empty buffer returns an empty array to avoid confusion.

Let me know if this explains what you're seeing. If not, will certainly be happy to dig deeper into the problem. Feel free to send over specific contract info so I can try to reproduce use case on my end.

If you have additional questions or comments don't hesitate to open another issue or shoot me an email at brown.2179@gmail.com

Cheers