IB API: contractDetailsEx

Discussion in 'Automated Trading' started by fullautotrading, Aug 10, 2010.

  1. I was substituting the call




    as suggested by the API guide.

    However, there is, possibly, something not working, or working unexpectedly (to me):

    the new function reqContractDetailsEx does NOT raise the event Tws.contractDetailsEx ; instead the old function reqContractDetails() raises all the events (in this order):


    (including Tws.contractDetailsEx).

    This is strange. I would have expected that reqContractDetailsEx() would rise the event Tws.contractDetailsEx, but it does not.

    Is this a bug, or I am missing something here ?

    Could anyone shed some light (or the people at IB correct this behaviour, if it's a bug) ?

    Thanks in advance.


    Further, on the page:
    clicking on reqContractDetailsEx() link one is redirected to a wrong (?) page:
    (the deprecated function)

  2. Which version of the API are you using?

    Just to make a sanity check here, you made sure to add the event handler for ContractDetailsEx() when you replaced the call, correct (and deleted the ContractDetails handler)?
    I haven't used the deprecated version for awhile, so I'm rusty on how it works under the hood.

    I'm using reqContractDetailsEx() in my code and I respond to the contractDetailsEx and End events and it works fine.

    I'll double check my code tonight, but I'm pretty sure I'm not doing anything off the wall to make it work.
  3. Thank you very much TheGoonior,

    I am using version API 9.63 (the latest non-beta).
    Which one are you using ?

    It does not work for me. If i place the two calls:


    one near the other one, and comment out them one at a time,
    when using:


    all the 3 events:

    Tws.contractDetailsEx ( yes, including Tws.contractDetailsEx !)

    are fired.

    (Sure, I have the event handler in place, as i do receive the event Tws.contractDetailsEx when testing reqContractDetails() )

    But, when running reqContractDetailsEx()

    nothing happens. No events are fired. No error appears (i am monitoring all error messages and possible exceptions). Nothing.

  4. I believe I'm running version 9.63 of the API.
    I looked at my code and didn't see anything that I could pin down. I only place the call to reqContractDetailsEx and handle that and the End events.

    I'm using the TWS control in my own WPF control, so it's in a WindowsFormHost, but I don't think that should make a difference.

    Have you tried making a simple form with the control just to see if the response is the same?
    Also, maybe try and change the amount of logged data that TWS records might give you something to help? Typically it's set to 3, but you can set it to 5 to generate a lot more stuff (check the API docs for what you need to do).

    Are you using c# or VB.Net?
  5. Thank you TheGoonior, no luck so far.

    I have one question for you: when you call the method:
    void reqContractDetailsEx(IContract*contract)

    how many arguments are you passing, 1 or 2 ? Do you pass the <b>reqId</b> too ?

  6. Yes, that is required. Pretty much all the API functions that are requesting or submitting data require a request ID.

    Also, I'm not sure which documentation you are referring to, but the function prototype shown is not correct. The link you provide is different than the one I use.


    This is the one you get if you follow the links on the IB website (Trading->API Solutions. Select IB API and then the link is at the bottom of the page). I've had to prompt them to update links and things in the past, but it seems fairly consistent now.

    Finally, sometimes, when all else fails, you can sometimes get some information by sending an email to api@interactivebrokers.com

    Typically a guy named Raymond replies and I normally get a response in a couple of days. You need to be fairly precise in your questions since they seem to reply in short answers, but normally you can get some helpful info from them.
  7. Thank you very much TheGoonior.

    Yes, it seems that at a certain time they have realized that a <b>request id</b> was indeed necessary to the programmer for "linking" the information to the contract and, perhaps, they changed the signature (?).

    If I solve the "mystery" I will let you know.


    Using VB.NET, btw
  8. dangqiwu


    I have the same problem.
    I use socket c++ API. When I call

    m_pClient->reqContractDetails(100, contract);

    only contractDetailsEnd() is fired. The contractDetails() just gives no response.
  9. dangqiwu


    Fortunately I solved this problem.

    I'm using the EWrapper from the old version.

    The old definition is
    void contractDetails(const ContractDetails &contractDetails);

    while the new one is
    void contractDetails(int reqId, const ContractDetails &contractDetails);

    My codes were written in the old one. Just move them to the new function and everything works.