SignalR Reference: Event Hub
Event Hub: server to client callbacks (signals, order/position updates, job completion) + history/replay APIs
- Hub URL:
/hubs/event/v1
Client to server
These methods return an API envelope (MesoLiveApiResponse<T>).
Envelope fields: MesoLiveApiResponse
SubscribeToStrategies
Subscribe this connection to server→client event callbacks for the specified strategies.
Args model: SubscribeToStrategiesArgs
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
Strategies | list[int] | No | Yes | Strategies to subscribe to. null = subscribe to all user strategies, empty = no-op. |
Returns (payload): SubscribeToStrategiesResult
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
SuccessfulStrategies | list[int] | Yes | No | Strategy ids that were successfully subscribed to. | |
FailedStrategies | list[int] | Yes | No | Strategy ids that failed to subscribe to. |
UnsubscribeFromStrategies
Unsubscribe this connection from server→client event callbacks for the specified strategies.
Args model: UnsubscribeFromStrategiesArgs
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
Strategies | list[int] | No | Yes | Strategies to unsubscribe from. null = unsubscribe from all, empty = no-op. |
Returns (payload): UnsubscribeFromStrategiesResult
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
SuccessfulStrategies | list[int] | Yes | No | Strategy ids that were successfully unsubscribed from. | |
FailedStrategies | list[int] | Yes | No | Strategy ids that failed to unsubscribe from. |
GetLatestEventSeqId
Get the latest event sequence id available for the authenticated user.
Args model: GetLatestEventSeqIdArgs
No fields.
Returns (payload): GetLatestEventSeqIdResult
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
LatestEventSeqId | int | Yes | No | Latest event sequence id currently available for the authenticated user. | |
SnapshotTime | datetime | Yes | No | UTC time when this snapshot was taken. |
GetEventsSince
Retrieve historical events since a given event sequence id (supports pagination).
Args model: GetEventsSinceArgs
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
SinceEventSeqId | int | Yes | No | Fetch events strictly after this sequence id. | |
Limit | int | Yes | No | Maximum number of events to return. Must be less than or equal to MaxEventsLimit. | |
ContinuationToken | str | No | Yes | Pagination token returned by a previous GetEventsSince call. |
Returns (payload): GetEventsSinceResult
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
Events | list[MesoLiveEventEnvelope] | Yes | No | Event envelopes returned by this page. | |
ContinuationToken | str | No | Yes | Pagination token for the next page. null/empty when no more events are available. |
Server to client callbacks
These callbacks are invoked by the server on your connection. The callback parameter is the event payload model.
On connect, the server may immediately send active signals/errors to the caller.
OnEntrySignal
Called when an entry signal is evaluated and/or changes state for a strategy.
Args model: EntrySignalEvent
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
EventId | UUID | No | No | Stable unique identifier for this event instance. | |
EventSeqId | int | No | No | Server-assigned event sequence id used for ordering and replay/history APIs. | |
EventTime | datetime | Yes | No | UTC timestamp when the event occurred on the server. | |
State | SignalState | Yes | No | Entry signal state (On/Off). | |
StrategyId | int | Yes | No | Live strategy id this signal belongs to. | |
StrategyName | str | Yes | No | Strategy name at the time of the event. | |
BrokerAccountId | str | Yes | No | Broker account id this signal is associated with. | |
EntrySignalResult | EntrySignalsResult | No | Yes | Optional detailed evaluation results for entry checks (may be null if not included). |
Returns: None
OnExitSignal
Called when an exit signal is evaluated and/or changes state for a position.
Args model: ExitSignalEvent
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
EventId | UUID | No | No | Stable unique identifier for this event instance. | |
EventSeqId | int | No | No | Server-assigned event sequence id used for ordering and replay/history APIs. | |
EventTime | datetime | Yes | No | UTC timestamp when the event occurred on the server. | |
State | SignalState | Yes | No | Exit signal state (On/Off). | |
StrategyId | int | Yes | No | Live strategy id this position belongs to. | |
StrategyName | str | Yes | No | Strategy name at the time of the event. | |
PositionId | int | Yes | No | Live position id this exit signal applies to. | |
PositionName | str | Yes | No | Position name at the time of the event. | |
BrokerAccountId | str | No | Yes | Broker account id this position belongs to (may be null in some contexts). | |
ExitSignalResult | ExitSignalsResult | No | Yes | Optional detailed evaluation results for exit checks (may be null if not included). |
Returns: None
OnAdjustmentSignal
Called when an adjustment signal is evaluated and/or changes state for a position.
Args model: AdjustmentSignalEvent
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
EventId | UUID | No | No | Stable unique identifier for this event instance. | |
EventSeqId | int | No | No | Server-assigned event sequence id used for ordering and replay/history APIs. | |
EventTime | datetime | Yes | No | UTC timestamp when the event occurred on the server. | |
State | SignalState | Yes | No | Adjustment signal state (On/Off). | |
StrategyId | int | Yes | No | Live strategy id this position belongs to. | |
StrategyName | str | Yes | No | Strategy name at the time of the event. | |
PositionId | int | Yes | No | Live position id this adjustment signal applies to. | |
PositionName | str | Yes | No | Position name at the time of the event. | |
BrokerAccountId | str | No | Yes | Broker account id this position belongs to (may be null in some contexts). | |
AdjustmentTimeOk | bool | Yes | No | Whether the adjustment timing window is satisfied. | |
Condition | ConditionEvaluation | Yes | No | Condition evaluation that triggered/represents this adjustment signal. |
Returns: None
OnOrderUpdate
Called when a live order changes state (submitted, filled, rejected, etc.).
Args model: OrderUpdateEvent
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
EventId | UUID | No | No | Stable unique identifier for this event instance. | |
EventSeqId | int | No | No | Server-assigned event sequence id used for ordering and replay/history APIs. | |
EventTime | datetime | Yes | No | UTC timestamp when the event occurred on the server. | |
OrderId | int | Yes | No | Live order id. | |
BrokerAccountId | str | No | Yes | Broker account id the order belongs to (may be null in some contexts). | |
ExecPlanId | int | No | Yes | Live execution plan id this order belongs to (if known). | |
LegGroupId | int | No | Yes | Leg group id within the execution plan (if known). | |
StrategyId | int | Yes | No | Live strategy id this order is associated with. | |
StrategyName | str | Yes | No | Strategy name at the time of the event. | |
State | OrderState | Yes | No | Current order state. | |
FilledQty | Decimal | Yes | Yes | Quantity filled so far (if available). | |
RemainingQty | Decimal | Yes | Yes | Remaining quantity (if available). | |
FillPrice | Decimal | Yes | Yes | Last fill price (if available). | |
AvgFillPrice | Decimal | Yes | Yes | Average fill price across all fills (if available). | |
Rejection | OrderRejectionInfo | No | Yes | Rejection details when the order is rejected. |
Returns: None
OnPositionUpdate
Called when a live position changes state (created, closed, adjusted, etc.).
Args model: PositionUpdateEvent
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
EventId | UUID | No | No | Stable unique identifier for this event instance. | |
EventSeqId | int | No | No | Server-assigned event sequence id used for ordering and replay/history APIs. | |
EventTime | datetime | Yes | No | UTC timestamp when the event occurred on the server. | |
PositionId | int | Yes | No | Live position id. | |
StrategyId | int | Yes | No | Live strategy id this position belongs to. | |
StrategyName | str | Yes | No | Strategy name at the time of the event. | |
PositionName | str | Yes | No | Position name at the time of the event. | |
BrokerAccountId | str | Yes | No | Broker account id this position belongs to. | |
Status | PositionStatus | Yes | No | Position status. | |
RealizedPnL | Decimal | No | No | Realized PnL at the time of the event. |
Returns: None
OnLegUpdate
Called when a live leg changes state (created, closed, quantity changed, etc.).
Args model: LegUpdateEvent
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
EventId | UUID | No | No | Stable unique identifier for this event instance. | |
EventSeqId | int | No | No | Server-assigned event sequence id used for ordering and replay/history APIs. | |
EventTime | datetime | Yes | No | UTC timestamp when the event occurred on the server. | |
BrokerAccountId | str | Yes | No | Broker account id this leg belongs to. | |
PositionId | int | Yes | No | Live position id this leg belongs to. | |
PositionName | str | Yes | No | Position name at the time of the event. | |
StrategyId | int | Yes | No | Live strategy id this position belongs to. | |
StrategyName | str | Yes | No | Strategy name at the time of the event. | |
LegId | int | Yes | No | Live leg id. | |
LegName | str | Yes | No | Leg name at the time of the event. | |
Contract | LiveContract | Yes | No | Contract for this leg. | |
Status | LegStatus | Yes | No | Leg status. | |
Qty | Decimal | No | No | Current leg quantity. | |
RealizedPnL | Decimal | No | No | Realized PnL attributed to this leg at the time of the event. |
Returns: None
OnAgentStatusChange
Called when an agent/connector status changes (connected, disconnected, error).
Args model: AgentStatusEvent
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
EventId | UUID | No | No | Stable unique identifier for this event instance. | |
EventSeqId | int | No | No | Server-assigned event sequence id used for ordering and replay/history APIs. | |
EventTime | datetime | Yes | No | UTC timestamp when the event occurred on the server. | |
Status | AgentStatus | Yes | No | Agent status. | |
Message | str | Yes | No | Human-readable status message. | |
Connector | AgentConnector | No | Yes | Optional hint which connector raised the event. |
Returns: None
OnError
Called when an error event is emitted or updated for a strategy/position.
Args model: ErrorEvent
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
EventId | UUID | No | No | Stable unique identifier for this event instance. | |
EventSeqId | int | No | No | Server-assigned event sequence id used for ordering and replay/history APIs. | |
EventTime | datetime | Yes | No | UTC timestamp when the event occurred on the server. | |
State | ErrorState | Yes | No | Error state transition. | |
ErrorId | UUID | Yes | No | Stable unique identifier for this error instance. | |
StrategyId | int | No | Yes | Live strategy id associated with the error (if applicable). | |
StrategyName | str | No | Yes | Strategy name associated with the error (if applicable). | |
PositionId | int | No | Yes | Live position id associated with the error (if applicable). | |
PositionName | str | No | Yes | Position name associated with the error (if applicable). | |
BrokerAccountId | str | No | Yes | Broker account id associated with the error (if applicable). | |
Message | str | No | Yes | Human-readable error message (if available). | |
ConditionType | ConditionType | No | Yes | Condition type associated with the error (if applicable). | |
Statement | str | No | Yes | Expression/statement associated with the error (if applicable). |
Returns: None
OnPositionEntryPreparationCompleted
Called when an asynchronous "prepare entry" job completes successfully.
Args model: PositionEntryPreparationCompletedEvent
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
EventId | UUID | No | No | Stable unique identifier for this event instance. | |
EventSeqId | int | No | No | Server-assigned event sequence id used for ordering and replay/history APIs. | |
EventTime | datetime | Yes | No | UTC timestamp when the event occurred on the server. | |
JobId | str | Yes | No | Job id returned by StartPreparePositionEntry. | |
StrategyId | int | Yes | No | Live strategy id the entry preparation belongs to. | |
StrategyName | str | Yes | No | Strategy name at the time of the event. | |
BrokerAccountId | str | No | Yes | Broker account id associated with the job (if available). | |
Result | PreparePositionEntryResult | Yes | No | Successful prepare-entry result payload. |
Returns: None
OnPositionEntryPreparationFailed
Called when an asynchronous "prepare entry" job fails.
Args model: PositionEntryPreparationFailedEvent
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
EventId | UUID | No | No | Stable unique identifier for this event instance. | |
EventSeqId | int | No | No | Server-assigned event sequence id used for ordering and replay/history APIs. | |
EventTime | datetime | Yes | No | UTC timestamp when the event occurred on the server. | |
JobId | str | Yes | No | Job id returned by StartPreparePositionEntry. | |
StrategyId | int | Yes | No | Live strategy id the entry preparation belongs to. | |
StrategyName | str | Yes | No | Strategy name at the time of the event. | |
BrokerAccountId | str | No | Yes | Broker account id associated with the job (if available). | |
Error | str | Yes | No | Error message describing why the job failed. |
Returns: None
OnPositionExitPreparationCompleted
Called when an asynchronous "prepare exit" job completes successfully.
Args model: PositionExitPreparationCompletedEvent
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
EventId | UUID | No | No | Stable unique identifier for this event instance. | |
EventSeqId | int | No | No | Server-assigned event sequence id used for ordering and replay/history APIs. | |
EventTime | datetime | Yes | No | UTC timestamp when the event occurred on the server. | |
JobId | str | Yes | No | Job id returned by StartPreparePositionExit. | |
StrategyId | int | Yes | No | Live strategy id the exit preparation belongs to. | |
StrategyName | str | Yes | No | Strategy name at the time of the event. | |
BrokerAccountId | str | No | Yes | Broker account id associated with the job (if available). | |
Result | PreparePositionExitResult | Yes | No | Successful prepare-exit result payload. |
Returns: None
OnPositionExitPreparationFailed
Called when an asynchronous "prepare exit" job fails.
Args model: PositionExitPreparationFailedEvent
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
EventId | UUID | No | No | Stable unique identifier for this event instance. | |
EventSeqId | int | No | No | Server-assigned event sequence id used for ordering and replay/history APIs. | |
EventTime | datetime | Yes | No | UTC timestamp when the event occurred on the server. | |
JobId | str | Yes | No | Job id returned by StartPreparePositionExit. | |
StrategyId | int | Yes | No | Live strategy id the exit preparation belongs to. | |
StrategyName | str | Yes | No | Strategy name at the time of the event. | |
BrokerAccountId | str | No | Yes | Broker account id associated with the job (if available). | |
Error | str | Yes | No | Error message describing why the job failed. |
Returns: None
OnPositionAdjustmentPreparationCompleted
Called when an asynchronous "prepare adjustment" job completes successfully.
Args model: PositionAdjustmentPreparationCompletedEvent
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
EventId | UUID | No | No | Stable unique identifier for this event instance. | |
EventSeqId | int | No | No | Server-assigned event sequence id used for ordering and replay/history APIs. | |
EventTime | datetime | Yes | No | UTC timestamp when the event occurred on the server. | |
JobId | str | Yes | No | Job id returned by StartPreparePositionAdjustment. | |
StrategyId | int | Yes | No | Live strategy id the adjustment preparation belongs to. | |
StrategyName | str | Yes | No | Strategy name at the time of the event. | |
BrokerAccountId | str | No | Yes | Broker account id associated with the job (if available). | |
Result | PreparePositionAdjustmentResult | Yes | No | Successful prepare-adjustment result payload. |
Returns: None
OnPositionAdjustmentPreparationFailed
Called when an asynchronous "prepare adjustment" job fails.
Args model: PositionAdjustmentPreparationFailedEvent
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
EventId | UUID | No | No | Stable unique identifier for this event instance. | |
EventSeqId | int | No | No | Server-assigned event sequence id used for ordering and replay/history APIs. | |
EventTime | datetime | Yes | No | UTC timestamp when the event occurred on the server. | |
JobId | str | Yes | No | Job id returned by StartPreparePositionAdjustment. | |
StrategyId | int | Yes | No | Live strategy id the adjustment preparation belongs to. | |
StrategyName | str | Yes | No | Strategy name at the time of the event. | |
BrokerAccountId | str | No | Yes | Broker account id associated with the job (if available). | |
Error | str | Yes | No | Error message describing why the job failed. |
Returns: None
OnAutoUpdateVarsAdjustmentStarted
Called when an auto-update-vars adjustment workflow starts.
Args model: AutoUpdateVarsAdjustmentStartedEvent
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
EventId | UUID | No | No | Stable unique identifier for this event instance. | |
EventSeqId | int | No | No | Server-assigned event sequence id used for ordering and replay/history APIs. | |
EventTime | datetime | Yes | No | UTC timestamp when the event occurred on the server. | |
JobId | str | Yes | No | Job id for the adjustment workflow. | |
StrategyId | int | Yes | No | Live strategy id the workflow belongs to. | |
StrategyName | str | Yes | No | Strategy name at the time of the event. | |
PositionId | int | Yes | No | Live position id the workflow applies to. | |
PositionName | str | Yes | No | Position name at the time of the event. | |
BrokerAccountId | str | No | Yes | Broker account id associated with the workflow (if available). | |
Condition | str | Yes | No | Condition identifier/expression used for selecting and validating the adjustment. |
Returns: None
OnAutoUpdateVarsAdjustmentCompleted
Called when an auto-update-vars adjustment workflow completes successfully.
Args model: AutoUpdateVarsAdjustmentCompletedEvent
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
EventId | UUID | No | No | Stable unique identifier for this event instance. | |
EventSeqId | int | No | No | Server-assigned event sequence id used for ordering and replay/history APIs. | |
EventTime | datetime | Yes | No | UTC timestamp when the event occurred on the server. | |
JobId | str | Yes | No | Job id for the adjustment workflow. | |
StrategyId | int | Yes | No | Live strategy id the workflow belongs to. | |
StrategyName | str | Yes | No | Strategy name at the time of the event. | |
PositionId | int | Yes | No | Live position id the workflow applies to. | |
PositionName | str | Yes | No | Position name at the time of the event. | |
BrokerAccountId | str | No | Yes | Broker account id associated with the workflow (if available). | |
Condition | str | Yes | No | Condition identifier/expression used for selecting and validating the adjustment. | |
UpdatedVars | dict[str, Decimal] | Yes | No | Variables updated by the workflow (var name → new value). |
Returns: None
OnAutoUpdateVarsAdjustmentFailed
Called when an auto-update-vars adjustment workflow fails.
Args model: AutoUpdateVarsAdjustmentFailedEvent
| Field | Type | Required | Nullable | Default | Description |
|---|---|---|---|---|---|
EventId | UUID | No | No | Stable unique identifier for this event instance. | |
EventSeqId | int | No | No | Server-assigned event sequence id used for ordering and replay/history APIs. | |
EventTime | datetime | Yes | No | UTC timestamp when the event occurred on the server. | |
JobId | str | Yes | No | Job id for the adjustment workflow. | |
StrategyId | int | Yes | No | Live strategy id the workflow belongs to. | |
StrategyName | str | Yes | No | Strategy name at the time of the event. | |
PositionId | int | Yes | No | Live position id the workflow applies to. | |
PositionName | str | Yes | No | Position name at the time of the event. | |
BrokerAccountId | str | No | Yes | Broker account id associated with the workflow (if available). | |
Condition | str | Yes | No | Condition identifier/expression used for selecting and validating the adjustment. | |
Error | str | Yes | No | Error message describing why the workflow failed. |
Returns: None