Example #1
0
        public static int Encode(NewOrderCross sno, DirectBuffer directBuffer, int bufferOffset)
        {
            // we position the car encoder on the direct buffer, at the correct offset (ie. just after the header)
            sno.WrapForEncode(directBuffer, bufferOffset);
            sno.SecurityID      = 48;
            sno.OrderQty        = 100;
            sno.MarketSegmentID = 70;
            sno.Price.Mantissa  = 11;
            NewOrderCross.NoSidesGroup g = sno.NoSidesCount(2);
            g.Next();
            g.Account = 1111;
            g.ClOrdID = 1234;
            g.Side    = Side.BUY;
            g.Next();
            g.Account = 2222;
            g.ClOrdID = 5678;
            g.Side    = Side.SELL;

            Negotiate n = new Negotiate();

            n.Timestamp.Time = 1123;

            return(sno.Size);
        }
Example #2
0
        public static void Decode(NewOrderCross sno,
                                  DirectBuffer directBuffer,
                                  int bufferOffset,
                                  int actingBlockLength,
                                  int actingVersion)
        {
            var buffer = new byte[128];
            var sb     = new StringBuilder();

            // position the car flyweight just after the header on the DirectBuffer
            sno.WrapForDecode(directBuffer, bufferOffset, actingBlockLength, actingVersion);

            NewOrderCross.NoSidesGroup g = sno.NoSides;
            while (g.HasNext)
            {
                g.Next();
                Console.WriteLine(g.Account);
                Console.WriteLine(g.ClOrdID);
                Console.WriteLine(g.Side);
            }
            Console.WriteLine(sb.ToString());
        }