Ejemplo n.º 1
0
        public virtual void OnMessage(QuickFix.FIX44.MarketDataSnapshotFullRefresh message, SessionID session)
        {
            try
            {
                enqueueToSplit(message);

                // Requisita a proxima lista de papeis
                if (message.IsSetLastFragment() && message.LastFragment.ToString().ToUpper().Equals("Y"))
                {
                    if (message.IsSetMDReqID())
                    {
                        logger.Info("Final do snapshot ID [" + message.MDReqID.ToString() + "]");
                    }

                    if (_marketDataRequested >= _channelUmdfConfig.Markets.Count)
                    {
                        logger.Info("Final das requisicoes de snapshot");
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("onMessage(MarketDataSnapshotFullRefresh): " + ex.Message, ex);
            }
        }
        public void OnMessage(QuickFix.FIX44.MarketDataSnapshotFullRefresh marketDataSnapshot, SessionID session)
        {
            MarketPrice marketPrice = new MarketPrice
            {
                Symbol = marketDataSnapshot.Symbol.getValue()
            };
            var nomdentries = marketDataSnapshot.NoMDEntries;
            // message.GetGroup(1, noMdEntries);
            var grp = new QuickFix.FIX44.MarketDataSnapshotFullRefresh.NoMDEntriesGroup();

            for (int i = 1; i <= nomdentries.getValue(); i++)
            {
                grp = (QuickFix.FIX44.MarketDataSnapshotFullRefresh.NoMDEntriesGroup)marketDataSnapshot.GetGroup(i, grp);

                //	var grp = marketDataSnapshot.GetGroup(i, new QuickFix.FIX44.MarketDataSnapshotFullRefresh.NoMDEntriesGroup()) as QuickFix.FIX44.MarketDataSnapshotFullRefresh.NoMDEntriesGroup;
                MDEntryType priceType = grp.Get(new MDEntryType());
                MDEntryPx   mdEntryPx = grp.Get(new MDEntryPx());
                if (priceType.getValue() == MDEntryType.BID)
                {
                    marketPrice.Bid = mdEntryPx.getValue();
                }
                else if (priceType.getValue() == MDEntryType.OFFER)
                {
                    marketPrice.Offer = mdEntryPx.getValue();
                }
                else if (priceType.getValue() == MDEntryType.TRADE)
                {
                    marketPrice.TradedPrice = mdEntryPx.getValue();
                }
                else if (priceType.getValue() == MDEntryType.TRADING_SESSION_LOW_PRICE)
                {
                    marketPrice.LowPx = mdEntryPx.getValue();
                }
                else if (priceType.getValue() == MDEntryType.TRADING_SESSION_HIGH_PRICE)
                {
                    marketPrice.HighPx = mdEntryPx.getValue();
                }
            }

            if (OnMarketPrice != null)
            {
                OnMarketPrice(marketPrice);
            }
        }