Beispiel #1
0
        public static SimpleOrderInfo CreateFromJObject(JArray obj)
        {
            if (obj == null)
            {
                return(null);
            }

            var r = new SimpleOrderInfo()
            {
                Price  = obj.Value <decimal>(0),
                Amount = obj.Value <decimal>(1),
            };

            return(r);
        }
Beispiel #2
0
        public static OrderBook CreateFromJObject(JObject o)
        {
            var r = new OrderBook();

            r.Asks = new List <SimpleOrderInfo>();
            r.Bids = new List <SimpleOrderInfo>();

            foreach (var item in o["asks"] as JArray)
            {
                var order = SimpleOrderInfo.CreateFromJObject(item as JArray);
                r.Asks.Add(order);
            }
            foreach (var item in o["bids"] as JArray)
            {
                var order = SimpleOrderInfo.CreateFromJObject(item as JArray);
                r.Bids.Add(order);
            }

            return(r);
        }