mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-28 17:00:51 +08:00
644486e6da
Adds four new methods to the Zipline API that can be used as circuit-breakers to interrupt the execution of an algorithm. The API methods are: `set_max_position_size` `set_max_order_size` `set_max_order_count` `set_long_only` Internally, these methods are implemented by each registering a TradingControl callback object with the TradingAlgorithm. During TradingAlgorithm.__validate_order_params (and thus before any side-effects of the order call occur), each callback's `validate` method is called with information about the order to be placed and the algorithm's current state, raising an exception if the callback detects that an error condition has been breached.