public TransformOrders GetOrder(string MainCoinName, string SecondCoinName) { string site = String.Format("http://data.gate.io/api2/1/orderBook/{0}", SecondCoinName.ToLower() + "_" + MainCoinName.ToLower()); HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(site); TransformOrders temp = new TransformOrders(); try { WebResponse resp = req.GetResponse(); using (StreamReader stream = new StreamReader( resp.GetResponseStream(), Encoding.UTF8)) { string str = stream.ReadToEnd(); if (!str.Contains("invalid currency pair")) { var a = JsonConvert.DeserializeObject <Field>(str); temp = new TransformOrders(a.asks, a.bids); } return(temp); } } catch (Exception e) { string message = e.Message; //MessageBoxButtons buttons = MessageBoxButtons.OK; //MessageBox.Show(message, "Gate", buttons); return(temp); } }
public TransformOrders GetOrder(string MainCoinName, string SecondCoinName) { if (MainCoinName == "USD") { return(new TransformOrders()); } TransformOrders temp = new TransformOrders(); string site = String.Format("https://www.cryptopia.co.nz/api/GetMarketOrders/{0}/30", SecondCoinName + '_' + MainCoinName); try { WebResponse resp = CryptoGetRequst.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 && res.Error == null) { temp = new TransformOrders(res.Data.Sell.ToDictionary(d => d.Price, k => k.Volume), res.Data.Buy.ToDictionary(d => d.Price, k => k.Volume)); } } return(temp); } catch (WebException e) { string message = e.Message; //MessageBoxButtons buttons = MessageBoxButtons.OK; //MessageBox.Show(message, "CRYPTO", buttons); return(temp); } }
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); } }
public TransformOrders GetOrder(string MainCoinName, string SecondCoinName) { if (MainCoinName == "USD") { return(new TransformOrders()); } string site = String.Format("https://poloniex.com/public?command=returnOrderBook¤cyPair={0}", MainCoinName + "_" + SecondCoinName); TransformOrders temp = new TransformOrders(); try { WebResponse resp = PoloniexGetRequst.ProxyRequst(site); if (resp != null) { using (StreamReader stream = new StreamReader( resp.GetResponseStream(), Encoding.UTF8)) { string str = stream.ReadToEnd(); if (!str.Contains("error")) { var res = JsonConvert.DeserializeObject <LiveAndPoloniexField>(str); temp = new TransformOrders(res.asks, res.bids); } } } return(temp); } catch (WebException e) { string message = e.Message; //MessageBoxButtons buttons = MessageBoxButtons.OK; //MessageBox.Show(message, "POLONIEX", buttons); return(temp); } }
public TransformOrders GetOrder(string MainCoinName, string SecondCoinName) { if (MainCoinName == "USDT") { return(new TransformOrders()); } string end = @"?limit=30"; string start = "https://yobit.net/api/3/depth/"; TransformOrders temp = new TransformOrders(); string site = start + SecondCoinName.ToLower() + "_" + MainCoinName.ToLower() + end; try { WebResponse resp = GetRequst.Requst(site); using (StreamReader stream = new StreamReader( resp.GetResponseStream(), Encoding.UTF8)) { string str = stream.ReadToEnd(); if (!str.Contains("Invalid pair name") && !str.Contains("Ddos")) { var res = JsonConvert.DeserializeObject <Dictionary <string, Field> >(str); temp = new TransformOrders(res.First().Value.asks, res.First().Value.bids); } } return(temp); } catch (WebException e) { string message = e.Message; //MessageBoxButtons buttons = MessageBoxButtons.OK; //MessageBox.Show(message, "YOBIT", buttons); return(temp); } }
public TransformOrders GetOrder(string MainCoinName, string SecondCoinName) { string site = " https://api.exmo.com/v1/order_book/?pair=" + SecondCoinName + "_" + MainCoinName; TransformOrders temp = new TransformOrders(); List <List <decimal> > ask = new List <List <decimal> >(); List <List <decimal> > bid = new List <List <decimal> >(); try { WebResponse resp = ExmoGetRequst.Requst(site); using (StreamReader stream = new StreamReader( resp.GetResponseStream(), Encoding.UTF8)) { string str = stream.ReadToEnd(); if (str == "{}") { return(temp); } var res = JsonConvert.DeserializeObject <Dictionary <string, dynamic> >(str); if (res.First().Value.ask == null) { return(temp); } foreach (var i in res.First().Value.ask) { decimal price = i[0]; decimal count = i[1]; var buf = new List <decimal>(); buf.Add(price); buf.Add(count); ask.Add(buf); } foreach (var i in res.First().Value.bid) { decimal price = i[0]; decimal count = i[1]; var buf = new List <decimal>(); buf.Add(price); buf.Add(count); bid.Add(buf); } temp = new TransformOrders(ask, bid); } return(temp); } catch (WebException e) { string message = e.Message; //MessageBoxButtons buttons = MessageBoxButtons.OK; //MessageBox.Show(message, "POLONIEX", buttons); return(temp); } }