Module Expr Str Import alias identifier ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias alias alias alias ImportFrom alias ImportFrom alias alias ImportFrom alias ImportFrom alias alias alias alias ImportFrom alias ImportFrom alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Num If NameLoad body Assign AttributeStore NameLoad attr NameLoad orelse Assign AttributeStore NameLoad attr ListLoad AttributeLoad AttributeLoad NameLoad attr attr If CompareIsNot NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad If CompareIsNot NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareLt AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AugAssignAdd AttributeStore NameLoad attr Num decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Num decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AugAssignAdd AttributeStore NameLoad attr Num decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults body Pass decorator_list FunctionDef arguments args NameParam NameParam defaults body Pass decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad If CompareEq AttributeLoad NameLoad attr Str body Raise Call NameLoad Str orelse Pass decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareEq AttributeLoad NameLoad attr Str body Raise Call NameLoad Str orelse Pass decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareEq AttributeLoad NameLoad attr Str body Raise Call NameLoad Str orelse Pass decorator_list FunctionDef arguments args NameParam defaults body If CompareEq AttributeLoad NameLoad attr Str body Raise Call NameLoad Str orelse Return ListLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Pass decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr Num decorator_list FunctionDef arguments args NameParam NameParam defaults body AugAssignAdd AttributeStore NameLoad attr Num If CompareGt AttributeLoad NameLoad attr Num body Expr BinOpDiv Num Num Pass decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body For NameStore Call NameLoad Num body Assign AttributeStore NameLoad attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr Num decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareGt AttributeLoad NameLoad attr Num body Import alias Expr Call AttributeLoad NameLoad attr Num Pass decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr Num decorator_list FunctionDef arguments args NameParam NameParam defaults body AugAssignAdd AttributeStore NameLoad attr Num Expr Call AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr Assign NameStore Str Expr Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Expr Call NameLoad NameLoad AttributeLoad NameLoad attr Str Num keyword AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr Num decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareEq AttributeLoad NameLoad attr Num body Assert CompareNotIn Num AttributeLoad AttributeLoad NameLoad attr attr orelse Assert CompareEq SubscriptLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Index Str AttributeLoad NameLoad attr Str Assert CompareEq SubscriptLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Index Str Call AttributeLoad NameLoad attr Call NameLoad Num Str Str AugAssignAdd AttributeStore NameLoad attr Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Num decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareEq AttributeLoad NameLoad attr Num body Assert CompareNotIn Num AttributeLoad AttributeLoad NameLoad attr attr orelse Assert CompareEq SubscriptLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Index Str AttributeLoad NameLoad attr Str Assert CompareEq SubscriptLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Index Str AttributeLoad NameLoad attr Str AugAssignAdd AttributeStore NameLoad attr Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Call AttributeLoad NameLoad attr Call NameLoad Num Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Call NameLoad Num Str decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults vararg kwarg body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareEq AttributeLoad NameLoad attr Num body Assert CompareEq Call NameLoad Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Num Assign NameStore Call NameLoad NameLoad AttributeLoad NameLoad attr Expr Call NameLoad Call AttributeLoad NameLoad attr Num Call AttributeLoad NameLoad attr Call NameLoad Num Str keyword Call NameLoad Num Num Assert CompareEq Call NameLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Call AttributeLoad NameLoad attr Num Num Assign NameStore SubscriptLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Call AttributeLoad NameLoad attr Num Index Num Assert CompareEq AttributeLoad NameLoad attr Num Assert CompareEq AttributeLoad NameLoad attr Num AugAssignAdd AttributeStore NameLoad attr Num decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareEq AttributeLoad NameLoad attr Num body Assert CompareNotIn Num AttributeLoad AttributeLoad NameLoad attr attr orelse Assert CompareEq SubscriptLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Index Str AttributeLoad NameLoad attr Str Assert CompareEq SubscriptLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Index Str Call AttributeLoad NameLoad attr Call NameLoad Num Str Str AugAssignAdd AttributeStore NameLoad attr Num Assign NameStore Num If Call NameLoad Call AttributeLoad NameLoad attr Num NameLoad body AugAssignMult NameStore AttributeLoad Call AttributeLoad NameLoad attr Num attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num BinOpMult Call AttributeLoad NameLoad attr Call NameLoad Num Str NameLoad decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Call NameLoad Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareEq AttributeLoad NameLoad attr Num body Assert CompareNotIn Num AttributeLoad AttributeLoad NameLoad attr attr orelse Assert CompareEq SubscriptLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Index Str AttributeLoad NameLoad attr Str Assert CompareEq SubscriptLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Index Str Call AttributeLoad NameLoad attr Call NameLoad Num Str Str Assign AttributeStore NameLoad attr Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Call NameLoad Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareEq AttributeLoad NameLoad attr Num body Assert CompareNotIn Num AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Num Assign AttributeStore NameLoad attr Num Return orelse Assert CompareEq SubscriptLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Index Str AttributeLoad NameLoad attr Str Assert CompareEq SubscriptLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Index Str Call AttributeLoad NameLoad attr Call NameLoad Num Str Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Num If Call NameLoad Call AttributeLoad NameLoad attr Num NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Call NameLoad Num Str Assign NameStore BinOpDiv BinOpMult Num AttributeLoad AttributeLoad NameLoad attr attr NameLoad orelse If Call NameLoad Call AttributeLoad NameLoad attr Num NameLoad body Assign NameStore BinOpDiv BinOpMult Num AttributeLoad AttributeLoad NameLoad attr attr BinOpMult Call AttributeLoad NameLoad attr Call NameLoad Num Str AttributeLoad Call AttributeLoad NameLoad attr Num attr Assign NameStore Call NameLoad Call NameLoad NameLoad AugAssignAdd AttributeStore NameLoad attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Call NameLoad Expr Call AttributeLoad NameLoad attr Call NameLoad Num decorator_list FunctionDef arguments args NameParam NameParam defaults body If UnaryOpNot AttributeLoad NameLoad attr body Assert CompareNotIn Num AttributeLoad AttributeLoad NameLoad attr attr orelse Assign NameStore BinOpMult AttributeLoad AttributeLoad NameLoad attr attr Num Assign NameStore BinOpMult SubscriptLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Index Str AttributeLoad NameLoad attr Assert CompareLtE Call NameLoad BinOpSub NameLoad NameLoad AttributeLoad NameLoad attr Str Assert CompareEq SubscriptLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Index Str Call AttributeLoad NameLoad attr Call NameLoad Num Str Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Call NameLoad Num Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Num Assign AttributeStore NameLoad attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Call NameLoad Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareEq AttributeLoad NameLoad attr Num body Assert CompareNotIn Num AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Num Assign AttributeStore NameLoad attr Num Return orelse Assert CompareEq SubscriptLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Index Str AttributeLoad NameLoad attr Str Assert CompareEq SubscriptLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Index Str Call AttributeLoad NameLoad attr Call NameLoad Num Str Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Num Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr BinOpDiv Num Call AttributeLoad NameLoad attr Call NameLoad Num Str If Call NameLoad Call AttributeLoad NameLoad attr Num NameLoad body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr BinOpDiv Num Call AttributeLoad NameLoad attr Call NameLoad Num Str If Call NameLoad Call AttributeLoad NameLoad attr Num NameLoad body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr BinOpDiv Num BinOpMult Call AttributeLoad NameLoad attr Call NameLoad Num Str AttributeLoad Call AttributeLoad NameLoad attr Num attr decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body If CompareGt Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr Num body If CompareGt SubscriptLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index AttributeLoad AttributeLoad NameLoad attr attr Index Str Num body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr UnaryOpUSub AttributeLoad NameLoad attr orelse Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num orelse Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Call AttributeLoad NameLoad attr keyword NameLoad decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad Assign AttributeStore NameLoad attr Num Expr Call AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad keyword NameLoad decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad body Assign AttributeStore NameLoad attr Num Expr Call AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad keyword NameLoad decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body Assign AttributeStore NameLoad attr Num Expr Call AttributeLoad NameLoad attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr Num Expr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr Num decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr Num Expr Call AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Call NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Num decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults vararg kwarg body Expr Call AttributeLoad NameLoad attr Call NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Pass decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults vararg kwarg body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num keyword Num Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num keyword Num Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num keyword Num keyword Num Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num keyword Num keyword Num Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num keyword Num Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num keyword Num Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num keyword Num keyword Num Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num keyword Num keyword Num Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num keyword Num Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num keyword Num decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults vararg kwarg body Pass decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr Num decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults vararg kwarg body If CompareNotIn Str NameLoad body Raise Call NameLoad Str orelse If UnaryOpNot Call NameLoad SubscriptLoad NameLoad Index Str TupleLoad NameLoad NameLoad body Assign AttributeStore NameLoad attr TupleLoad SubscriptLoad NameLoad Index Str orelse Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Str Assign AttributeStore NameLoad attr Call NameLoad GeneratorExp TupleLoad NameLoad ListLoad comprehension NameStore AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body For NameStore AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareIs NameLoad NameLoad body If CompareEq Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr Num body Assign NameStore AttributeLoad NameLoad attr orelse Assign NameStore BinOpMult TupleLoad AttributeLoad NameLoad attr Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults vararg kwarg body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If UnaryOpNot AttributeLoad NameLoad attr body For NameStore AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Num Assign AttributeStore NameLoad attr NameLoad If UnaryOpNot AttributeLoad NameLoad attr body Assign NameStore ListComp AttributeLoad NameLoad attr comprehension NameStore Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr If BoolOpAnd CompareGt Call NameLoad NameLoad Num Call NameLoad ListComp CompareEq NameLoad Num comprehension NameStore NameLoad body For NameStore AttributeLoad AttributeLoad NameLoad attr attr body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Num Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr keyword Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults vararg kwarg body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr SubscriptLoad Call AttributeLoad NameLoad attr Str Index Num decorator_list FunctionDef arguments args NameParam NameParam defaults body ImportFrom alias alias alias alias alias For NameStore ListLoad Call NameLoad Call NameLoad Num Call NameLoad Num Call NameLoad Num Num body With Call NameLoad NameLoad body Expr Call NameLoad AttributeLoad NameLoad attr Num keyword Num keyword NameLoad With Call NameLoad NameLoad body Expr Call NameLoad AttributeLoad NameLoad attr Num keyword Num keyword NameLoad With Call NameLoad NameLoad body Expr Call NameLoad AttributeLoad NameLoad attr Num keyword Num keyword NameLoad With Call NameLoad NameLoad body Expr Call NameLoad AttributeLoad NameLoad attr Num keyword Num keyword NameLoad With Call NameLoad NameLoad body Expr Call NameLoad AttributeLoad NameLoad attr Num keyword Num keyword NameLoad With Call NameLoad NameLoad body Expr Call NameLoad AttributeLoad NameLoad attr Num keyword Num keyword NameLoad With Call NameLoad NameLoad body Expr Call NameLoad AttributeLoad NameLoad attr Num keyword Num keyword NameLoad With Call NameLoad NameLoad body Expr Call NameLoad AttributeLoad NameLoad attr Num keyword Num keyword NameLoad With Call NameLoad NameLoad body Expr Call NameLoad AttributeLoad NameLoad attr Num keyword Num keyword NameLoad With Call NameLoad NameLoad body Expr Call NameLoad AttributeLoad NameLoad attr Num keyword Num keyword NameLoad With Call NameLoad NameLoad body Expr Call NameLoad AttributeLoad NameLoad attr Num keyword Num keyword NameLoad With Call NameLoad NameLoad body Expr Call NameLoad AttributeLoad NameLoad attr Num keyword Num keyword NameLoad decorator_list decorator_list FunctionDef arguments args NameParam defaults body Pass decorator_list FunctionDef arguments args NameParam NameParam defaults body Pass decorator_list FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr NameLoad Expr Call NameLoad Call NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareEq AttributeLoad NameLoad attr Num body Assert CompareNotIn Num AttributeLoad AttributeLoad NameLoad attr attr orelse Assert CompareEq SubscriptLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Index Str AttributeLoad NameLoad attr Str Assert CompareEq SubscriptLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Index Str Call AttributeLoad NameLoad attr Call NameLoad Num Str Str AugAssignAdd AttributeStore NameLoad attr Num Expr Call NameLoad Call NameLoad Num Num Expr Call NameLoad keyword AttributeLoad NameLoad attr decorator_list Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str
N/A N/A 
Algorithm Protocol
===================

