'Internal utility method to return the trailing mean volume over the
past \'window_length\' days, and volatility of close prices for a
specific asset.
Parameters
data : The BarData from which to fetch the daily windows.
asset : The Asset whose data we are fetching.
window_length : Number of days of history used to calculate the mean
volume and close price volatility.
Returns
(mean volume, volatility)'

def _get_window_data(self, data, asset, window_length):

    try:
        values = self._window_data_cache.get(asset, data.current_session)
    except KeyError:
        try:
            volume_history = data.history(asset, 'volume', (window_length + 1), '1d')
            close_history = data.history(asset, 'close', (window_length + 1), '1d')
        except HistoryWindowStartsBeforeData:
            return (0, np.NaN)
        close_volatility = close_history[:(-1)].pct_change()[1:].std(skipna=False)
        values = {'volume': volume_history[:(-1)].mean(), 'close': (close_volatility * SQRT_252)}
        self._window_data_cache.set(asset, values, data.current_session)
    return (values['volume'], values['close'])
