示例#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));
        }
示例#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"));
        }
示例#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));
        }
示例#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());
        }
示例#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))));
        }