For a class to be passed as a trading algorithm to the
:py:class:`zipline.lines.SimulatedTrading` zipline it must follow an
implementation protocol. Examples of this algorithm protocol are provided
below.

The algorithm must expose methods:

  - initialize: method that takes no args, no returns. Simply called to
    enable the algorithm to set any internal state needed.

  - get_sid_filter: method that takes no args, and returns a list of valid
    sids. List must have a length between 1 and 10. If None is returned the
    filter will block all events.

  - handle_data: method that accepts a :py:class:`zipline.protocol.BarData`
    of the current state of the simulation universe. An example data object:

        ..  This outputs the table as an HTML table but for some reason there
            is no bounding box. Make the previous paraagraph ending colon a
            double-colon to turn this back into blockquoted table in ASCII art.

        +-----------------+--------------+----------------+-------------------+
        |                 | sid(133)     |  sid(134)      | sid(135)          |
        +=================+==============+================+===================+
        | price           | $10.10       | $22.50         | $13.37            |
        +-----------------+--------------+----------------+-------------------+
        | volume          | 10,000       | 5,000          | 50,000            |
        +-----------------+--------------+----------------+-------------------+
        | mvg_avg_30      | $9.97        | $22.61         | $13.37            |
        +-----------------+--------------+----------------+-------------------+
        | dt              | 6/30/2012    | 6/30/2011      | 6/29/2012         |
        +-----------------+--------------+----------------+-------------------+

  - set_order: method that accepts a callable. Will be set as the value of the
    order method of trading_client. An algorithm can then place orders with a
    valid sid and a number of shares::

        self.order(sid(133), share_count)

  - set_performance: property which can be set equal to the
    cumulative_trading_performance property of the trading_client. An
    algorithm can then check position information with the
    Portfolio object::

        self.Portfolio[sid(133)]['cost_basis']

  - set_transact_setter: method that accepts a callable. Will
    be set as the value of the set_transact_setter method of
    the trading_client. This allows an algorithm to change the
    slippage model used to predict transactions based on orders
    and trade events.

 N/A numpy np nose.tools assert_raises six.moves range six itervalues zipline.algorithm TradingAlgorithm zipline.api FixedSlippage order set_slippage record sid zipline.errors UnsupportedOrderParameters zipline.assets Future Equity zipline.finance.commission PerShare zipline.finance.execution LimitOrder MarketOrder StopLimitOrder StopOrder zipline.finance.controls AssetDateBounds zipline.utils.math_utils round_if_near_integer TestAlgorithm N/A TradingAlgorithm N/A N/A 
    This algorithm will send a specified number of orders, to allow unit tests
    to verify the orders sent/received, transactions created, and positions
    at the close of a simulation.
     initialize N/A N/A self sid amount order_count sid_filter slippage commission N/A None None None N/A N/A N/A self count order_count N/A N/A self asset N/A N/A self sid sid N/A N/A self amount amount N/A N/A self incr 0 N/A sid_filter N/A N/A N/A self sid_filter sid_filter N/A N/A N/A self sid_filter N/A N/A N/A self asset sid N/A N/A slippage None N/A N/A N/A N/A self set_slippage slippage N/A N/A commission None N/A N/A N/A N/A self set_commission commission N/A handle_data N/A N/A self data N/A N/A N/A N/A N/A self incr N/A self count N/A N/A N/A N/A self order N/A self asset N/A self amount N/A N/A self incr 1 N/A N/A HeavyBuyAlgorithm N/A TradingAlgorithm N/A N/A 
    This algorithm will send a specified number of orders, to allow unit tests
    to verify the orders sent/received, transactions created, and positions
    at the close of a simulation.
     initialize N/A N/A self sid amount N/A N/A N/A N/A self asset N/A N/A self sid sid N/A N/A self amount amount N/A N/A self incr 0 N/A handle_data N/A N/A self data N/A N/A N/A N/A N/A self order N/A self asset N/A self amount N/A N/A self incr 1 N/A N/A NoopAlgorithm N/A TradingAlgorithm N/A N/A 
    Dolce fa niente.
     initialize N/A N/A self N/A N/A N/A N/A handle_data N/A N/A self data N/A N/A N/A N/A N/A ExceptionAlgorithm N/A TradingAlgorithm N/A N/A 
    Throw an exception from the method name specified in the
    constructor.
     initialize N/A N/A self throw_from sid N/A N/A N/A N/A self throw_from throw_from N/A N/A self asset N/A N/A self sid sid N/A N/A N/A self throw_from initialize N/A N/A N/A Exception Algo exception in initialize N/A N/A N/A set_portfolio N/A N/A self portfolio N/A N/A N/A N/A N/A self throw_from set_portfolio N/A N/A N/A Exception Algo exception in set_portfolio N/A N/A N/A handle_data N/A N/A self data N/A N/A N/A N/A N/A self throw_from handle_data N/A N/A N/A Exception Algo exception in handle_data N/A N/A N/A get_sid_filter N/A N/A self N/A N/A N/A N/A N/A self throw_from get_sid_filter N/A N/A N/A Exception Algo exception in get_sid_filter N/A N/A N/A N/A self asset N/A set_transact_setter N/A N/A self txn_sim_callable N/A N/A N/A N/A N/A DivByZeroAlgorithm N/A TradingAlgorithm N/A initialize N/A N/A self sid N/A N/A N/A N/A self asset N/A N/A self sid sid N/A N/A self incr 0 N/A handle_data N/A N/A self data N/A N/A N/A N/A self incr 1 N/A N/A N/A self incr 1 N/A N/A N/A 5 0 N/A N/A N/A TooMuchProcessingAlgorithm N/A TradingAlgorithm N/A initialize N/A N/A self sid N/A N/A N/A N/A self asset N/A N/A self sid sid N/A handle_data N/A N/A self data N/A N/A N/A i N/A range 1000000000 N/A N/A N/A self foo i N/A N/A TimeoutAlgorithm N/A TradingAlgorithm N/A initialize N/A N/A self sid N/A N/A N/A N/A self asset N/A N/A self sid sid N/A N/A self incr 0 N/A handle_data N/A N/A self data N/A N/A N/A N/A N/A self incr 4 N/A N/A time N/A N/A N/A time sleep 100 N/A N/A N/A RecordAlgorithm N/A TradingAlgorithm N/A initialize N/A N/A self N/A N/A N/A N/A self incr 0 N/A handle_data N/A N/A self data N/A N/A N/A N/A self incr 1 N/A N/A N/A self record incr N/A self incr N/A name name N/A N/A N/A self record name N/A self incr N/A N/A record name N/A self incr name2 2 name3 N/A self incr N/A N/A TestOrderAlgorithm N/A TradingAlgorithm N/A initialize N/A N/A self N/A N/A N/A N/A self incr 0 N/A handle_data N/A N/A self data N/A N/A N/A N/A N/A self incr 0 N/A N/A N/A 0 N/A N/A self portfolio positions N/A N/A N/A N/A N/A N/A N/A self portfolio positions N/A 0 N/A amount N/A self incr Orders not filled immediately. N/A N/A N/A N/A N/A N/A self portfolio positions N/A 0 N/A last_sale_price N/A N/A data current N/A sid 0 price Orders not filled at current price. N/A N/A self incr 1 N/A N/A N/A self order N/A N/A self sid 0 1 N/A N/A TestOrderInstantAlgorithm N/A TradingAlgorithm N/A initialize N/A N/A self N/A N/A N/A N/A self incr 0 N/A N/A self last_price None N/A handle_data N/A N/A self data N/A N/A N/A N/A N/A self incr 0 N/A N/A N/A 0 N/A N/A self portfolio positions N/A N/A N/A N/A N/A N/A N/A self portfolio positions N/A 0 N/A amount N/A self incr Orders not filled immediately. N/A N/A N/A N/A N/A N/A self portfolio positions N/A 0 N/A last_sale_price N/A self last_price Orders was not filled at last price. N/A N/A self incr 1 N/A N/A N/A self order_value N/A N/A self sid 0 N/A N/A data current N/A sid 0 price N/A N/A self last_price N/A N/A data current N/A sid 0 price N/A N/A TestOrderStyleForwardingAlgorithm N/A TradingAlgorithm N/A N/A 
    Test Algorithm for verifying that ExecutionStyles are properly forwarded by
    order API helper methods.  Pass the name of the method to be tested as a
    string parameter to this algorithm's constructor.
     __init__ N/A N/A self N/A args kwargs N/A N/A N/A self method_name N/A N/A kwargs pop method_name N/A N/A N/A N/A super TestOrderStyleForwardingAlgorithm self __init__ args kwargs N/A initialize N/A N/A self N/A N/A N/A N/A self incr 0 N/A N/A self last_price None N/A handle_data N/A N/A self data N/A N/A N/A N/A N/A self incr 0 N/A N/A N/A N/A len N/A N/A N/A N/A self portfolio positions keys 0 N/A method_to_check N/A getattr self N/A self method_name N/A N/A method_to_check N/A N/A self sid 133 N/A N/A data current N/A sid 0 price style N/A StopLimitOrder 10 10 N/A N/A N/A len N/A N/A N/A self blotter open_orders N/A N/A N/A self sid 133 1 N/A result N/A N/A N/A N/A self blotter open_orders N/A N/A N/A self sid 133 N/A 0 N/A N/A N/A result limit 10 N/A N/A N/A result stop 10 N/A N/A self incr 1 N/A N/A TestOrderValueAlgorithm N/A TradingAlgorithm N/A initialize N/A N/A self N/A N/A N/A N/A self incr 0 N/A N/A self sale_price None N/A handle_data N/A N/A self data N/A N/A N/A N/A N/A self incr 0 N/A N/A N/A 0 N/A N/A self portfolio positions N/A N/A N/A N/A N/A N/A N/A self portfolio positions N/A 0 N/A amount N/A self incr Orders not filled immediately. N/A N/A N/A N/A N/A N/A self portfolio positions N/A 0 N/A last_sale_price N/A N/A data current N/A sid 0 price Orders not filled at current price. N/A N/A self incr 2 N/A multiplier 2.0 N/A N/A isinstance N/A N/A self sid 0 Future N/A N/A multiplier N/A N/A N/A self sid 0 multiplier N/A N/A N/A self order_value N/A N/A self sid 0 N/A N/A N/A data current N/A sid 0 price multiplier N/A N/A TestTargetAlgorithm N/A TradingAlgorithm N/A initialize N/A N/A self N/A N/A N/A N/A N/A self set_slippage N/A FixedSlippage N/A N/A self target_shares 0 N/A N/A self sale_price None N/A handle_data N/A N/A self data N/A N/A N/A N/A N/A self target_shares 0 N/A N/A N/A 0 N/A N/A self portfolio positions N/A N/A N/A N/A N/A N/A N/A self portfolio positions N/A 0 N/A amount N/A self target_shares Orders not filled immediately. N/A N/A N/A N/A N/A N/A self portfolio positions N/A 0 N/A last_sale_price N/A N/A data current N/A sid 0 price Orders not filled at current price. N/A N/A self target_shares 10 N/A N/A N/A self order_target N/A N/A self sid 0 N/A self target_shares N/A N/A TestOrderPercentAlgorithm N/A TradingAlgorithm N/A initialize N/A N/A self N/A N/A N/A N/A N/A self set_slippage N/A FixedSlippage N/A N/A self target_shares 0 N/A N/A self sale_price None N/A handle_data N/A N/A self data N/A N/A N/A N/A N/A self target_shares 0 N/A N/A N/A 0 N/A N/A self portfolio positions N/A N/A N/A self order N/A N/A self sid 0 10 N/A N/A self target_shares 10 N/A N/A N/A N/A N/A N/A N/A N/A self portfolio positions N/A 0 N/A amount N/A self target_shares Orders not filled immediately. N/A N/A N/A N/A N/A N/A self portfolio positions N/A 0 N/A last_sale_price N/A N/A data current N/A sid 0 price Orders not filled at current price. N/A N/A N/A self order_percent N/A N/A self sid 0 0.001 N/A N/A isinstance N/A N/A self sid 0 Equity N/A N/A price N/A N/A data current N/A sid 0 price N/A new_shares N/A N/A 0.001 N/A N/A self portfolio portfolio_value price N/A N/A N/A isinstance N/A N/A self sid 0 Future N/A N/A new_shares N/A N/A 0.001 N/A N/A self portfolio portfolio_value N/A N/A N/A data current N/A sid 0 price N/A N/A N/A self sid 0 contract_multiplier N/A new_shares N/A int N/A round_if_near_integer new_shares N/A N/A self target_shares new_shares N/A N/A TestTargetPercentAlgorithm N/A TradingAlgorithm N/A initialize N/A N/A self N/A N/A N/A N/A self ordered False N/A N/A self sale_price None N/A N/A N/A self set_slippage N/A FixedSlippage N/A N/A N/A self set_commission N/A PerShare 0 N/A handle_data N/A N/A self data N/A N/A N/A N/A N/A self ordered N/A N/A N/A 0 N/A N/A self portfolio positions N/A N/A target_value N/A N/A N/A self portfolio portfolio_value 0.002 N/A position_value N/A N/A N/A N/A N/A self portfolio positions N/A 0 N/A amount N/A self sale_price N/A N/A N/A abs N/A target_value position_value N/A self sale_price Orders not filled correctly N/A N/A N/A N/A N/A N/A self portfolio positions N/A 0 N/A last_sale_price N/A N/A data current N/A sid 0 price Orders not filled at current price. N/A N/A self sale_price N/A N/A data current N/A sid 0 price N/A N/A N/A self order_target_percent N/A N/A self sid 0 0.002 N/A N/A self ordered True N/A N/A TestTargetValueAlgorithm N/A TradingAlgorithm N/A initialize N/A N/A self N/A N/A N/A N/A N/A self set_slippage N/A FixedSlippage N/A N/A self target_shares 0 N/A N/A self sale_price None N/A handle_data N/A N/A self data N/A N/A N/A N/A N/A self target_shares 0 N/A N/A N/A 0 N/A N/A self portfolio positions N/A N/A N/A self order N/A N/A self sid 0 10 N/A N/A self target_shares 10 N/A N/A N/A N/A N/A N/A N/A N/A self portfolio positions N/A 0 N/A amount N/A self target_shares Orders not filled immediately. N/A N/A N/A N/A N/A N/A self portfolio positions N/A 0 N/A last_sale_price N/A N/A data current N/A sid 0 price Orders not filled at current price. N/A N/A N/A self order_target_value N/A N/A self sid 0 20 N/A N/A self target_shares N/A N/A np round N/A 20 N/A N/A data current N/A sid 0 price N/A N/A isinstance N/A N/A self sid 0 Equity N/A N/A N/A self target_shares N/A N/A np round N/A 20 N/A N/A data current N/A sid 0 price N/A N/A isinstance N/A N/A self sid 0 Future N/A N/A N/A self target_shares N/A N/A np round N/A 20 N/A N/A N/A data current N/A sid 0 price N/A N/A N/A self sid 0 multiplier N/A N/A FutureFlipAlgo N/A TestAlgorithm N/A handle_data N/A N/A self data N/A N/A N/A N/A N/A len N/A N/A self portfolio positions 0 N/A N/A N/A N/A N/A N/A N/A self portfolio positions N/A N/A N/A self asset sid N/A amount 0 N/A N/A N/A N/A self order_target N/A self asset N/A N/A self amount N/A N/A N/A N/A self order_target N/A self asset 0 N/A N/A N/A N/A self order_target N/A self asset N/A self amount N/A N/A SetMaxLeverageAlgorithm N/A TradingAlgorithm N/A initialize N/A N/A self max_leverage N/A None N/A N/A N/A N/A self set_max_leverage max_leverage max_leverage N/A N/A SetMaxPositionSizeAlgorithm N/A TradingAlgorithm N/A initialize N/A N/A self asset max_shares max_notional N/A None None None N/A N/A N/A N/A self set_slippage N/A FixedSlippage N/A N/A self order_count 0 N/A N/A N/A self set_max_position_size asset asset max_shares max_shares max_notional max_notional N/A N/A SetMaxOrderSizeAlgorithm N/A TradingAlgorithm N/A initialize N/A N/A self asset max_shares max_notional N/A None None None N/A N/A N/A self order_count 0 N/A N/A N/A self set_max_order_size asset asset max_shares max_shares max_notional max_notional N/A N/A SetDoNotOrderListAlgorithm N/A TradingAlgorithm N/A initialize N/A N/A self sid restricted_list N/A None None N/A N/A N/A self order_count 0 N/A N/A N/A self set_do_not_order_list restricted_list N/A N/A SetMaxOrderCountAlgorithm N/A TradingAlgorithm N/A initialize N/A N/A self count N/A N/A N/A N/A self order_count 0 N/A N/A N/A self set_max_order_count count N/A N/A self minute_count 0 N/A N/A SetLongOnlyAlgorithm N/A TradingAlgorithm N/A initialize N/A N/A self N/A N/A N/A N/A self order_count 0 N/A N/A N/A self set_long_only N/A N/A SetAssetDateBoundsAlgorithm N/A TradingAlgorithm N/A N/A 
    Algorithm that tries to order 1 share of sid 0 on every bar and has an
    AssetDateBounds() trading control in place.
     initialize N/A N/A self N/A N/A N/A N/A N/A self register_trading_control N/A AssetDateBounds N/A handle_data N/A N/A algo data N/A N/A N/A N/A N/A algo order N/A N/A algo sid 0 1 N/A N/A TestRegisterTransformAlgorithm N/A TradingAlgorithm N/A initialize N/A N/A self N/A args kwargs N/A N/A N/A N/A self set_slippage N/A FixedSlippage N/A handle_data N/A N/A self data N/A N/A N/A N/A N/A AmbitiousStopLimitAlgorithm N/A TradingAlgorithm N/A N/A 
    Algorithm that tries to buy with extremely low stops/limits and tries to
    sell with extremely high versions of same. Should not end up with any
    positions for reasonable data.
     initialize N/A N/A self N/A args kwargs N/A N/A N/A self asset N/A N/A self sid N/A N/A kwargs pop sid N/A handle_data N/A N/A self data N/A N/A N/A N/A N/A self order N/A self asset 100 limit_price 1 N/A N/A N/A self order N/A self asset 100 stop_price 10000000 N/A N/A N/A self order N/A self asset 100 limit_price 10000000 stop_price 10000000 N/A N/A N/A self order N/A self asset 100 limit_price 1 stop_price 1 N/A N/A N/A self order N/A self asset -100 limit_price 1000000 N/A N/A N/A self order N/A self asset -100 stop_price 1 N/A N/A N/A self order N/A self asset -100 limit_price 1000000 stop_price 1000000 N/A N/A N/A self order N/A self asset -100 limit_price 1 stop_price 1 N/A N/A N/A self order N/A self asset 100 limit_price 1e-08 N/A N/A N/A self order N/A self asset -100 stop_price 1e-08 N/A N/A SetPortfolioAlgorithm N/A TradingAlgorithm N/A N/A 
    An algorithm that tries to set the portfolio directly.

    The portfolio should be treated as a read-only object
    within the algorithm.
     initialize N/A N/A self N/A args kwargs N/A N/A N/A handle_data N/A N/A self data N/A N/A N/A N/A self portfolio 3 N/A N/A TALIBAlgorithm N/A TradingAlgorithm N/A N/A 
    An algorithm that applies a TA-Lib transform. The transform object can be
    passed at initialization with the 'talib' keyword argument. The results are
    stored in the talib_results array.
     initialize N/A N/A self N/A args kwargs N/A N/A N/A talib kwargs N/A N/A N/A KeyError No TA-LIB transform specified (use keyword 'talib'). N/A N/A N/A N/A isinstance N/A kwargs N/A talib N/A list tuple N/A N/A N/A self talib_transforms N/A N/A kwargs N/A talib N/A N/A N/A self talib_transforms N/A kwargs N/A talib N/A N/A self talib_results N/A dict N/A N/A t N/A N/A t N/A self talib_transforms N/A handle_data N/A N/A self data N/A N/A N/A t N/A self talib_transforms N/A N/A result N/A N/A t handle_data data N/A N/A result None N/A N/A N/A N/A len N/A N/A t talib_fn output_names 1 N/A N/A result N/A np nan N/A N/A result N/A N/A N/A np nan N/A len N/A N/A t talib_fn output_names N/A N/A N/A N/A N/A self talib_results N/A t append result N/A N/A EmptyPositionsAlgorithm N/A TradingAlgorithm N/A N/A 
    An algorithm that ensures that 'phantom' positions do not appear in
    portfolio.positions in the case that a position has been entered
    and fully exited.
     initialize N/A N/A self sids N/A args kwargs N/A N/A N/A self ordered False N/A N/A self exited False N/A N/A self sids sids N/A handle_data N/A N/A self data N/A N/A N/A N/A N/A self ordered N/A N/A s N/A self sids N/A N/A N/A N/A self order N/A N/A self sid s 1 N/A N/A self ordered True N/A N/A N/A self exited N/A N/A amounts N/A N/A pos amount N/A pos N/A itervalues N/A N/A self portfolio positions N/A N/A N/A N/A len amounts 0 N/A all N/A N/A amount 1 N/A amount amounts N/A N/A stock N/A N/A self portfolio positions N/A N/A N/A N/A self order N/A N/A self sid stock -1 N/A N/A self exited True N/A N/A N/A self record num_positions N/A len N/A N/A self portfolio positions N/A N/A InvalidOrderAlgorithm N/A TradingAlgorithm N/A N/A 
    An algorithm that tries to make various invalid order calls, verifying that
    appropriate exceptions are raised.
     initialize N/A N/A self N/A args kwargs N/A N/A N/A self asset N/A N/A self sid N/A N/A N/A kwargs pop sids N/A 0 N/A handle_data N/A N/A self data N/A N/A zipline.api order_percent order_target order_target_percent order_target_value order_value N/A style N/A N/A MarketOrder N/A LimitOrder 10 N/A StopOrder 10 N/A StopLimitOrder 10 10 N/A N/A N/A assert_raises UnsupportedOrderParameters N/A N/A N/A order N/A self asset 10 limit_price 10 style style N/A N/A assert_raises UnsupportedOrderParameters N/A N/A N/A order N/A self asset 10 stop_price 10 style style N/A N/A assert_raises UnsupportedOrderParameters N/A N/A N/A order_value N/A self asset 300 limit_price 10 style style N/A N/A assert_raises UnsupportedOrderParameters N/A N/A N/A order_value N/A self asset 300 stop_price 10 style style N/A N/A assert_raises UnsupportedOrderParameters N/A N/A N/A order_percent N/A self asset 0.1 limit_price 10 style style N/A N/A assert_raises UnsupportedOrderParameters N/A N/A N/A order_percent N/A self asset 0.1 stop_price 10 style style N/A N/A assert_raises UnsupportedOrderParameters N/A N/A N/A order_target N/A self asset 100 limit_price 10 style style N/A N/A assert_raises UnsupportedOrderParameters N/A N/A N/A order_target N/A self asset 100 stop_price 10 style style N/A N/A assert_raises UnsupportedOrderParameters N/A N/A N/A order_target_value N/A self asset 100 limit_price 10 style style N/A N/A assert_raises UnsupportedOrderParameters N/A N/A N/A order_target_value N/A self asset 100 stop_price 10 style style N/A N/A assert_raises UnsupportedOrderParameters N/A N/A N/A order_target_percent N/A self asset 0.2 limit_price 10 style style N/A N/A assert_raises UnsupportedOrderParameters N/A N/A N/A order_target_percent N/A self asset 0.2 stop_price 10 style style N/A N/A initialize_noop N/A N/A context N/A N/A N/A N/A handle_data_noop N/A N/A context data N/A N/A N/A N/A initialize_api N/A N/A context N/A N/A N/A N/A context incr 0 N/A N/A context sale_price None N/A N/A set_slippage N/A FixedSlippage N/A handle_data_api N/A N/A context data N/A N/A N/A N/A N/A context incr 0 N/A N/A N/A 0 N/A N/A context portfolio positions N/A N/A N/A N/A N/A N/A N/A context portfolio positions N/A 0 N/A amount N/A context incr Orders not filled immediately. N/A N/A N/A N/A N/A N/A context portfolio positions N/A 0 N/A last_sale_price N/A N/A data current N/A sid 0 price Orders not filled at current price. N/A N/A context incr 1 N/A N/A order N/A sid 0 1 N/A N/A record incr N/A context incr N/A N/A noop_algo 
