示例#1
0
        public void OnMessage(QuickFix.FIX44.SecurityList msg,
                              SessionID s)
        {
            for (int idx = 0; idx < msg.NoRelatedSym.getValue(); idx++)
            {
                var symbol = new QuickFix.FIX44.SecurityList.NoRelatedSymGroup();
                msg.GetGroup(idx + 1, symbol);

                Console.WriteLine($"Received symbol {symbol.Symbol} @ {symbol.SecurityExchange}");
            }
            Console.WriteLine($"--------------------------------------------------");
        }
示例#2
0
        public void OnMessage(QuickFix.FIX44.SecurityList msg, SessionID s)
        {
            string text = $"Received SecurityList with id = {msg.SecurityReqID.getValue()}, type {msg.SecurityRequestResult.getValue()}";

            if (msg.IsSetTotNoRelatedSym())
            {
                text += $", TotNoRelatedSym = {msg.TotNoRelatedSym.getValue()}, LastFragment = {msg.LastFragment.getValue()}, NoRelatedSym = {msg.NoRelatedSym.getValue()}";
            }
            Console.WriteLine(text);
            return;

            for (int idx = 0; idx < msg.NoRelatedSym.getValue(); idx++)
            {
                var symbol = new QuickFix.FIX44.SecurityList.NoRelatedSymGroup();
                msg.GetGroup(idx + 1, symbol);

                Console.WriteLine($"Received symbol {symbol.Symbol} @ {symbol.SecurityExchange}");
            }
            Console.WriteLine($"--------------------------------------------------");
        }
        public void OnMessage(QuickFix.FIX44.SecurityList msg, SessionID sessionID) // -> this method get called by the Crack(msg,SessionID)
        {
            //received Security List message from HSC
            //parse this message to get Instrument's info like symbol, ref price
            //please view HSC Datafeeed document for detail info about Security List message
            Console.WriteLine("ON SecurityList Response:" + msg.ToString());

            int result = msg.SecurityRequestResult.getValue(); //0 = success , 1 = reject

            if (result == 0)
            {
                int noRelatedSym = msg.GetInt(Tags.NoRelatedSym);
                //parse repeating group, more details: http://quickfixn.org/tutorial/repeating-groups.html
                if (noRelatedSym > 0)
                {
                    for (int i = 0; i < noRelatedSym; i++)
                    {
                        var noRelatedSymGroup = new QuickFix.FIX44.SecurityList.NoRelatedSymGroup();

                        msg.GetGroup(i + 1, noRelatedSymGroup);
                        if (noRelatedSymGroup != null)
                        {
                            var   StockSymbol = noRelatedSymGroup.GetString(QuickFix.Fields.Symbol.TAG);
                            Stock stock       = new Stock {
                                Symbol = StockSymbol
                            };
                            var RefPrice = noRelatedSymGroup.GetDecimal(Tags.TradingReferencePrice);
                            stock.RefPrice = RefPrice;
                            Console.WriteLine("StockInfo:" + JsonConvert.SerializeObject(stock));
                        }
                    }
                }
            }
            else
            {
                Console.WriteLine("Security list request was rejected");
            }
        }