I am currently working on homework 2 for the coursera computational finance.
While executing this line:
ep.eventprofiler(df_events, d_data, i_lookback=20, i_lookforward=20,
s_filename=report_filename, b_market_neutral=True, b_errorbars=True,
anaconda/lib/python2.7/site-packages/pandas/indexes/base.py:2397: RuntimeWarning: Cannot compare type 'Timestamp' with type 'str', sort order is undefined for incomparable objects
return this.join(other, how=how, return_indexers=return_indexers)
YHOO YUM ZION ZMH SPY
2008-01-02 16:00:00 23.72 37.88 45.29 66.29 144.93
2008-01-03 16:00:00 23.84 37.35 44.38 66.36 144.86
2008-01-04 16:00:00 23.16 36.82 42.40 66.50 141.31
2008-01-07 16:00:00 23.18 37.68 43.28 68.66 141.19
*** AttributeError: 'dict' object has no attribute 'dtypes'
the trouble is caused by the line:
df_rets = df_rets - df_rets[s_market_sym]
in these couple of lines:
if b_market_neutral == True: df_rets = df_rets - df_rets[s_market_sym] del df_rets[s_market_sym] del df_events[s_market_sym]
eventprofiler(...) function. Quite frankly I think the line is a bug and it should be put as a comment, to say at least - as the logic behind escapes my understanding. Others are just fine.
If you set the argument
False, it will give you a nice graph, but that also takes into account the SPY market data when calculating the mean return. So the workaround, in order to use a "proper" logic when calculating mean values, would be to comment this line and recompile QSTK with this modification.
Hope this helps.