public bool Equals(SmallFinancialTick t)
 {
     return(t.Bid == this.Bid &&
            t.Ask == this.Ask &&
            t.BidVolume == this.BidVolume &&
            t.AskVolume == this.AskVolume &&
            t.Timestamp == this.Timestamp);
 }
 public bool Equals(SmallFinancialTick t)
 {
     return t.Bid == this.Bid &&
            t.Ask == this.Ask &&
            t.BidVolume == this.BidVolume &&
            t.AskVolume == this.AskVolume &&
            t.Timestamp == this.Timestamp;
 }
        private static int SerializationCycle()
        {
            MemoryStream       outputStream = new MemoryStream();
            BinaryFormatter    formatter    = new BinaryFormatter();
            SmallFinancialTick tick         = new SmallFinancialTick();

            formatter.Serialize(outputStream, tick);

            byte[] data = outputStream.ToArray();

            MemoryStream inputStream = new MemoryStream(data);

            formatter.Deserialize(inputStream);
            return(data.Length);
        }
        private static int FudgeCycle(bool useNames, bool useOrdinals)
        {
            MemoryStream outputStream = new MemoryStream();
            var bw = new FudgeBinaryWriter(outputStream);
            SmallFinancialTick tick = new SmallFinancialTick();
            FudgeMsg msg = new FudgeMsg(fudgeContext);
            if (useNames && useOrdinals)
            {
                msg.Add("ask", (short)1, tick.Ask);
                msg.Add("askVolume", (short)2, tick.AskVolume);
                msg.Add("bid", (short)3, tick.Bid);
                msg.Add("bidVolume", (short)4, tick.BidVolume);
                msg.Add("ts", (short)5, tick.Timestamp);
            }
            else if (useNames)
            {
                msg.Add("ask", tick.Ask);
                msg.Add("askVolume", tick.AskVolume);
                msg.Add("bid", tick.Bid);
                msg.Add("bidVolume", tick.BidVolume);
                msg.Add("ts", tick.Timestamp);
            }
            else if (useOrdinals)
            {
                msg.Add(1, tick.Ask);
                msg.Add(2, tick.AskVolume);
                msg.Add(3, tick.Bid);
                msg.Add(4, tick.BidVolume);
                msg.Add(5, tick.Timestamp);
            }
            fudgeContext.Serialize(msg, bw);

            byte[] data = outputStream.ToArray();

            MemoryStream inputstream = new MemoryStream(data);
            var br = new FudgeBinaryReader(inputstream);
            msg = fudgeContext.Deserialize(inputstream).Message;

            tick = new SmallFinancialTick();
            if (useOrdinals)
            {
                tick.Ask = msg.GetDouble(1).Value;
                tick.AskVolume = msg.GetDouble(2).Value;
                tick.Bid = msg.GetDouble(3).Value;
                tick.BidVolume = msg.GetDouble(4).Value;
                tick.Timestamp = msg.GetLong(5).Value;
            }
            else if (useNames)
            {
                tick.Ask = msg.GetDouble("ask").Value;
                tick.AskVolume = msg.GetDouble("askVolume").Value;
                tick.Bid = msg.GetDouble("bid").Value;
                tick.BidVolume = msg.GetDouble("bidVolume").Value;
                tick.Timestamp = msg.GetLong("ts").Value;
            }
            else
            {
                throw new InvalidOperationException("Names or ordinals, pick at least one.");
            }
            return data.Length;
        }
        private static int SerializationCycle()
        {
            MemoryStream outputStream = new MemoryStream();
            BinaryFormatter formatter = new BinaryFormatter();
            SmallFinancialTick tick = new SmallFinancialTick();
            formatter.Serialize(outputStream, tick);

            byte[] data = outputStream.ToArray();

            MemoryStream inputStream = new MemoryStream(data);
            formatter.Deserialize(inputStream);
            return data.Length;
        }
        private static int FudgeCycle(bool useNames, bool useOrdinals)
        {
            MemoryStream       outputStream = new MemoryStream();
            var                bw           = new FudgeBinaryWriter(outputStream);
            SmallFinancialTick tick         = new SmallFinancialTick();
            FudgeMsg           msg          = new FudgeMsg(fudgeContext);

            if (useNames && useOrdinals)
            {
                msg.Add("ask", (short)1, tick.Ask);
                msg.Add("askVolume", (short)2, tick.AskVolume);
                msg.Add("bid", (short)3, tick.Bid);
                msg.Add("bidVolume", (short)4, tick.BidVolume);
                msg.Add("ts", (short)5, tick.Timestamp);
            }
            else if (useNames)
            {
                msg.Add("ask", tick.Ask);
                msg.Add("askVolume", tick.AskVolume);
                msg.Add("bid", tick.Bid);
                msg.Add("bidVolume", tick.BidVolume);
                msg.Add("ts", tick.Timestamp);
            }
            else if (useOrdinals)
            {
                msg.Add(1, tick.Ask);
                msg.Add(2, tick.AskVolume);
                msg.Add(3, tick.Bid);
                msg.Add(4, tick.BidVolume);
                msg.Add(5, tick.Timestamp);
            }
            fudgeContext.Serialize(msg, bw);

            byte[] data = outputStream.ToArray();

            MemoryStream inputstream = new MemoryStream(data);
            var          br          = new FudgeBinaryReader(inputstream);

            msg = fudgeContext.Deserialize(inputstream).Message;

            tick = new SmallFinancialTick();
            if (useOrdinals)
            {
                tick.Ask       = msg.GetDouble(1).Value;
                tick.AskVolume = msg.GetDouble(2).Value;
                tick.Bid       = msg.GetDouble(3).Value;
                tick.BidVolume = msg.GetDouble(4).Value;
                tick.Timestamp = msg.GetLong(5).Value;
            }
            else if (useNames)
            {
                tick.Ask       = msg.GetDouble("ask").Value;
                tick.AskVolume = msg.GetDouble("askVolume").Value;
                tick.Bid       = msg.GetDouble("bid").Value;
                tick.BidVolume = msg.GetDouble("bidVolume").Value;
                tick.Timestamp = msg.GetLong("ts").Value;
            }
            else
            {
                throw new InvalidOperationException("Names or ordinals, pick at least one.");
            }
            return(data.Length);
        }