{
 "metadata": {
  "name": "",
  "signature": "sha256:90eb88d243db799eeb4faa3c9f910ae318467f17db9c425de01c3b6e7b6ad24e"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import cumprod, linspace, random\n",
      "import time\n",
      "\n",
      "from bokeh.sampledata.stocks import AAPL, FB, GOOG, IBM, MSFT\n",
      "from bokeh.plotting import *\n",
      "from bokeh.objects import GridPlot"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "num_points = 300\n",
      "\n",
      "now = time.time()\n",
      "dt = 24*3600 # days\n",
      "dates = linspace(now, now + num_points*dt, num_points)\n",
      "acme = cumprod(random.lognormal(0.0, 0.04, size=num_points))\n",
      "choam = cumprod(random.lognormal(0.0, 0.04, size=num_points))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "output_notebook()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "figure(x_axis_type = \"datetime\", tools=\"pan,wheel_zoom,box_zoom,reset,previewsave\")\n",
      "\n",
      "hold()\n",
      "\n",
      "line(dates, acme, color='#1F78B4', legend='ACME')\n",
      "line(dates, choam, color='#FB9A99', legend='CHOAM')\n",
      "\n",
      "curplot().title = \"Stock Returns\"\n",
      "grid().grid_line_alpha=0.3\n",
      "\n",
      "show()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "figure(tools=\"pan,wheel_zoom,box_zoom,reset,previewsave\")\n",
      "\n",
      "scatter(acme, choam, color='#A6CEE3', legend='close')\n",
      "\n",
      "curplot().title = \"ACME / CHOAM Correlations\"\n",
      "grid().grid_line_alpha=0.3\n",
      "\n",
      "show()  # open a browser"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}