Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions application/rebalance_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ def _should_publish_cycle_notification(result: Mapping[str, Any]) -> bool:
return True
if result.get("error") or result.get("ok") is False:
return True
return False
# A completed strategy run without an order is itself a useful heartbeat.
return result.get("ok") is True


def load_strategy_plugin_signals(
Expand Down Expand Up @@ -857,7 +858,7 @@ def acquire_submission_claim() -> bool:
elif send_cycle_notification:
result["notification_sent"] = False
result["notification_suppressed"] = True
result.setdefault("notification_suppressed_reason", "no_trade_or_error")
result.setdefault("notification_suppressed_reason", "policy_or_incomplete_cycle")
else:
result["notification_sent"] = False
result["notification_suppressed"] = True
Expand Down
9 changes: 5 additions & 4 deletions tests/test_rebalance_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,10 +585,11 @@ def evaluate(self, **inputs):
assert result["skipped_orders"] == [
{"symbol": "AAA", "reason": "below_trade_threshold", "delta_value": 0.0}
]
assert result["notification_sent"] is False
assert result["notification_suppressed"] is True
assert result["notification_suppressed_reason"] == "no_trade_or_error"
assert messages == []
assert result["notification_sent"] is True
assert len(messages) == 1
assert "Heartbeat" in messages[0]
assert "Total assets: $0.00" in messages[0]
assert "Available cash: $0.00" in messages[0]


def test_run_strategy_cycle_loads_strategy_plugin_report_and_sends_email(
Expand Down
Loading