Skip to content

Commit d8d6deb

Browse files
Add support for Brokerage ActionRequired message type (#9040)
* Add support for Brokerage ActionRequired message type * Minor syntax check typo fix
1 parent 81b2d45 commit d8d6deb

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

Algorithm.Python/ConsolidatorStartTimeRegressionAlgorithm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def bar_handler(self, _, bar):
4040
if self.time != bar.end_time:
4141
raise RegressionTestException(f"Unexpected consolidation time {bar.Time} != {Time}!")
4242

43-
self.debug(f"{self.Time} - Consolidation")
43+
self.debug(f"{self.time} - Consolidation")
4444
expected = self._expectedConsolidationTime.pop()
4545
if bar.time.time() != expected:
4646
raise RegressionTestException(f"Unexpected consolidation time {bar.time.time()} != {expected}!")

Common/Brokerages/BrokerageMessageType.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ public enum BrokerageMessageType
4343
/// <summary>
4444
/// Brokerage disconnected from remote server (4)
4545
/// </summary>
46-
Disconnect
46+
Disconnect,
47+
48+
/// <summary>
49+
/// Action required by the user (5)
50+
/// </summary>
51+
ActionRequired,
4752
}
48-
}
53+
}

Common/Brokerages/DefaultBrokerageMessageHandler.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ where exchange.IsOpenDuringBar(
163163
_cancellationTokenSource.Cancel();
164164
}
165165
break;
166+
167+
case BrokerageMessageType.ActionRequired:
168+
// not supported atm
169+
_algorithm.SetRuntimeError(new Exception("Brokerage requires user action"), Messages.DefaultBrokerageMessageHandler.BrokerageDisconnectedShutDownContext);
170+
break;
166171
}
167172
}
168173

Engine/Setup/BrokerageSetupHandler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ public IBrokerage CreateBrokerage(AlgorithmNodePacket algorithmNodePacket, IAlgo
135135

136136
// initialize the correct brokerage using the resolved factory
137137
var brokerage = _factory.CreateBrokerage(liveJob, uninitializedAlgorithm);
138+
Composer.Instance.AddPart(brokerage);
138139

139140
return brokerage;
140141
}

0 commit comments

Comments
 (0)