# Noop algo
def initialize(context):
    pass

def handle_data(context, data):
    pass
 N/A no_handle_data 
def initialize(context):
    pass
 N/A api_algo 
from zipline.api import (order,
                         set_slippage,
                         FixedSlippage,
                         record,
                         sid)

def initialize(context):
    context.incr = 0
    context.sale_price = None
    set_slippage(FixedSlippage())

def handle_data(context, data):
    if context.incr == 0:
        assert 0 not in context.portfolio.positions
    else:
        assert context.portfolio.positions[0]['amount'] ==                 context.incr, "Orders not filled immediately."
        assert context.portfolio.positions[0]['last_sale_price'] ==                 data.current(sid(0), "price"),                 "Orders not filled at current price."
    context.incr += 1
    order(sid(0), 1)

    record(incr=context.incr)
 N/A api_get_environment_algo 
from zipline.api import get_environment, order, symbol


def initialize(context):
    context.environment = get_environment()

def handle_data(context, data):
    pass
 N/A api_symbol_algo 
from zipline.api import (order,
                         symbol)

def initialize(context):
    pass

def handle_data(context, data):
    order(symbol('TEST'), 1)
 N/A call_order_in_init 
from zipline.api import (sid, order)

def initialize(context):
    order(sid(0), 10)
    pass

