public override Dictionary <string, Balance> GetBalancesEnd(string parameters) { string response = DoKeyRequest(parameters); BBalances jdata = Newtonsoft.Json.JsonConvert.DeserializeObject <BBalances>(response); //lastRequestMsg = jdata.message; //lastRequestStatus = jdata.success; if (!jdata.success) { throw new MarketAPIException("Market API Error:" + jdata.message); } Dictionary <string, Balance> balances; balances = new Dictionary <string, Balance>(); int n = 0; foreach (var item in jdata.result) { n++; balances.Add(item.Currency, new Balance { currency = item.Currency, balance = item.Balance }); } return(balances); }
public override Dictionary <string, Balance> GetBalancesEnd(string parameters) { string response = DoKeyRequest(parameters); string errmsg = ""; string errcaption = ""; BBalances jdata = null; try { jdata = Newtonsoft.Json.JsonConvert.DeserializeObject <BBalances>(response); if (!jdata.success) { errcaption = "Market API Error:"; errmsg = jdata.message; } if (jdata.result == null) { errcaption += "Market API Error:"; errmsg += "DataResult=Null >>> " + response; } } catch (Exception ex) { errcaption = "Parsing Response Error:"; errmsg = ex.Message + " >>> " + response; } if (errmsg != "") { throw new MarketAPIException(errcaption + " >> " + errmsg); } //lastRequestMsg = jdata.message; //lastRequestStatus = jdata.success; Dictionary <string, Balance> balances; balances = new Dictionary <string, Balance>(); int n = 0; foreach (var item in jdata.result) { n++; balances.Add(item.Currency, new Balance { currency = item.Currency, balance = item.Balance }); } return(balances); }