Esempio n. 1
0
        private static string Query(string method, BTCECURRENCYPAIR[] pairlist, Dictionary <string, string> args = null)
        {
            var           pairliststr = MakePairListString(pairlist);
            StringBuilder sb          = new StringBuilder();

            sb.Append("https://btc-e.com/api/3/");
            sb.Append(method);
            sb.Append("/");
            sb.Append(pairliststr);
            if (args != null && args.Count > 0)
            {
                sb.Append("?");
                var arr = args.Select(x => string.Format("{0}={1}", HttpUtility.UrlEncode(x.Key), HttpUtility.UrlEncode(x.Value))).ToArray();
                sb.Append(string.Join("&", arr));
            }
            var queryStr = sb.ToString();

            return(WEBAPI.Query(queryStr));
        }
Esempio n. 2
0
        public static decimal GetFee(BTCECURRENCYPAIR pair)
        {
            string queryStr = string.Format("https://btc-e.com/api/2/{0}/fee", BTCECURRENCYPAIRHELPER.ToString(pair));

            return(JObject.Parse(WEBAPI.Query(queryStr)).Value <decimal>("trade"));
        }
Esempio n. 3
0
        public static TICKER GetTicker(BTCECURRENCYPAIR pair)
        {
            string queryStr = string.Format("https://btc-e.com/api/2/{0}/ticker", BTCECURRENCYPAIRHELPER.ToString(pair));

            return(TICKER.ReadFromJObject(JObject.Parse(WEBAPI.Query(queryStr))["ticker"] as JObject));
        }
Esempio n. 4
0
        public static List <TRADEINFORMATIONv2> GetTrades(BTCECURRENCYPAIR pair)
        {
            string queryStr = string.Format("https://btc-e.com/api/2/{0}/trades", BTCECURRENCYPAIRHELPER.ToString(pair));

            return(JArray.Parse(WEBAPI.Query(queryStr)).OfType <JObject>().Select(TRADEINFORMATIONv2.ReadFromJObject).ToList());
        }
Esempio n. 5
0
        public static DEPTH GetDepth(BTCECURRENCYPAIR pair)
        {
            string queryStr = string.Format("https://btc-e.com/api/2/{0}/depth", BTCECURRENCYPAIRHELPER.ToString(pair));

            return(DEPTH.ReadFromJObject(JObject.Parse(WEBAPI.Query(queryStr))));
        }