Esempio n. 1
0
        public void ParserMultipleMessageTypes()
        {
            byte[] message0 = new MessageBuilder().AddRaw("35=D|53=10|44=145|55=ABC|").Build();
            byte[] message1 = new MessageBuilder().AddRaw("35=S|53=1|44=120|55=ABC.S|").Build();

            // Registering both Slice and Order message types when building the message parser.
            var parser = new ParserBuilder <object>()
                         .AddOutputType <Order>()
                         .AddOutputType <Slice>()
                         .Build <byte>() as MessageParser;

            Order order = parser.Parse <Order>(message0);
            Slice slice = parser.Parse <Slice>(message1);

            Console.WriteLine($"Order {order.Symbol} - Px {order.Price}, Qty {order.Quantity}");
            Console.WriteLine($"Slice {slice.Symbol} - Px {slice.Price}, Qty {slice.Quantity}");
        }
Esempio n. 2
0
        public void ParserByParserBuilder()
        {
            byte[] message = new MessageBuilder().AddRaw("35=D|53=10|44=145|55=ABC|").Build();
            var    parser  = new ParserBuilder <object>().AddOutputType <Order>().Build <byte>() as MessageParser;

            Order order = parser.Parse <Order>(message);

            Console.WriteLine($"Order {order.Symbol} - Px {order.Price}, Qty {order.Quantity}");
        }
Esempio n. 3
0
        public void ParserValueType()
        {
            byte[] message = new MessageBuilder().AddRaw("35=Q|134=10|132=145|62=20190112-23:34:12|").Build();
            IMessageParser <Quote, byte> parser = new ParserBuilder <Quote>().Build <byte>();

            Quote quote = parser.Parse(message);

            Console.WriteLine($"Quote Px {quote.Price}, Qty {quote.Quantity}");
        }
        public void Parser()
        {
            string message = "134=10|132=145|62=20190112-23:34:12|";
            IMessageParser <Quote, char> parser = new ParserBuilder <Quote>()
                                                  .Build <char>(new MessageParserOptions()
            {
                SOHChar = '|'
            });

            Quote quote = parser.Parse(message);

            Console.WriteLine($"Quote Px {quote.Price}, Qty {quote.Quantity}, @{quote.Expiry.Hour}:{quote.Expiry.Minute}");
        }
        public void ParserWithOptions()
        {
            string message = "134=10,132=145,62=20190112-23:34:12,";

            // Creating a new Quote parser with custom setting custom SOH char to ','.
            IMessageParser <Quote, char> parser = new ParserBuilder <Quote>()
                                                  .Build <char>(new MessageParserOptions()
            {
                SOHChar = ','
            });

            Quote quote = parser.Parse(message);

            Console.WriteLine($"Quote Px {quote.Price}, Qty {quote.Quantity}, @{quote.Expiry.Hour}:{quote.Expiry.Minute}");
        }