softwarespartan / IB4m

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

MarketDataExample databuf accessibility #56

Open GIL1105 opened 5 years ago

GIL1105 commented 5 years ago

Do you know where I can find the definition of all the TWS fields hidden behind databuf, like bidPrice ?

It's a pity databuf is not a Matlab structure, this would have helped accessing the data inside of it.

Thanks to Abel's example I know I have to suffix with "data" to get the answer, but I couldn't find the way on the IB pages below https://interactivebrokers.github.io/tws-api/top_data.html

Illustration:

mktDataEvents = collection2cell(databuf);

mktDataEvents{1}.data % suffixing with data

ans =

bidPrice:200.6

Thanks for helping

softwarespartan commented 5 years ago

You can always ask any objects in MATLAB for their class, fields and methods

class(mktDataEvents{1}) methods(mktDataEvents{1}) fields(mktDataEvents{1})

softwarespartan commented 5 years ago

btw, you can see the src code for MarketData here

https://github.com/softwarespartan/TWS/blob/master/src/com/tws/MarketData.java

GIL1105 commented 5 years ago

Indeed fields(XYZ) allows to look at what's in, thank you Abel

About the source code you point to, well, it seems to me it has nothing to deal with to your MarketData.m example, but I am a layman in Java ...