Ejemplo n.º 1
0
def _plot_bollinger_bands(data, axes, period = 50, bandwidth = 1):
    _check_int(period,    raise_err = True)
    _check_int(bandwidth, raise_err = True)

    _check_pandas_series(data, raise_err = True)

    lowr, mean, uppr = _get_bollinger_bands(data, period = period, bandwidth = bandwidth)

    axes.plot(lowr, color = 'r', linestyle = '--')
    axes.plot(mean, color = 'g', linestyle = '--')
    axes.plot(uppr, color = 'r', linestyle = '--')
Ejemplo n.º 2
0
def _plot_bollinger_bands(data, axes, period = 50, bandwidth = 1):
    _check_int(period,    raise_err = True)
    _check_int(bandwidth, raise_err = True)

    _check_pandas_series(data, raise_err = True)

    lowr, mean, uppr = _get_bollinger_bands(data, period = period, bandwidth = bandwidth)

    axes.plot(lowr, color = 'r', linestyle = '--')
    axes.plot(mean, color = 'g', linestyle = '--')
    axes.plot(uppr, color = 'r', linestyle = '--')
Ejemplo n.º 3
0
def _get_bollinger_bands(data, period=50, bandwidth=1):
    _check_int(period, raise_err=True)
    _check_int(bandwidth, raise_err=True)

    _check_pandas_series(data, raise_err=True)

    roll = data.rolling(window=period)
    std, mean = roll.std(), roll.mean()

    upper = mean + bandwidth * std
    lower = mean - bandwidth * std

    return (lower, mean, upper)
Ejemplo n.º 4
0
def _get_bollinger_bands(data, period = 50, bandwidth = 1):
    _check_int(period,    raise_err = True)
    _check_int(bandwidth, raise_err = True)

    _check_pandas_series(data, raise_err = True)

    roll      = data.rolling(window = period)
    std, mean = roll.std(), roll.mean()

    upper     = mean + bandwidth * std
    lower     = mean - bandwidth * std

    return (lower, mean, upper)
Ejemplo n.º 5
0
def _plot_global_mean(data, axes):
    _check_pandas_series(data, raise_err=True)

    mean = data.mean()
    axes.axhline(mean, color='b', linestyle='-.')
Ejemplo n.º 6
0
def _plot_global_mean(data, axes):
    _check_pandas_series(data, raise_err = True)

    mean     = data.mean()
    axes.axhline(mean, color = 'b', linestyle = '-.')