getDateTime() public method

Get a MAMA date/time field.
public getDateTime ( Wombat.MamaFieldDescriptor descriptor ) : System.DateTime
descriptor Wombat.MamaFieldDescriptor
return System.DateTime
コード例 #1
0
        private void handleRecap(
			MamdaSubscription subscription,
			MamaMsg msg)
        {
            // Synchronize the current Order Book in case a snapshot is being created
            if (mFullBook != null)
            {
                lock (mFullBook)
                {
                    msg.tryU64(MamaReservedFields.SenderId, ref mPreviousSenderId);
                    handleStandardFields(subscription, msg, false);
                    if (createDeltaFromMamaMsg(mTempmDeltaBook, msg))
                    {
                        mDeltaBook.setSymbol(subscription.getSymbol());
                        mDeltaBook.setBookTime(msg.getDateTime(MamdaOrderBookFields.BOOK_TIME, mSrcTime));
                        mDeltaBook.setAsDeltaDifference(mFullBook, mTempmDeltaBook);
                        mFullBook.copy(mTempmDeltaBook);
                        mFullBook.setSymbol(subscription.getSymbol());
                        mFullBook.setBookTime(mDeltaBook.getBookTime());
                        mFullBook.setIsConsistent(true);
                        invokeRecapHandlers(subscription, msg);
                    }
                }
            }
            else
            {
                handleStandardFields(subscription, msg, false);
                // Set the delta to be the contents of the recap.
                if (createDeltaFromMamaMsg(mDeltaBook, msg))
                {
                        mDeltaBook.setSymbol(subscription.getSymbol());
                    invokeRecapHandlers(subscription, msg);
                }
            }
            mGotInitial = true;
        }
コード例 #2
0
        private void handleUpdateImpl(
			MamdaSubscription subscription,
			MamaMsg msg)
        {
            handleStandardFields(subscription, msg, true);
            if (createDeltaFromMamaMsg(mDeltaBook, msg))
            {

                mDeltaBook.setSymbol(subscription.getSymbol());
                mDeltaBook.setBookTime(msg.getDateTime(MamdaOrderBookFields.BOOK_TIME, mSrcTime));
                if (mFullBook != null)
                {
                    if (mUpdateInconsistentBook || mFullBook.getIsConsistent())
                    {
                        mFullBook.apply(mDeltaBook);
                    }

                    mFullBook.setBookTime(mDeltaBook.getBookTime());
                }
                if (mHandlers.Count > 0)
                {
                    if (mUpdateInconsistentBook || (mFullBook == null) || mFullBook.getIsConsistent())
                    {
                        invokeDeltaHandlers(subscription, msg);
                    }
                }
            }
        }
コード例 #3
0
        private void getLevelInfo(
			MamdaOrderBookPriceLevel level,
			MamaMsg plMsg,
            MamdaOrderBook deltaBook)
        {
            level.setPrice(plMsg.getPrice(MamdaOrderBookFields.PL_PRICE));

            level.setSize((long)plMsg.getF64(MamdaOrderBookFields.PL_SIZE, 0));
            level.setNumEntries((int)plMsg.getF64(MamdaOrderBookFields.PL_NUM_ENTRIES, 1));
            level.setAction((MamdaOrderBookPriceLevel.Actions)plMsg.getChar(
                             MamdaOrderBookFields.PL_ACTION, 'A'));
            level.setSide((MamdaOrderBookPriceLevel.Sides)plMsg.getChar(
                           MamdaOrderBookFields.PL_SIDE, 'B'));

            /* Optional order book fields: */
            level.setSizeChange((long)plMsg.getF64(MamdaOrderBookFields.PL_SIZE_CHANGE, 0)); //default 0
            level.setTime(plMsg.getDateTime(MamdaOrderBookFields.PL_TIME, deltaBook.getBookTime()));
        }
コード例 #4
0
        void getEntryInfo(
			MamdaOrderBookEntry entry,
			MamaMsg entMsg,
            MamdaOrderBookPriceLevel level)
        {
            entry.setAction((MamdaOrderBookEntry.Actions)entMsg.getChar(
                             MamdaOrderBookFields.ENTRY_ACTION, 'D'));
            entry.setId(entMsg.getString(MamdaOrderBookFields.ENTRY_ID));
            entry.setSize((long)entMsg.getF64(MamdaOrderBookFields.ENTRY_SIZE, 0));
            entry.setTime(entMsg.getDateTime(MamdaOrderBookFields.ENTRY_TIME, level.getTime()));
        }
