Exemple #1
0
        /// <summary>
        /// Set the dictionary for common options fields.
        /// Maintains a cache of MamaFieldDescriptors for common options
        /// related fields. The <code>properties</code> parameter allows users
        /// of the API to map the common dictionary names to something else
        /// if they are beig published under different names.
        /// </summary>
        /// <param name="dictionary">A reference to a valid MamaDictionary</param>
        /// <param name="properties">A NameValueCollection object containing field mappings.
        /// (See MamdaFields for more information)</param>
        public static void setDictionary(
			MamaDictionary		dictionary,
			NameValueCollection	properties)
        {
            if (mInitialised)
            {
                return;
            }

            string wIssueSymbol      = lookupFieldName(properties, "wIssueSymbol");
            string wUnderlyingSymbol = lookupFieldName(properties, "wUnderlyingSymbol");
            string wExpirationDate   = lookupFieldName(properties, "wExpirationDate");
            string wStrikePrice      = lookupFieldName(properties, "wStrikePrice");
            string wPutCall          = lookupFieldName(properties, "wPutCall");
            string wExerciseStyle    = lookupFieldName(properties, "wExerciseStyle");
            string wOpenInterest     = lookupFieldName(properties, "wOpenInterest");

            CONTRACT_SYMBOL			 = dictionary.getFieldByName(wIssueSymbol);
            UNDERLYING_SYMBOL		 = dictionary.getFieldByName(wUnderlyingSymbol);
            EXPIRATION_DATE			 = dictionary.getFieldByName(wExpirationDate);
            STRIKE_PRICE			 = dictionary.getFieldByName(wStrikePrice);
            PUT_CALL    			 = dictionary.getFieldByName(wPutCall);
            EXERCISE_STYLE           = dictionary.getFieldByName(wExerciseStyle);
            OPEN_INTEREST            = dictionary.getFieldByName(wOpenInterest);

            mInitialised = true;
        }
        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);
            }
        }
Exemple #3
0
		/// <summary>
		/// Set the dictionary for common update fields.
		/// Maintains a cache of MamaFieldDescriptors for common update
		/// related fields.
		/// The <code>properties</code> parameter allows users
		/// of the API to map the common dictionary names to
		/// something else if they are beig published under different
		/// names.
		/// </summary>
		/// <param name="dictionary">A reference to a valid MamaDictionary</param>
		/// <param name="properties">A NameValueCollection object containing field mappings. (See
		/// MamdaFields for more information)</param>
		public static void setDictionary(
			MamaDictionary dictionary,
			NameValueCollection properties)
		{
			if (mInitialised)
			{
				return;
			}

			String wSymbol = lookupFieldName(properties, "wSymbol");
			String wIssueSymbol = lookupFieldName(properties, "wIssueSymbol");
            String wIndexSymbol = lookupFieldName(properties, "wIndexSymbol");
            String wPartId = lookupFieldName(properties, "wPartId");
            String wSeqNum = lookupFieldName(properties, "wSeqNum");
            String wSrcTime = lookupFieldName(properties, "wSrcTime");
            String wLineTime = lookupFieldName(properties, "wLineTime");
            String wActivityTime = lookupFieldName(properties, "wActivityTime");
            String wPubId = lookupFieldName(properties, "wPubId");
            String wMsgQual = lookupFieldName(properties, "wMsgQual");
            
			SYMBOL = dictionary.getFieldByName(wSymbol);
			ISSUE_SYMBOL = dictionary.getFieldByName(wIssueSymbol);
            INDEX_SYMBOL = dictionary.getFieldByName(wIndexSymbol);
			PART_ID = dictionary.getFieldByName(wPartId);
            SEQ_NUM = dictionary.getFieldByName(wSeqNum);
			SRC_TIME = dictionary.getFieldByName(wSrcTime);
            LINE_TIME = dictionary.getFieldByName(wLineTime);
			ACTIVITY_TIME = dictionary.getFieldByName(wActivityTime);
            PUB_ID = dictionary.getFieldByName(wPubId);
			MSG_QUAL = dictionary.getFieldByName(wMsgQual);
        
			mInitialised = true;
		}
        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);
            }
        }
		/// <summary>
		/// Set the dictionary for common fundamental fields.
		/// Maintains a cache of MamaFieldDescriptors for common fundamental
		/// related fields. The <code>properties</code> parameter allows users
		/// of the API to map the common dictionary names to something else
		/// if they are beig published under different names.
		/// </summary>
		/// <param name="dictionary">A reference to a valid MamaDictionary</param>
		/// <param name="properties">A Properties object containing field mappings.
		/// (See <see cref="MamdaFields">MamdaFields</see> for more information)</param>
		public static void setDictionary(
			MamaDictionary		dictionary,
			NameValueCollection	properties)
		{
			if (mInitialised)
			{
				return;
			}

			string wSrcTime				= lookupFieldName(properties, "wSrcTime");
			string wActivityTime		= lookupFieldName(properties, "wActivityTime");
			string wCorpActType			= lookupFieldName(properties, "wCorpActType");
			string wDividend			= lookupFieldName(properties, "wDividend");
			string wDivFreq				= lookupFieldName(properties, "wDivFreq");
			string wDivExDate			= lookupFieldName(properties, "wDivExDate");
			string wDivPayDate			= lookupFieldName(properties, "wDivPayDate");
			string wDivRecordDate		= lookupFieldName(properties, "wDivRecordDate");
			string wDivCurrency			= lookupFieldName(properties, "wDivCurrency");
			string wSharesOut			= lookupFieldName(properties, "wSharesOut");
			string wSharesFloat			= lookupFieldName(properties, "wSharesFloat");
			string wSharesAuth			= lookupFieldName(properties, "wSharesAuth");
			string wEarnPerShare		= lookupFieldName(properties, "wEarnPerShare");
			string wVolatility			= lookupFieldName(properties, "wVolatility");
			string wPeRatio				= lookupFieldName(properties, "wPeRatio");
			string wYield				= lookupFieldName(properties, "wYield");
			string wMarketSegmentNative = lookupFieldName(properties, "wMarketSegmentNative");
			string wMarketSectorNative  = lookupFieldName(properties, "wMarketSectorNative");
			string wMarketSegment		= lookupFieldName(properties, "wMarketSegment");
			string wMarketSector		= lookupFieldName(properties, "wMarketSector");
			string wRiskFreeRate		= lookupFieldName(properties, "wRiskFreeRate");
			string wHistVolatility		= lookupFieldName(properties, "wHistVolatility");

			SRC_TIME            = dictionary.getFieldByName(wSrcTime);
			ACTIVITY_TIME       = dictionary.getFieldByName(wActivityTime);
			CORP_ACT_TYPE       = dictionary.getFieldByName(wCorpActType);
			DIVIDEND_PRICE      = dictionary.getFieldByName(wDividend);
			DIVIDEND_FREQ       = dictionary.getFieldByName(wDivFreq);
			DIVIDEND_EX_DATE    = dictionary.getFieldByName(wDivExDate);
			DIVIDEND_PAY_DATE   = dictionary.getFieldByName(wDivPayDate);
			DIVIDEND_REC_DATE   = dictionary.getFieldByName(wDivRecordDate);
			DIVIDEND_CURRENCY   = dictionary.getFieldByName(wDivCurrency);
			SHARES_OUT          = dictionary.getFieldByName(wSharesOut);
			SHARES_FLOAT        = dictionary.getFieldByName(wSharesFloat);
			SHARES_AUTH         = dictionary.getFieldByName(wSharesAuth);
			EARN_PER_SHARE      = dictionary.getFieldByName(wEarnPerShare);
			VOLATILITY          = dictionary.getFieldByName(wVolatility);
			PRICE_EARN_RATIO    = dictionary.getFieldByName(wPeRatio);
			YIELD               = dictionary.getFieldByName(wYield);
			MRKT_SEGM_NATIVE    = dictionary.getFieldByName(wMarketSegmentNative);
			MRKT_SECT_NATIVE    = dictionary.getFieldByName(wMarketSectorNative);
			MRKT_SEGMENT        = dictionary.getFieldByName(wMarketSegment);
			MRKT_SECTOR         = dictionary.getFieldByName(wMarketSector);
			RISK_FREE_RATE      = dictionary.getFieldByName(wRiskFreeRate);
			HIST_VOLATILITY     = dictionary.getFieldByName(wHistVolatility);

			mInitialised = true;
		}
Exemple #6
0
		/// <summary>
		/// Set the dictionary for common quote fields.
		/// Maintains a cache of MamaFieldDescriptors for common quote
		/// related fields. The <code>properties</code> parameter allows users
		/// of the API to map the common dictionary names to something else
		/// if they are beig published under different names.
		/// </summary>
		/// <param name="dictionary">A reference to a valid MamaDictionary</param>
		/// <param name="properties">A NameValueCollection object containing field mappings. (See
		/// MamdaFields for more information)</param>
		public static void setDictionary(
			MamaDictionary		dictionary,
			NameValueCollection	properties)
		{
			if (initialised)
			{
				return;
			}

			string wUncrossPrice    = lookupFieldName (properties, "wUncrossPrice");
			string wUncrossVolume   = lookupFieldName (properties, "wUncrossVolume");
			string wUncrossPriceInd = lookupFieldName (properties, "wUncrossPriceInd");
			

			UNCROSS_PRICE       = dictionary.getFieldByName (wUncrossPrice);
			UNCROSS_VOLUME      = dictionary.getFieldByName (wUncrossVolume);
			UNCROSS_PRICE_IND   = dictionary.getFieldByName (wUncrossPriceInd);
			
			MAX_FID = dictionary.getMaxFid();
			initialised = true;
		}
        public void SetUp()
        {
            try
            {
                MamaBridge mBridge = Mama.loadBridge("lbm");
                Mama.open();

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

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

                mSubscription = new MamdaSubscription();
            }
            catch (Exception ex)
            {
                throw new MamdaDataException(ex.Message, ex);
            }
        }
		/// <summary>
		/// Set the dictionary for common security status fields.
		/// Maintains a cache of MamaFieldDescriptors for common security status
		/// related fields. The <code>properties</code> parameter allows users
		/// of the API to map the common dictionary names to something else
		/// if they are being published under different names.
		/// </summary>
		/// <param name="dictionary">A reference to a valid MamaDictionary</param>
		/// <param name="properties">A NameValueCollection object containing field mappings.
		/// (See MamdaFields for more information)</param>
		public static void setDictionary(
			MamaDictionary dictionary,
			NameValueCollection properties)
		{
			if (mInitialised)
			{
				return;
			}

			string wSrcTime = lookupFieldName(properties, "wSrcTime");
			string wActivityTime = lookupFieldName(properties, "wActivityTime");
			string wSecurityStatus = lookupFieldName(properties, "wSecurityStatus");
			string wSecStatusQual = lookupFieldName(properties, "wSecStatusQual");
			string wSecurityStatusTime = lookupFieldName(properties, "wSecurityStatusTime");
			string wSecurityStatusOrig = lookupFieldName(properties, "wSecurityStatusOrig");
            string wShortSaleCircuitBreaker = lookupFieldName(properties,"wShortSaleCircuitBreaker");
			string wSeqNum = lookupFieldName(properties, "wSeqNum");
			string wReason = lookupFieldName(properties, "wReason");
			string wLuldIndicator = lookupFieldName(properties, "wLuldIndicator");
			string wLuldTime = lookupFieldName(properties, "wLuldTime");
			string wLuldHighLimit = lookupFieldName(properties, "wHighLimit");
			string wLuldLowLimit = lookupFieldName(properties, "wLowLimit");

			SRC_TIME					= dictionary.getFieldByName(wSrcTime);
			ACTIVITY_TIME				= dictionary.getFieldByName(wActivityTime);
			SECURITY_STATUS				= dictionary.getFieldByName(wSecurityStatus);
			SECURITY_STATUS_QUAL		= dictionary.getFieldByName(wSecStatusQual);
			SECURITY_STATUS_TIME		= dictionary.getFieldByName(wSecurityStatusTime);
			SECURITY_STATUS_ORIG		= dictionary.getFieldByName(wSecurityStatusOrig);
            SHORT_SALE_CIRCUIT_BREAKER	= dictionary.getFieldByName(wShortSaleCircuitBreaker);
			SEQNUM						= dictionary.getFieldByName(wSeqNum);
			REASON						= dictionary.getFieldByName(wReason);
            LULDINDICATOR               = dictionary.getFieldByName(wLuldIndicator);
            LULDTIME                    = dictionary.getFieldByName(wLuldTime);
            LULDHIGHLIMIT               = dictionary.getFieldByName(wLuldHighLimit);
            LULDLOWLIMIT                = dictionary.getFieldByName(wLuldLowLimit);

			MAX_FID = dictionary.getMaxFid();
			mInitialised = true;
		}
        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);
            }
        }
