In [1]:
import pandas as pd
import urllib
import json
import matplotlib as mpl
mpl.use('agg')
import seaborn as sns; sns.set()
%matplotlib inline
In [2]:
def read_quandl(url):
d = json.loads(urllib.urlopen(url).read())
df = pd.DataFrame(d['data'], columns=d['column_names']).set_index('Date').sort()
return df
In [3]:
url = "https://www.quandl.com/api/v1/datasets/BCHAIN/TOTBC.json"
In [4]:
number = read_quandl(url)
Number of Bitcoins in existence.
In [5]:
number.plot(figsize=(10, 5))
Out[5]:
In [6]:
url = "https://www.quandl.com/api/v1/datasets/BAVERAGE/USD.json"
In [7]:
quotes = read_quandl(url)
Historical Bitcoin rate in USD.
In [8]:
quotes[['24h Average', 'Total Volume']][quotes.index > '2012-12-31'].plot(
subplots=True, figsize=(10, 5), color='b')
Out[8]:
Bitcoin rate to the USD in 2015.
In [9]:
quotes[['24h Average', 'Total Volume']][quotes.index > '2014-12-31'].plot(
subplots=True, figsize=(10, 5), color='b')
Out[9]: