Пример #1
0
        public OrderbookPublicInformation GetOrderbookPublic(string symbol = "", int limit = -1)
        {
            OrderbookPublicResponse response = kucoinClient.GetOrderbookPublic(symbol, limit);

            OrderbookPublicInformation result = new OrderbookPublicInformation()
            {
                Datetime = response.Data.Timestamp.ToString(),
                Ask      = new List <OrderbookPublicInfoDetail>(),
                Bid      = new List <OrderbookPublicInfoDetail>()
            };

            foreach (var index in response.Data.Asks)
            {
                OrderbookPublicInfoDetail detailNew = new OrderbookPublicInfoDetail()
                {
                    Price = Convert.ToDouble(index[0], CultureInfo.InvariantCulture),
                    Size  = Convert.ToDouble(index[1], CultureInfo.InvariantCulture)
                };

                result.Ask.Add(detailNew);
            }
            foreach (var index in response.Data.Bids)
            {
                OrderbookPublicInfoDetail detailNew = new OrderbookPublicInfoDetail()
                {
                    Price = Convert.ToDouble(index[0], CultureInfo.InvariantCulture),
                    Size  = Convert.ToDouble(index[1], CultureInfo.InvariantCulture)
                };

                result.Bid.Add(detailNew);
            }

            return(result);
        }
        public OrderbookPublicInformation GetOrderbookPublic(string symbol = "", int limit = -1)
        {
            OrderbookPublicResponse response = hitbtcClient.GetOrderbookPublic(symbol, limit);

            OrderbookPublicInformation result = new OrderbookPublicInformation()
            {
                Datetime = response.Datetime,
                Ask      = new List <OrderbookPublicInfoDetail>(),
                Bid      = new List <OrderbookPublicInfoDetail>()
            };

            foreach (var index in response.Ask)
            {
                OrderbookPublicInfoDetail detailNew = new OrderbookPublicInfoDetail()
                {
                    Price = index.Price,
                    Size  = index.Size
                };

                result.Ask.Add(detailNew);
            }
            foreach (var index in response.Bid)
            {
                OrderbookPublicInfoDetail detailNew = new OrderbookPublicInfoDetail()
                {
                    Price = index.Price,
                    Size  = index.Size
                };

                result.Bid.Add(detailNew);
            }

            return(result);
        }