• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Wombat.MamaMsg类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Wombat.MamaMsg的典型用法代码示例。如果您正苦于以下问题:C# MamaMsg类的具体用法?C# MamaMsg怎么用?C# MamaMsg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MamaMsg类属于Wombat命名空间,在下文中一共展示了MamaMsg类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: onQuoteRecap

 public void onQuoteRecap(
     MamdaSubscription   sub,
     MamdaQuoteListener  listener,
     MamaMsg             msg,
     MamdaQuoteRecap     recap)
 {
 }
开发者ID:jacobraj,项目名称:MAMA,代码行数:7,代码来源:UnderlyingTicker.cs


示例2: onQuoteClosing

 public void onQuoteClosing(
     MamdaSubscription   sub,
     MamdaQuoteListener  listener,
     MamaMsg             msg,
     MamdaQuoteClosing   closingEvent,
     MamdaQuoteRecap     recap)
 {
 }
开发者ID:jacobraj,项目名称:MAMA,代码行数:8,代码来源:UnderlyingTicker.cs


示例3: onQuoteRecap

        public void onQuoteRecap(
			MamdaSubscription   sub,
			MamdaQuoteListener  listener,
			MamaMsg             msg,
			MamdaQuoteRecap     recap)
        {
            Console.WriteLine ("Quote Recap (" + msg.getString
                            (MamdaCommonFields.ISSUE_SYMBOL)+ "): ");
        }
开发者ID:jacobraj,项目名称:MAMA,代码行数:9,代码来源:ComboTicker.cs


示例4: onQuoteClosing

        public void onQuoteClosing(
			MamdaSubscription   sub,
			MamdaQuoteListener  listener,
			MamaMsg             msg,
			MamdaQuoteClosing   closingEvent,
			MamdaQuoteRecap     recap)
        {
            Console.WriteLine("Quote Closing (" + sub.getSymbol() + "): ");
        }
开发者ID:jacobraj,项目名称:MAMA,代码行数:9,代码来源:ComboTicker.cs


示例5: onQuoteGap

        public void onQuoteGap(
			MamdaSubscription   sub,
			MamdaQuoteListener  listener,
			MamaMsg             msg,
			MamdaQuoteGap       gapEvent,
			MamdaQuoteRecap     recap)
        {
            Console.WriteLine("Quote gap (" + gapEvent.getBeginGapSeqNum() +
                            "-" + gapEvent.getEndGapSeqNum() + ")");
        }
开发者ID:jacobraj,项目名称:MAMA,代码行数:10,代码来源:ComboTicker.cs


示例6: addMamaHeaderFields

 public void addMamaHeaderFields(
                     MamaMsg msg,
                     byte msgType,
                     byte msgStatus,
                     uint seqNum)
 {
     msg.addU8(null, 1, msgType);
     msg.addU8(null, 2, msgStatus);
     msg.addU32(null, 10, seqNum);
     msg.addU64(null, 20, 1);
 }
开发者ID:jacobraj,项目名称:MAMA,代码行数:11,代码来源:MamdaQuoteListenerShortSaleTests.cs


示例7: Setup

        public void Setup()
        {
			Mama.loadBridge ("lbm");
			Mama.open ();
            // Create the message
            m_msg = new MamaMsg();

            // Create the array of messages
            m_vectorPrice = InitialisePriceArray(m_numberPrices, 69);
            m_vectorPrice2 = InitialisePriceArray(m_numberPrices, 144);
        }
开发者ID:jacobraj,项目名称:MAMA,代码行数:11,代码来源:MamaMsgVectorPriceTest.cs


示例8: testOrigShortSaleCircuitBreaker

 public void testOrigShortSaleCircuitBreaker()
 {
     mMsg = new MamaMsg();
     addMamaHeaderFields(mMsg,
                         (byte)mamaMsgType.MAMA_MSG_TYPE_CANCEL,
                         (byte)mamaMsgStatus.MAMA_MSG_STATUS_OK,
                         (uint)1);
     mMsg.addChar("wOrigShortSaleCircuitBreaker", 5249, 'C');
     ticker.callMamdaOnMsg(mSubscription, mMsg);
     Assert.AreEqual('C', ticker.myOrigShortSaleCircuitBreaker);
 }
