Adds an event to the algorithm's EventManager. Parameters ---------- rule : EventRule The rule for when the callback should be triggered. callback : callable[(context, data) -> None] The function to execute when the rule is triggered.
(self, rule, callback)
| 876 | return csv_data_source |
| 877 | |
| 878 | def add_event(self, rule, callback): |
| 879 | """Adds an event to the algorithm's EventManager. |
| 880 | |
| 881 | Parameters |
| 882 | ---------- |
| 883 | rule : EventRule |
| 884 | The rule for when the callback should be triggered. |
| 885 | callback : callable[(context, data) -> None] |
| 886 | The function to execute when the rule is triggered. |
| 887 | """ |
| 888 | self.event_manager.add_event( |
| 889 | zipline.utils.events.Event(rule, callback), |
| 890 | ) |
| 891 | |
| 892 | @api_method |
| 893 | def schedule_function(self, |
no outgoing calls
no test coverage detected