private OrderBookLevel[] JArrayToTradingTicker(JArray data)
        {
            var result = new List <OrderBookLevel>();

            foreach (var item in data)
            {
                var array = item.ToArray();

                var level = new OrderBookLevel();

                if (array.Length == 2)
                {
                    level.Side   = _side;
                    level.Price  = (double)array[0];
                    level.Amount = (double)array[1];
                }
                else
                {
                    var side = (string)array[0];
                    level.Side = string.IsNullOrWhiteSpace(side) ? OrderBookSide.Undefined :
                                 side == "buy" ? OrderBookSide.Buy : OrderBookSide.Sell;
                    level.Price  = (double)array[1];
                    level.Amount = (double)array[2];
                }

                result.Add(level);
            }

            return(result.ToArray());
        }
 private OrderBookLevel ConvertLevel(string pair, FtxOrderBookLevel x)
 {
     return(new OrderBookLevel
            (
                x.Price.ToString(CultureInfo.InvariantCulture),
                ConvertSide(x.Side),
                x.Price,
                x.Amount,
                null,
                pair
            ));
 }