Introduction

Simply the first step to prepare the data for the following notebooks


In [ ]:
import Quandl
import pandas as pd
import numpy as np
import blaze as bz

Data source is http://www.quandl.com. We use blaze to store data.


In [ ]:
with open('../.quandl_api_key.txt', 'r') as f:
    api_key = f.read()

In [ ]:
db = Quandl.get("EOD/DB", authtoken=api_key)
bz.odo(db['Rate'].reset_index(), '../data/db.bcolz')

In [ ]:
fx = Quandl.get("CURRFX/EURUSD", authtoken=api_key)
bz.odo(fx['Rate'].reset_index(), '../data/eurusd.bcolz')

Can also migrate it to a sqlite database


In [ ]:
bz.odo('../data/db.bcolz', 'sqlite:///osqf.db::db')

In [ ]:
%load_ext sql

In [ ]:
%%sql sqlite:///osqf.db
select * from db

Can perform queries


In [ ]:
d = bz.Data('../data/db.bcolz')
d.Close.max()