from IPython.display import HTML !curl -o mtgoxUSD.csv http://api.bitcoincharts.com/v1/trades.csv?symbol=mtgoxUSD !head mtgoxUSD.csv import pandas as pd df=pd.read_csv("mtgoxUSD.csv", names=["unixtime", "price", "amount"], header=None) # Live-Abfrage #df=pd.read_csv("http://api.bitcoincharts.com/v1/trades.csv?symbol=mtgoxUSD", # names=["unixtime", "price", "amount"], # header=None) df df.head() import datetime df["datetime"]=df["unixtime"].map(datetime.datetime.fromtimestamp) df.head() df.index df["price"] ts=df.set_index("datetime") ts.head() del ts["unixtime"] ts.head() ts.price ts.price.describe() %pylab inline figsize(15,9) ts.price.plot() ts.price.plot() pd.rolling_mean(ts.price, 1000).plot(style="r-") ts.amount.plot() ts.amount.describe() ts["volume"]=ts["price"]*ts["amount"] ts.volume.plot() ts.volume.sum() ts.volume.max() ts.volume.idxmax() per_hour = ts.resample("H", how="sum") per_hour per_hour.volume.plot(kind="bar") !curl -o bitcoin_weighted_prices.json http://api.bitcoincharts.com/v1/weighted_prices.json import json !head bitcoin_weighted_prices.json data=[json.loads(line) for line in open("bitcoin_weighted_prices.json")] data data[0] wp=pd.DataFrame(data[0]) wp wp[["CAD", "EUR"]].T wp["datetime"]=wp.timestamp.apply(datetime.datetime.fromtimestamp) del wp["timestamp"] wp wp.T pd.DataFrame(wp.ix["24h", ["AUD", "EUR", "ILS"]]).T