Ejemplo n.º 1
0
        public Dictionary <string, TransformBallans> GetBalances()
        {
            var postData = new Dictionary <string, string>();
            var str      = ExmoPostRequst.PostString(Balance, postData);
            Dictionary <string, TransformBallans> temp = new Dictionary <string, TransformBallans>();
            var t = JsonConvert.DeserializeObject <ExmoBalanceField>(str);

            foreach (var item in t.balances)
            {
                var buf = new TransformBallans();
                buf.Available = Convert.ToDecimal(item.Value.Replace('.', ','));
                buf.OnOrders  = Convert.ToDecimal(t.reserved.Where(x => x.Key == item.Key).
                                                  First().Value.Replace('.', ','));
                temp.Add(item.Key, buf);
            }
            return(temp);
        }
Ejemplo n.º 2
0
        public Dictionary <string, TransformBallans> GetBalances()
        {
            WebResponse response = LiveCoinGetRequst.AuthRequst(Payment + "balances", "");
            Dictionary <string, TransformBallans> temp = new Dictionary <string, TransformBallans>();

            using (StreamReader stream = new StreamReader(
                       response.GetResponseStream(), Encoding.UTF8))
            {
                string str    = stream.ReadToEnd();
                var    resalt = JsonConvert.DeserializeObject <List <Field> >(str);
                foreach (var item in resalt)
                {
                    if (temp.ContainsKey(item.currency))
                    {
                        if (item.type == "available")
                        {
                            temp[item.currency].Available = Convert.ToDecimal(item.price);
                        }
                        if (item.type == "trade")
                        {
                            temp[item.currency].OnOrders = Convert.ToDecimal(item.price);
                        }
                    }
                    else
                    {
                        if (item.type == "available")
                        {
                            var a = new TransformBallans();
                            a.Available = Convert.ToDecimal(item.price);
                            temp.Add(item.currency, a);
                        }
                        if (item.type == "trade")
                        {
                            var a = new TransformBallans();
                            a.OnOrders = Convert.ToDecimal(item.price);
                            temp.Add(item.currency, a);
                        }
                    }
                }
                return(temp);
            }
        }