c# - Why is my API not printing out to the textbox? -
so after understanding how api work managed set prints out data labels flawlessly. when try same thing different api (almost same one) decides not print out, feels missed code, me?
the first ticker (update_btc_ticker) works flawlessly, prints out should other 1 (update_btc_trades) not want print out, did miss out?
private void update_btc_ticker(object sender, eventargs e) { var client = new restclient("https://btc-e.com/api"); var request = new restrequest("2/btc_usd/ticker", method.get); //request.addheader("key", "46g9r9d6-wj77xoip-xh9hh5vq-a3xn3yoz-8t1r8i8t"); request.onbeforedeserialization = resp => { resp.contenttype = "application/json"; }; irestresponse<btcusdticker> response = client.execute<btcusdticker>(request); selllabel.text = convert.tostring(response.data.ticker.sell); buylabeltrue.text = convert.tostring(response.data.ticker.buy); } private void update_btc_trades(object sender, eventargs e) { var client = new restclient("https://btc-e.com/api"); var request = new restrequest("2/btc_usd/trades", method.get); //request.addheader("key", "46g9r9d6-wj77xoip-xh9hh5vq-a3xn3yoz-8t1r8i8t"); request.onbeforedeserialization = resp => { resp.contenttype = "application/json"; }; irestresponse<btctradeticker> response = client.execute<btctradeticker>(request); textbox1.text = convert.tostring(response.data.tradeticker.price); } public class btcusdticker { public ticker ticker { get; set; } } public class ticker { public float high { get; set; } public float low { get; set; } public float avg { get; set; } public float vol { get; set; } public float vol_cur { get; set; } public float last { get; set; } public float buy { get; set; } public float sell { get; set; } public int updated { get; set; } public int server_time { get; set; } } public class btctradeticker { public tradeticker tradeticker { get; set; } } public class tradeticker { public int date { get; set; } public double price { get; set; } public double amount { get; set; } public int tid { get; set; } public string price_currency { get; set; } public string item { get; set; } public string trade_type { get; set; } }
Comments
Post a Comment