I am trying to get Bitcoin price data from Quandl, and the import seems to work.
However, the handle_data
never runs (no log output). What gives?
import pandas as pd
def initialize(context):
fetch_csv(
'https://www.quandl.com/api/v3/datasets/BCHARTS/BITFINEXUSD.csv?start_date=2015-01-01&end_date=2016-01-01',
pre_func=import_btc_data,
date_format='%Y-%m-%d',
symbol='btcusd'
)
def import_btc_data(df):
df.columns = ['date', 'open', 'high', 'low', 'close_price', 'volume_btc', 'volume', 'vwap']
log.info(df.head())
return df
def handle_data(context, data):
log.info('hi')
if 'close_price' not in data['btcusd']:
log.error('missing data')
record(price=data['btcusd']['close_price'])