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