Пример #1
0
        public void OnMessage(QuickFix.FIX44.MarketDataIncrementalRefresh msg, SessionID s)
        {
            var symbols   = new HashSet <string>();
            var entryType = new HashSet <string>();

            for (int idx = 0; idx < msg.NoMDEntries.getValue(); idx++)
            {
                var item = new QuickFix.FIX44.MarketDataIncrementalRefresh.NoMDEntriesGroup();
                msg.GetGroup(idx + 1, item);
                symbols.Add(item.Symbol.getValue());
                if (MDEntryType.BID == item.MDEntryType.getValue())
                {
                    entryType.Add("BID");
                }
                else if (MDEntryType.OFFER == item.MDEntryType.getValue())
                {
                    entryType.Add("OFFER");
                }
                else if (MDEntryType.TRADE == item.MDEntryType.getValue())
                {
                    entryType.Add("TRADE");
                }

                if (!_seen.Contains(item.Symbol.getValue()) && MDEntryType.TRADE != item.MDEntryType.getValue())
                {
                    //throw new Exception("Incremential before snapshot");
                }
            }

            for (int idx = 0; idx < msg.NoMDEntries.getValue(); idx++)
            {
                var item = new QuickFix.FIX44.MarketDataIncrementalRefresh.NoMDEntriesGroup();
                msg.GetGroup(idx + 1, item);

                if (item.Symbol.getValue() == DebugSymbol)
                {
                    Console.WriteLine($"Received MarketDataIncrementalRefresh {msg.NoMDEntries.getValue()} items for {string.Join(",", symbols)} with {string.Join(",", entryType)} (lag: {(DateTime.UtcNow - msg.Header.GetDateTime(52)).TotalMilliseconds} / {(DateTime.UtcNow - item.MDEntryDate.getValue().Add(item.MDEntryTime.getValue().TimeOfDay)).TotalMilliseconds}).");
                }
                return;

                Console.WriteLine($"{item.MDEntryType} {item.MDUpdateAction} @ {item.Symbol}:");
                if (item.IsSetMDEntryID())
                {
                    Console.WriteLine($" ID: {item.MDEntryID}");
                }
                Console.WriteLine($" Date: {item.MDEntryDate}");
                Console.WriteLine($" Time: {item.MDEntryTime}");
                Console.WriteLine($" Px: {item.MDEntryPx}");
                Console.WriteLine($" Size: {item.MDEntrySize}");
                if (item.IsSetMDEntryOriginator())
                {
                    Console.WriteLine($" TakerSide: {item.MDEntryOriginator}");
                }
            }
            Console.WriteLine($"--------------------------------------------------");
        }
Пример #2
0
        public void OnMessage(QuickFix.FIX44.MarketDataIncrementalRefresh msg,
                              SessionID s)
        {
            for (int idx = 0; idx < msg.NoMDEntries.getValue(); idx++)
            {
                var item = new QuickFix.FIX44.MarketDataIncrementalRefresh.NoMDEntriesGroup();
                msg.GetGroup(idx + 1, item);

                Console.WriteLine($"{item.MDEntryType} {item.MDUpdateAction} @ {item.Symbol}:");
                if (item.IsSetMDEntryID())
                {
                    Console.WriteLine($" ID: {item.MDEntryID}");
                }
                Console.WriteLine($" Date: {item.MDEntryDate}");
                Console.WriteLine($" Time: {item.MDEntryTime}");
                Console.WriteLine($" Px: {item.MDEntryPx}");
                Console.WriteLine($" Size: {item.MDEntrySize}");
                if (item.IsSetMDEntryOriginator())
                {
                    Console.WriteLine($" TakerSide: {item.MDEntryOriginator}");
                }
            }
            Console.WriteLine($"--------------------------------------------------");
        }