Пример #1
0
        /// <summary>
        /// Used to get retrieve the orderbook for a given market
        /// Example: https://bittrex.com/api/v1.1/public/getorderbook?market=BTC-LTC&type=buy&depth=50
        /// </summary>
        /// <returns></returns>
        /// TODO: Create a json converter to handle this properly with OrderType.Both
        public async Task <ApiResult <BookOrder[]> > GetOrderBook(String market, BookOrderType orderType, int depth = 20)
        {
            var typeString = orderType.ToString().ToLower();

            var url = $"{_publicBaseUrl}/getorderbook?market={market}&type={typeString}&depth={depth}";

            var json = await GetPublicAsync(url);

            var apiResult = JsonConvert.DeserializeObject <ApiResult <BookOrder[]> >(json);

            if (!apiResult.Success)
            {
                return(apiResult);
            }

            foreach (var order in apiResult.Result)
            {
                order.OrderType = orderType;
            }

            return(apiResult);
        }
Пример #2
0
        public BookOrder[] GetOrderBook(string market, BookOrderType orderType, int depth = 20)
        {
            var res = m_api.GetOrderBook(market, orderType, depth);

            return(res);
        }