Bitstamp has live bitcoin data that are publicly available in JSON at this link. Do not try to access it more than 600 times in ten minutes or else they'll block your IP (plus, it's unnecessary anyway; read more here). The below is a C# approach to getting live data:
using (var WebClient = new System.Net.WebClient())
{
var json = WebClient.DownloadString("
https://www.bitstamp.net/api/ticker/");
string value = Convert.ToString(json);
// Parse/use from here
}
From here, you can parse the JSON and store it in a database (or with MongoDB insert it directly) and then access it.
For historic data (depending on the database - if that's how you approach it), do an insert from a flat file, which most databases allow you to use (for instance, with SQL Server you can do a BULK INSERT from a CSV file).