TWS C api order problem...

Discussion in 'Automated Trading' started by frostengine, Dec 7, 2005.

  1. I am using hte tws c api, but am having problems sending a simple order...

    This is what I am trying:

    Setting contract with

    memset(&c, 0, sizeof c);
    c.c_symbol = "YM";
    c.c_sectype = "FUT";
    c.c_expiry = "200512";
    c.c_right = "";
    c.c_multiplier = "";
    c.c_exchange = "ECBOT";
    c.c_primary_exch = "";
    c.c_currency = "USD";
    c.c_local_symbol = "";

    setting order like this
    memset(&order1, 0, sizeof order1);

    tws_place_order(ti, 5000, &c, &order1);

    When i enter this my program just locks up...... any idea what I am doing wrong? Thanks
  2. fatrat


    Not familar with the TWS C API, but how is the structure defined for 'c'? If those are character arrays in the structure, then assigning static strings is not going to help you. If they're pointers, it'll probably work; though, they will be pointing to a static pre-initialized data region in the process space.

  3. slacker


    With this last release I upgraded my C++ software to the latest TWS api and did not make any changes to my working code. I also had a problem with the placeOrder command.

    It looks like a lot of changes were made in the TWS PlaceOrder area. Values that do not apply to my order are now being checked and validated.

    I went to the new C++ example code that is part of this release and took all of the initialization values for Contract and Order and copied them to my code. Make sure everything in your code is the same as the SocketClient C++ demo. Everything works fine now.

    No other code changes were necessary in this release other than with this PlaceOrder change.

    Good luck,