IB API C++ programming

On this page http://interactivebrokers.github.io...Client.html#a5b7d2f3048b2be5c9c3a87c18fb01dd3
the reqMktData() method is described, but unfortunately what the last parameter (mktDataOptions) is supposed to have is not described :-(

void reqMktData(int tickerId,
Contract contract,
string genericTickList,
bool snapshot,
List< TagValue > mktDataOptions
)

OTOH the genericTickList values are IMO very useful (HV, IV, RT HV etc. besides many other values like Volume etc.)
In the doc they pass just a TagValueListSPtr() object (?) created on the stack it seems :). Reason I don't know yet :).
Hmm maybe it is just a pointer as the suffix might indicate (but the signature doesn't expect a pointer or a reference, funny, maybe they are using some magic macro stuff or operator overloading...):
m_pClient->reqMktData(1001, ContractSamples::StockComboContract(), "", false, TagValueListSPtr());

Hmm... need to study the stuff deeper...
 
Last edited:
IBApi ::

[ComVisible(true)]
public class TagValue : TWSApi.ITagValue
{
private string tag;
private string value;

public string Tag
{
get { return tag; }
set { tag = value; }
}


public string Value
{
get { return this.value; }
set { this.value = value; }
}

public TagValue()
{
}

public TagValue(string p_tag, string p_value)
{
tag = p_tag;
value = p_value;
}

public override bool Equals(Object other)
{

if (this == other)
return true;

if (other == null)
return false;

TagValue l_theOther = (TagValue)other;

if (Util.StringCompare(Tag, l_theOther.Tag) != 0 ||
Util.StringCompare(Value, l_theOther.Value) != 0)
{
return false;
}

return true;
}

string TWSApi.ITagValue.tag
{
get
{
return this.tag;
}
set
{
this.tag = value;
}
}

string TWSApi.ITagValue.value
{
get
{
return this.value;
}
set
{
this.value = value;
}
}
}

You're welcome;
 
Yup, right with you. I modified the source to compile with g++, and am doing the same type of stuff. Big screens of code in front of me right now, on my home-built Centos 7 Linux rig. Intel I7 Dual core @ 4GHz.

In my opinion, beware the following:

1. IB do not provide tick data. For U.S. Equities, you get one price update (not a tick!) per 250ms. Assuming that the exchanges step at 1ms, TTBOMK, this is some kind of volume-weighted average of these 250 data points.
2. Often these data are delivered in bursts; i.e., you may wait 5 seconds, and receive a burst of 20 price movements.

Sincerely,
Keith
 
IBApi ::

[ComVisible(true)]
public class TagValue : TWSApi.ITagValue
{
private string tag;
private string value;

public string Tag
{
get { return tag; }
set { tag = value; }
}
<snip>

I don't think this is standard C++, it must be rather something non-standard Microsoft stuff I guess... Thx, but I can't use that thing as the topic is about C++...
 
Last edited:
I don't think this is standard C++, it must be rather something non-standard Microsoft stuff I guess... I can't use that thing...
Seriously
Just turn it into a type n you'll be right
Imho
This is the least of your worries re profitability
C++ is overkill
Do this in excel
Faster to build
Then test your efficacy.
 
Yup, right with you. I modified the source to compile with g++, and am doing the same type of stuff. Big screens of code in front of me right now, on my home-built Centos 7 Linux rig. Intel I7 Dual core @ 4GHz.

In my opinion, beware the following:

1. IB do not provide tick data. For U.S. Equities, you get one price update (not a tick!) per 250ms. Assuming that the exchanges step at 1ms, TTBOMK, this is some kind of volume-weighted average of these 250 data points.
2. Often these data are delivered in bursts; i.e., you may wait 5 seconds, and receive a burst of 20 price movements.

Sincerely,
Keith
Thanks, I know about the consolidated data feed of IB. But this is ok for me.

Btw, I guess you mean the sample application (TestCppClient). I had to modify some sources,
move some sources to other directories, and also modified the makefile to exclude the SSL stuff
as it didn't compile verbatim. Now I switched to the non-SSL code and it compiled successfully.
If anybody interessted I can try to recollect the changes I had made (was some days ago...).
But as said: this is the Beta 9.72 API version for Linux/Unix/MacOSX or so.

And: I had also sent the compiler warnings to IB's API team, but have not heard anything since then yet...
 
Last edited:
Seriously
Just turn it into a type n you'll be right
Imho
This is the least of your worries re profitability
C++ is overkill
Do this in excel
Faster to build
Then test your efficacy.
As was clearly stated in the initial posting and also in the thread title, the project is in C++, and under Linux.
Since the used compiler g++ is also available in the Cygwin POSIX environment under Windows, then it should compile there as well.
 
Last edited:
Ok, here is the solution to the TagValueList problem in v9.72:

http://holowczak.com/ib-tws-api-tagvaluelist/
"... Starting with the the IB TWS API version 9.71, several of the API calls require a new parameter with a class (or data structure) of TagValueList. The documentation for this new class is not very clear on how to construct the TagValueList. This class is also used to construct a variable length set of parameters for multi-leg combo orders and parameters for IB’s Algo orders..."

I guess 9.71 is a typo and he rather means 9.72.
The solution is given in the rest of the text at the above link for all the languages the API supports.
 
Last edited:
Back
Top