def handle_data(context, data):
    pass
 N/A access_portfolio_in_init 
def initialize(context):
    var = context.portfolio.cash
    pass

def handle_data(context, data):
    pass
 N/A access_account_in_init 
def initialize(context):
    var = context.account.settled_cash
    pass

def handle_data(context, data):
    pass
 N/A call_all_order_methods 
from zipline.api import (order,
                         order_value,
                         order_percent,
                         order_target,
                         order_target_value,
                         order_target_percent,
                         sid)

def initialize(context):
    pass

def handle_data(context, data):
    order(sid(0), 10)
    order_value(sid(0), 300)
    order_percent(sid(0), .1)
    order_target(sid(0), 100)
    order_target_value(sid(0), 100)
    order_target_percent(sid(0), .2)
 N/A record_variables 
from zipline.api import record

def initialize(context):
    context.stocks = [0, 1]
    context.incr = 0

def handle_data(context, data):
    context.incr += 1
    record(incr=context.incr)
 N/A record_float_magic 
from zipline.api import record

def initialize(context):
    context.stocks = [0, 1]
    context.incr = 0

def handle_data(context, data):
    context.incr += 1
    record(data=float('%s'))
 N/A call_with_kwargs 
from zipline.api import symbol

def initialize(context):
    pass

def handle_data(context, data):
    price_history = data.history(assets=symbol('TEST'), fields="price",
                                 bar_count=5, frequency="1d")
    current = data.current(assets=symbol('TEST'), fields="price")
 N/A call_without_kwargs 
