Exemple #1
0
        private static async Task <TradingLimit> ParseResponseAsync(string response)
        {
            TradingLimit limit = new TradingLimit();

            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);

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

                            limit.Limit = Convert.ToDouble(jtr.Value.ToString());
                        }
                        else
                        {
                            continue;
                        }
                    }
                }
            }
            return(limit);
        }
Exemple #2
0
        /// <summary>
        /// Gets list of all trade limits.
        /// </summary>
        /// <returns>List of all trade limits.</returns>
        internal static async Task <List <TradingLimit> > GetAllLimitsAsync()
        {
            List <TradingLimit> LimitList = new List <TradingLimit>();
            List <TradingPair>  PairList  = await TradingPair.GetAllPairsAsync().ConfigureAwait(false);

            foreach (TradingPair tp in PairList)
            {
                TradingLimit NewLimit = await GetLimitAsync(tp.Pair).ConfigureAwait(false);

                LimitList.Add(NewLimit);
            }
            return(LimitList);
        }
Exemple #3
0
 /// <summary>
 /// Gets list of all trade limits.
 /// </summary>
 /// <returns>List of all trade limits.</returns>
 public static async Task <List <TradingLimit> > GetAllTradeLimitsAsync() =>
 await TradingLimit.GetAllLimitsAsync().ConfigureAwait(false);
Exemple #4
0
 /// <summary>
 /// Gets trade limit for specified currency pair.
 /// </summary>
 /// <param name="Pair">Currency pair to exchange.</param>
 /// <returns>Trading limit information.</returns>
 public static async Task <TradingLimit> GetTradeLimitAsync(string Pair) =>
 await TradingLimit.GetLimitAsync(Pair).ConfigureAwait(false);
Exemple #5
0
 /// <summary>
 /// Gets trade limit for specified currency pair.
 /// </summary>
 /// <param name="Ticker1">Ticker for currency to exchange from.</param>
 /// <param name="Ticker2">Ticker for currency to exchange to.</param>
 /// <returns>Trading limit information.</returns>
 public static async Task <TradingLimit> GetTradeLimitAsync(string Ticker1, string Ticker2) =>
 await TradingLimit.GetLimitAsync(Ticker1, Ticker2).ConfigureAwait(false);