开发者ID:jacobraj,项目名称:MAMA,代码行数:11,代码来源:MamdaTradeListenerShortSaleTests.cs


示例9: TestCorrTradeId

        public void TestCorrTradeId()
        {
            mMsg = new MamaMsg();

            addMamaHeaderFields(mMsg,
                                (byte)mamaMsgType.MAMA_MSG_TYPE_CORRECTION,
                                (byte)mamaMsgStatus.MAMA_MSG_STATUS_OK,
                                (uint)1);
            mMsg.addString("wCorrTradeId", 4060, "B");
            ticker.callMamdaOnMsg(mSubscription, mMsg);
            Assert.AreEqual("B", ticker.myCorrTradeId);
        }
开发者ID:jacobraj,项目名称:MAMA,代码行数:12,代码来源:MamdaTradeListenerTradeIdTests.cs


示例10: onQuoteUpdate

        public void onQuoteUpdate(
			MamdaSubscription   sub,
			MamdaQuoteListener  listener,
			MamaMsg             msg,
			MamdaQuoteUpdate    update,
			MamdaQuoteRecap     recap)
        {
            Console.WriteLine ("Quote ("  + msg.getString
                                (MamdaCommonFields.ISSUE_SYMBOL)   +
                                ":"        + recap.getQuoteCount()  +
                                "):  "     + update.getBidPrice()    +
                                " "        + update.getBidSize()     +
                                " X "      + update.getAskSize()     +
                                " "        + update.getAskPrice()    +
                                " (seq#: " + update.getEventSeqNum() +
                                "; time: " + update.getEventTime()   +
                                "; qual: " + update.getQuoteQual()   + ")");
        }
开发者ID:jacobraj,项目名称:MAMA,代码行数:18,代码来源:ComboTicker.cs


示例11: callMamdaOnMsg

 public void callMamdaOnMsg(MamdaSubscription sub, MamaMsg msg)
 {
     try
     {
         ArrayList msgListeners = new ArrayList();
         msgListeners = sub.getMsgListeners();
         IEnumerator iter = msgListeners.GetEnumerator();
         int size = msgListeners.Count;
         for (int i = 0; i < size; i++)
         {
             iter.MoveNext();
             MamdaMsgListener listener = (MamdaMsgListener)iter.Current;
             listener.onMsg(sub, msg, msg.getType());
         }
     }
     catch (Exception ex)
     {
         throw new MamdaDataException(ex.Message, ex);
     }
 }
开发者ID:jacobraj,项目名称:MAMA,代码行数:20,代码来源:MamdaTradeListenerAggressorSideTests.cs


示例12: CheckMessageArray

        private void CheckMessageArray(MamaMsg[] messages, int numberMessages, int offset)
        {
            // Verify that the array has the correct number of messages
            if (messages.Length != numberMessages)
            {
                throw new ArgumentOutOfRangeException("numberMessages");
            }

            // Chech each item in the array
            for (int nextMessage = 0; nextMessage < numberMessages; nextMessage++)
            {
                // Get the int32 field
                int intValue = messages[nextMessage].getI32(string.Empty, (ushort)(nextMessage + 1));

                // Verify that it has the correct value
                if (intValue != (nextMessage + offset))
                {
                    throw new InvalidOperationException();
                }
            }
        }
开发者ID:jacobraj,项目名称:MAMA,代码行数:21,代码来源:MamaMsgVectorMsgTest.cs


