示例#1
0
        public KunaUserInfo GetUserInfo()
        {
            var response = UserQuery("members/me", "GET", new Dictionary <string, string>());
            var json     = JObject.Parse(response);

            return(KunaUserInfo.FromJson(json));
        }
示例#2
0
        public static KunaUserInfo FromJson(JObject json)
        {
            var res = new KunaUserInfo()
            {
                Email     = (json["email"] as JValue).Value.ToString(),
                Activated = (bool)(json["activated"] as JValue).Value
            };

            foreach (JObject acc in (json["accounts"] as JArray))
            {
                var kunaAcc = new KunaAccount()
                {
                    Currency = acc["currency"].ToString(),
                    Balance  = Convert.ToDouble(acc["balance"].ToString(), CultureInfo.InvariantCulture),
                    Locked   = Convert.ToDouble(acc["locked"].ToString(), CultureInfo.InvariantCulture)
                };
                res.Accounts.Add(kunaAcc);
                res.AccountsByCurr[kunaAcc.Currency] = kunaAcc;
            }

            return(res);
        }