internal static OrderbookSnapshot FromProto(Msgs.OrderbookSnapshot o)
        {
            var asks = (o.Asks.Count > 0 ? o.Asks.Select(x => FromProto(x)) : EmptyOrders);
            var bids = o.Bids.Count > 0 ? o.Bids.Select(x => FromProto(x)) : EmptyOrders;

            return(new OrderbookSnapshot(o.StockId, DateTimeOffset.FromUnixTimeMilliseconds(o.TimeIssued), o.AskQuantity, o.BidQuantity, asks.ToList(), bids.ToList()));
        }
        internal static Msgs.OrderbookSnapshot ToProto(OrderbookSnapshot o)
        {
            var obs = new Msgs.OrderbookSnapshot()
            {
                AskQuantity = o.AskQuantity,
                BidQuantity = o.BidQuantity,
                StockId     = o.StockId,
                TimeIssued  = o.Timestamp.ToUnixTimeMilliseconds()
            };

            if (o.Asks.Count > 0)
            {
                obs.Asks.AddRange(o.Asks.Select(x => ToProto(x)));
            }

            if (o.Bids.Count > 0)
            {
                obs.Bids.AddRange(o.Bids.Select(x => ToProto(x)));
            }

            return(obs);
        }