from zipline.api import symbol

def initialize(context):
    pass

def handle_data(context, data):
    price_history = data.history(symbol('TEST'), "price", 5, "1d")
    current = data.current(symbol('TEST'), "price")
    is_stale = data.is_stale(symbol('TEST'))
    can_trade = data.can_trade(symbol('TEST'))
 N/A call_with_bad_kwargs_history 
from zipline.api import symbol

def initialize(context):
    pass

def handle_data(context, data):
    price_history = data.history(assets=symbol('TEST'), fields="price",
                                 blahblah=5, frequency="1d")
 N/A call_with_bad_kwargs_current 
from zipline.api import symbol

def initialize(context):
    pass

def handle_data(context, data):
    current = data.current(assets=symbol('TEST'), blahblah="price")
 N/A bad_type_history_assets 
def initialize(context):
    pass

def handle_data(context, data):
    data.history(1, 'price', 5, '1d')
 N/A bad_type_history_fields 
from zipline.api import symbol

def initialize(context):
    pass

def handle_data(context, data):
    data.history(symbol('TEST'), 10 , 5, '1d')
 N/A bad_type_history_bar_count 
from zipline.api import symbol

def initialize(context):
    pass

def handle_data(context, data):
    data.history(symbol('TEST'), 'price', '5', '1d')
 N/A bad_type_history_frequency 
