Adds BroadcastCommand Method (#8617)
Regression Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled

* Adds BroadcastCommand Method

Send a command to all live algorithms.

* Addresses Peer-Review

* Minor tweaks

---------

Co-authored-by: Martin Molinero <martin.molinero1@gmail.com>
This commit is contained in:
Alexandre Catarino
2025-03-07 20:48:10 +00:00
committed by GitHub
parent 07003af6d5
commit 49265bd773
7 changed files with 145 additions and 6 deletions
@@ -94,6 +94,14 @@ class CallbackCommandRegressionAlgorithm(QCAlgorithm):
raise ValueError(f'Invalid link was generated! {untyped_command_link}')
self.notify.email("email@address", "Untyped Command Event", f"Signal Y trade\nFollow link to trigger: {untyped_command_link}")
# We need to create a project on QuantConnect to test the broadcast_command method
# and use the project_id in the broadcast_command call
self.project_id = 21805137;
# All live deployments receive the broadcasts below
broadcast_result = self.broadcast_command(potential_command);
broadcast_result2 = self.broadcast_command({ "symbol": "SPY", "parameters": { "quantity": 10 } });
def on_command(self, data):
self.debug(f"on_command: {str(data)}")
self.buy(data.symbol, data.parameters["quantity"])