ANVIL API (Assent) Developer Thread

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

  1. tfjield

    tfjield

    Glad I could help, even in a small way.

    I've been meaning to do the same thing and post an example, I just haven't gotten around to it, yet. I'm sure it would be very helpful if you were to do that!
     
    #161     Jul 9, 2008
  2. Whoever need anvil subcontractor that already had "fun" with Anvil API internals during long sleepless nights please write directly to alex.kroifer at gmail dot com
     
    #162     Jul 10, 2008
  3. zjc123

    zjc123

    Does anyone know how to keep track of an order status? I'm submitting orders using the B_SendOrder method and I keep a pointer to the order. The problem I'm having is when Anvil rejects the order. I was hoping that the messages:

    M_POOL_UPDATE_ORDER
    M_POOL_ASSIGN_ORDER_ID
    M_POOL_EXECUTION

    would notify me if the order was rejected but I'm not getting any of these messages when this situation happens.

    I've also tried monitoring the different methods within the order like:

    IsActive
    IsDead
    IsCancelConfirmed

    and these also don't appear to be updated as I would expect. When I run in debug mode and see that the order was rejected the return of the IsActive method still returns true.
     
    #163     Jul 24, 2008
  4. If you are sending smart order try monitoring this message:

    M_SMARTORDER_REMOVE
     
    #164     Jul 24, 2008
  5. zjc123

    zjc123

    I'm using the B_SendOrder command, do you know if Anvil internally considers this a smart order?
     
    #165     Jul 24, 2008
  6. You will not get msgs on a failed SendOrder()

    You need to check it as follow:

    check this parameter on return from call:
    .., Order** orderSent = NULL, ...

    Something like this:

    // Error ?
    if ( NULL == pCAnvilOrder->m_pOrder )
    {
    const char* pError = B_GetOrderErrorMessage(error);

    STATICLOG4( "SoftErr: PlaceStockOrder: (%u) %s - Dest: %s - %s", error, (pError ? pError : ""), pCAnvilOrder->m_Venue.c_str(), pCAnvilOrder->Verbose() );
    }
     
    #166     Jul 24, 2008
  7. B_SendOrder will give you a regular order. (i.e. limit, market, or stop also)

    The question is, weather Anvil is rejecting your order, or it is getting rejected further on in its travels.

    Here is my experience:

    - If Anvil rejects your order, you won't see it in your Anvil orders window. However, you will see an error message in the "position manager" window, and you also get a return code from B_SendOrder which is != SO_OK (sometimes it is SO_OK, but your order pointer will be NULL - that's an error too). You will also see the SO_.* error message in your log file just after the Level1 <Symbol> line and the print out of the current state of the box.

    - If the order is rejected further down the chain, you do get a M_POOL_UPDATE_ORDER message for the reject. (you will also get a M_REQ_NEW_ORDER message before B_SendOrder returns. This will tell you the order has been created in Anvil) At this point isDead() should be true (provided all your shares have been rejected, I have seen the case where only some shares are rejected out of the total order size, and then your order is still [a]live.

    I try not to hold onto the Order pointer returned, because I'm not sure that there is a guarantee/contract that this will be a valid pointer for the lifetime of the order (someone else may have experience with this though). If I need to find the order, I'll ask Anvil to re-find it via the B_ method. Most of the time I don't need it anyway, because the POOL_UPDATE_ORDER (and the other UPDATE messages) will give me a pointer to the order in question anyway.
     
    #167     Jul 24, 2008
  8. jeffweng

    jeffweng

    Has anyone tried to use Order::CancelReplace?
    it didn't work as I expect.
    Could anybody who had successfully used it share some code?

    Thank you in advance!
     
    #168     Jul 31, 2008
  9. I tried to use a while back but could not get it to work. I was expecting it to cancel/replace the order, but the messages did not come thru.

    I found it easier to keep the order pointer and cancel it, then add new one ..

    Sorry I could not be of more help ...
     
    #169     Jul 31, 2008
  10. jeffweng

    jeffweng

    Thanks ctarmor-et!
    It does help.
     
    #170     Jul 31, 2008