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


C# MamaMsg.tryF64方法代码示例

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


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

示例1: updateFundamentalFields

        private void updateFundamentalFields(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.
            */

            if (msg.tryDateTime(MamdaFundamentalFields.SRC_TIME, ref mSrcTimeStr))
              mSrcTimeStrFieldState = MamdaFieldState.MODIFIED;
            
            if (msg.tryDateTime(MamdaFundamentalFields.ACTIVITY_TIME, ref mActTimeStr))
              mActTimeStrFieldState = MamdaFieldState.MODIFIED;
            
            if (msg.tryString(MamdaFundamentalFields.CORP_ACT_TYPE, ref mCorpActType))
              mCorpActTypeFieldState = MamdaFieldState.MODIFIED;
            
            if(msg.tryField (MamdaFundamentalFields.DIVIDEND_FREQ, ref mTmpfield))
            {
                mDivFreq = getFieldAsString(mTmpfield);
                mDivFreqFieldState = MamdaFieldState.MODIFIED;
            }

            if (msg.tryString(MamdaFundamentalFields.DIVIDEND_EX_DATE, ref mDivExDate))
              mDivExDateFieldState = MamdaFieldState.MODIFIED;
            
            if(msg.tryString(MamdaFundamentalFields.DIVIDEND_PAY_DATE, ref mDivPayDate))
              mDivPayDateFieldState = MamdaFieldState.MODIFIED;
            
            if (msg.tryString(MamdaFundamentalFields.DIVIDEND_REC_DATE, ref mDivRecordDate))
              mDivRecordDateFieldState = MamdaFieldState.MODIFIED;
            
            if(msg.tryString(MamdaFundamentalFields.DIVIDEND_CURRENCY, ref mDivCurrency))
              mDivCurrencyFieldState = MamdaFieldState.MODIFIED;

            if (msg.tryString(MamdaFundamentalFields.MRKT_SEGM_NATIVE, ref mMrktSegmNative))
              mMrktSegmNativeFieldState = MamdaFieldState.MODIFIED;
            
            if (msg.tryString(MamdaFundamentalFields.MRKT_SECT_NATIVE, ref mMrktSectNative))
              mMrktSectNativeFieldState = MamdaFieldState.MODIFIED;

            if(msg.tryField (MamdaFundamentalFields.MRKT_SEGMENT, ref mTmpfield))
            {
                mMarketSegment = getFieldAsString(mTmpfield);
                mMarketSegmentFieldState = MamdaFieldState.MODIFIED;
            }

            if(msg.tryField (MamdaFundamentalFields.MRKT_SECTOR, ref mTmpfield))
            {
                mMarketSector = getFieldAsString(mTmpfield);
                mMarketSectorFieldState = MamdaFieldState.MODIFIED;
            }

            if (msg.tryI64  (MamdaFundamentalFields.SHARES_OUT, ref mSharesOut))
              mSharesOutFieldState = MamdaFieldState.MODIFIED;
            
            if (msg.tryI64  (MamdaFundamentalFields.SHARES_FLOAT, ref mSharesFloat))
              mSharesFloatFieldState = MamdaFieldState.MODIFIED;
            
            if (msg.tryI64  (MamdaFundamentalFields.SHARES_AUTH, ref mSharesAuth))
              mSharesAuthFieldState = MamdaFieldState.MODIFIED;

            if (msg.tryF64(MamdaFundamentalFields.DIVIDEND_PRICE, ref mDividendPrice))
              mDividendPriceFieldState = MamdaFieldState.MODIFIED;
            
            if (msg.tryF64(MamdaFundamentalFields.EARN_PER_SHARE, ref mEarnPerShare))
              mEarnPerShareFieldState = MamdaFieldState.MODIFIED;
            
            if (msg.tryF64(MamdaFundamentalFields.VOLATILITY, ref mVolatility))
              mVolatilityFieldState = MamdaFieldState.MODIFIED;

            if (msg.tryF64(MamdaFundamentalFields.PRICE_EARN_RATIO, ref mPeRatio))
              mPeRatioFieldState = MamdaFieldState.MODIFIED;
            
            if (msg.tryF64(MamdaFundamentalFields.YIELD, ref mYield))
              mYieldFieldState = MamdaFieldState.MODIFIED;
            
            if (msg.tryF64(MamdaFundamentalFields.HIST_VOLATILITY, ref mHistVolatility))
              mHistVolatilityFieldState = MamdaFieldState.MODIFIED;
            
            if (msg.tryF64(MamdaFundamentalFields.RISK_FREE_RATE, ref mRiskFreeRate))
              mRiskFreeRateFieldState = MamdaFieldState.MODIFIED;
        }
