Ejemplo n.º 1
0
        public static Ticker CreateFromJObject(JObject o)
        {
            if (o == null)
            {
                return null;
            }

            decimal highestBid = 0m, lowestAsk = 0m;

            var sellOrders = o["sellorders"] as JArray;
            if (sellOrders != null)
            {
                lowestAsk = sellOrders.Min(s => s.Value<decimal>("price"));
            }
            var buyOrders = o["buyorders"] as JArray;
            if (buyOrders != null)
            {
                highestBid = buyOrders.Max(s => s.Value<decimal>("price"));
            }


            var tick = new Ticker()
            {
                Bid = highestBid,
                Ask = lowestAsk,
                Volume = o.Value<decimal>("volume"),
                High = o.Value<decimal>("24hhigh"),
                Low = o.Value<decimal>("24hlow"),
                Last = o.Value<decimal>("lasttradeprice")
            };

            return tick;
        }
Ejemplo n.º 2
0
        public static Ticker CreateFromJObject(JObject o)
        {
            if (o == null)
            {
                return null;
            }

            var tick = new Ticker()
            {
                Bid = o.Value<decimal>("top_bid"),
                Ask = o.Value<decimal>("top_ask"),
                Volume = o.Value<decimal>("volume"),
                High = o.Value<decimal>("24hhigh"),
                Low = o.Value<decimal>("24hlow"),
                Last = o.Value<decimal>("lasttradeprice")
            };

            return tick;
        }