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.
This commit is contained in:
Thomas Wiecki
2014-01-16 12:07:33 -05:00
committed by Eddie Hebert
parent adcae79da3
commit b69590a2f7
9 changed files with 591 additions and 25 deletions
+2 -1
View File
@@ -27,9 +27,10 @@ from zipline.utils.test_utils import setup_logger
from zipline.sources.data_source import DataSource
import zipline.utils.factory as factory
from zipline.transforms import batch_transform
from zipline.test_algorithms import (BatchTransformAlgorithm,
BatchTransformAlgorithmMinute,
batch_transform,
ReturnPriceBatchTransform)
from zipline.algorithm import TradingAlgorithm