Visual Studio c++ API sample code

Discussion in 'Automated Trading' started by bellman, Dec 12, 2013.

  1. bellman

    bellman

    Which brokers have c++ API sample code that meets the following criteria?

    1. Sample receiving live tick data
    2. Sample retrieval bid ask (and hopefully level II as well)
    3. Sample buy/sell
    4. Sample GetCurrentPosition();
    5. Sample GetCurrentOrders();
    6. (optional - bonus points) MFC project file for VS 2013


    Please provide links or private message me with information. Thank you.
     
  2. matt44545

    matt44545

    I'm looking for similar information though I'd prefer a C# interface, if possible.
     
  3. boskop

    boskop

    why not make a DLL in your favourite programming language and connect it via whatever API the broker offers you? i did that in MT4 once. there is sample code too.
     
  4. bellman

    bellman

    That sounds like a TON more work than what I'm talking about. With a well written API, I just need to call a function here and there to get the data/ send the orders.

    What is your language of choice?

     
  5. boskop

    boskop

    hmmm i thought that was rather simple. just like you want i think. call the DLL's function from MT4 to send or receive data.

    the MT4 script would look something like this (pseudocode):

    buyorsell = myfunctionfromdll(some_intdata, somemore_intdata, currentask, currentbid, anythingelse);

    if (buyorsell == 0)
    order_send( ...
    else if (buyorsell == 1)
    order_send( ..
    else
    ...


    i speak C/C++ best, so i wrote my DLL in that language.
     
  6. Eyez

    Eyez


    Try XTRADER API or CQG API. Stop being blatantly lazy
     
  7. bellman

    bellman

    Well, that is easy. Is this just as easy to do from the DLL?

    bool myfunctionfromdll(some_intdata, somemore_intdata, currentask, currentbid, anythingelse) {
    bool bs;
    ...

    currentPos = myFunctionFromMT4();

    ...

    return bs;

    }


     
  8. bellman

    bellman

    I don't see lazy as a negative. I am not an overall lazy person (quite the opposite). I've been down the road of writing a lot of code not directly related to the trading algorithm; I've learned to be as lazy as possible--there are only so many productive hours in the day.

     
  9. boskop

    boskop

    that i don't know :) but there is a way if you want to know inside your DLL info about current orders etc. just send that information to the DLL by doing it this way:

    in MT4:

    myfunctionfromdll_senddataA(a);
    myfunctionfromdll_senddataB(b);
    ...
    myfunctionfromdll_processdata();
    buyorsell = myfunctionfromdll_getwhat2do();
     
  10. bellman

    bellman

    Well, that could work, and in the long run, that would not be much code to write.

    I've always been hesitant to trade futures (and the MT4 platform in particular is not a good fit for me), otherwise, I would ask you to collaborate.

     
    #10     Dec 12, 2013