示例13: onMsg

		/// <summary>
		/// Implementation of MamdaListener interface.
		/// </summary>
		/// <param name="subscription"></param>
		/// <param name="msg"></param>
		/// <param name="msgType"></param>
		public void onMsg(
			MamdaSubscription	subscription,
			MamaMsg				msg,
			mamaMsgType			msgType)
		{
			if(!MamdaOptionFields.isSet())
			{
				return;
			}

			if (msgType == mamaMsgType.MAMA_MSG_TYPE_END_OF_INITIALS)
			{
				foreach (MamdaOptionChainHandler handler in mHandlers)
				{
					handler.onOptionChainRecap(subscription, this, msg, mChain);
				}
				return;
			}

			MamdaOptionContract contract = findContract(subscription, msg);

			switch (msgType)
			{
				case mamaMsgType.MAMA_MSG_TYPE_INITIAL:
				case mamaMsgType.MAMA_MSG_TYPE_RECAP:
					handleQuoteMsg(contract, subscription, msg, msgType);
					handleTradeMsg(contract, subscription, msg, msgType);
					break;
				case mamaMsgType.MAMA_MSG_TYPE_QUOTE:
					handleQuoteMsg(contract, subscription, msg, msgType);
					break;
				case mamaMsgType.MAMA_MSG_TYPE_TRADE:
				case mamaMsgType.MAMA_MSG_TYPE_CANCEL:
				case mamaMsgType.MAMA_MSG_TYPE_ERROR:
				case mamaMsgType.MAMA_MSG_TYPE_CORRECTION:
					handleTradeMsg(contract, subscription, msg, msgType);
					break;
			}
		}
开发者ID:jacobraj,项目名称:MAMA,代码行数:45,代码来源:MamdaOptionChainListener.cs


示例14: onTradeCorrection

            public void onTradeCorrection(
				MamdaSubscription        sub,
				MamdaTradeListener       listener,
				MamaMsg                  msg,
				MamdaTradeCorrection     correctionEvent,
				MamdaTradeRecap          recap)
            {
            }
开发者ID:jacobraj,项目名称:MAMA,代码行数:8,代码来源:MamdaOptionChainView.cs


示例15: extractPutCall

        private MamdaOptionContract.PutOrCall extractPutCall(
                MamaMsg        msg,
                string         fullSymbol)
            {
                MamdaOptionContract.PutOrCall putCall = MamdaOptionContract.PutOrCall.Unknown;
                int putCallInt = 0;               
                if (!msg.tryField (MamdaOptionFields.PUT_CALL, ref tmpfield_))
                {   
                    
                   Console.WriteLine("findContract:CANNOT find put/call in msg:"+fullSymbol+putCall);
                }
                else
                {
                    switch(tmpfield_.getType())
                    {
                        case mamaFieldType.MAMA_FIELD_TYPE_I8:
                        case mamaFieldType.MAMA_FIELD_TYPE_U8:
                        case mamaFieldType.MAMA_FIELD_TYPE_I16:
                        case mamaFieldType.MAMA_FIELD_TYPE_U16:                  
                            putCallInt = tmpfield_.getU16();
                        switch(putCallInt)
                        {
                            case 1:
                                putCall = MamdaOptionContract.PutOrCall.Put;
                                break;
                            case 2:
                                putCall = MamdaOptionContract.PutOrCall.Call;
                                break;
                            case 99:
                                putCall = MamdaOptionContract.PutOrCall.Unknown;
                                break;
                            default:
                                putCall =  MamdaOptionContract.PutOrCall.Unknown;                       
                                Console.WriteLine("Unhandled value for wPutCall."+ putCallInt);
                                break;
                        }
                        break; 
                        case mamaFieldType.MAMA_FIELD_TYPE_STRING:                       
                        string putCallStr = tmpfield_.getString();                      
                        switch (putCallStr[0])
                        {
                            case '1':
                            case 'P':
                                putCall = MamdaOptionContract.PutOrCall.Put;
                                break;
                            case '2':
                            case 'C':
                                putCall = MamdaOptionContract.PutOrCall.Call;
                                break;
                            default:
                                putCall = MamdaOptionContract.PutOrCall.Unknown; 
                                if ((putCallStr=="99") && (putCallStr=="Z"))
                                {
                                    Console.WriteLine("Unhandled value for wPutCall."+ putCallStr);

                                }
                                break;
                        }
                        break;
                        default:
                            putCall = MamdaOptionContract.PutOrCall.Unknown;               
                            Console.WriteLine("Unhandled type for wPutCall. Expected string or integer but returned: "+tmpfield_.getType());
                            break;
                    }
                }
                return putCall;
            }
开发者ID:jacobraj,项目名称:MAMA,代码行数:67,代码来源:MamdaOptionChainListener.cs