Exemple #10
0
 public void onTimeout(MamaDictionary dictionary)
 {
     Console.Error.WriteLine("Timed out waiting for dictionary");
     Environment.Exit(1);
 }
Exemple #11
0
        /// <summary>
        /// This function will create the dictionary.
        /// </summary>
        private void createDictionary()
        {
            if (m_downloadDictionary)
            {
                using (MamaSource dictionarySource = new MamaSource())
                {
                    /* If a dictionary transport has been specified then a new one must be created otherwise
                     * the main transport will be re-used.
                     */
                    MamaTransport dictionaryTransport = null;
                    try
                    {
                        if((m_dictionaryTransportName == null) || (m_dictionaryTransportName == string.Empty))
                        {
                            dictionarySource.transport = m_transport;
                        }
                        else
                        {
                            dictionaryTransport = new MamaTransport();
                            dictionaryTransport.create(m_dictionaryTransportName, m_bridge);

                            dictionarySource.transport = dictionaryTransport;
                        }

                        // The symbol namespace must also be set
                        dictionarySource.symbolNamespace = m_dictionarySourceName;

                        // Instantiate a callback class
                        ListenerDictionaryCallback dictionaryCallback = new ListenerDictionaryCallback(m_bridge);

                        // Create the actual dictionary object using the default queue
                        m_dictionary = new MamaDictionary();
                        m_dictionary.create(m_defaultQueue, dictionaryCallback, dictionarySource, 3, 10.0);

                        // Start the bridge, this will block until the dictionary is downloaded or something goes wrong
                        Mama.start(m_bridge);

                        // If something went wrong then throw an exception
                        if (!dictionaryCallback.DictionaryComplete)
                        {
                            throw new ApplicationException("Can't create dictionary.");
                        }
                    }

                    finally
                    {
                        if (dictionaryTransport != null)
                        {
                            dictionaryTransport.destroy();
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Set the dictionary for common trade fields.
        /// Maintains a cache of MamaFieldDescriptors for common trade related
        /// fields. The <code>properties</code> parameter allows users of the API
        /// to map the common dictionary names to something else if they are being
        /// published under different names.
        /// </summary>
        /// <param name="dictionary">A reference to a valid MamaDictionary</param>
        /// <param name="properties">A NameValueCollection object containing field
        /// mappings. (See MamdaFields for further details)</param>
        public static void setDictionary(
            MamaDictionary dictionary,
            NameValueCollection properties)
        {
            if (mInitialised)
            {
                return;
            }

            string wSymbol                      = lookupFieldName(properties, "wSymbol");
            string wIssueSymbol                 = lookupFieldName(properties, "wIssueSymbol");
            string wPartId                      = lookupFieldName(properties, "wPartId");
            string wSrcTime                     = lookupFieldName(properties, "wSrcTime");
            string wActivityTime                = lookupFieldName(properties, "wActivityTime");
            string wLineTime                    = lookupFieldName(properties, "wLineTime");
            string MamaSendTime                 = lookupFieldName(properties, MamaReservedFields.SendTime.getName());
            string wPubId                       = lookupFieldName(properties, "wPubId");
            string wTradePrice                  = lookupFieldName(properties, "wTradePrice");
            string wTradeDate                   = lookupFieldName(properties, "wTradeDate");
            string wTradeTime                   = lookupFieldName(properties, "wTradeTime");
            string wTradeTick                   = lookupFieldName(properties, "wTradeTick");
            string wLastPrice                   = lookupFieldName(properties, "wLastPrice");
            string wLastVolume                  = lookupFieldName(properties, "wLastVolume");
            string wLastPartId                  = lookupFieldName(properties, "wLastPartId");
            string wLastTime                    = lookupFieldName(properties, "wLastTime");
            string wNetChange                   = lookupFieldName(properties, "wNetChange");
            string wPctChange                   = lookupFieldName(properties, "wPctChange");
            string wTradeVolume                 = lookupFieldName(properties, "wTradeVolume");
            string wTotalVolume                 = lookupFieldName(properties, "wTotalVolume");
            string wOffExTotalVolume            = lookupFieldName(properties, "wOffExchangeTotalVolume");
            string wOnExTotalVolume             = lookupFieldName(properties, "wOnExchangeTotalVolume");
            string wTradeUnits                  = lookupFieldName(properties, "wTradeUnits");
            string wHighPrice                   = lookupFieldName(properties, "wHighPrice");
            string wLowPrice                    = lookupFieldName(properties, "wLowPrice");
            string wOpenPrice                   = lookupFieldName(properties, "wOpenPrice");
            string wClosePrice                  = lookupFieldName(properties, "wClosePrice");
            string wCloseDate                   = lookupFieldName(properties, "wCloseDate");
            string wPrevClosePrice              = lookupFieldName(properties, "wPrevClosePrice");
            string wPrevCloseDate               = lookupFieldName(properties, "wPrevCloseDate");
            string wAdjPrevClose                = lookupFieldName(properties, "wAdjPrevClose");
            string wPrevVolume                  = lookupFieldName(properties, "wPrevVolume");
            string wTradeSeqNum                 = lookupFieldName(properties, "wTradeSeqNum");
            string wTradeQualifier              = lookupFieldName(properties, "wTradeQualifier");
            string wTradePartId                 = lookupFieldName(properties, "wTradePartId");
            string wAggressorSide               = lookupFieldName(properties, "wAggressorSide");
            string wTradeSide                   = lookupFieldName(properties, "wTradeSide");
            string wTotalValue                  = lookupFieldName(properties, "wTotalValue");
            string wOffExTotalValue             = lookupFieldName(properties, "wOffExchangeTotalValue");
            string wOnExTotalValue              = lookupFieldName(properties, "wOnExchangeTotalValue");
            string wVwap                        = lookupFieldName(properties, "wVwap");
            string wOffExVwap                   = lookupFieldName(properties, "wOffExchangeVwap");
            string wOnExVwap                    = lookupFieldName(properties, "wOnExchangeVwap");
            string wStdDev                      = lookupFieldName(properties, "wStdDev");
            string wStdDevSum                   = lookupFieldName(properties, "wStdDevSum");
            string wStdDevSumSquares            = lookupFieldName(properties, "wStdDevSumSquares");
            string wOrderId                     = lookupFieldName(properties, "wOrderId");
            string wSettlePrice                 = lookupFieldName(properties, "wSettlePrice");
            string wSettleDate                  = lookupFieldName(properties, "wSettleDate");
            string wSaleCondition               = lookupFieldName(properties, "wSaleCondition");
            string wSellersSaleDays             = lookupFieldName(properties, "wSellersSaleDays");
            string wStopStockInd                = lookupFieldName(properties, "wStopStockIndicator");
            string wTradeExecVenue              = lookupFieldName(properties, "wTradeExecVenueEnum");
            string wOffExTradePrice             = lookupFieldName(properties, "wOffExchangeTradePrice");
            string wOnExTradePrice              = lookupFieldName(properties, "wOnExchangeTradePrice");
            string wIsIrregular                 = lookupFieldName(properties, "wIsIrregular");
            string wIrregPartId                 = lookupFieldName(properties, "wIrregPartId");
            string wIrregPrice                  = lookupFieldName(properties, "wIrregPrice");
            string wIrregSize                   = lookupFieldName(properties, "wIrregSize");
            string wIrregTime                   = lookupFieldName(properties, "wIrregTime");
            string wOrigPartId                  = lookupFieldName(properties, "wOrigPartId");
            string wOrigPrice                   = lookupFieldName(properties, "wOrigPrice");
            string wOrigSize                    = lookupFieldName(properties, "wOrigSize");
            string wOrigSeqNum                  = lookupFieldName(properties, "wOrigSeqNum");
            string wOrigQualifier               = lookupFieldName(properties, "wOrigQualifier");
            string wOrigCondition               = lookupFieldName(properties, "wOrigCondition");
            string wOrigSaleDays                = lookupFieldName(properties, "wOrigSaleDays");
            string wOrigStopStockInd            = lookupFieldName(properties, "wOrigStopStockInd");
            string wCorrPartId                  = lookupFieldName(properties, "wCorrPartId");
            string wCorrPrice                   = lookupFieldName(properties, "wCorrPrice");
            string wCorrSize                    = lookupFieldName(properties, "wCorrSize");
            string wCorrQualifier               = lookupFieldName(properties, "wCorrQualifier");
            string wCorrCondition               = lookupFieldName(properties, "wCorrCondition");
            string wCorrSaleDays                = lookupFieldName(properties, "wCorrSaleDays");
            string wCorrStopStockInd            = lookupFieldName(properties, "wCorrStopStockInd");
            string wCorrTime                    = lookupFieldName(properties, "wCorrTime");
            string wCancelTime                  = lookupFieldName(properties, "wCancelTime");
            string wTradeId                     = lookupFieldName(properties, "wTradeId");
            string wOrigTradeId                 = lookupFieldName(properties, "wOrigTradeId");
            string wCorrTradeId                 = lookupFieldName(properties, "wCorrTradeId");
            string wPrimExch                    = lookupFieldName(properties, "wPrimExch");
            string wTradeCount                  = lookupFieldName(properties, "wTradeCount");
            string wBlockCount                  = lookupFieldName(properties, "wBlockCount");
            string wBlockVolume                 = lookupFieldName(properties, "wBlockVolume");
            string wUpdateAsTrade               = lookupFieldName(properties, "wUpdateAsTrade");
            string wLastTradeSeqNum             = lookupFieldName(properties, "wLastTradeSeqNum");
            string wHighSeqNum                  = lookupFieldName(properties, "wHighSeqNum");
            string wLowSeqNum                   = lookupFieldName(properties, "wLowSeqNum");
            string wTotalVolumeSeqNum           = lookupFieldName(properties, "wTotalVolumeSeqNum");
            string wCurrencyCode                = lookupFieldName(properties, "wCurrencyCode");
            string wConflateCount               = lookupFieldName(properties, "wConflateTradeCount");
            string wShortSaleCircuitBreaker     = lookupFieldName(properties, "wShortSaleCircuitBreaker");
            string wOrigShortSaleCircuitBreaker = lookupFieldName(properties, "wOrigShortSaleCircuitBreaker");
            string wCorrShortSaleCircuitBreaker = lookupFieldName(properties, "wCorrShortSaleCircuitBreaker");

            SYMBOL                    = dictionary.getFieldByName(wSymbol);
            ISSUE_SYMBOL              = dictionary.getFieldByName(wIssueSymbol);
            PART_ID                   = dictionary.getFieldByName(wPartId);
            SRC_TIME                  = dictionary.getFieldByName(wSrcTime);
            ACTIVITY_TIME             = dictionary.getFieldByName(wActivityTime);
            LINE_TIME                 = dictionary.getFieldByName(wLineTime);
            SEND_TIME                 = dictionary.getFieldByName(MamaSendTime);
            PUB_ID                    = dictionary.getFieldByName(wPubId);
            TRADE_PRICE               = dictionary.getFieldByName(wTradePrice);
            TRADE_DATE                = dictionary.getFieldByName(wTradeDate);
            TRADE_TIME                = dictionary.getFieldByName(wTradeTime);
            TRADE_DIRECTION           = dictionary.getFieldByName(wTradeTick);
            LAST_PRICE                = dictionary.getFieldByName(wLastPrice);
            LAST_VOLUME               = dictionary.getFieldByName(wLastVolume);
            LAST_PART_ID              = dictionary.getFieldByName(wLastPartId);
            LAST_TIME                 = dictionary.getFieldByName(wLastTime);
            NET_CHANGE                = dictionary.getFieldByName(wNetChange);
            PCT_CHANGE                = dictionary.getFieldByName(wPctChange);
            TRADE_SIZE                = dictionary.getFieldByName(wTradeVolume);
            TOTAL_VOLUME              = dictionary.getFieldByName(wTotalVolume);
            OFF_EXCHANGE_TOTAL_VOLUME = dictionary.getFieldByName(wOffExTotalVolume);
            ON_EXCHANGE_TOTAL_VOLUME  = dictionary.getFieldByName(wOnExTotalVolume);
            TRADE_UNITS               = dictionary.getFieldByName(wTradeUnits);
            HIGH_PRICE                = dictionary.getFieldByName(wHighPrice);
            LOW_PRICE                 = dictionary.getFieldByName(wLowPrice);
            OPEN_PRICE                = dictionary.getFieldByName(wOpenPrice);
            CLOSE_PRICE               = dictionary.getFieldByName(wClosePrice);
            CLOSE_DATE                = dictionary.getFieldByName(wCloseDate);
            PREV_CLOSE_PRICE          = dictionary.getFieldByName(wPrevClosePrice);
            PREV_CLOSE_DATE           = dictionary.getFieldByName(wPrevCloseDate);
            ADJ_PREV_CLOSE            = dictionary.getFieldByName(wAdjPrevClose);
            PREV_VOLUME               = dictionary.getFieldByName(wPrevVolume);
            TRADE_SEQNUM              = dictionary.getFieldByName(wTradeSeqNum);
            TRADE_QUALIFIER           = dictionary.getFieldByName(wTradeQualifier);
            TRADE_PART_ID             = dictionary.getFieldByName(wTradePartId);
            AGGRESSOR_SIDE            = dictionary.getFieldByName(wAggressorSide);
            TRADE_SIDE                = dictionary.getFieldByName(wTradeSide);
            TOTAL_VALUE               = dictionary.getFieldByName(wTotalValue);
            OFF_EXCHANGE_TOTAL_VALUE  = dictionary.getFieldByName(wTotalValue);
            ON_EXCHANGE_TOTAL_VALUE   = dictionary.getFieldByName(wTotalValue);
            VWAP = dictionary.getFieldByName(wVwap);
            OFF_EXCHANGE_VWAP               = dictionary.getFieldByName(wVwap);
            ON_EXCHANGE_VWAP                = dictionary.getFieldByName(wVwap);
            STD_DEV                         = dictionary.getFieldByName(wStdDev);
            STD_DEV_SUM                     = dictionary.getFieldByName(wStdDevSum);
            STD_DEV_SUM_SQUARES             = dictionary.getFieldByName(wStdDevSumSquares);
            ORDER_ID                        = dictionary.getFieldByName(wOrderId);
            SETTLE_PRICE                    = dictionary.getFieldByName(wSettlePrice);
            SETTLE_DATE                     = dictionary.getFieldByName(wSettleDate);
            SALE_CONDITION                  = dictionary.getFieldByName(wSaleCondition);
            SELLERS_SALE_DAYS               = dictionary.getFieldByName(wSellersSaleDays);
            STOP_STOCK_IND                  = dictionary.getFieldByName(wStopStockInd);
            TRADE_EXEC_VENUE                = dictionary.getFieldByName(wTradeExecVenue);
            OFF_EXCHANGE_TRADE_PRICE        = dictionary.getFieldByName(wOffExTradePrice);
            ON_EXCHANGE_TRADE_PRICE         = dictionary.getFieldByName(wOnExTradePrice);
            IS_IRREGULAR                    = dictionary.getFieldByName(wIsIrregular);
            IRREG_PART_ID                   = dictionary.getFieldByName(wIrregPartId);
            IRREG_PRICE                     = dictionary.getFieldByName(wIrregPrice);
            IRREG_SIZE                      = dictionary.getFieldByName(wIrregSize);
            IRREG_TIME                      = dictionary.getFieldByName(wIrregTime);
            ORIG_PART_ID                    = dictionary.getFieldByName(wOrigPartId);
            ORIG_PRICE                      = dictionary.getFieldByName(wOrigPrice);
            ORIG_SIZE                       = dictionary.getFieldByName(wOrigSize);
            ORIG_SEQNUM                     = dictionary.getFieldByName(wOrigSeqNum);
            ORIG_TRADE_QUALIFIER            = dictionary.getFieldByName(wOrigQualifier);
            ORIG_SALE_CONDITION             = dictionary.getFieldByName(wOrigCondition);
            ORIG_SELLERS_SALE_DAYS          = dictionary.getFieldByName(wOrigSaleDays);
            ORIG_STOP_STOCK_IND             = dictionary.getFieldByName(wOrigStopStockInd);
            CORR_PART_ID                    = dictionary.getFieldByName(wCorrPartId);
            CORR_PRICE                      = dictionary.getFieldByName(wCorrPrice);
            CORR_SIZE                       = dictionary.getFieldByName(wCorrSize);
            CORR_TRADE_QUALIFIER            = dictionary.getFieldByName(wCorrQualifier);
            CORR_SALE_CONDITION             = dictionary.getFieldByName(wCorrCondition);
            CORR_SELLERS_SALE_DAYS          = dictionary.getFieldByName(wCorrSaleDays);
            CORR_STOP_STOCK_IND             = dictionary.getFieldByName(wCorrStopStockInd);
            CORR_TIME                       = dictionary.getFieldByName(wCorrTime);
            CANCEL_TIME                     = dictionary.getFieldByName(wCancelTime);
            TRADE_ID                        = dictionary.getFieldByName(wTradeId);
            ORIG_TRADE_ID                   = dictionary.getFieldByName(wOrigTradeId);
            CORR_TRADE_ID                   = dictionary.getFieldByName(wCorrTradeId);
            PRIMARY_EXCH                    = dictionary.getFieldByName(wPrimExch);
            TRADE_COUNT                     = dictionary.getFieldByName(wTradeCount);
            BLOCK_COUNT                     = dictionary.getFieldByName(wBlockCount);
            BLOCK_VOLUME                    = dictionary.getFieldByName(wBlockVolume);
            UPDATE_AS_TRADE                 = dictionary.getFieldByName(wUpdateAsTrade);
            LAST_SEQNUM                     = dictionary.getFieldByName(wLastTradeSeqNum);
            HIGH_SEQNUM                     = dictionary.getFieldByName(wHighSeqNum);
            LOW_SEQNUM                      = dictionary.getFieldByName(wLowSeqNum);
            TOTAL_VOLUME_SEQNUM             = dictionary.getFieldByName(wTotalVolumeSeqNum);
            CURRENCY_CODE                   = dictionary.getFieldByName(wCurrencyCode);
            CONFLATE_COUNT                  = dictionary.getFieldByName(wConflateCount);
            SHORT_SALE_CIRCUIT_BREAKER      = dictionary.getFieldByName(wShortSaleCircuitBreaker);
            ORIG_SHORT_SALE_CIRCUIT_BREAKER = dictionary.getFieldByName(wOrigShortSaleCircuitBreaker);
            CORR_SHORT_SALE_CIRCUIT_BREAKER = dictionary.getFieldByName(wCorrShortSaleCircuitBreaker);

            MAX_FID      = dictionary.getMaxFid();
            mInitialised = true;
        }
Exemple #13
0
 public void onError(MamaDictionary dictionary, string message)
 {
     Console.Error.WriteLine("Error getting dictionary: {0}", message);
     Environment.Exit(1);
 }
Exemple #14
0
        public void onError(MamaDictionary dictionary, string message)
        {
            Console.WriteLine("Dictionary error:" + message);

            Mama.stop(mamaBridge);
        }
Exemple #15
0
            internal ListenerSubscriptionCallback(MamaDictionary dictionary, bool iterator, int quietness, int totalSubscriptions)
            {
                // Save arguments in member variables
                m_dictionary = dictionary;
                m_iterator = iterator;
                m_quietness = quietness;
                m_totalSubscriptions = totalSubscriptions;

                // Create the message iterator
                if (iterator)
                {
                    m_messageIterator = new MamaMsgIterator(m_dictionary);
                }
            }
Exemple #16
0
 internal ListenerFieldCallback(MamaDictionary dictionary, bool iterator, int quietness)
 {
     // Save arguments in member variables
     m_dictionary = dictionary;
     m_iterator = iterator;
     m_quietness = quietness;
 }
Exemple #17
0
        private void initializeMama()
        {
            mamaBridge = Mama.loadBridge(mamaMiddlewareName);

            Console.WriteLine(Mama.getVersion(mamaBridge));

            Mama.open();

            if (mamaHighWaterMark > 0 || mamaLowWaterMark > 0)
            {
                if (mamaHighWaterMark > 0)
                {
                    Mama.setDefaultQueueHighWatermark(mamaHighWaterMark);
                }

                if (mamaLowWaterMark > 0)
                {
                    try
                    {
                        Mama.setDefaultQueueLowWatermark(mamaLowWaterMark);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Could not set default queue low water mark MamaStatus: " + e);
                    }
                }
            }

            // create the transport
            mamaTransport = new MamaTransport();

            mamaTransport.setTransportCallback(this);

            // the default throttle rate is 500 msg/sec
            if (mamaThrottle != -1)
            {
                mamaTransport.setOutboundThrottle(MamaTransport.MamaThrottleInstance.MAMA_THROTTLE_DEFAULT, mamaThrottle);
            }

            // the default recap throttle rate is 250 msg/sec
            if (mamaRecapThrottle != -1)
            {
                mamaTransport.setOutboundThrottle(MamaTransport.MamaThrottleInstance.MAMA_THROTTLE_RECAP, mamaRecapThrottle);
            }

            mamaTransport.create(mamaTransportName, mamaBridge);

            // create default queue and, if required, queue group
            createQueues();

            mamaDictionarySource = new MamaSource();
            mamaDictionarySource.symbolNamespace = mamaDictionarySourceName;
            mamaDictionarySource.transport = mamaTransport;

            // download dictionary
            mamaDictionary = new MamaDictionary();

            mamaDictionary.create(
                mamaDefaultQueue,
                this,
                mamaDictionarySource,
                3,
                10.0f);

            loadSymbolMap();

            Mama.start(mamaBridge);

            if (!dictionaryComplete)
            {
                throw new Exception("Can't create dictionary.");
            }

        }
Exemple #18
0
        /// <summary>
        /// Set the dictionary for common orderbook fields.
        /// Maintains a cache of MamaFieldDescriptors for common orderbook
        /// related fields. The <code>properties</code> parameter allows users
        /// of the API to map the common dictionary names to something else
        /// if they are beig published under different names.
        /// </summary>
        /// <param name="dictionary">A reference to a valid MamaDictionary</param>
        /// <param name="properties">A Properties object containing field mappings. (See
        /// MamdaFields for more information</param>
        public static void setDictionary(
            MamaDictionary dictionary,
            NameValueCollection properties)
        {
            if (mInitialised)
            {
                return;
            }

            MamdaCommonFields.setDictionary(dictionary, null);

            string wSrcTime      = lookupFieldName(properties, "wSrcTime");
            string wActivityTime = lookupFieldName(properties, "wActivityTime");
            string wLineTime     = lookupFieldName(properties, "wLineTime");
            string wPartId       = lookupFieldName(properties, "wPartId");
            string wSeqNum       = lookupFieldName(properties, "wSeqNum");
            string wBookTime     = lookupFieldName(properties, "wBookTime");
            string wNumLevels    = lookupFieldName(properties, "wNumLevels");
            string wPriceLevels  = lookupFieldName(properties, "wPriceLevels");
            string wPlAction     = lookupFieldName(properties, "wPlAction");
            string wPlPrice      = lookupFieldName(properties, "wPlPrice");
            string wPlSide       = lookupFieldName(properties, "wPlSide");
            string wPlSize       = lookupFieldName(properties, "wPlSize");
            string wPlSizeChange = lookupFieldName(properties, "wPlSizeChange");
            string wPlTime       = lookupFieldName(properties, "wPlTime");
            string wPlNumEntries = lookupFieldName(properties, "wPlNumEntries");
            string wPlNumAttach  = lookupFieldName(properties, "wPlNumAttach");
            string wPlEntries    = lookupFieldName(properties, "wPlEntries");
            string wEntryId      = lookupFieldName(properties, "wEntryId");
            string wEntryAction  = lookupFieldName(properties, "wEntryAction");
            string wEntryReason  = lookupFieldName(properties, "wEntryReason");
            string wEntrySize    = lookupFieldName(properties, "wEntrySize");
            string wEntryTime    = lookupFieldName(properties, "wEntryTime");
            string wEntryStatus  = lookupFieldName(properties, "wEntryStatus");

            SRC_TIME       = dictionary.getFieldByName(wSrcTime);
            ACTIVITY_TIME  = dictionary.getFieldByName(wActivityTime);
            LINE_TIME      = dictionary.getFieldByName(wLineTime);
            PART_ID        = dictionary.getFieldByName(wPartId);
            SEQNUM         = dictionary.getFieldByName(wSeqNum);
            BOOK_TIME      = dictionary.getFieldByName(wBookTime);
            NUM_LEVELS     = dictionary.getFieldByName(wNumLevels);
            PRICE_LEVELS   = dictionary.getFieldByName(wPriceLevels);
            PL_ACTION      = dictionary.getFieldByName(wPlAction);
            PL_PRICE       = dictionary.getFieldByName(wPlPrice);
            PL_SIDE        = dictionary.getFieldByName(wPlSide);
            PL_SIZE        = dictionary.getFieldByName(wPlSize);
            PL_SIZE_CHANGE = dictionary.getFieldByName(wPlSizeChange);
            PL_TIME        = dictionary.getFieldByName(wPlTime);
            PL_NUM_ENTRIES = dictionary.getFieldByName(wPlNumEntries);
            PL_NUM_ATTACH  = dictionary.getFieldByName(wPlNumAttach);
            PL_ENTRIES     = dictionary.getFieldByName(wPlEntries);
            ENTRY_ID       = dictionary.getFieldByName(wEntryId);
            ENTRY_ACTION   = dictionary.getFieldByName(wEntryAction);
            ENTRY_REASON   = dictionary.getFieldByName(wEntryReason);
            ENTRY_SIZE     = dictionary.getFieldByName(wEntrySize);
            ENTRY_TIME     = dictionary.getFieldByName(wEntryTime);
            ENTRY_STATUS   = dictionary.getFieldByName(wEntryStatus);

            mNumLevelFields = 0;
            while (true)
            {
                string wPriceLevel = lookupFieldName(
                    properties,
                    "wPriceLevel" + (mNumLevelFields + 1));
                if (dictionary.getFieldByName(wPriceLevel) == null)
                {
                    break;
                }
                mNumLevelFields++;
            }

            PRICE_LEVEL = new MamaFieldDescriptor[mNumLevelFields + 1];
            for (int i = 1; i <= mNumLevelFields; i++)
            {
                string wPriceLevel = lookupFieldName(properties, "wPriceLevel" + i);
                PRICE_LEVEL[i] = dictionary.getFieldByName(wPriceLevel);
            }

            mNumEntryFields = 0;
            while (true)
            {
                string wPlEntry = lookupFieldName(
                    properties,
                    "wPlEntry" + (mNumEntryFields + 1));
                if (dictionary.getFieldByName(wPlEntry) == null)
                {
                    break;
                }
                mNumEntryFields++;
            }

            PL_ENTRY = new MamaFieldDescriptor[mNumEntryFields + 1];
            for (int i = 1; i <= mNumEntryFields; i++)
            {
                string wPlEntry = lookupFieldName(properties, "wPlEntry" + i);
                PL_ENTRY[i] = dictionary.getFieldByName(wPlEntry);
            }

            mInitialised = true;
        }
        /// <summary>
        /// Set the dictionary for common quote fields.
        /// Maintains a cache of MamaFieldDescriptors for common quote
        /// related fields. The <code>properties</code> parameter allows users
        /// of the API to map the common dictionary names to something else
        /// if they are beig published under different names.
        /// </summary>
        /// <param name="dictionary">A reference to a valid MamaDictionary</param>
        /// <param name="properties">A NameValueCollection object containing field mappings. (See
        /// MamdaFields for more information)</param>
        public static void setDictionary(
            MamaDictionary dictionary,
            NameValueCollection properties)
        {
            if (mInitialised)
            {
                return;
            }

            string wSymbol       = lookupFieldName(properties, "wSymbol");
            string wIssueSymbol  = lookupFieldName(properties, "wIssueSymbol");
            string wPartId       = lookupFieldName(properties, "wPartId");
            string wSrcTime      = lookupFieldName(properties, "wSrcTime");
            string wActivityTime = lookupFieldName(properties, "wActivityTime");
            string wLineTime     = lookupFieldName(properties, "wLineTime");
            string wSendTime     = lookupFieldName(properties, "wSendTime");
            string wPubId        = lookupFieldName(properties, "wPubId");

            string wBidPrice         = lookupFieldName(properties, "wBidPrice");
            string wBidSize          = lookupFieldName(properties, "wBidSize");
            string wBidPartId        = lookupFieldName(properties, "wBidPartId");
            string wBidDepth         = lookupFieldName(properties, "wBidDepth");
            string wBidClose         = lookupFieldName(properties, "wBidClose");
            string wBidCloseDate     = lookupFieldName(properties, "wBidCloseDate");
            string wPrevBidClose     = lookupFieldName(properties, "wPrevBidClose");
            string wPrevBidCloseDate = lookupFieldName(properties, "wPrevBidCloseDate");
            string wBidHigh          = lookupFieldName(properties, "wBidHigh");
            string wBidLow           = lookupFieldName(properties, "wBidLow");

            string wAskPrice         = lookupFieldName(properties, "wAskPrice");
            string wAskSize          = lookupFieldName(properties, "wAskSize");
            string wAskPartId        = lookupFieldName(properties, "wAskPartId");
            string wAskDepth         = lookupFieldName(properties, "wAskDepth");
            string wAskClose         = lookupFieldName(properties, "wAskClose");
            string wAskCloseDate     = lookupFieldName(properties, "wAskCloseDate");
            string wPrevAskClose     = lookupFieldName(properties, "wPrevAskClose");
            string wPrevAskCloseDate = lookupFieldName(properties, "wPrevAskCloseDate");
            string wAskHigh          = lookupFieldName(properties, "wAskHigh");
            string wAskLow           = lookupFieldName(properties, "wAskLow");

            string wQuoteSeqNum      = lookupFieldName(properties, "wQuoteSeqNum");
            string wQuoteTime        = lookupFieldName(properties, "wQuoteTime");
            string wQuoteDate        = lookupFieldName(properties, "wQuoteDate");
            string wQuoteQualifier   = lookupFieldName(properties, "wQuoteQualifier");
            string wCondition        = lookupFieldName(properties, "wCondition");
            string wQuoteCount       = lookupFieldName(properties, "wQuoteCount");
            string wConflateCount    = lookupFieldName(properties, "wConflateQuoteCount");
            string wShortSaleBidTick = lookupFieldName(properties, "wShortSaleBidTick");
            string wBidTick          = lookupFieldName(properties, "wBidTick");

            string wAskTime                 = lookupFieldName(properties, "wAskTime");
            string wBidTime                 = lookupFieldName(properties, "wBidTime");
            string wAskIndicator            = lookupFieldName(properties, "wAskIndicator");
            string wBidIndicator            = lookupFieldName(properties, "wBidIndicator");
            string wAskUpdateCount          = lookupFieldName(properties, "wAskUpdateCount");
            string wBidUpdateCount          = lookupFieldName(properties, "wBidUpdateCount");
            string wAskYield                = lookupFieldName(properties, "wAskYield");
            string wBidYield                = lookupFieldName(properties, "wBidYield");
            string wShortSaleCircuitBreaker = lookupFieldName(properties, "wShortSaleCircuitBreaker");

            SYMBOL        = dictionary.getFieldByName(wSymbol);
            ISSUE_SYMBOL  = dictionary.getFieldByName(wIssueSymbol);
            PART_ID       = dictionary.getFieldByName(wPartId);
            SRC_TIME      = dictionary.getFieldByName(wSrcTime);
            ACTIVITY_TIME = dictionary.getFieldByName(wActivityTime);
            LINE_TIME     = dictionary.getFieldByName(wLineTime);
            SEND_TIME     = dictionary.getFieldByName(wSendTime);
            PUB_ID        = dictionary.getFieldByName(wPubId);

            BID_PRICE            = dictionary.getFieldByName(wBidPrice);
            BID_SIZE             = dictionary.getFieldByName(wBidSize);
            BID_PART_ID          = dictionary.getFieldByName(wBidPartId);
            BID_DEPTH            = dictionary.getFieldByName(wBidDepth);
            BID_CLOSE_PRICE      = dictionary.getFieldByName(wBidClose);
            BID_CLOSE_DATE       = dictionary.getFieldByName(wBidCloseDate);
            BID_PREV_CLOSE_PRICE = dictionary.getFieldByName(wPrevBidClose);
            BID_PREV_CLOSE_DATE  = dictionary.getFieldByName(wPrevBidCloseDate);
            BID_HIGH             = dictionary.getFieldByName(wBidHigh);
            BID_LOW = dictionary.getFieldByName(wBidLow);

            ASK_PRICE            = dictionary.getFieldByName(wAskPrice);
            ASK_SIZE             = dictionary.getFieldByName(wAskSize);
            ASK_PART_ID          = dictionary.getFieldByName(wAskPartId);
            ASK_DEPTH            = dictionary.getFieldByName(wAskDepth);
            ASK_CLOSE_PRICE      = dictionary.getFieldByName(wAskClose);
            ASK_CLOSE_DATE       = dictionary.getFieldByName(wAskCloseDate);
            ASK_PREV_CLOSE_PRICE = dictionary.getFieldByName(wPrevAskClose);
            ASK_PREV_CLOSE_DATE  = dictionary.getFieldByName(wPrevAskCloseDate);
            ASK_HIGH             = dictionary.getFieldByName(wAskHigh);
            ASK_LOW = dictionary.getFieldByName(wAskLow);

            QUOTE_SEQ_NUM     = dictionary.getFieldByName(wQuoteSeqNum);
            QUOTE_TIME        = dictionary.getFieldByName(wQuoteTime);
            QUOTE_DATE        = dictionary.getFieldByName(wQuoteDate);
            QUOTE_QUAL        = dictionary.getFieldByName(wQuoteQualifier);
            QUOTE_QUAL_NATIVE = dictionary.getFieldByName(wCondition);
            QUOTE_COUNT       = dictionary.getFieldByName(wQuoteCount);
            CONFLATE_COUNT    = dictionary.getFieldByName(wConflateCount);

            SHORT_SALE_BID_TICK = dictionary.getFieldByName(wShortSaleBidTick);
            BID_TICK            = dictionary.getFieldByName(wBidTick);


            ASK_TIME                   = dictionary.getFieldByName(wAskTime);
            BID_TIME                   = dictionary.getFieldByName(wBidTime);
            ASK_INDICATOR              = dictionary.getFieldByName(wAskIndicator);
            BID_INDICATOR              = dictionary.getFieldByName(wBidIndicator);
            ASK_UPDATE_COUNT           = dictionary.getFieldByName(wAskUpdateCount);
            BID_UPDATE_COUNT           = dictionary.getFieldByName(wBidUpdateCount);
            ASK_YIELD                  = dictionary.getFieldByName(wAskYield);
            BID_YIELD                  = dictionary.getFieldByName(wBidYield);
            SHORT_SALE_CIRCUIT_BREAKER = dictionary.getFieldByName(wShortSaleCircuitBreaker);


            MAX_FID      = dictionary.getMaxFid();
            mInitialised = true;
        }
Exemple #20
0
        /// <summary>
        /// Set the dictionary for common orderbook fields.
        /// Maintains a cache of MamaFieldDescriptors for common orderbook
        /// related fields. The <code>properties</code> parameter allows users
        /// of the API to map the common dictionary names to something else
        /// if they are beig published under different names.
        /// </summary>
        /// <param name="dictionary">A reference to a valid MamaDictionary</param>
        /// <param name="properties">A Properties object containing field mappings. (See
        /// MamdaFields for more information</param>
        public static void setDictionary(
			MamaDictionary dictionary,
			NameValueCollection properties)
        {
            if (mInitialised)
            {
                return;
            }

            MamdaCommonFields.setDictionary(dictionary, null);

            string wSrcTime       = lookupFieldName(properties, "wSrcTime");
            string wActivityTime  = lookupFieldName(properties, "wActivityTime");
            string wLineTime      = lookupFieldName(properties, "wLineTime");
            string wPartId        = lookupFieldName(properties, "wPartId");
            string wSeqNum        = lookupFieldName(properties, "wSeqNum");
            string wBookTime      = lookupFieldName(properties, "wBookTime");
            string wNumLevels     = lookupFieldName(properties, "wNumLevels");
            string wPriceLevels   = lookupFieldName(properties, "wPriceLevels");
            string wPlAction      = lookupFieldName(properties, "wPlAction");
            string wPlPrice       = lookupFieldName(properties, "wPlPrice");
            string wPlSide        = lookupFieldName(properties, "wPlSide");
            string wPlSize        = lookupFieldName(properties, "wPlSize");
            string wPlSizeChange  = lookupFieldName(properties, "wPlSizeChange");
            string wPlTime        = lookupFieldName(properties, "wPlTime");
            string wPlNumEntries  = lookupFieldName(properties, "wPlNumEntries");
            string wPlNumAttach   = lookupFieldName(properties, "wPlNumAttach");
            string wPlEntries     = lookupFieldName(properties, "wPlEntries");
            string wEntryId       = lookupFieldName(properties, "wEntryId");
            string wEntryAction   = lookupFieldName(properties, "wEntryAction");
            string wEntryReason   = lookupFieldName(properties, "wEntryReason");
            string wEntrySize     = lookupFieldName(properties, "wEntrySize");
            string wEntryTime     = lookupFieldName(properties, "wEntryTime");
            string wEntryStatus   = lookupFieldName(properties, "wEntryStatus");

            SRC_TIME       = dictionary.getFieldByName(wSrcTime);
            ACTIVITY_TIME  = dictionary.getFieldByName(wActivityTime);
            LINE_TIME      = dictionary.getFieldByName(wLineTime);
            PART_ID        = dictionary.getFieldByName(wPartId);
            SEQNUM         = dictionary.getFieldByName(wSeqNum);
            BOOK_TIME      = dictionary.getFieldByName(wBookTime);
            NUM_LEVELS     = dictionary.getFieldByName(wNumLevels);
            PRICE_LEVELS   = dictionary.getFieldByName(wPriceLevels);
            PL_ACTION      = dictionary.getFieldByName(wPlAction);
            PL_PRICE       = dictionary.getFieldByName(wPlPrice);
            PL_SIDE        = dictionary.getFieldByName(wPlSide);
            PL_SIZE        = dictionary.getFieldByName(wPlSize);
            PL_SIZE_CHANGE = dictionary.getFieldByName(wPlSizeChange);
            PL_TIME        = dictionary.getFieldByName(wPlTime);
            PL_NUM_ENTRIES = dictionary.getFieldByName(wPlNumEntries);
            PL_NUM_ATTACH  = dictionary.getFieldByName(wPlNumAttach);
            PL_ENTRIES     = dictionary.getFieldByName(wPlEntries);
            ENTRY_ID       = dictionary.getFieldByName(wEntryId);
            ENTRY_ACTION   = dictionary.getFieldByName(wEntryAction);
            ENTRY_REASON   = dictionary.getFieldByName(wEntryReason);
            ENTRY_SIZE     = dictionary.getFieldByName(wEntrySize);
            ENTRY_TIME     = dictionary.getFieldByName(wEntryTime);
            ENTRY_STATUS   = dictionary.getFieldByName(wEntryStatus);

            mNumLevelFields = 0;
            while (true)
            {
                string wPriceLevel = lookupFieldName(
                    properties,
                    "wPriceLevel" + (mNumLevelFields + 1));
                if (dictionary.getFieldByName(wPriceLevel) == null)
                    break;
                mNumLevelFields++;
            }

            PRICE_LEVEL = new MamaFieldDescriptor[mNumLevelFields + 1];
            for (int i = 1; i <= mNumLevelFields; i++)
            {
                string wPriceLevel = lookupFieldName(properties, "wPriceLevel" + i);
                PRICE_LEVEL[i] = dictionary.getFieldByName(wPriceLevel);
            }

            mNumEntryFields = 0;
            while (true)
            {
                string wPlEntry = lookupFieldName(
                    properties,
                    "wPlEntry" + (mNumEntryFields + 1));
                if (dictionary.getFieldByName(wPlEntry) == null)
                    break;
                mNumEntryFields++;
            }

            PL_ENTRY = new MamaFieldDescriptor[mNumEntryFields + 1];
            for (int i = 1; i <= mNumEntryFields; i++)
            {
                string wPlEntry = lookupFieldName(properties, "wPlEntry" + i);
                PL_ENTRY[i] = dictionary.getFieldByName(wPlEntry);
            }

            mInitialised = true;
        }
        public static void setDictionary(
            MamaDictionary dictionary,
            NameValueCollection properties)
        {
            if (mInitialised)
            {
                return;
            }

            string wHighIndicationPrice = lookupFieldName(properties, "wHighIndicationPrice");
            string wLowIndicationPrice  = lookupFieldName(properties, "wLowIndicationPrice");
            string wIndicationPrice     = lookupFieldName(properties, "wIndicationPrice");
            string wBuyVolume           = lookupFieldName(properties, "wBuyVolume");
            string wSellVolume          = lookupFieldName(properties, "wSellVolume");
            string wMatchVolume         = lookupFieldName(properties, "wMatchVolume");
            string wSecStatusQual       = lookupFieldName(properties, "wSecStatusQual");
            string wInsideMatchPrice    = lookupFieldName(properties, "wInsideMatchPrice");
            string wFarClearingPrice    = lookupFieldName(properties, "wFarClearingPrice");
            string wNearClearingPrice   = lookupFieldName(properties, "wNearClearingPrice");
            string wNoClearingPrice     = lookupFieldName(properties, "wNoClearingPrice");
            string wPriceVarInd         = lookupFieldName(properties, "wPriceVarInd");
            string wCrossType           = lookupFieldName(properties, "wCrossType");
            string wSrcTime             = lookupFieldName(properties, "wSrcTime");
            string wMsgType             = lookupFieldName(properties, "wMsgType");
            string wIssueSymbol         = lookupFieldName(properties, "wIssueSymbol");
            string wSymbol             = lookupFieldName(properties, "wSymbol");
            string wPartId             = lookupFieldName(properties, "wPartId");
            string wSeqNum             = lookupFieldName(properties, "wSeqNum");
            string wSecurityStatusOrig = lookupFieldName(properties, "wSecurityStatusOrig");
            string wSecurityStatusTime = lookupFieldName(properties, "wSecurityStatusTime");
            string wAuctionTime        = lookupFieldName(properties, "wAuctionTime");
            string wActivityTime       = lookupFieldName(properties, "wActivityTime");
            string wLineTime           = lookupFieldName(properties, "wLineTime");
            string wSendTime           = lookupFieldName(properties, "wSendTime");

            HIGH_INDICATION_PRICE = dictionary.getFieldByName(wHighIndicationPrice);
            LOW_INDICATION_PRICE  = dictionary.getFieldByName(wLowIndicationPrice);
            INDICATION_PRICE      = dictionary.getFieldByName(wIndicationPrice);
            BUY_VOLUME            = dictionary.getFieldByName(wBuyVolume);
            SELL_VOLUME           = dictionary.getFieldByName(wSellVolume);
            MATCH_VOLUME          = dictionary.getFieldByName(wMatchVolume);
            SECURITY_STATUS_QUAL  = dictionary.getFieldByName(wSecStatusQual);
            INSIDE_MATCH_PRICE    = dictionary.getFieldByName(wInsideMatchPrice);
            FAR_CLEARING_PRICE    = dictionary.getFieldByName(wFarClearingPrice);
            NEAR_CLEARING_PRICE   = dictionary.getFieldByName(wNearClearingPrice);
            NO_CLEARING_PRICE     = dictionary.getFieldByName(wNoClearingPrice);
            PRICE_VAR_IND         = dictionary.getFieldByName(wPriceVarInd);
            CROSS_TYPE            = dictionary.getFieldByName(wCrossType);
            SRC_TIME             = dictionary.getFieldByName(wSrcTime);
            MSG_TYPE             = dictionary.getFieldByName(wMsgType);
            ISSUE_SYMBOL         = dictionary.getFieldByName(wIssueSymbol);
            PART_ID              = dictionary.getFieldByName(wPartId);
            SEQ_NUM              = dictionary.getFieldByName(wSeqNum);
            SECURITY_STATUS_ORIG = dictionary.getFieldByName(wSecurityStatusOrig);
            SECURITY_STATUS_TIME = dictionary.getFieldByName(wSecurityStatusTime);
            AUCTION_TIME         = dictionary.getFieldByName(wAuctionTime);
            ACTIVITY_TIME        = dictionary.getFieldByName(wActivityTime);
            SEND_TIME            = dictionary.getFieldByName(wSendTime);
            LINE_TIME            = dictionary.getFieldByName(wLineTime);
            SYMBOL = dictionary.getFieldByName(wSymbol);

            MAX_FID      = dictionary.getMaxFid();
            mInitialised = true;
        }
Exemple #22
0
		/// <summary>
		/// Set the dictionary for common quote fields.
		/// Maintains a cache of MamaFieldDescriptors for common quote
		/// related fields. The <code>properties</code> parameter allows users
		/// of the API to map the common dictionary names to something else
		/// if they are beig published under different names.
		/// </summary>
		/// <param name="dictionary">A reference to a valid MamaDictionary</param>
		/// <param name="properties">A NameValueCollection object containing field mappings. (See
		/// MamdaFields for more information)</param>
		public static void setDictionary(
			MamaDictionary		dictionary,
			NameValueCollection	properties)
		{
			if (mInitialised)
			{
				return;
			}

			string wSymbol           = lookupFieldName (properties, "wSymbol");
			string wIssueSymbol      = lookupFieldName (properties, "wIssueSymbol");
			string wPartId           = lookupFieldName (properties, "wPartId");
			string wSrcTime          = lookupFieldName (properties, "wSrcTime");
			string wActivityTime     = lookupFieldName (properties, "wActivityTime");
			string wLineTime         = lookupFieldName (properties, "wLineTime");
			string wSendTime         = lookupFieldName (properties, "wSendTime");
			string wPubId            = lookupFieldName (properties, "wPubId");

			string wBidPrice         = lookupFieldName (properties, "wBidPrice");
			string wBidSize          = lookupFieldName (properties, "wBidSize");
			string wBidPartId        = lookupFieldName (properties, "wBidPartId");
			string wBidDepth         = lookupFieldName (properties, "wBidDepth"); 
			string wBidClose         = lookupFieldName (properties, "wBidClose");
			string wBidCloseDate     = lookupFieldName (properties, "wBidCloseDate");
			string wPrevBidClose     = lookupFieldName (properties, "wPrevBidClose");
			string wPrevBidCloseDate = lookupFieldName (properties, "wPrevBidCloseDate");
			string wBidHigh          = lookupFieldName (properties, "wBidHigh");
			string wBidLow           = lookupFieldName (properties, "wBidLow");

			string wAskPrice         = lookupFieldName (properties, "wAskPrice");
			string wAskSize          = lookupFieldName (properties, "wAskSize");
			string wAskPartId        = lookupFieldName (properties, "wAskPartId");
			string wAskDepth         = lookupFieldName (properties, "wAskDepth");
			string wAskClose         = lookupFieldName (properties, "wAskClose");
			string wAskCloseDate     = lookupFieldName (properties, "wAskCloseDate");
			string wPrevAskClose     = lookupFieldName (properties, "wPrevAskClose");
			string wPrevAskCloseDate = lookupFieldName (properties, "wPrevAskCloseDate");
			string wAskHigh          = lookupFieldName (properties, "wAskHigh");
			string wAskLow           = lookupFieldName (properties, "wAskLow");

			string wQuoteSeqNum      = lookupFieldName (properties, "wQuoteSeqNum");
			string wQuoteTime        = lookupFieldName (properties, "wQuoteTime");
            string wQuoteDate        = lookupFieldName (properties, "wQuoteDate");
			string wQuoteQualifier   = lookupFieldName (properties, "wQuoteQualifier");
			string wCondition        = lookupFieldName (properties, "wCondition");
			string wQuoteCount       = lookupFieldName (properties, "wQuoteCount");
            string wConflateCount       = lookupFieldName (properties, "wConflateQuoteCount");
			string wShortSaleBidTick = lookupFieldName (properties, "wShortSaleBidTick");
			string wBidTick          = lookupFieldName (properties,  "wBidTick");
            
            string wAskTime          = lookupFieldName (properties, "wAskTime");
            string wBidTime          = lookupFieldName (properties, "wBidTime");
            string wAskIndicator     = lookupFieldName (properties, "wAskIndicator");
            string wBidIndicator     = lookupFieldName (properties, "wBidIndicator");
            string wAskUpdateCount   = lookupFieldName (properties, "wAskUpdateCount");
            string wBidUpdateCount   = lookupFieldName (properties, "wBidUpdateCount");
            string wAskYield         = lookupFieldName (properties, "wAskYield");
            string wBidYield         = lookupFieldName (properties, "wBidYield");   
            string wShortSaleCircuitBreaker = lookupFieldName(properties, "wShortSaleCircuitBreaker");

			SYMBOL				= dictionary.getFieldByName (wSymbol);
			ISSUE_SYMBOL		= dictionary.getFieldByName (wIssueSymbol);
			PART_ID				= dictionary.getFieldByName (wPartId);
			SRC_TIME			= dictionary.getFieldByName (wSrcTime);
			ACTIVITY_TIME		= dictionary.getFieldByName (wActivityTime);
			LINE_TIME			= dictionary.getFieldByName (wLineTime);
			SEND_TIME			= dictionary.getFieldByName (wSendTime);
			PUB_ID				= dictionary.getFieldByName (wPubId);

			BID_PRICE			= dictionary.getFieldByName (wBidPrice);
			BID_SIZE			= dictionary.getFieldByName (wBidSize);
			BID_PART_ID			= dictionary.getFieldByName (wBidPartId);  
			BID_DEPTH			= dictionary.getFieldByName (wBidDepth);
			BID_CLOSE_PRICE		= dictionary.getFieldByName (wBidClose);
			BID_CLOSE_DATE		= dictionary.getFieldByName (wBidCloseDate);
			BID_PREV_CLOSE_PRICE = dictionary.getFieldByName (wPrevBidClose);
			BID_PREV_CLOSE_DATE = dictionary.getFieldByName (wPrevBidCloseDate);
			BID_HIGH			= dictionary.getFieldByName (wBidHigh);
			BID_LOW				= dictionary.getFieldByName (wBidLow);

			ASK_PRICE			= dictionary.getFieldByName (wAskPrice);
			ASK_SIZE			= dictionary.getFieldByName (wAskSize);
			ASK_PART_ID			= dictionary.getFieldByName (wAskPartId);
			ASK_DEPTH			= dictionary.getFieldByName (wAskDepth);
			ASK_CLOSE_PRICE		= dictionary.getFieldByName (wAskClose);
			ASK_CLOSE_DATE		= dictionary.getFieldByName (wAskCloseDate);
			ASK_PREV_CLOSE_PRICE = dictionary.getFieldByName (wPrevAskClose);
			ASK_PREV_CLOSE_DATE = dictionary.getFieldByName (wPrevAskCloseDate);
			ASK_HIGH			= dictionary.getFieldByName (wAskHigh);
			ASK_LOW				= dictionary.getFieldByName (wAskLow);

			QUOTE_SEQ_NUM		= dictionary.getFieldByName (wQuoteSeqNum);
			QUOTE_TIME			= dictionary.getFieldByName (wQuoteTime);
            QUOTE_DATE			= dictionary.getFieldByName (wQuoteDate);
			QUOTE_QUAL			= dictionary.getFieldByName (wQuoteQualifier);
			QUOTE_QUAL_NATIVE	= dictionary.getFieldByName (wCondition);
			QUOTE_COUNT			= dictionary.getFieldByName (wQuoteCount);
            CONFLATE_COUNT      = dictionary.getFieldByName (wConflateCount);

			SHORT_SALE_BID_TICK = dictionary.getFieldByName (wShortSaleBidTick);
			BID_TICK            = dictionary.getFieldByName (wBidTick);
            
            
            ASK_TIME            = dictionary.getFieldByName (wAskTime);
            BID_TIME            = dictionary.getFieldByName (wBidTime);
            ASK_INDICATOR       = dictionary.getFieldByName (wAskIndicator);
            BID_INDICATOR       = dictionary.getFieldByName (wBidIndicator);
            ASK_UPDATE_COUNT    = dictionary.getFieldByName (wAskUpdateCount);
            BID_UPDATE_COUNT    = dictionary.getFieldByName (wBidUpdateCount);
            ASK_YIELD           = dictionary.getFieldByName (wAskYield);
            BID_YIELD           = dictionary.getFieldByName (wBidYield);
            SHORT_SALE_CIRCUIT_BREAKER = dictionary.getFieldByName(wShortSaleCircuitBreaker);
           

			MAX_FID = dictionary.getMaxFid();
			mInitialised = true;
		}
Exemple #23
0
        /// <summary>
        /// Invoke the specified callback for each field in the message.
        /// </summary>
        /// <param name="iterator"></param>
        /// <param name="dictionary"></param>
        /// <param name="closure"></param>
        public void iterateFields(
			MamaMsgFieldIterator iterator,
			MamaDictionary  dictionary,
			object closure)
        {
            #if MAMA_WRAPPERS_CHECK_ARGUMENTS
            if (iterator == null)
            {
                throw new ArgumentNullException("iterator");
            }
            #endif // MAMA_WRAPPERS_CHECK_ARGUMENTS
            EnsurePeerCreated();

            IntPtr dictHandle = dictionary != null ? dictionary.NativeHandle : IntPtr.Zero;
            if (forwarder == null)
            {
                forwarder = new CallbackForwarder(this, iterator, closure);
                callback =
                    new CallbackForwarder.MamaMessageIteratorDelegate(forwarder.OnField);
                GC.SuppressFinalize(forwarder);
                GC.SuppressFinalize(callback);
            }
            else
            {
                forwarder.mCallback = iterator;
                forwarder.mClosure = closure;
            }
            int code = NativeMethods.mamaMsg_iterateFields(nativeHandle, callback, dictHandle, nativeHandle);
            CheckResultCode(code);

            GC.KeepAlive(iterator);
            GC.KeepAlive(dictionary);
        }
Exemple #24
0
        /// <summary>
        /// This function will clean up all the objects initialised before Mama.start is called.
        /// </summary>
        private void uninitializeMama()
        {
            if (m_source != null)
            {
                m_source.destroy();
                m_source = null;
            }

            if (m_dictionary != null)
            {
                m_dictionary.Dispose();
                m_dictionary = null;
            }

            if (m_queueGroup != null)
            {
                m_queueGroup.destroyWait();
                m_queueGroup = null;
            }

            if (m_transport != null)
            {
                m_transport.destroy();
                m_transport = null;
            }

            Mama.close();
        }
Exemple #25
0
        /// <summary>
        /// Creates and iterator
        /// </summary>
        /// <param name="dictionary">Dictionary to use when iterating through the
        /// fields. Pass <code>null</code> is no dictionary is available</param>
        public MamaMsgIterator(MamaDictionary dictionary)
        {
            IntPtr dictHandle = dictionary != null ? dictionary.NativeHandle : IntPtr.Zero;

            int code = NativeMethods.mamaMsgIterator_create(ref nativeHandle, dictHandle);
            CheckResultCode(code);
        }
Exemple #26
0
			public CallbackForwarder(
				MamaDictionary sender,
				MamaDictionaryCallback callback)
			{
				this.mSender = sender;
				this.mCallback = callback;
			}
Exemple #27
0
        /// <summary>
        /// Dictionary callbacks
        /// </summary>
        /////////////////////////////////////////////////////////////////////////////////////////////////
        public void onTimeout(MamaDictionary dictionary)
        {
            Console.WriteLine("Dictionary timeout.");

            Mama.stop(mamaBridge);
        }
Exemple #28
0
        private static MamaDictionary buildDataDictionary(
			MamaTransport transport,
			MamaQueue defaultQueue,
			MamaSource dictionarySource)
        {
            bool[] gotDict = new bool[] { false };
            MamaDictionaryCallback dictionaryCallback = new DictionaryCallback(gotDict);
            lock (dictionaryCallback)
            {
                MamaSubscription subscription = new MamaSubscription ();

                MamaDictionary dictionary = new MamaDictionary();
                dictionary.create(
                    defaultQueue,
                    dictionaryCallback,
                    dictionarySource,
                    3,
                    10);

                Mama.start(myBridge);
                if (!gotDict[0])
                {
                    if (!Monitor.TryEnter(dictionaryCallback, 30000))
                    {
                        Console.Error.WriteLine("Timed out waiting for dictionary.");
                        Environment.Exit(0);
                    }
                    Monitor.Exit(dictionaryCallback);
                }
                return dictionary;
            }
        }
Exemple #29
0
        public void onComplete(MamaDictionary dictionary)
        {
            Console.WriteLine("Dictionary complete.");

            dictionaryComplete = true;

            Mama.stop(mamaBridge);
        }
Exemple #30
0
 public void onComplete(MamaDictionary dictionary)
 {
     lock (this)
     {
         gotDict_[0] = true;
         Mama.stop(myBridge);
         Monitor.PulseAll(this);
     }
 }
		public static void setDictionary(
			MamaDictionary		dictionary,
			NameValueCollection	properties)
		{
			if (mInitialised)
			{
				return;
			}

			string wHighIndicationPrice = lookupFieldName(properties, "wHighIndicationPrice");
			string wLowIndicationPrice  = lookupFieldName(properties, "wLowIndicationPrice");
			string wIndicationPrice     = lookupFieldName(properties, "wIndicationPrice");
			string wBuyVolume           = lookupFieldName(properties, "wBuyVolume");
			string wSellVolume          = lookupFieldName(properties, "wSellVolume");
			string wMatchVolume         = lookupFieldName(properties, "wMatchVolume");
			string wSecStatusQual       = lookupFieldName(properties, "wSecStatusQual");
			string wInsideMatchPrice    = lookupFieldName(properties, "wInsideMatchPrice");
			string wFarClearingPrice    = lookupFieldName(properties, "wFarClearingPrice");
			string wNearClearingPrice   = lookupFieldName(properties, "wNearClearingPrice");
			string wNoClearingPrice     = lookupFieldName(properties, "wNoClearingPrice");
			string wPriceVarInd         = lookupFieldName(properties, "wPriceVarInd");
			string wCrossType           = lookupFieldName(properties, "wCrossType");
			string wSrcTime             = lookupFieldName(properties, "wSrcTime");
			string wMsgType             = lookupFieldName(properties, "wMsgType");
			string wIssueSymbol         = lookupFieldName(properties, "wIssueSymbol");
			string wSymbol				= lookupFieldName(properties, "wSymbol");
			string wPartId              = lookupFieldName(properties, "wPartId");
			string wSeqNum              = lookupFieldName(properties, "wSeqNum");
			string wSecurityStatusOrig  = lookupFieldName(properties, "wSecurityStatusOrig");
			string wSecurityStatusTime  = lookupFieldName(properties, "wSecurityStatusTime");
			string wAuctionTime         = lookupFieldName(properties, "wAuctionTime");
			string wActivityTime        = lookupFieldName(properties, "wActivityTime");
			string wLineTime			= lookupFieldName(properties, "wLineTime");
			string wSendTime			= lookupFieldName(properties, "wSendTime");

			HIGH_INDICATION_PRICE = dictionary.getFieldByName(wHighIndicationPrice);
			LOW_INDICATION_PRICE  = dictionary.getFieldByName(wLowIndicationPrice);
			INDICATION_PRICE      = dictionary.getFieldByName(wIndicationPrice);
			BUY_VOLUME            = dictionary.getFieldByName(wBuyVolume);
			SELL_VOLUME           = dictionary.getFieldByName(wSellVolume);
			MATCH_VOLUME          = dictionary.getFieldByName(wMatchVolume);
			SECURITY_STATUS_QUAL  = dictionary.getFieldByName(wSecStatusQual);
			INSIDE_MATCH_PRICE    = dictionary.getFieldByName(wInsideMatchPrice);
			FAR_CLEARING_PRICE    = dictionary.getFieldByName(wFarClearingPrice);
			NEAR_CLEARING_PRICE   = dictionary.getFieldByName(wNearClearingPrice);
			NO_CLEARING_PRICE     = dictionary.getFieldByName(wNoClearingPrice);
			PRICE_VAR_IND         = dictionary.getFieldByName(wPriceVarInd);
			CROSS_TYPE            = dictionary.getFieldByName(wCrossType);
			SRC_TIME              = dictionary.getFieldByName(wSrcTime);
			MSG_TYPE              = dictionary.getFieldByName(wMsgType);  
			ISSUE_SYMBOL          = dictionary.getFieldByName(wIssueSymbol);
			PART_ID               = dictionary.getFieldByName(wPartId);
			SEQ_NUM               = dictionary.getFieldByName(wSeqNum);
			SECURITY_STATUS_ORIG  = dictionary.getFieldByName(wSecurityStatusOrig);
			SECURITY_STATUS_TIME  = dictionary.getFieldByName(wSecurityStatusTime);
			AUCTION_TIME          = dictionary.getFieldByName(wAuctionTime);
			ACTIVITY_TIME         = dictionary.getFieldByName(wActivityTime);
			SEND_TIME			  = dictionary.getFieldByName(wSendTime);
			LINE_TIME			  = dictionary.getFieldByName(wLineTime);
			SYMBOL				  = dictionary.getFieldByName(wSymbol);
        
			MAX_FID = dictionary.getMaxFid();
			mInitialised = true;
		}
Exemple #32
0
        /// <summary>
        /// Set the dictionary for common trade fields.
        /// Maintains a cache of MamaFieldDescriptors for common trade related
        /// fields. The <code>properties</code> parameter allows users of the API
        /// to map the common dictionary names to something else if they are being
        /// published under different names.
        /// </summary>
        /// <param name="dictionary">A reference to a valid MamaDictionary</param>
        /// <param name="properties">A NameValueCollection object containing field
        /// mappings. (See MamdaFields for further details)</param>
        public static void setDictionary(
            MamaDictionary  dictionary,
            NameValueCollection properties)
        {
            if (mInitialised)
            {
                return;
            }

            string wSymbol           = lookupFieldName(properties, "wSymbol");
            string wIssueSymbol      = lookupFieldName(properties, "wIssueSymbol");
            string wPartId           = lookupFieldName(properties, "wPartId");
            string wSrcTime          = lookupFieldName(properties, "wSrcTime");
            string wActivityTime     = lookupFieldName(properties, "wActivityTime");
            string wLineTime         = lookupFieldName(properties, "wLineTime");
            string MamaSendTime      = lookupFieldName(properties, MamaReservedFields.SendTime.getName());
            string wPubId            = lookupFieldName(properties, "wPubId");
            string wTradePrice       = lookupFieldName(properties, "wTradePrice");
            string wTradeDate        = lookupFieldName(properties, "wTradeDate");
            string wTradeTime        = lookupFieldName(properties, "wTradeTime");
            string wTradeTick        = lookupFieldName(properties, "wTradeTick");
            string wLastPrice        = lookupFieldName(properties, "wLastPrice");
            string wLastVolume       = lookupFieldName(properties, "wLastVolume");
            string wLastPartId       = lookupFieldName(properties, "wLastPartId");
            string wLastTime         = lookupFieldName(properties, "wLastTime");
            string wNetChange        = lookupFieldName(properties, "wNetChange");
            string wPctChange        = lookupFieldName(properties, "wPctChange");
            string wTradeVolume      = lookupFieldName(properties, "wTradeVolume");
            string wTotalVolume      = lookupFieldName(properties, "wTotalVolume");
            string wOffExTotalVolume = lookupFieldName(properties, "wOffExchangeTotalVolume");
            string wOnExTotalVolume  = lookupFieldName(properties, "wOnExchangeTotalVolume");
            string wTradeUnits       = lookupFieldName(properties, "wTradeUnits");
            string wHighPrice        = lookupFieldName(properties, "wHighPrice");
            string wLowPrice         = lookupFieldName(properties, "wLowPrice");
            string wOpenPrice        = lookupFieldName(properties, "wOpenPrice");
            string wClosePrice       = lookupFieldName(properties, "wClosePrice");
            string wCloseDate        = lookupFieldName(properties, "wCloseDate");
            string wPrevClosePrice   = lookupFieldName(properties, "wPrevClosePrice");
            string wPrevCloseDate    = lookupFieldName(properties, "wPrevCloseDate");
            string wAdjPrevClose     = lookupFieldName(properties, "wAdjPrevClose");
            string wPrevVolume       = lookupFieldName(properties, "wPrevVolume");
            string wTradeSeqNum      = lookupFieldName(properties, "wTradeSeqNum");
            string wTradeQualifier   = lookupFieldName(properties, "wTradeQualifier");
            string wTradePartId      = lookupFieldName(properties, "wTradePartId");
            string wAggressorSide    = lookupFieldName(properties, "wAggressorSide");
            string wTradeSide        = lookupFieldName(properties, "wTradeSide");
            string wTotalValue       = lookupFieldName(properties, "wTotalValue");
            string wOffExTotalValue  = lookupFieldName(properties, "wOffExchangeTotalValue");
            string wOnExTotalValue   = lookupFieldName(properties, "wOnExchangeTotalValue");
            string wVwap             = lookupFieldName(properties, "wVwap");
            string wOffExVwap        = lookupFieldName(properties, "wOffExchangeVwap");
            string wOnExVwap         = lookupFieldName(properties, "wOnExchangeVwap");
            string wStdDev           = lookupFieldName(properties, "wStdDev");
            string wStdDevSum        = lookupFieldName(properties, "wStdDevSum");
            string wStdDevSumSquares = lookupFieldName(properties, "wStdDevSumSquares");
            string wOrderId          = lookupFieldName(properties, "wOrderId");
            string wSettlePrice      = lookupFieldName(properties, "wSettlePrice");
            string wSettleDate       = lookupFieldName(properties, "wSettleDate");
            string wSaleCondition    = lookupFieldName(properties, "wSaleCondition");
            string wSellersSaleDays  = lookupFieldName(properties, "wSellersSaleDays");
            string wStopStockInd     = lookupFieldName(properties, "wStopStockIndicator");
            string wTradeExecVenue   = lookupFieldName(properties, "wTradeExecVenueEnum");
            string wOffExTradePrice  = lookupFieldName(properties, "wOffExchangeTradePrice");
            string wOnExTradePrice   = lookupFieldName(properties, "wOnExchangeTradePrice");
            string wIsIrregular      = lookupFieldName(properties, "wIsIrregular");
            string wIrregPartId      = lookupFieldName(properties, "wIrregPartId");
            string wIrregPrice       = lookupFieldName(properties, "wIrregPrice");
            string wIrregSize        = lookupFieldName(properties, "wIrregSize");
            string wIrregTime        = lookupFieldName(properties, "wIrregTime");
            string wOrigPartId       = lookupFieldName(properties, "wOrigPartId");
            string wOrigPrice        = lookupFieldName(properties, "wOrigPrice");
            string wOrigSize         = lookupFieldName(properties, "wOrigSize");
            string wOrigSeqNum       = lookupFieldName(properties, "wOrigSeqNum");
            string wOrigQualifier    = lookupFieldName(properties, "wOrigQualifier");
            string wOrigCondition    = lookupFieldName(properties, "wOrigCondition");
            string wOrigSaleDays     = lookupFieldName(properties, "wOrigSaleDays");
            string wOrigStopStockInd = lookupFieldName(properties, "wOrigStopStockInd");
            string wCorrPartId       = lookupFieldName(properties, "wCorrPartId");
            string wCorrPrice        = lookupFieldName(properties, "wCorrPrice");
            string wCorrSize         = lookupFieldName(properties, "wCorrSize");
            string wCorrQualifier    = lookupFieldName(properties, "wCorrQualifier");
            string wCorrCondition    = lookupFieldName(properties, "wCorrCondition");
            string wCorrSaleDays     = lookupFieldName(properties, "wCorrSaleDays");
            string wCorrStopStockInd = lookupFieldName(properties, "wCorrStopStockInd");
            string wCorrTime         = lookupFieldName(properties, "wCorrTime");
            string wCancelTime       = lookupFieldName(properties, "wCancelTime");
            string wTradeId          = lookupFieldName(properties, "wTradeId");
            string wOrigTradeId      = lookupFieldName(properties, "wOrigTradeId");
            string wCorrTradeId      = lookupFieldName(properties, "wCorrTradeId");
            string wPrimExch         = lookupFieldName(properties, "wPrimExch");
            string wTradeCount       = lookupFieldName(properties, "wTradeCount");
            string wBlockCount       = lookupFieldName(properties, "wBlockCount");
            string wBlockVolume      = lookupFieldName(properties, "wBlockVolume");
            string wUpdateAsTrade    = lookupFieldName(properties, "wUpdateAsTrade");
            string wLastTradeSeqNum  = lookupFieldName(properties, "wLastTradeSeqNum");
            string wHighSeqNum       = lookupFieldName(properties, "wHighSeqNum");
            string wLowSeqNum        = lookupFieldName(properties, "wLowSeqNum");
            string wTotalVolumeSeqNum= lookupFieldName(properties, "wTotalVolumeSeqNum");
            string wCurrencyCode     = lookupFieldName(properties, "wCurrencyCode");
            string wConflateCount    = lookupFieldName (properties, "wConflateTradeCount");
            string wShortSaleCircuitBreaker   = lookupFieldName (properties, "wShortSaleCircuitBreaker");
            string wOrigShortSaleCircuitBreaker   = lookupFieldName (properties, "wOrigShortSaleCircuitBreaker");
            string wCorrShortSaleCircuitBreaker   = lookupFieldName (properties, "wCorrShortSaleCircuitBreaker");

            SYMBOL                      = dictionary.getFieldByName(wSymbol);
            ISSUE_SYMBOL                = dictionary.getFieldByName(wIssueSymbol);
            PART_ID                     = dictionary.getFieldByName(wPartId);
            SRC_TIME                    = dictionary.getFieldByName(wSrcTime);
            ACTIVITY_TIME               = dictionary.getFieldByName(wActivityTime);
            LINE_TIME                   = dictionary.getFieldByName(wLineTime);
            SEND_TIME                   = dictionary.getFieldByName(MamaSendTime);
            PUB_ID                      = dictionary.getFieldByName(wPubId);
            TRADE_PRICE                 = dictionary.getFieldByName(wTradePrice);
            TRADE_DATE                  = dictionary.getFieldByName(wTradeDate);
            TRADE_TIME                  = dictionary.getFieldByName(wTradeTime);
            TRADE_DIRECTION             = dictionary.getFieldByName(wTradeTick);
            LAST_PRICE                  = dictionary.getFieldByName(wLastPrice);
            LAST_VOLUME                 = dictionary.getFieldByName(wLastVolume);
            LAST_PART_ID                = dictionary.getFieldByName(wLastPartId);
            LAST_TIME                   = dictionary.getFieldByName(wLastTime);
            NET_CHANGE                  = dictionary.getFieldByName(wNetChange);
            PCT_CHANGE                  = dictionary.getFieldByName(wPctChange);
            TRADE_SIZE                  = dictionary.getFieldByName(wTradeVolume);
            TOTAL_VOLUME                = dictionary.getFieldByName(wTotalVolume);
            OFF_EXCHANGE_TOTAL_VOLUME   = dictionary.getFieldByName(wOffExTotalVolume);
            ON_EXCHANGE_TOTAL_VOLUME    = dictionary.getFieldByName(wOnExTotalVolume);
            TRADE_UNITS                 = dictionary.getFieldByName(wTradeUnits);
            HIGH_PRICE                  = dictionary.getFieldByName(wHighPrice);
            LOW_PRICE                   = dictionary.getFieldByName(wLowPrice);
            OPEN_PRICE                  = dictionary.getFieldByName(wOpenPrice);
            CLOSE_PRICE                 = dictionary.getFieldByName(wClosePrice);
            CLOSE_DATE                  = dictionary.getFieldByName(wCloseDate);
            PREV_CLOSE_PRICE            = dictionary.getFieldByName(wPrevClosePrice);
            PREV_CLOSE_DATE             = dictionary.getFieldByName(wPrevCloseDate);
            ADJ_PREV_CLOSE              = dictionary.getFieldByName(wAdjPrevClose);
            PREV_VOLUME                 = dictionary.getFieldByName(wPrevVolume);
            TRADE_SEQNUM                = dictionary.getFieldByName(wTradeSeqNum);
            TRADE_QUALIFIER             = dictionary.getFieldByName(wTradeQualifier);
            TRADE_PART_ID               = dictionary.getFieldByName(wTradePartId);
            AGGRESSOR_SIDE              = dictionary.getFieldByName(wAggressorSide);
            TRADE_SIDE                  = dictionary.getFieldByName(wTradeSide);
            TOTAL_VALUE                 = dictionary.getFieldByName(wTotalValue);
            OFF_EXCHANGE_TOTAL_VALUE    = dictionary.getFieldByName(wTotalValue);
            ON_EXCHANGE_TOTAL_VALUE     = dictionary.getFieldByName(wTotalValue);
            VWAP                        = dictionary.getFieldByName(wVwap);
            OFF_EXCHANGE_VWAP           = dictionary.getFieldByName(wVwap);
            ON_EXCHANGE_VWAP            = dictionary.getFieldByName(wVwap);
            STD_DEV                     = dictionary.getFieldByName(wStdDev);
            STD_DEV_SUM                 = dictionary.getFieldByName(wStdDevSum);
            STD_DEV_SUM_SQUARES         = dictionary.getFieldByName(wStdDevSumSquares);
            ORDER_ID                    = dictionary.getFieldByName(wOrderId);
            SETTLE_PRICE                = dictionary.getFieldByName(wSettlePrice);
            SETTLE_DATE                 = dictionary.getFieldByName(wSettleDate);
            SALE_CONDITION              = dictionary.getFieldByName(wSaleCondition);
            SELLERS_SALE_DAYS           = dictionary.getFieldByName(wSellersSaleDays);
            STOP_STOCK_IND              = dictionary.getFieldByName(wStopStockInd);
            TRADE_EXEC_VENUE            = dictionary.getFieldByName(wTradeExecVenue);
            OFF_EXCHANGE_TRADE_PRICE    = dictionary.getFieldByName(wOffExTradePrice);
            ON_EXCHANGE_TRADE_PRICE     = dictionary.getFieldByName(wOnExTradePrice);
            IS_IRREGULAR                = dictionary.getFieldByName(wIsIrregular);
            IRREG_PART_ID               = dictionary.getFieldByName(wIrregPartId);
            IRREG_PRICE                 = dictionary.getFieldByName(wIrregPrice);
            IRREG_SIZE                  = dictionary.getFieldByName(wIrregSize);
            IRREG_TIME                  = dictionary.getFieldByName(wIrregTime);
            ORIG_PART_ID                = dictionary.getFieldByName(wOrigPartId);
            ORIG_PRICE                  = dictionary.getFieldByName(wOrigPrice);
            ORIG_SIZE                   = dictionary.getFieldByName(wOrigSize);
            ORIG_SEQNUM                 = dictionary.getFieldByName(wOrigSeqNum);
            ORIG_TRADE_QUALIFIER        = dictionary.getFieldByName(wOrigQualifier);
            ORIG_SALE_CONDITION         = dictionary.getFieldByName(wOrigCondition);
            ORIG_SELLERS_SALE_DAYS      = dictionary.getFieldByName(wOrigSaleDays);
            ORIG_STOP_STOCK_IND         = dictionary.getFieldByName(wOrigStopStockInd);
            CORR_PART_ID                = dictionary.getFieldByName(wCorrPartId);
            CORR_PRICE                  = dictionary.getFieldByName(wCorrPrice);
            CORR_SIZE                   = dictionary.getFieldByName(wCorrSize);
            CORR_TRADE_QUALIFIER        = dictionary.getFieldByName(wCorrQualifier);
            CORR_SALE_CONDITION         = dictionary.getFieldByName(wCorrCondition);
            CORR_SELLERS_SALE_DAYS      = dictionary.getFieldByName(wCorrSaleDays);
            CORR_STOP_STOCK_IND         = dictionary.getFieldByName(wCorrStopStockInd);
            CORR_TIME                   = dictionary.getFieldByName(wCorrTime);
            CANCEL_TIME                 = dictionary.getFieldByName(wCancelTime);
            TRADE_ID                    = dictionary.getFieldByName(wTradeId);
            ORIG_TRADE_ID               = dictionary.getFieldByName(wOrigTradeId);
            CORR_TRADE_ID               = dictionary.getFieldByName(wCorrTradeId);
            PRIMARY_EXCH                = dictionary.getFieldByName(wPrimExch);
            TRADE_COUNT                 = dictionary.getFieldByName(wTradeCount);
            BLOCK_COUNT                 = dictionary.getFieldByName(wBlockCount);
            BLOCK_VOLUME                = dictionary.getFieldByName(wBlockVolume);
            UPDATE_AS_TRADE             = dictionary.getFieldByName(wUpdateAsTrade);
            LAST_SEQNUM                 = dictionary.getFieldByName(wLastTradeSeqNum);
            HIGH_SEQNUM                 = dictionary.getFieldByName(wHighSeqNum);
            LOW_SEQNUM                  = dictionary.getFieldByName(wLowSeqNum);
            TOTAL_VOLUME_SEQNUM         = dictionary.getFieldByName(wTotalVolumeSeqNum);
            CURRENCY_CODE               = dictionary.getFieldByName(wCurrencyCode);
            CONFLATE_COUNT              = dictionary.getFieldByName(wConflateCount);
            SHORT_SALE_CIRCUIT_BREAKER	= dictionary.getFieldByName (wShortSaleCircuitBreaker);
            ORIG_SHORT_SALE_CIRCUIT_BREAKER = dictionary.getFieldByName (wOrigShortSaleCircuitBreaker);
            CORR_SHORT_SALE_CIRCUIT_BREAKER = dictionary.getFieldByName (wCorrShortSaleCircuitBreaker);

            MAX_FID                     = dictionary.getMaxFid();
            mInitialised                = true;
        }