コード例 #5
0
        private void handleStandardFields(MamdaSubscription subscription,
                                           MamaMsg msg,
                                           bool checkSeqNum)
        {
            if (mSymbol == null)
                msg.tryString (MamdaCommonFields.SYMBOL, ref mSymbol);

            if (mPartId == null)
            {
                if ((!msg.tryString (MamdaOrderBookFields.PART_ID, ref mPartId)) && (mSymbol != null))
                {
                    // No explicit part ID in message, but maybe in symbol.
                    int lastDot = mSymbol.IndexOf (".");
                    if (lastDot != -1)
                    {
                        lastDot++;
                        int lastChar = mSymbol.Length;
                        if (lastDot != lastChar)
                        {
                            mPartId = mSymbol.Substring (lastDot, (lastChar-lastDot));
                        }
                    }
                }
            }

            msg.tryDateTime (MamdaOrderBookFields.SRC_TIME, ref mSrcTime);
            msg.tryDateTime (MamdaOrderBookFields.ACTIVITY_TIME, ref mActivityTime);
            msg.tryDateTime (MamdaOrderBookFields.LINE_TIME, ref mLineTime);
            msg.tryDateTime (MamaReservedFields.SendTime, ref mSendTime);

            mEventTime = msg.getDateTime (MamdaOrderBookFields.BOOK_TIME, mSrcTime);

            long seqNum = msg.getI64(MamaReservedFields.SeqNum);
            if (checkSeqNum && (seqNum != (mEventSeqNum + 1)))
            {
                mGapBegin    = mEventSeqNum + 1;
                mGapEnd      = seqNum - 1;
                mEventSeqNum = seqNum;
                invokeGapHandlers (subscription, msg);
            }
            else
            {
                mEventSeqNum = seqNum;
            }
        }
コード例 #6
0
        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);
                        }
                        else
                        {
                            mLevelEntryHandler.onBookAtomicLevelEntryDelta (
                                        subscription, this, msg, this);
                        }
                    }
                }
                else
                {
                    // Second, try the list of entries.
                    int maxEntryFields = MamdaOrderBookFields.getNumEntryFields ();

                    // getNumEntryFields() defaults to 0 but we want to go into the
                    // below loop at least once for flattened messages scenario
                    if (maxEntryFields == 0)
                    {
                        maxEntryFields = 1;
                    }

                    int numEntryAttached = plMsg.getI32(MamdaOrderBookFields.PL_NUM_ATTACH, 1);
                    if (numEntryAttached < maxEntryFields)
                    {
                        maxEntryFields = numEntryAttached;
                    }
                    mPriceLevelActNumEntries = maxEntryFields;
                    for (int j = 1; j <= maxEntryFields; j++)
                    {

                        if (MamdaOrderBookFields.PL_ENTRY.Length > 1)
                        {
                            entMsg = plMsg.getMsg(MamdaOrderBookFields.PL_ENTRY[j], null);
                        }

                        if ((entMsg == null) && (numEntryAttached == 1))
                        {
                            // Price level fields are probably be in the main message.
                            entMsg = plMsg;
                        }
                        if (entMsg != null)
                        {
                            if (!getEntriesInfo(entMsg))
                            {
                                return;
                            }

                            if (isRecap)
                            {
                                mLevelEntryHandler.onBookAtomicLevelEntryRecap (
                                    subscription, this, msg, this);
                            }
                            else
                            {
                                mLevelEntryHandler.onBookAtomicLevelEntryDelta (
                                    subscription, this, msg, this);
                            }
                        }
                    }
                }
            }
        }
コード例 #7
0
        private bool getEntriesInfo(MamaMsg entMsg)
        {
            int priceLevelEntryActionInt = 0;
            ulong mPriceLevelEntrySizeUlong = 0;

            if (entMsg.tryI32(MamdaOrderBookFields.ENTRY_ACTION, ref priceLevelEntryActionInt))
            {
                mPriceLevelEntryAction = (sbyte) priceLevelEntryActionInt;
            }

            entMsg.tryU64 (MamdaOrderBookFields.ENTRY_SIZE, ref mPriceLevelEntrySizeUlong);
            mPriceLevelEntrySize = (long) mPriceLevelEntrySizeUlong;

            mPriceLevelEntryTime = entMsg.getDateTime(MamdaOrderBookFields.ENTRY_TIME, mPriceLevelTime);

            if(entMsg.tryStringAnsi (MamdaOrderBookFields.ENTRY_ID, ref mPriceLevelEntryIdIntPtr))
            {
                return true;
            }
            else
            {
                return false;
            }
        }