Exemple #1
0
        public TransformOrders GetOrder(string MainCoinName, string SecondCoinName)
        {
            if (MainCoinName == "USD")
            {
                return(new TransformOrders());
            }
            string site = String.Format("https://bittrex.com/api/v1.1/public/getorderbook?market={0}&type=both&depth=30", MainCoinName + '-' + SecondCoinName);

            TransformOrders temp = new TransformOrders();

            try
            {
                WebResponse resp = BittrexGetRequst.Requst(site);
                using (StreamReader stream = new StreamReader(
                           resp.GetResponseStream(), Encoding.UTF8))
                {
                    string str = stream.ReadToEnd();
                    var    res = JsonConvert.DeserializeObject <Field>(str);
                    if (res.success == true)
                    {
                        temp = new TransformOrders(res.result.sell, res.result.buy);
                    }
                }
                return(temp);
            }
            catch (WebException e)
            {
                string message = e.Message;
                //MessageBoxButtons buttons = MessageBoxButtons.OK;
                //MessageBox.Show(message, "BITTREX", buttons);
                return(temp);
            }
        }
Exemple #2
0
        public Dictionary <string, TransformInfo> GetInfo()
        {
            string site = "https://bittrex.com/api/v1.1/public/getcurrencies";
            Dictionary <string, TransformInfo> temp = new Dictionary <string, TransformInfo>();

            try {
                WebResponse resp = BittrexGetRequst.Requst(site);

                using (StreamReader stream = new StreamReader
                                                 (resp.GetResponseStream(), Encoding.UTF8))
                {
                    string str = stream.ReadToEnd();
                    var    a   = JsonConvert.DeserializeObject <Field>(str);
                    temp = a.result.ToDictionary(d => d.Currency, d => new TransformInfo(d));
                }
            }
            catch (System.Net.WebException)
            {
                temp = null;
            }
            return(temp);
        }