コード例 #1
0
        private ExchangeOrderBook ParseOrderBook(JToken token)
        {
            ExchangeOrderBook book = new ExchangeOrderBook();

            foreach (JArray array in token["bids"])
            {
                book.Bids.Add(new ExchangeOrderPrice {
                    Price = (decimal)array[0], Amount = (decimal)array[1]
                });
            }
            foreach (JArray array in token["asks"])
            {
                book.Asks.Add(new ExchangeOrderPrice {
                    Price = (decimal)array[0], Amount = (decimal)array[1]
                });
            }
            return(book);
        }
コード例 #2
0
        private bool ParseOrderBook(ExchangeTicker ticker, string symbole, out ExchangeOrderBook book)
        {
            bool result;

            book = new ExchangeOrderBook();
            book.Bids.Add(new ExchangeOrderPrice {
                Price = ticker.Bid, Amount = ticker.BidAmount,
            });
            book.Asks.Add(new ExchangeOrderPrice {
                Price = ticker.Ask, Amount = ticker.AskAmount,
            });

            decimal minAmount = MinAmountWithRounding(ticker.Bid, symbole);

            result = (ticker.BidAmount > minAmount);

            result = (!result ? false : (ticker.AskAmount > minAmount));

            return(result);
        }