示例16: findContract

        private MamdaOptionContract findContract(
            MamdaSubscription  subscription,
            MamaMsg            msg)
        {
            /*
            * NOTE: fields which are enums can be pubished as integers if feedhandler
            * uses mama-publish-enums-as-ints.  It may also be possible for a feed to
            * publish the numerical value as a string. All enumerated fields must be handled
            * by getting the value based on the field type.
            */

            // Look up the strike price and expiration date
            string contractSymbol = null;
            if (!msg.tryString(MamdaOptionFields.CONTRACT_SYMBOL, ref contractSymbol))
            {
                throw new MamdaDataException ("cannot find contract symbol");
            }

            string fullSymbol = contractSymbol;
            MamdaOptionContract contract = mChain.getContract(fullSymbol);
            if (contract == null)
            {
                string expireDateStr = String.Empty;
                double strikePrice = 0.0;
                string putCall = String.Empty;
                uint openInterest = 0;
                
                msg.tryString(MamdaOptionFields.EXPIRATION_DATE, ref expireDateStr);
                msg.tryF64(MamdaOptionFields.STRIKE_PRICE, ref strikePrice);

                if (msg.tryField (MamdaOptionFields.PUT_CALL, ref tmpfield_))
                {
                    putCall = getFieldAsString(tmpfield_);
                }

                int symbolLen = fullSymbol.Length;
                string symbol   = null;
                string exchange = null;
                int dotIndex = fullSymbol.LastIndexOf('.');
                if (dotIndex > 0)
                {
                    // Have exchange in symbol.
                    exchange = fullSymbol.Substring(dotIndex + 1);
                    symbol   = fullSymbol.Substring(0, dotIndex);
                }
                else
                {
                    exchange = "";
                    symbol = fullSymbol;
                }

                DateTime expireDate = DateTime.MinValue;
                try
                {
                    expireDate = mDateFormat.Parse(expireDateStr);
                }
                catch (FormatException e)
                {
                    throw new MamdaDataException (
                        String.Format("cannot parse expiration date: {0}", expireDateStr));
                }

                MamdaOptionContract.PutOrCall putCallchar = extractPutCall(msg,fullSymbol);
                contract = new MamdaOptionContract(
                    symbol,
                    exchange,
                    expireDate,
                    strikePrice,
                    putCallchar);

               MamdaOptionContract.ExerciseStyle exerciseStyleChar = extractExerciseStyle(msg,fullSymbol);
               contract.setExerciseStyle(exerciseStyleChar);

               
                if (msg.tryU32 (MamdaOptionFields.OPEN_INTEREST, ref openInterest))
                {
                    contract.setOpenInterest( (long)openInterest );
                }

                mChain.addContract(fullSymbol, contract);

                mLastActionContract = contract;
                mLastActionContractFieldState = MamdaFieldState.MODIFIED;
                mLastAction = MamdaOptionAction.Add;
                mLastActionFieldState = MamdaFieldState.MODIFIED;
                foreach (MamdaOptionChainHandler handler in mHandlers)
                {
                    handler.onOptionContractCreate(subscription, this, msg, contract, mChain);
                }
            }
            return contract;
        }
开发者ID:jacobraj,项目名称:MAMA,代码行数:92,代码来源:MamdaOptionChainListener.cs


示例17: handleTradeMsg

		private void handleTradeMsg(
			MamdaOptionContract  contract,
			MamdaSubscription    subscription,
			MamaMsg              msg,
			mamaMsgType          msgType)
		{
			MamdaTradeListener tradeListener = contract.getTradeListener();
			if (tradeListener != null)
			{
				tradeListener.onMsg(subscription, msg, msgType);
			}
		}	
开发者ID:jacobraj,项目名称:MAMA,代码行数:12,代码来源:MamdaOptionChainListener.cs