from zipline.api import symbol

def initialize(context):
    pass

def handle_data(context, data):
    data.history(symbol('TEST'), 'price', 5, 1)
 N/A bad_type_current_assets 
def initialize(context):
    pass

def handle_data(context, data):
    data.current(1, 'price')
 N/A bad_type_current_fields 
from zipline.api import symbol

def initialize(context):
    pass

def handle_data(context, data):
    data.current(symbol('TEST'), 10)
 N/A bad_type_is_stale_assets 
def initialize(context):
    pass

def handle_data(context, data):
    data.is_stale('TEST')
 N/A bad_type_can_trade_assets 
def initialize(context):
    pass

def handle_data(context, data):
    data.can_trade('TEST')
 N/A bad_type_history_assets_kwarg 
def initialize(context):
    pass

def handle_data(context, data):
    data.history(frequency='1d', fields='price', assets=1, bar_count=5)
 N/A bad_type_history_fields_kwarg 
from zipline.api import symbol

def initialize(context):
    pass

def handle_data(context, data):
    data.history(frequency='1d', fields=10, assets=symbol('TEST'),
                 bar_count=5)
 N/A bad_type_history_bar_count_kwarg 
from zipline.api import symbol

def initialize(context):
    pass

def handle_data(context, data):
    data.history(frequency='1d', fields='price', assets=symbol('TEST'),
                 bar_count='5')
 N/A bad_type_history_frequency_kwarg 
