ENH: Factor out API methods. Add support for algo scripts.

This is a step towards the goal of uniting Quantopian scripts
and zipline.

To make the syntax of zipline identical to Quantopian
we break out the API methods (like order) and turn them into
functions. To access the algo object we add a thread local reference
to the current algorithm that is accessed in the API functions.

TradingAlgorithm now takes either a string or two functions
(initialize and handle_data) that it executes.

Use api method decorator for methods available in algoscript.

Ported appropriate algorithm tests from internal code.
ENH: Add Brazilian calendar for BMF&Bovespa stock market

Add Brazilian Bovespa Stock Market calendar
BLD: Update to latest Cython release.

0.19.2 -> 0.20
BLD: Update to latest tornado release.

Used by IPython notebook, update version from 3.1.1 to 3.2
BLD: Add mock to requirements file.

mock was recently added as part of the testing of port of the script
API for algorithms.
BUG: Fix typo in requirements file.

Fix incorrect number of '='
MAINT: Use more exact boolean checks for pandas structures.

To prepare for being compatible with pandas==0.13.0, which is stricter
on boolean checks.
merging with quantopian/master