ANVIL API (Assent) Developer Thread

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

  1. tfjield

    tfjield

    Most of what I know has come from trial and error trying to develop with the API. ctarmor-et has been very helpful, as well. Some of the info came from Marc Hodakowski at Assent -- he's their Managing Director (of Software, I believe). He seems to be a decent guy, but it's really hit or miss getting support.
     
    #81     Apr 8, 2008
  2. I think they been saying "working on dev api documentation" since I been developing in Anvil. I have not seen one yet....

    As per tfjield, it is mostly trial and error. If you have a question or issue, you can post it here. At them same time also contact development support at Anvil. Lets see who responds quicker :)

    Yes, you'll need SP1 since it has some fixes to the CRT runtime for multi-threaing ...
     
    #82     Apr 8, 2008
  3. Does an account need to be approved for 'blackbox' trading in order to use the API?

    Eventually, I'd like to take a list of tickers and corresponding +- shares in excel and execute orders without having to type the info into Anvil. This might require an API hook but the set of orders would be triggered by me. I'm currently just poking around in simulation mode testing out the platform.
     
    #83     Apr 23, 2008
  4. tfjield

    tfjield

    I don't believe so, but don't quote me on that.
     
    #84     Apr 23, 2008
  5. I do not htink so. But you have to disclose you will be using the API in live mode. The may consider you account a "black box" whihc meas kaching$$$ from you ....
     
    #85     Apr 23, 2008
  6. Hexar

    Hexar

    Hi guys, I have a question about the Anvil API. Basically, I'm writing a program which keeps track of orders sent and which can automatically cancel them if certain conditions arise. So I'm using the B_SendOrder method in the API, kinda like this:

    unsigned int SendOrder(...)
    {
    ...
    Order* orderSent;
    B_SendOrder(stockHandle, side, destination, size, visibilityMode, visibleSize, price,
    &stopPrice, &descretionaryPrice, seconds, proactive, principalOrAgency,
    superMontageAlgorithm, oversellHandling, destinationExchange, &orderSent);

    return orderSent->GetId();
    }

    void CancelOrder(unsigned int orderID)
    {
    Observable* account = B_GetCurrentAccount();

    // Question: Why does this return null?
    //Order* order = B_FindOrder(orderID, account);

    // Do this instead
    Order* order = B_FindOrder(orderID, NULL);

    if (order != NULL)
    {
    order->Cancel();
    }
    }

    In simulation mode, the numbers I am getting back from SendOrder are quite a bit larger than are entered in Anvil itself; in fact I have to set some code to subtract from 2147483648 in simulation mode to get a valid order ID for cancelling. This works okay but is hokey.

    The real problem is, when in real mode, the numbers I am getting back from SendOrder have no clearly defined relationship with the order numbers entered into Anvil. I would do similarly to what I said above (subtracting from a large number) but there's no way to know exactly what the mapping or difference is, because it changes (presumably because other people are making orders in the system).

    To further explain, basically I want to write code like this:

    void mymethod()
    {
    unsigned int orderID = SendOrder("SBUX", 100, true, 15.00, 86400);
    CancelOrder(orderID);
    }

    But this doesn't work because my orderID ends up being wrong.

    Also, in CancelOrder above, why does B_FindOrder return null when I use the current account as an argument?

    Thanks a lot,
    Hexar
     
    #86     Apr 30, 2008
  7. More likely becasue an order may hop around exchanges and Anvil can assign multiple ids before it is executed in full.

    I have done this. I'll dig out my code and post it for you later ..
     
    #87     Apr 30, 2008
  8. A couple of ways of doing this. I did not use the OrderID. It changes too many times.

    You really want to keep the pOrderSent pointer on your code. Cancel it when you need to, pOrderSent->Cancel().

    You can also use the "Overfill" option in anvil. Basically if you have an order for a symbol, and the you place a diff order for the same, it will autimatically cancel the other orthers for you.


    This is not as efficient but you can do this too:

    static void* iterator;
    static Order * pOrder;

    iterator = B_CreateOrderIterator(OS_PENDINGLONG|OS_PENDINGSHORT, gAccount->m_AccountObservable);
    B_StartIteration(iterator);

    while(pOrder = B_GetNextOrder(iterator))
    if ( m_Symbol == pOrder->GetSymbol() )
    pOrder->Cancel();

    B_DestroyIterator(iterator);
     
    #88     May 2, 2008
  9. danjos

    danjos

    I have been using Anvil API for almost several years now and since my system is raeching stable and mature state, I would not need my programmer on full time basis anymore. If anybody is interested in hiring an Anvil API programmer you can PM me.

    Thanks:p
     
    #89     May 2, 2008
  10. I'm glad I found this thread.

    I have a very simple question.

    I open up one of the example AnvilTrader. I compile and a window pops up and that says...


    Executable For Debug Session
    - please specify the name of the executable file to be used for the debug session.

    Executable file name:

    URL where the project can be accessed (ATL server only)

    - not sure what to do here

    any help would be greatly appreciated

    Thank you
     
    #90     May 9, 2008