simple moving average 

    Parameters
    ----------
    eqdata : DataFrame
    window : int, optional
        Lookback period for sma. Defaults to 20.
    outputcol : str, optional
        Column to use for output. Defaults to 'SMA'.
    selection : str, optional
        Column of eqdata on which to calculate sma. If
        `eqdata` has only 1 column, `selection` is ignored,
        and sma is calculated on that column. Defaults
        to 'Adj Close'.

def sma(eqdata, **kwargs):
    """ 
    simple moving average 

    Parameters
    ----------
    eqdata : DataFrame
    window : int, optional
        Lookback period for sma. Defaults to 20.
    outputcol : str, optional
        Column to use for output. Defaults to 'SMA'.
    selection : str, optional
        Column of eqdata on which to calculate sma. If
        `eqdata` has only 1 column, `selection` is ignored,
        and sma is calculated on that column. Defaults
        to 'Adj Close'.
    """
    if len(eqdata.shape) > 1 and eqdata.shape[1] != 1:
        _selection = kwargs.get('selection', 'Adj Close')
        _eqdata = eqdata.loc[:, _selection]
    else:
        _eqdata = eqdata
    _window = kwargs.get('window', 20)
    _outputcol = kwargs.get('outputcol', 'SMA')
    ret = pd.DataFrame(index=_eqdata.index, columns=[_outputcol], dtype=np.float64)
    ret.loc[:, _outputcol] = _eqdata.rolling(window=_window, center=False).mean().values.flatten()
    return ret