示例#1
0
        private static async Task <TradingMarketInfo> ParseResponseAsync(string response)
        {
            TradingMarketInfo MarketInfo = new TradingMarketInfo();

            using (JsonTextReader jtr = new JsonTextReader(new StringReader(response)))
            {
                while (await jtr.ReadAsync().ConfigureAwait(false))
                {
                    if (jtr.Value != null)
                    {
                        if (jtr.Value.ToString() == "pair")
                        {
                            await jtr.ReadAsync().ConfigureAwait(false);

                            MarketInfo.Pair = jtr.Value.ToString();
                        }
                        else if (jtr.Value.ToString() == "rate")
                        {
                            await jtr.ReadAsync().ConfigureAwait(false);

                            MarketInfo.Rate = Convert.ToDouble(jtr.Value.ToString());
                        }
                        else if (jtr.Value.ToString() == "limit")
                        {
                            await jtr.ReadAsync().ConfigureAwait(false);

                            MarketInfo.Limit = Convert.ToDouble(jtr.Value.ToString());
                        }
                        else if (jtr.Value.ToString() == "min")
                        {
                            await jtr.ReadAsync().ConfigureAwait(false);

                            MarketInfo.Min = Convert.ToDouble(jtr.Value.ToString());
                        }
                        else if (jtr.Value.ToString() == "minerFee")
                        {
                            await jtr.ReadAsync().ConfigureAwait(false);

                            MarketInfo.MinerFee = Convert.ToDouble(jtr.Value.ToString());
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
            }
            return(MarketInfo);
        }
示例#2
0
        /// <summary>
        /// Gets market info for all currency pairs.
        /// </summary>
        /// <returns>List of Market Information.</returns>
        internal static async Task <List <TradingMarketInfo> > GetAllMarketsAsync()
        {
            List <TradingMarketInfo> MarketList = new List <TradingMarketInfo>();
            List <TradingPair>       PairList   = await TradingPair.GetAllPairsAsync().ConfigureAwait(false);

            foreach (TradingPair tp in PairList)
            {
                TradingMarketInfo NewMarket = await GetMarketInfoAsync(tp.Pair).ConfigureAwait(false);

                MarketList.Add(NewMarket);
            }
            return(MarketList);
        }
示例#3
0
 /// <summary>
 /// Gets market info for specific currency pair.
 /// </summary>
 /// <param name="Ticker1">Ticker for currency to exchange from.</param>
 /// <param name="Ticker2">Ticker for currency to exchange to.</param>
 /// <returns>Market Information.</returns>
 public static async Task <TradingMarketInfo> GetMarketInfoAsync(string Ticker1, string Ticker2) =>
 await TradingMarketInfo.GetMarketInfoAsync(Ticker1, Ticker2).ConfigureAwait(false);
示例#4
0
 /// <summary>
 /// Gets market info for all currency pairs.
 /// </summary>
 /// <returns>List of Market Information.</returns>
 public static async Task <List <TradingMarketInfo> > GetAllMarketInfosAsync() =>
 await TradingMarketInfo.GetAllMarketsAsync().ConfigureAwait(false);
示例#5
0
 /// <summary>
 /// Gets market info for specific currency pair.
 /// </summary>
 /// <param name="Pair">Pair to get information for.</param>
 /// <returns>Market Information.</returns>
 public static async Task <TradingMarketInfo> GetMarketInfoAsync(string Pair) =>
 await TradingMarketInfo.GetMarketInfoAsync(Pair).ConfigureAwait(false);