{
 "metadata": {
  "name": "",
  "signature": "sha256:d278b13f509e61532f29ae9fa9f4f68f175fb992049eac973dd90c72a0c26d90"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from bokeh.plotting import *\n",
      "import numpy as np"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "output_notebook()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Define Bollinger Bands.\n",
      "upperband = np.random.random_integers(100, 150, size=100)\n",
      "lowerband = upperband - 100\n",
      "x_data = np.arange(1, 101)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Bollinger shading glyph:\n",
      "band_x = np.append(x_data, x_data[::-1]) \n",
      "band_y = np.append(lowerband, upperband[::-1])  "
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "p = figure(x_axis_type='datetime')\n",
      "p.patch(band_x, band_y, color='#7570B3', fill_alpha=0.2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "p.title = 'Bollinger Bands'\n",
      "p.plot_height = 600\n",
      "p.plot_width = 800\n",
      "p.grid.grid_line_alpha = 0.4"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "show(p)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}