ANVIL API (Assent) Developer Thread

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

  1. tfjield

    tfjield

    I'm sorry, I misread your question... I thought you were receiving this messages from the Admin observable, not the Account observable. I'm actually not observing the Account observable, so I didn't receive either message today.

    If I get a chance, I'll add a listener to the Account observable and see what I get.
     
    #51     Jan 24, 2008
  2. tfjield

    tfjield

    Hey, anyone know how to suppress the popup message that comes up when Anvil is started?

    If it's in simulation mode, it asks you whether you want to be in simulation mode, and if it's a live account, it asks you if you're an authorized user.

    Both of these are interfering with me starting Anvil automatically...

    Thanks!
     
    #52     Jan 27, 2008
  3. I do not the answer to it but I suspect you can either:

    - Enter a value in the Anvil.ini. like Passsowrd=....
    - A User/Pass paramater to Anvil.exe command.
     
    #53     Jan 27, 2008
  4. tfjield

    tfjield

    Yeah, I've done that, my account name and password are stored in the .ini file. Anvil does log me in automatically... The problem is the popup that occurs after the login screen. Even with account info in the .ini file, Anvil still stops and waits for an acknowledgement.
     
    #54     Jan 27, 2008
  5. tfjield

    tfjield

    Just talked to Assent... There is no way to get rid of the popup verifying the account's legitimacy. That's a compliance issue. There's probably no way to suppress the "simulation" popup, either, but they're checking.

    Looks like I need to use the system service... And they're checking on that to see what I need to do to make it work.

    I've actually installed it as a service, and it starts, but it doesn't load my extension DLL's... I'm using the same .ini file that does work when launching Anvil directly.

    I'll post the solution here when we figure it out!
     
    #55     Jan 28, 2008
  6. tfjield

    tfjield

    OK, I've been watching for these messages for a couple days, now. Today I received them when the Market Receiver went down right at the close.

    It seems to follow the pattern that you mentioned. Since these are coming from the Account Observable it might not affect your receipt of data but I would be concerned that it may affect your order entry.

    Here are the results of my log. If the log says Unwatched Message Received, it just means that I don't care about that message. Note that I am watching the Admin Observable with the same listener.

    Hope this helps!

    15:53:56(2129411397679686),thr 0x00000A64 : M_SYNC_TIME message received. Time difference: 394248932
    15:53:59(2129417609029392),thr 0x00000A64 : Unwatched Message Received: 41021
    15:53:59(2129417984661522),thr 0x00000A64 : Unwatched Message Received: 30011
    15:54:59(2129537305589316),thr 0x00000A64 : Unwatched Message Received: 41021
    15:55:41(2129622029242368),thr 0x00000A64 : MSGID_CONNECTION_LOST: Market Receiver
    15:55:41(2129622029430522),thr 0x00000A64 : Unwatched Message Received: 41044
    15:55:46(2129632003455174),thr 0x00000A64 : MSGID_CONNECTION_STARTED Message Received.
    15:55:59(2129657002227102),thr 0x00000A64 : Unwatched Message Received: 41021
    15:56:08(2129673959352924),thr 0x00000A64 : MSGID_CONNECTION_FAILED Message Received.
    15:56:12(2129681939039442),thr 0x00000A64 : MSGID_CONNECTION_STARTED Message Received.
    15:56:32(2129723708281608),thr 0x00000A64 : MSGID_CONNECTION_FAILED Message Received.
    15:56:37(2129731812630738),thr 0x00000A64 : MSGID_CONNECTION_STARTED Message Received.
    15:56:58(2129773893583218),thr 0x00000A64 : MSGID_CONNECTION_FAILED Message Received.
    15:56:59(2129776698890196),thr 0x00000A64 : Unwatched Message Received: 41021
    15:57:02(2129781686257794),thr 0x00000A64 : MSGID_CONNECTION_STARTED Message Received.
    15:57:22(2129823424312824),thr 0x00000A64 : MSGID_CONNECTION_FAILED Message Received.
    15:57:27(2129831559828948),thr 0x00000A64 : MSGID_CONNECTION_STARTED Message Received.
    15:57:47(2129873391394866),thr 0x00000A64 : MSGID_CONNECTION_FAILED Message Received.
    15:57:52(2129881433426544),thr 0x00000A64 : MSGID_CONNECTION_STARTED Message Received.
    15:57:59(2129896395495972),thr 0x00000A64 : Unwatched Message Received: 41021
    15:58:13(2129923358509992),thr 0x00000A64 : MSGID_CONNECTION_FAILED Message Received.
    15:58:17(2129931307030440),thr 0x00000A64 : MSGID_CONNECTION_STARTED Message Received.
    15:58:37(2129973107486370),thr 0x00000A64 : MSGID_CONNECTION_FAILED Message Received.
    15:58:42(2129981180679750),thr 0x00000A64 : MSGID_CONNECTION_STARTED Message Received.
    15:58:59(2130016092169788),thr 0x00000A64 : Unwatched Message Received: 41021
    15:59:03(2130023292745158),thr 0x00000A64 : MSGID_CONNECTION_FAILED Message Received.
    15:59:07(2130031054214880),thr 0x00000A64 : MSGID_CONNECTION_STARTED Message Received.
    15:59:27(2130072823455456),thr 0x00000A64 : MSGID_CONNECTION_FAILED Message Received.
    15:59:32(2130080927845422),thr 0x00000A64 : MSGID_CONNECTION_STARTED Message Received.
    15:59:53(2130123008722884),thr 0x00000A64 : MSGID_CONNECTION_FAILED Message Received.
    15:59:57(2130130801362048),thr 0x00000A64 : MSGID_CONNECTION_STARTED Message Received.
    15:59:59(2130135788692230),thr 0x00000A64 : Unwatched Message Received: 41021
    16:00:17(2130172539408540),thr 0x00000A64 : MSGID_CONNECTION_FAILED Message Received.
    16:00:22(2130180674932182),thr 0x00000A64 : MSGID_CONNECTION_STARTED Message Received.
    16:00:42(2130222506477028),thr 0x00000A64 : MSGID_CONNECTION_FAILED Message Received.
    16:00:47(2130230548479504),thr 0x00000A64 : MSGID_CONNECTION_STARTED Message Received.
    16:00:59(2130255485243688),thr 0x00000A64 : Unwatched Message Received: 41021
    16:01:08(2130272473521570),thr 0x00000A64 : MSGID_CONNECTION_FAILED Message Received.
    16:01:12(2130280422045768),thr 0x00000A64 : MSGID_CONNECTION_STARTED Message Received.
    16:01:32(2130322222420968),thr 0x00000A64 : MSGID_CONNECTION_FAILED Message Received.
    16:01:37(2130330295606260),thr 0x00000A64 : MSGID_CONNECTION_STARTED Message Received.
    16:01:58(2130372407667312),thr 0x00000A64 : MSGID_CONNECTION_FAILED Message Received.
    16:01:59(2130375181756524),thr 0x00000A64 : Unwatched Message Received: 41021
    16:02:02(2130380169124404),thr 0x00000A64 : MSGID_CONNECTION_STARTED Message Received.
    16:02:10(2130397937824272),thr 0x00000A64 : MSGID_CONNECTION_MADE: Market Receiver
    16:02:10(2130397984128072),thr 0x00000A64 : Unwatched Message Received: 41081
    16:02:10(2130397984178838),thr 0x00000A64 : Unwatched Message Received: 41080
    16:02:10(2130397984273518),thr 0x00000A64 : Unwatched Message Received: 41079
    16:02:10(2130397984681272),thr 0x00000A64 : Unwatched Message Received: 10017
    16:02:10(2130397994105742),thr 0x00000A64 : Unwatched Message Received: 41085
    16:02:10(2130397994300352),thr 0x00000A64 : Unwatched Message Received: 10017
    16:02:10(2130397994666028),thr 0x00000A64 : M_SYNC_TIME message received. Time difference: 394240182
     
    #56     Jan 29, 2008
  7. Thank you .. it definetly helps...

    Althought, I do get them through the day ..... I am wondering if I am using the right IP addresses from our server.

    In my case it seems to be affecting market data as well as orders.

    thanks for your post ...
     
    #57     Jan 30, 2008
  8. riskaverse305

    riskaverse305 Guest

    could someone explain how the observer and observable classes work? i understand (albeit basically) that they are used to signal when an object has changed/updated but how do you associate that with something specific like a stock price or bid for example?

    thanks
     
    #58     Feb 28, 2008
  9. tfjield

    tfjield

    Hey,

    The Observable and Observer classes are part of a design pattern called Subject/Observer (or Observable/Observer, or Subject/Listener, or the like.) Many things in the API are observable, meaning that you can attach an Observer class to them and when the Observables change a notification will be sent to all of the Observers that are listening to that Observable. (It can be a one-to-many relationship.)

    So basically how it works is you derive a class from Observer, like:

    class CStock : public Observer
    {
    CStock(LPCTSTR lpszSymbol);
    virtual ~CStock();
    virtual void Process(const Message* pMessage, Observable* pFrom, const Message* pAdditionalInfo);

    StockBase *m_pStockHandle;
    Observable *m_pPrints;
    }

    The Process() function is the function that will be called by the Observable when something changes. This is a required override for all classes derived from Observer.

    In the constructor, you need to do several things, like get the stock handle:

    m_pStockHandle=B_GetStockHandle(lpszSymbol));

    ...get a pointer to the Observable that handles prints:

    m_pPrints=B_GetPrints(m_pStockHandle);

    ...and most importantly, you need to "subscribe" to the prints Observable so that it will send you messages:

    m_pPrints->Add(this);

    Now when m_pPrints changes, our Process() function will be called by it.

    This is very similar to using a callback function, but it gives you much more flexibility (since you don't need static callbacks).

    In the process function, you will have to check to see what kind of update you're getting, and where it's coming from, because it's possible to subscribe to many Observables in the same Observer.

    There are several different messages that are sent for processing prints. You might do something like this:

    switch(pMessage->GetType())
    {
    case M_TAL_LAST_TRADE:
    case M_LAST_TRADE_SHORT:
    {
    if(pFrom == m_pPrints)
    ProcessPrints();

    break;
    }
    }

    There are several other message types that you would have to process to receive all the prints. The same logic follows for processing bids/asks, etc. You would need to subscribe to the appropriate Observable and process the appropriate messages.

    Hopefully this will point you in the right direction. The examples implement most of the things that you will want to do... Unfortunately, they're not commented very well.

    Good luck!
     
    #59     Feb 28, 2008
  10. riskaverse305

    riskaverse305 Guest

    thanks for the reply, def helped resolve my mental block re: observers/observables

    but of course, one problem solved reveals 20 more, so here goes:

    first off, i'm using VC++ 8 to compile. in my stock class .cpp file i've included "Messages.h" mirroring the stock.cpp in the AnvilTrader example. When i go to compile the extension (which just consists of the api files, a dll entry .cpp, and a header and .cpp file for the stock class derived from observer) i get a ton of errors... one for every message in MessageIds.h:

    \desktop\anvil api defaults\32-bit\anviltraderexample_2_6_7_4\MessageIds.h(6) : error C2236: unexpected 'enum' 'MessageIds'. Did you forget a ';'?
    1>\desktop\anvil api defaults\32-bit\anviltraderexample_2_6_7_4\MessageIds.h(7) : error C2447: '{' : missing function header (old-style formal list?)
    1>\desktop\anvil api defaults\32-bit\anviltraderexample_2_6_7_4\Messages.h(109) : error C2065: 'M_REQ_RESEND_PACKET' : undeclared identifier
    1>\desktop\anvil api defaults\32-bit\anviltraderexample_2_6_7_4\Messages.h(118) : error C2065: 'M_RESP_RESEND_PACKET' : undeclared identifier

    and so on for every message id

    i'm obviously doing something silly. the a/c is broken in my office and my brain is functioning accordingly

    AnvilTrader still compiles and runs, so its not anything i did to MessageIds.h

    thanks again for the help
     
    #60     Mar 6, 2008