ANVIL API (Assent) Developer Thread

Discussion in 'Trading Software' started by ctarmor-et, Dec 10, 2007.

  1. Does Anvil have a .Net compatible API/Object (AKA COM/COM+ object) that one could use?

    Also where can I find the API documentation?

    Thanks
     
    #11     Dec 17, 2007
  2. No, it does not.

    But you can create you ANVIL extension with managed / unmanaged C++.NET. Then you can use DotNET remoting to access your objects within ANVIL form external DotNET applications.

    I hope that helps ...
     
    #12     Dec 17, 2007
  3. tfjield

    tfjield

    As for documentation, there is none. The only thing to help you are the examples provided with the API. There are a few comments in the examples, but not many. Assent has stated that they are working on a documentation package, but I have no idea when it will come out.

    Hopefully that's where this forum thread will come in handy!
     
    #13     Dec 17, 2007
  4. Thanks ...

    Has anyone already done that and wont mind sharing the code?
     
    #14     Dec 17, 2007
  5. >> Has anyone already done
    Yes, it does work

    >> wont mind sharing the code?
    Sorry, it is propietary code
     
    #15     Dec 18, 2007
  6. I have been hitting my head against the wall since this morning trying to get something going here ...

    A few questions:

    - Can I call all B_* API's from a console App. IE. Lets say that Anvil is running but I have my application called MyAnvilExecutor.exe that I want to use to call B_* API's. Is that possible? Everytime I call B_SendOrder, the console App just crash's.

    - Can some explain a little bit more on the Message pump model? Are you hooking to the windows message pump for Anvil?

    Also here is my code that I am trying to use ... (All the includes for BusinessApi.h and linking is factored in ...)

    int _tmain(int argc, _TCHAR* argv[])
    {
    Observable* acc = B_GetCurrentAccount();
    Money price;
    price.SetZero();

    B_SendOrder(B_GetStockHandle("SPY"), 'B', "ISLD", 100, 1, 1, price, 0, 0, 555, false, true, SUMO_ALG_UNKNOWN,//char superMontageAlgorithm,
    OS_RESIZE, 0);

    printf("Order sent ... \n");

    return 0;
    }

    What could I be doing wrong here considering this should work ...

    Thanks
     
    #16     Dec 24, 2007
  7. See inline ctarmor comments..

     
    #17     Dec 25, 2007
  8. So what I am guessing is then everyone who has gotten anything to work in Anvil has been through the extensions and nothing natively then?

    If thats the case, then the Anvil API isnt everything that it is made to sound like. Its deep yes, but not easily accessible.

    Finally, are you hooking into the windows message pump through a different app or through a custom extension DLL that you developed.

    thanks
     
    #18     Dec 25, 2007
  9. tfjield

    tfjield

    I think you're right... It does appear that you should be able to open a connection to the server directly via the API (I forget the call right now, but in the arguments you can specify an IP, port, account name, password, etc.) but Assent has told me that I must use it as an extension DLL, as they then have more control and can guarantee compliance better (their words.) Perhaps your situation is different, though, and they wouldn't mind a stand-alone app.

    At one point as part of my debugging, I tried to link my DLL to an "empty" application since you can run Anvil only during market hours. Unfortunately, I couldn't even load my DLL when I had the API linked in, and I didn't investigate further to figure out why.

    I'm using C++/MFC, not .NET, but what I do since I want to be able to process data in my own app as opposed to an extension DLL is I used named pipes to send message between the DLL and my app. You could use sockets, shared memory, windows messages, i.e. any standard interprocess communication mechanism, to accomplish the same thing. Named pipes were the simplest, most convenient for me.

    I would much rather have been able to just add the API to my own app.

    BTW, if you do use it as an extension DLL, you can run Anvil as a system service and automatically load the DLL on startup. This, at least, made it an acceptable solution for me. I don't have to worry about whether or not Anvil is up when I'm running my app. If the market is open, it's up in the background.
     
    #19     Dec 25, 2007
  10. I was exactly thinking along the same lines ...

    I did try B_CreateAccount() but it somehow crashs if you dont run it in a MFC env. (Was looking at the Business.dll ASM code ...)

    Looks like IPC is the only way to go ...

    Any specific reason why you choose named pipes over LPC? I am planning to go with LPC as I can then just create a wrapper along the most commonly used calls. (B_SendOrder and B_SendSmartOrder). But I am worried that if I start sending every quote over LPC, the performance would suck.

    Ofcourse named pipes are easy to implement for quote transactions as its a stream could require extra parsing for OrderEntry.
     
    #20     Dec 25, 2007