当前位置: 首页>>代码示例>>C#>>正文


C# MamdaSubscription.addMsgListener方法代码示例

本文整理汇总了C#中Wombat.MamdaSubscription.addMsgListener方法的典型用法代码示例。如果您正苦于以下问题:C# MamdaSubscription.addMsgListener方法的具体用法?C# MamdaSubscription.addMsgListener怎么用?C# MamdaSubscription.addMsgListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Wombat.MamdaSubscription的用法示例。


在下文中一共展示了MamdaSubscription.addMsgListener方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetUp

        public void SetUp()
        {
            try
            {
                MamaBridge mBridge = Mama.loadBridge("lbm");
                Mama.open();

                MamaDictionary mDictionary = new MamaDictionary();
                mDictionary.create("dictionary.txt");

                MamdaCommonFields.setDictionary(mDictionary, null);
                MamdaQuoteFields.reset();
                MamdaQuoteFields.setDictionary(mDictionary, null);

                mSubscription = new MamdaSubscription();
                mQuoteListener = new MamdaQuoteListener();
                mSubscription.addMsgListener(mQuoteListener);

                ticker = new QuoteTicker();
                mQuoteListener.addHandler(ticker);

            }
            catch (Exception ex)
            {
                throw new MamdaDataException(ex.Message, ex);
            }
        }
开发者ID:jacobraj,项目名称:MAMA,代码行数:27,代码来源:MamdaQuoteListenerShortSaleTests.cs

示例2: SetUp

        public void SetUp()
        {
            try
            {
                //Intialise mama
                myBridge = new MamaBridge("lbm");
                Mama.open();

                mDictionary = new MamaDictionary();
                mDictionary.create("dictionary.txt");

                MamdaCommonFields.setDictionary(mDictionary, null);
                MamdaTradeFields.reset();
                MamdaTradeFields.setDictionary(mDictionary, null);

                mSubscription = new MamdaSubscription();
                mTradeListener = new MamdaTradeListener();
                mSubscription.addMsgListener(mTradeListener);

                ticker = new tradetickerCB();
                mTradeListener.addHandler(ticker);

            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.ToString());
                Environment.Exit(1);
            }
        }
开发者ID:jacobraj,项目名称:MAMA,代码行数:29,代码来源:MamdaTradeListenerTradeIdTests.cs

示例3: MamdaOrderBookChecker

        /// <summary>
        /// </summary>
        /// <param name="transport"></param>
        /// <param name="queue"></param>
        /// <param name="handler"></param>
        /// <param name="source"></param>
        /// <param name="symbol"></param>
        /// <param name="intervalSeconds"></param>
        public MamdaOrderBookChecker(
			MamaTransport transport,
			MamaQueue queue,
			MamdaOrderBookCheckerHandler handler,
			string source,
			string symbol,
			double intervalSeconds)
        {
            mSnapShotmHandler = new SnapShotChecker(this);
            mRealTimeSubsc = new MamdaSubscription();
            mRealTimeListener = new MamdaOrderBookListener();
            mHandler = handler;
            mQueue = queue;
            mIntervalSecs = intervalSeconds;
            mRandomTimerFired = false;
            mRealTimeSubsc.setType(mamaSubscriptionType.MAMA_SUBSC_TYPE_BOOK);
            mRealTimeSubsc.create(transport, queue, source, symbol, null);
            mRealTimeSubsc.addMsgListener(mRealTimeListener);
            init();
        }
开发者ID:jacobraj,项目名称:MAMA,代码行数:28,代码来源:MamdaOrderBookChecker.cs

示例4: SetUp

        public void SetUp()
        {
            try
            {
                MamaBridge mBridge = Mama.loadBridge("lbm");
                Mama.open();

                MamaDictionary mDictionary = new MamaDictionary();
                mDictionary.create("dictionary.txt");

                MamdaCommonFields.setDictionary(mDictionary, null);
                MamdaTradeFields.reset();
                MamdaTradeFields.setDictionary(mDictionary, null);

                mSubscription = new MamdaSubscription();
                mTradeListener = new MamdaTradeListener();
                mSubscription.addMsgListener(mTradeListener);
                recap = new MamdaConcreteTradeRecap();
            }
            catch (Exception ex)
            {
                throw new MamdaDataException(ex.Message, ex);
            }
        }
开发者ID:jacobraj,项目名称:MAMA,代码行数:24,代码来源:MamdaTradeListenerAggressorSideTests.cs

示例5: Main

        public static void Main(string[] args)
        {
            MamaTransport        transport    = null;
            MamaQueue            defaultQueue = null;
            MamaDictionary       dictionary   = null;
            CommandLineProcessor options      = new CommandLineProcessor(args);
            double               throttleRate = options.getThrottleRate();

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

            if ((throttleRate > 100.0) || (throttleRate <= 0.0))
            {
                throttleRate = 100.0;
            }

            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);

                //Initialise the dictionary and fields
                MamdaCommonFields.setDictionary(dictionary, null);
                MamdaQuoteFields.setDictionary(dictionary, null);
                MamdaTradeFields.setDictionary(dictionary, null);

                foreach (string symbol in options.getSymbolList())
                {
                    MamdaSubscription aSubscription = new MamdaSubscription();
                    aSubscription.setType(mamaSubscriptionType.MAMA_SUBSC_TYPE_GROUP);
                    aSubscription.create(
                        transport,
                        defaultQueue,
                        options.getSource(),
                        symbol,
                        null);

                    /* For each subscription a MamdaMultiParticipantManager is
                    * added as the message listener. The callbacks on the
                    * MamdaMultiPartHandler will be invokes as new group members
                    * become available.*/
                    MamdaMultiParticipantManager multiPartManager =
                        new MamdaMultiParticipantManager(symbol);
                    multiPartManager.addHandler(new MultiPartHandler());

                    aSubscription.addMsgListener(multiPartManager);

                    aSubscription.activate();

                   mamdaSubscriptions.Add(aSubscription);
                }

                Mama.start(myBridge);
                GC.KeepAlive(dictionary);
                Console.WriteLine("Press ENTER or Ctrl-C to quit...");
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                Environment.Exit(1);
            }
        }
开发者ID:jacobraj,项目名称:MAMA,代码行数:76,代码来源:MamdaMultiPartTicker.cs


注:本文中的Wombat.MamdaSubscription.addMsgListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。