'Write nans to the locations in data corresponding to the (date, asset)
pairs for which we wouldn\'t have data for `asset` on `date` in a
backtest.
Parameters
df : pd.DataFrame
A DataFrame with a DatetimeIndex as index and an object index of
Assets as columns.
This means that we write nans for dates after an asset\'s end_date and
**on or before** an asset\'s start_date.  The assymetry here is because
of the fact that, on the morning of an asset\'s first date, we haven\'t
yet seen any trades for that asset, so we wouldn\'t be able to show any
useful data to the user.'

def write_nans(self, df):

    index = df.index
    (min_, max_) = index[[0, (-1)]]
    for asset in df.columns:
        if (asset.start_date >= min_):
            start = index.get_loc(asset.start_date, method='bfill')
            df.loc[:(start + 1), asset] = nan
        if (asset.end_date <= max_):
            end = index.get_loc(asset.end_date)
            df.ix[(end + 1):, asset] = nan