开发者ID:jacobraj,项目名称:MAMA,代码行数:84,代码来源:MamdaFundamentalListener.cs

示例2: 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

示例3: getLevelInfoAndEntries

        private void getLevelInfoAndEntries(
                                MamdaSubscription subscription,
                                MamaMsg msg,
                                MamaMsg plMsg,
                                bool isRecap)
        {
            double priceLevelSizeChange = 0.0;
            int priceLevelActionInt = 0;
            int priceLevelSideInt = 0;
            MamaMsg entMsg = null;

            plMsg.tryPrice(MamdaOrderBookFields.PL_PRICE, ref mPriceLevelPrice);

            plMsg.tryF64(MamdaOrderBookFields.PL_SIZE, ref mPriceLevelSize);

            plMsg.tryF64(MamdaOrderBookFields.PL_NUM_ENTRIES, ref mPriceLevelNumEntries);

            if (plMsg.tryI32(MamdaOrderBookFields.PL_ACTION, ref priceLevelActionInt))
            {
                mPriceLevelAction = (sbyte) priceLevelActionInt;
            }

            if (plMsg.tryI32(MamdaOrderBookFields.PL_SIDE, ref priceLevelSideInt))
            {
                mPriceLevelSide = (sbyte) priceLevelSideInt;
            }

            // Optional order book fields:

            mPriceLevelTime = plMsg.getDateTime (MamdaOrderBookFields.PL_TIME, mEventTime);

            if ( plMsg.tryF64(MamdaOrderBookFields.PL_SIZE_CHANGE, ref priceLevelSizeChange) )
            {
                mPriceLevelSizeChange = (long) priceLevelSizeChange;
            }

            // Call the Price Level Handler if set
            if (mLevelHandler!=null)
            {
                if (isRecap)
                {
                    mLevelHandler.onBookAtomicLevelRecap (
                                    subscription, this, msg, this);
                }
                else
                {
                    mLevelHandler.onBookAtomicLevelDelta (
                                    subscription, this, msg, this);
                }
            }

            // Handle entries.
            //
            // Note: the number of entries actually present may well
            // not add up to the PL_NUM_ENTRIES; it may be more than,
            // less than or equal to PL_NUM_ENTRIES.  For example, if
            // the delta is a price level update then PL_NUM_ENTRIES
            // indicates the total number of remaining entries whereas
            // the array of entries in the message will only contain
            // those that are being added/deleted/updated. Only if the
            // price level action is an add should the number of
            // entries match.
            //

            if (mLevelEntryHandler!=null)
            {
                // clear entry cache
                clearLevelEntryFields();

                // First try a single vector.
                int  numEntriesInMsg = 0;
                MamaMsg[] msgEntries = null;

                /* We won't have PL_ENTRIES if FieldAttrsOrderBookWombatMsg
                * is not specified in the data dictionary */
                if (MamdaOrderBookFields.PL_ENTRIES != null)
                {
                    /* null is passed as default value otherwise
                    * getVectorMsg throws an exception if not found */
                    msgEntries = plMsg.getVectorMsg(MamdaOrderBookFields.PL_ENTRIES, null);
                    if (msgEntries != null)
                    {
                        numEntriesInMsg = msgEntries.Length;
                    }
                }

                if (numEntriesInMsg > 0)
                {
                    mPriceLevelActNumEntries = numEntriesInMsg;

                    for (int j = 0; j < numEntriesInMsg; j++)
                    {
                        entMsg = msgEntries[j];

                        getEntriesInfo(entMsg);
                        if (isRecap)
                        {
                            mLevelEntryHandler.onBookAtomicLevelEntryRecap (
                                        subscription, this, msg, this);
                        }
//.........这里部分代码省略.........
开发者ID:jacobraj,项目名称:MAMA,代码行数:101,代码来源:MamdaBookAtomicListener.cs


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