Get Current Bitcoin Price With A Few Lines of C#

C# example of retrieving the current price of Bitcoin using Coindesk’s REST API:

string json;

using (var web = new System.Net.WebClient())
var url = @"";
json = web.DownloadString(url);

dynamic obj = Newtonsoft.Json.JsonConvert.DeserializeObject(json);
var currentPrice = Convert.ToDecimal(obj.bpi.USD.rate.Value);


Leave a Reply

Your email address will not be published. Required fields are marked *