Description Usage Arguments Details Zipline Documentation
These controls ensure that your algorithm is performing as expected. The controls act as guards against certain actions such as ordering black listed stocks, shorting, or exceeding a maximum leverage threshold.
1 2 3 4 5 6 7 8 9 10 11 12 13 | fly_control_set_do_not_order_list(restricted_list, on_error = "fail")
fly_control_set_long_only(on_error = "fail")
fly_control_set_max_leverage(max_leverage)
fly_control_set_max_order_count(max_count, on_error = "fail")
fly_control_set_max_order_size(asset = NULL, max_shares = NULL,
max_notional = NULL, on_error = "fail")
fly_control_set_max_position_size(asset = NULL, max_shares = NULL,
max_notional = NULL, on_error = "fail")
|
restricted_list |
A list of assets that cannot be ordered. |
on_error |
How to proceed on a control error. The default is
to stop the backtest. Another option is |
max_count |
An integer. The maximum number of orders that can be placed on a single day. |
asset |
An asset. If provided, guard only on positions in the given asset. |
max_shares |
An integer. The maximum number of shares that can be ordered at any one time. |
max_notional |
The maximum value that can be ordered at any one time. |
fly_control_set_do_not_order_list()
- Place a restriction on which assets
can be ordered.
fly_control_set_long_only()
- Specify that this algorithm cannot take
short positions.
fly_control_set_max_leverage()
- Set a limit on the maximum leverage
allowed.
fly_control_set_max_order_count()
- Set a limit on the number of orders
that can be placed in a single day.
fly_control_set_max_order_size()
- Set a limit on the number of shares
and/or the dollar value of any single order placed for the specified
asset. Limits are treated as absolute values. Limits are only enforced at
the time of order, meaning it is possible to end up with more than the
max number of shares due to splits/dividends, and more than the max
notional due to price improvement.
fly_control_set_max_position_size()
- Set a limit on the number of shares
and/or the dollar value held for a single asset.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.