from zipline.api import symbol

def initialize(context):
    pass

def handle_data(context, data):
    data.history(frequency=1, fields='price', assets=symbol('TEST'),
                 bar_count=5)
 N/A bad_type_current_assets_kwarg 
def initialize(context):
    pass

def handle_data(context, data):
    data.current(fields='price', assets=1)
 N/A bad_type_current_fields_kwarg 
from zipline.api import symbol

def initialize(context):
    pass

def handle_data(context, data):
    data.current(fields=10, assets=symbol('TEST'))
 N/A bad_type_history_assets_kwarg_list 
def initialize(context):
    pass

def handle_data(context, data):
    data.history(assets=[1,2], fields='price', bar_count=5, frequency="1d")
 N/A call_with_bad_kwargs_get_open_orders 
from zipline.api import symbol

def initialize(context):
    pass

def handle_data(context, data):
    context.get_open_orders(sid=symbol('TEST'))
 N/A call_with_good_kwargs_get_open_orders 
from zipline.api import symbol

def initialize(context):
    pass

def handle_data(context, data):
    context.get_open_orders(asset=symbol('TEST'))
 N/A call_with_no_kwargs_get_open_orders 
from zipline.api import symbol

def initialize(context):
    pass

def handle_data(context, data):
    context.get_open_orders(symbol('TEST'))
 N/A empty_positions 
from zipline.api import record, schedule_function, time_rules, date_rules,     symbol

def initialize(context):
    schedule_function(test_history, date_rules.every_day(),
                      time_rules.market_open(hours=1))
    context.sid = symbol('TEST')

def test_history(context,data):
    record(amounts=context.portfolio.positions[context.sid].amount)
    record(num_positions=len(context.portfolio.positions))
 N/A set_benchmark_algo 
from zipline.api import symbol, set_benchmark

def initialize(context):
    set_benchmark(symbol('TEST'))
    context.sid = symbol('TEST')

def handle_data(context, data):
    pass
