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);
        }
Example #2
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);
        }
Example #3
0
        public OrderbookPublicInformation GetOrderbookPublic(string symbol = "", int limit = -1)
        {
            GetDepthsResponse response = binanceClient.GetDepth(symbol, limit);

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

            foreach (var index in response.Asks)
            {
                double dPrice = Convert.ToDouble(index[0], CultureInfo.InvariantCulture);
                double dSize  = Convert.ToDouble(index[1], CultureInfo.InvariantCulture);

                OrderbookPublicInfoDetail detailNew = new OrderbookPublicInfoDetail()
                {
                    Price = dPrice,
                    Size  = dSize
                };

                result.Ask.Add(detailNew);
            }

            foreach (var index in response.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);
        }