IB API C++ programming

Discussion in 'App Development' started by marsman, Jul 14, 2016.

  1. marsman

    marsman

    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: Jul 14, 2016
    #11     Jul 14, 2016
  2. conduit

    conduit

    yes they significantly re-wrote the API in 9.72 but I think it was beta when I took a look a few months back, not sure it still is.
     
    #12     Jul 14, 2016
  3. 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;
     
    #13     Jul 14, 2016
  4. kmiklas

    kmiklas

    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
     
    #14     Jul 14, 2016
  5. marsman

    marsman

    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: Jul 14, 2016
    #15     Jul 14, 2016
  6. 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.
     
    #16     Jul 14, 2016
  7. marsman

    marsman

    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: Jul 14, 2016
    #17     Jul 14, 2016
  8. marsman

    marsman

    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: Jul 14, 2016
    #18     Jul 14, 2016
  9. marsman

    marsman

    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: Jul 14, 2016
    #19     Jul 14, 2016
  10. marsman

    marsman

    A new update of the Beta 9.72 (9.72.16) has been released just today:
    http://interactivebrokers.github.io/
    "Version: API beta 9.72
    Release Date: Jul 14 2016"

    I had tested the 9.72.14 version. Haven't checked this recent version yet, will do so later tomorow or over the weekend.
     
    #20     Jul 14, 2016