Fixing DailyBarReader for volume to 0 instead of NaN

This commit is contained in:
Victor Grau Serrat
2017-10-17 23:16:49 -06:00
parent 733f2c3433
commit fb32e1ce5d
2 changed files with 5 additions and 1 deletions
+3 -1
View File
@@ -215,11 +215,13 @@ cpdef _read_bcolz_data(ctable_t table,
else:
continue
if column_name in ['open', 'high', 'low', 'close', 'volume']:
if column_name in ['open', 'high', 'low', 'close']:
where_nan = (outbuf == 0)
outbuf_as_float = outbuf.astype(float64) * .000000001
outbuf_as_float[where_nan] = NAN
results.append(outbuf_as_float)
elif column_name in ['volume']:
results.append(outbuf.astype(float64) * .000000001)
else:
results.append(outbuf)
return results
+2
View File
@@ -152,6 +152,8 @@ def load_crypto_market_data(trading_day=None, trading_days=None,
data_frequency='daily')
br.columns = ['close']
br = br.pct_change(1).iloc[1:]
br.loc[first_date]=0
br=br.sort_index()
# Override first_date for treasury data since we have it for many more years
# and is independent of crypto data