public void onBookAtomicLevelEntryDelta(
     MamdaSubscription subscription,
     MamdaBookAtomicListener listener,
     MamaMsg msg,
     MamdaBookAtomicLevelEntry levelEntry)
 {
     if (myQuietModeLevel < 2)
     {
         prettyPrint(subscription, levelEntry);
     }
 }
            public void onBookAtomicBeginBook(
                MamdaSubscription subscription,
                MamdaBookAtomicListener listener,
                bool isRecap)

            {
                if (myQuietModeLevel < 2)
                {
                    Console.WriteLine("BEGIN BOOK - " + subscription.getSymbol());
                }
            }
 public void onBookAtomicClear(
     MamdaSubscription subscription,
     MamdaBookAtomicListener listener,
     MamaMsg msg)
 {
     if (myQuietModeLevel < 2)
     {
         Console.WriteLine("BOOK CLEAR - " + subscription.getSymbol());
         Console.WriteLine();
     }
 }
 public void onBookAtomicLevelRecap(
     MamdaSubscription subscription,
     MamdaBookAtomicListener listener,
     MamaMsg msg,
     MamdaBookAtomicLevel level)
 {
     if (myQuietModeLevel < 2)
     {
         prettyPrint(subscription, level);
     }
 }
 public void onBookAtomicGap(
     MamdaSubscription subscription,
     MamdaBookAtomicListener listener,
     MamaMsg msg,
     MamdaBookAtomicGap gapEvent)
 {
     if (myQuietModeLevel < 2)
     {
         Console.WriteLine("BOOK GAP - " + subscription.getSymbol());
         Console.WriteLine("Begin Gap: " + listener.getBeginGapSeqNum());
         Console.WriteLine("End Gap  : " + listener.getEndGapSeqNum());
         Console.WriteLine();
     }
 }
 public void onBookAtomicEndBook(
     MamdaSubscription subscription,
     MamdaBookAtomicListener listener)
 {
     if (myQuietModeLevel < 2)
     {
         if (listener.getPriceLevelNumLevels() == 0)
         {
             Console.WriteLine();
             Console.WriteLine("END BOOK - " + subscription.getSymbol());
             Console.WriteLine(" - empty book message !!!");
             Console.WriteLine();
             Console.WriteLine();
         }
         else
         {
             Console.WriteLine();
             Console.WriteLine("END BOOK - " + subscription.getSymbol());
             Console.WriteLine();
             Console.WriteLine();
         }
     }
 }
        static void Main(string[] args)
        {
            MamaTransport        transport    = null;
            MamaQueue            defaultQueue = null;
            MamaDictionary       dictionary   = null;
            CommandLineProcessor options      = new CommandLineProcessor(args);

            myQuietModeLevel = options.getQuietModeLevel();


            if (options.hasLogLevel())
            {
                myLogLevel = options.getLogLevel();
                Mama.enableLogging(myLogLevel);
            }

            try
            {
                //Initialize MAMA API
                myBridge = new MamaBridge(options.getMiddleware());
                Mama.open();
                transport = new MamaTransport();
                transport.create(options.getTransport(), myBridge);
                defaultQueue = Mama.getDefaultEventQueue(myBridge);
                myMamaSource = new MamaSource();
                //Get the Data dictionary.....
                MamaSource dictionarySource = new MamaSource();
                dictionarySource.symbolNamespace = "WOMBAT";
                dictionarySource.transport       = transport;
                dictionary = buildDataDictionary(transport, defaultQueue, dictionarySource);

                MamdaQuoteFields.setDictionary(dictionary, null);
                MamdaTradeFields.setDictionary(dictionary, null);
                MamdaCommonFields.setDictionary(dictionary, null);
                MamdaOrderBookFields.setDictionary(dictionary, null);

                myQueueGroup = new MamaQueueGroup(myBridge, options.getNumThreads());

                foreach (string symbol in options.getSymbolList())
                {
                    MamdaSubscription aSubscription = new MamdaSubscription();

                    MamdaBookAtomicListener aBookListener = new MamdaBookAtomicListener();
                    AtomicBookTicker        aTicker       = new AtomicBookTicker();

                    aBookListener.addBookHandler(aTicker);
                    aBookListener.addLevelHandler(aTicker);

                    if (options.getPrintEntries())
                    {   // Entries
                        aBookListener.addLevelEntryHandler(aTicker);
                    }

                    aSubscription.addMsgListener(aBookListener);
                    aSubscription.addStaleListener(aTicker);
                    aSubscription.addErrorListener(aTicker);
                    aSubscription.setType(mamaSubscriptionType.MAMA_SUBSC_TYPE_BOOK);

                    aSubscription.create(transport,
                                         myQueueGroup.getNextQueue(),
                                         options.getSource(),
                                         symbol,
                                         null);

                    mamdaSubscriptions.Add(aSubscription);
                }

                //Start dispatching on the default MAMA event queue
                Console.WriteLine("Hit Enter or Ctrl-C to exit.");
                Mama.start(myBridge);
                GC.KeepAlive(dictionary);
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                Environment.Exit(1);
            }
        }
 public void onBookAtomicLevelRecap(
     MamdaSubscription           subscription,
     MamdaBookAtomicListener     listener,
     MamaMsg                     msg,
     MamdaBookAtomicLevel        level)
 {
     if (myQuietModeLevel<2)
     {
         prettyPrint (subscription, level);
     }
 }
        static void Main(string[] args)
        {
            MamaTransport        transport = null;
            MamaQueue            defaultQueue = null;
            MamaDictionary       dictionary = null;
            CommandLineProcessor options = new CommandLineProcessor (args);
            myQuietModeLevel = options.getQuietModeLevel ();

            if (options.hasLogLevel ())
            {
                myLogLevel = options.getLogLevel ();
                Mama.enableLogging (myLogLevel);
            }

            try
            {
                //Initialize MAMA API
                myBridge = new MamaBridge (options.getMiddleware());
                Mama.open();
                transport = new MamaTransport();
                transport.create(options.getTransport(), myBridge);
                defaultQueue = Mama.getDefaultEventQueue(myBridge);
                myMamaSource = new MamaSource ();
                //Get the Data dictionary.....
                MamaSource dictionarySource = new MamaSource ();
                dictionarySource.symbolNamespace = "WOMBAT";
                dictionarySource.transport = transport;
                dictionary = buildDataDictionary(transport, defaultQueue, dictionarySource);

                MamdaQuoteFields.setDictionary (dictionary, null);
                MamdaTradeFields.setDictionary (dictionary, null);
                MamdaCommonFields.setDictionary (dictionary, null);
                MamdaOrderBookFields.setDictionary (dictionary, null);

                myQueueGroup = new MamaQueueGroup (myBridge, options.getNumThreads());

                foreach (string symbol in options.getSymbolList())
                {
                    MamdaSubscription  aSubscription = new MamdaSubscription ();

                    MamdaBookAtomicListener aBookListener = new MamdaBookAtomicListener();
                    AtomicBookTicker        aTicker       = new AtomicBookTicker ();

                    aBookListener.addBookHandler (aTicker);
                    aBookListener.addLevelHandler (aTicker);

                    if (options.getPrintEntries())
                    {   // Entries
                        aBookListener.addLevelEntryHandler (aTicker);
                    }

                    aSubscription.addMsgListener (aBookListener);
                    aSubscription.addStaleListener (aTicker);
                    aSubscription.addErrorListener (aTicker);
                    aSubscription.setType(mamaSubscriptionType.MAMA_SUBSC_TYPE_BOOK);

                    aSubscription.create (transport,
                                          myQueueGroup.getNextQueue(),
                                          options.getSource (),
                                          symbol,
                                          null);

                    mamdaSubscriptions.Add(aSubscription);
                }

                //Start dispatching on the default MAMA event queue
                Console.WriteLine("Hit Enter or Ctrl-C to exit.");
                Mama.start (myBridge);
                GC.KeepAlive(dictionary);
                Console.ReadLine();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                    Environment.Exit(1);
                }
        }
 public void onBookAtomicLevelEntryDelta(
     MamdaSubscription               subscription,
     MamdaBookAtomicListener         listener,
     MamaMsg                         msg,
     MamdaBookAtomicLevelEntry       levelEntry)
 {
     if (myQuietModeLevel<2)
     {
         prettyPrint (subscription, levelEntry);
     }
 }
 public void onBookAtomicGap(
     MamdaSubscription              subscription,
     MamdaBookAtomicListener        listener,
     MamaMsg                        msg,
     MamdaBookAtomicGap             gapEvent)
 {
     if (myQuietModeLevel<2)
     {
         Console.WriteLine ( "BOOK GAP - " + subscription.getSymbol () );
         Console.WriteLine ( "Begin Gap: " + listener.getBeginGapSeqNum () );
         Console.WriteLine ( "End Gap  : " + listener.getEndGapSeqNum () );
         Console.WriteLine ();
     }
 }
 public void onBookAtomicEndBook(
     MamdaSubscription           subscription,
     MamdaBookAtomicListener     listener)
 {
     if (myQuietModeLevel<2)
     {
         if (listener.getPriceLevelNumLevels () == 0)
         {
             Console.WriteLine ();
             Console.WriteLine ( "END BOOK - " + subscription.getSymbol () );
             Console.WriteLine ( " - empty book message !!!" );
             Console.WriteLine ();
             Console.WriteLine ();
         }
         else
         {
           Console.WriteLine ();
           Console.WriteLine ( "END BOOK - " + subscription.getSymbol () );
           Console.WriteLine ();
           Console.WriteLine ();
         }
     }
 }
 public void onBookAtomicClear(
     MamdaSubscription           subscription,
     MamdaBookAtomicListener     listener,
     MamaMsg                     msg)
 {
     if (myQuietModeLevel<2)
     {
          Console.WriteLine ("BOOK CLEAR - " + subscription.getSymbol () );
          Console.WriteLine ();
     }
 }
 public void onBookAtomicBeginBook(
     MamdaSubscription           subscription,
     MamdaBookAtomicListener     listener,
     bool                     isRecap)
 {
     if (myQuietModeLevel<2)
     {
          Console.WriteLine ("BEGIN BOOK - " + subscription.getSymbol ());
     }
 }