示例18: extractExerciseStyle

 private MamdaOptionContract.ExerciseStyle extractExerciseStyle(
         MamaMsg            msg,
         string             fullSymbol)
     {
         MamdaOptionContract.ExerciseStyle exerciseStyle = MamdaOptionContract.ExerciseStyle.Unknown;
         int exerciseStyleInt = 0;   
        
         if (!msg.tryField (MamdaOptionFields.EXERCISE_STYLE, ref tmpfield_) )
         {
             Console.WriteLine("findContract:CANNOT find exercisestyle in msg:"+fullSymbol+exerciseStyle);                    
         }
         else
         {
             switch(tmpfield_.getType())
             {
                 case mamaFieldType.MAMA_FIELD_TYPE_I8:
                 case mamaFieldType.MAMA_FIELD_TYPE_U8:
                 case mamaFieldType.MAMA_FIELD_TYPE_I16:
                 case mamaFieldType.MAMA_FIELD_TYPE_U16:                
                     exerciseStyleInt =tmpfield_.getU16();
                 switch(exerciseStyleInt)
                 {
                     case 1:                                    
                         exerciseStyle = MamdaOptionContract.ExerciseStyle.American;
                         break;
                     case 2:
                         exerciseStyle = MamdaOptionContract.ExerciseStyle.European;
                         break;
                     case 3:                                    
                         exerciseStyle = MamdaOptionContract.ExerciseStyle.Capped;
                         break;
                     case 99:
                         exerciseStyle = MamdaOptionContract.ExerciseStyle.Unknown;
                         break;
                     default:
                         exerciseStyle = MamdaOptionContract.ExerciseStyle.Unknown;
                         Console.Write("Unhandled value for wExerciseStyle."+exerciseStyleInt);
                         break;
                     }
                     break;       
                     case mamaFieldType.MAMA_FIELD_TYPE_STRING:                      
                     string exerciseStyleStr = tmpfield_.getString();                             ;
                     switch (exerciseStyleStr[0])
                     {
                         case '1':
                         case 'A':                                        
                             exerciseStyle = MamdaOptionContract.ExerciseStyle.American;
                             break;
                         case '2':
                         case 'E':                                        
                             exerciseStyle = MamdaOptionContract.ExerciseStyle.European;
                             break;
                         case '3':
                         case 'C':                                       
                             exerciseStyle = MamdaOptionContract.ExerciseStyle.Capped;
                             break;
                         default:
                             exerciseStyle = MamdaOptionContract.ExerciseStyle.Unknown;
                             if ((exerciseStyleStr=="99") && (exerciseStyleStr=="Z"))
                             {
                                 Console.WriteLine("Unhandled value for wExerciseStyle."+exerciseStyleStr);
                             }
                             break;
                     }
                     break;
                 default:
                 exerciseStyle = MamdaOptionContract.ExerciseStyle.Unknown;
                 Console.WriteLine("Unhandled type for wExerciseStyle. Expected string or integer but returned:"+ tmpfield_.getType());
                 break;
             }
         }
         return  exerciseStyle;
     }
开发者ID:jacobraj,项目名称:MAMA,代码行数:73,代码来源:MamdaOptionChainListener.cs


示例19: onOptionSeriesUpdate

        /// <summary>
        /// Handler for option chain structural updates.
        /// </summary>
        /// <param name="subscription"></param>
        /// <param name="listener"></param>
        /// <param name="msg"></param>
        /// <param name="updateEvent"></param>
        /// <param name="chain"></param>
        public void onOptionSeriesUpdate(
			MamdaSubscription         subscription,
			MamdaOptionChainListener  listener,
			MamaMsg                   msg,
			MamdaOptionSeriesUpdate   updateEvent,
			MamdaOptionChain          chain)
        {
            resetRange();
        }
开发者ID:jacobraj,项目名称:MAMA,代码行数:17,代码来源:MamdaOptionChainView.cs


示例20: handleQuoteMsg

        /*      End Field State Accessors   */

        private void handleQuoteMsg(
			MamdaOptionContract  contract,
			MamdaSubscription    subscription,
			MamaMsg              msg,
			mamaMsgType          msgType)
		{
			MamdaQuoteListener quoteListener = contract.getQuoteListener();
			if (quoteListener != null)
			{
				quoteListener.onMsg(subscription, msg, msgType);
			}
		}
开发者ID:jacobraj,项目名称:MAMA,代码行数:14,代码来源:MamdaOptionChainListener.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Wombat.MamaMsgField类代码示例发布时间:2022-05-26
下一篇:
C# Wombat.MamaFieldDescriptor类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap