示例#1
0
            public void onParticipantCreate(
				MamdaSubscription             subscription,
				MamdaMultiParticipantManager  manager,
				string                        participantId,
				NullableBool                   isPrimary)
            {
                MamdaTradeListener aTradeListener = new MamdaTradeListener();
                MamdaQuoteListener aQuoteListener = new MamdaQuoteListener();
                ComboTicker        aTicker        = new ComboTicker();

                aTradeListener.addHandler(aTicker);
                aQuoteListener.addHandler(aTicker);

                manager.addParticipantListener(aTradeListener, participantId);
                manager.addParticipantListener(aQuoteListener, participantId);
            }
示例#2
0
            public void onConsolidatedCreate(
				MamdaSubscription              subscription,
				MamdaMultiParticipantManager   manager)
            {
                MamdaTradeListener aTradeListener = new MamdaTradeListener();
                MamdaQuoteListener aQuoteListener = new MamdaQuoteListener();
                ComboTicker        aTicker        = new ComboTicker();

                aTradeListener.addHandler(aTicker);
                aQuoteListener.addHandler(aTicker);

                manager.addConsolidatedListener(aTradeListener);
                manager.addConsolidatedListener(aQuoteListener);
            }
示例#3
0
            public void onSecurityCreate(
				MamdaSubscription           subscription,
				MamdaMultiSecurityManager   manager,
				string                      symbol)
            {
                MamdaTradeListener aTradeListener = new MamdaTradeListener();
                MamdaQuoteListener aQuoteListener = new MamdaQuoteListener();
                ComboTicker        aTicker        = new ComboTicker();

                aTradeListener.addHandler(aTicker);
                aQuoteListener.addHandler(aTicker);

                manager.addListener(aTradeListener, symbol);
                manager.addListener(aQuoteListener, symbol);
            }
示例#4
0
        public 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 MAMDA
                myBridge = new MamaBridge(options.getMiddleware());
                Mama.open();
                transport = new MamaTransport();
                transport.create(options.getTransport(), myBridge);
                defaultQueue = Mama.getDefaultEventQueue(myBridge);

                /*Get the data dictionary*/
                MamaSource dictionarySource = new MamaSource();
                dictionarySource.symbolNamespace = options.getDictSource();
                dictionarySource.transport = transport;
                dictionary = buildDataDictionary(transport, defaultQueue, dictionarySource);

                MamdaQuoteFields.setDictionary(dictionary, null);
                MamdaTradeFields.setDictionary(dictionary, null);
                MamdaSecurityStatusFields.setDictionary(dictionary, null);

                mamdaSubscriptions = new MamdaSubscription [options.getSymbolList().Count];
                int i=0;
                foreach (string symbol in options.getSymbolList())
                {
                    mamdaSubscriptions[i] =  new MamdaSubscription();

                    MamdaTradeListener aTradeListener = new MamdaTradeListener();
                    MamdaQuoteListener aQuoteListener = new MamdaQuoteListener();
                    MamdaSecurityStatusListener aSecurityStatusListener = new MamdaSecurityStatusListener();
                    ComboTicker        aTicker        = new ComboTicker();

                    aTradeListener.addHandler(aTicker);
                    aQuoteListener.addHandler(aTicker);
                    aSecurityStatusListener.addHandler(aTicker);
                    mamdaSubscriptions[i].addMsgListener(aTradeListener);
                    mamdaSubscriptions[i].addMsgListener(aQuoteListener);
                    mamdaSubscriptions[i].addStaleListener(aTicker);
                    mamdaSubscriptions[i].addErrorListener(aTicker);

                    mamdaSubscriptions[i].create(transport,
                        defaultQueue,
                        options.getSource(),
                        symbol,
                        null/*Closure*/);

                    i++;
                }

                Console.WriteLine("Hit Enter or Ctrl-C to exit.");
                Mama.start(myBridge);
                GC.KeepAlive(dictionary);
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.ToString());
                Environment.Exit(1);
            }
        }
示例#5
0
        public 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 MAMDA
                myBridge = new MamaBridge(options.getMiddleware());
                Mama.open();
                transport = new MamaTransport();
                transport.create(options.getTransport(), myBridge);
                defaultQueue = Mama.getDefaultEventQueue(myBridge);

                /*Get the data dictionary*/
                MamaSource dictionarySource = new MamaSource();
                dictionarySource.symbolNamespace = options.getDictSource();
                dictionarySource.transport       = transport;
                dictionary = buildDataDictionary(transport, defaultQueue, dictionarySource);

                MamdaQuoteFields.setDictionary(dictionary, null);
                MamdaTradeFields.setDictionary(dictionary, null);
                MamdaSecurityStatusFields.setDictionary(dictionary, null);

                mamdaSubscriptions = new MamdaSubscription [options.getSymbolList().Count];
                int i = 0;
                foreach (string symbol in options.getSymbolList())
                {
                    mamdaSubscriptions[i] = new MamdaSubscription();

                    MamdaTradeListener          aTradeListener          = new MamdaTradeListener();
                    MamdaQuoteListener          aQuoteListener          = new MamdaQuoteListener();
                    MamdaSecurityStatusListener aSecurityStatusListener = new MamdaSecurityStatusListener();
                    ComboTicker aTicker = new ComboTicker();

                    aTradeListener.addHandler(aTicker);
                    aQuoteListener.addHandler(aTicker);
                    aSecurityStatusListener.addHandler(aTicker);
                    mamdaSubscriptions[i].addMsgListener(aTradeListener);
                    mamdaSubscriptions[i].addMsgListener(aQuoteListener);
                    mamdaSubscriptions[i].addStaleListener(aTicker);
                    mamdaSubscriptions[i].addErrorListener(aTicker);

                    mamdaSubscriptions[i].create(transport,
                                                 defaultQueue,
                                                 options.getSource(),
                                                 symbol,
                                                 null /*Closure*/);

                    i++;
                }

                Console.WriteLine("Hit Enter or Ctrl-C to exit.");
                Mama.start(myBridge);
                GC.KeepAlive(dictionary);
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.ToString());
                Environment.Exit(1);
            }
        }