Skip to main content

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

FieldTypeRequiredNullableDefaultDescription
Strategieslist[int]NoYesStrategies to subscribe to. null = subscribe to all user strategies, empty = no-op.

Returns (payload): SubscribeToStrategiesResult

FieldTypeRequiredNullableDefaultDescription
SuccessfulStrategieslist[int]YesNoStrategy ids that were successfully subscribed to.
FailedStrategieslist[int]YesNoStrategy ids that failed to subscribe to.

UnsubscribeFromStrategies

Unsubscribe this connection from server→client event callbacks for the specified strategies.

Args model: UnsubscribeFromStrategiesArgs

FieldTypeRequiredNullableDefaultDescription
Strategieslist[int]NoYesStrategies to unsubscribe from. null = unsubscribe from all, empty = no-op.

Returns (payload): UnsubscribeFromStrategiesResult

FieldTypeRequiredNullableDefaultDescription
SuccessfulStrategieslist[int]YesNoStrategy ids that were successfully unsubscribed from.
FailedStrategieslist[int]YesNoStrategy 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

FieldTypeRequiredNullableDefaultDescription
LatestEventSeqIdintYesNoLatest event sequence id currently available for the authenticated user.
SnapshotTimedatetimeYesNoUTC time when this snapshot was taken.

GetEventsSince

Retrieve historical events since a given event sequence id (supports pagination).

Args model: GetEventsSinceArgs

FieldTypeRequiredNullableDefaultDescription
SinceEventSeqIdintYesNoFetch events strictly after this sequence id.
LimitintYesNoMaximum number of events to return. Must be less than or equal to MaxEventsLimit.
ContinuationTokenstrNoYesPagination token returned by a previous GetEventsSince call.

Returns (payload): GetEventsSinceResult

FieldTypeRequiredNullableDefaultDescription
Eventslist[MesoLiveEventEnvelope]YesNoEvent envelopes returned by this page.
ContinuationTokenstrNoYesPagination 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.

note

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

FieldTypeRequiredNullableDefaultDescription
EventIdUUIDNoNoStable unique identifier for this event instance.
EventSeqIdintNoNoServer-assigned event sequence id used for ordering and replay/history APIs.
EventTimedatetimeYesNoUTC timestamp when the event occurred on the server.
StateSignalStateYesNoEntry signal state (On/Off).
StrategyIdintYesNoLive strategy id this signal belongs to.
StrategyNamestrYesNoStrategy name at the time of the event.
BrokerAccountIdstrYesNoBroker account id this signal is associated with.
EntrySignalResultEntrySignalsResultNoYesOptional 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

FieldTypeRequiredNullableDefaultDescription
EventIdUUIDNoNoStable unique identifier for this event instance.
EventSeqIdintNoNoServer-assigned event sequence id used for ordering and replay/history APIs.
EventTimedatetimeYesNoUTC timestamp when the event occurred on the server.
StateSignalStateYesNoExit signal state (On/Off).
StrategyIdintYesNoLive strategy id this position belongs to.
StrategyNamestrYesNoStrategy name at the time of the event.
PositionIdintYesNoLive position id this exit signal applies to.
PositionNamestrYesNoPosition name at the time of the event.
BrokerAccountIdstrNoYesBroker account id this position belongs to (may be null in some contexts).
ExitSignalResultExitSignalsResultNoYesOptional 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

FieldTypeRequiredNullableDefaultDescription
EventIdUUIDNoNoStable unique identifier for this event instance.
EventSeqIdintNoNoServer-assigned event sequence id used for ordering and replay/history APIs.
EventTimedatetimeYesNoUTC timestamp when the event occurred on the server.
StateSignalStateYesNoAdjustment signal state (On/Off).
StrategyIdintYesNoLive strategy id this position belongs to.
StrategyNamestrYesNoStrategy name at the time of the event.
PositionIdintYesNoLive position id this adjustment signal applies to.
PositionNamestrYesNoPosition name at the time of the event.
BrokerAccountIdstrNoYesBroker account id this position belongs to (may be null in some contexts).
AdjustmentTimeOkboolYesNoWhether the adjustment timing window is satisfied.
ConditionConditionEvaluationYesNoCondition evaluation that triggered/represents this adjustment signal.

Returns: None

OnOrderUpdate

Called when a live order changes state (submitted, filled, rejected, etc.).

Args model: OrderUpdateEvent

FieldTypeRequiredNullableDefaultDescription
EventIdUUIDNoNoStable unique identifier for this event instance.
EventSeqIdintNoNoServer-assigned event sequence id used for ordering and replay/history APIs.
EventTimedatetimeYesNoUTC timestamp when the event occurred on the server.
OrderIdintYesNoLive order id.
BrokerAccountIdstrNoYesBroker account id the order belongs to (may be null in some contexts).
ExecPlanIdintNoYesLive execution plan id this order belongs to (if known).
LegGroupIdintNoYesLeg group id within the execution plan (if known).
StrategyIdintYesNoLive strategy id this order is associated with.
StrategyNamestrYesNoStrategy name at the time of the event.
StateOrderStateYesNoCurrent order state.
FilledQtyDecimalYesYesQuantity filled so far (if available).
RemainingQtyDecimalYesYesRemaining quantity (if available).
FillPriceDecimalYesYesLast fill price (if available).
AvgFillPriceDecimalYesYesAverage fill price across all fills (if available).
RejectionOrderRejectionInfoNoYesRejection details when the order is rejected.

Returns: None

OnPositionUpdate

Called when a live position changes state (created, closed, adjusted, etc.).

Args model: PositionUpdateEvent

FieldTypeRequiredNullableDefaultDescription
EventIdUUIDNoNoStable unique identifier for this event instance.
EventSeqIdintNoNoServer-assigned event sequence id used for ordering and replay/history APIs.
EventTimedatetimeYesNoUTC timestamp when the event occurred on the server.
PositionIdintYesNoLive position id.
StrategyIdintYesNoLive strategy id this position belongs to.
StrategyNamestrYesNoStrategy name at the time of the event.
PositionNamestrYesNoPosition name at the time of the event.
BrokerAccountIdstrYesNoBroker account id this position belongs to.
StatusPositionStatusYesNoPosition status.
RealizedPnLDecimalNoNoRealized 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

FieldTypeRequiredNullableDefaultDescription
EventIdUUIDNoNoStable unique identifier for this event instance.
EventSeqIdintNoNoServer-assigned event sequence id used for ordering and replay/history APIs.
EventTimedatetimeYesNoUTC timestamp when the event occurred on the server.
BrokerAccountIdstrYesNoBroker account id this leg belongs to.
PositionIdintYesNoLive position id this leg belongs to.
PositionNamestrYesNoPosition name at the time of the event.
StrategyIdintYesNoLive strategy id this position belongs to.
StrategyNamestrYesNoStrategy name at the time of the event.
LegIdintYesNoLive leg id.
LegNamestrYesNoLeg name at the time of the event.
ContractLiveContractYesNoContract for this leg.
StatusLegStatusYesNoLeg status.
QtyDecimalNoNoCurrent leg quantity.
RealizedPnLDecimalNoNoRealized 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

FieldTypeRequiredNullableDefaultDescription
EventIdUUIDNoNoStable unique identifier for this event instance.
EventSeqIdintNoNoServer-assigned event sequence id used for ordering and replay/history APIs.
EventTimedatetimeYesNoUTC timestamp when the event occurred on the server.
StatusAgentStatusYesNoAgent status.
MessagestrYesNoHuman-readable status message.
ConnectorAgentConnectorNoYesOptional 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

FieldTypeRequiredNullableDefaultDescription
EventIdUUIDNoNoStable unique identifier for this event instance.
EventSeqIdintNoNoServer-assigned event sequence id used for ordering and replay/history APIs.
EventTimedatetimeYesNoUTC timestamp when the event occurred on the server.
StateErrorStateYesNoError state transition.
ErrorIdUUIDYesNoStable unique identifier for this error instance.
StrategyIdintNoYesLive strategy id associated with the error (if applicable).
StrategyNamestrNoYesStrategy name associated with the error (if applicable).
PositionIdintNoYesLive position id associated with the error (if applicable).
PositionNamestrNoYesPosition name associated with the error (if applicable).
BrokerAccountIdstrNoYesBroker account id associated with the error (if applicable).
MessagestrNoYesHuman-readable error message (if available).
ConditionTypeConditionTypeNoYesCondition type associated with the error (if applicable).
StatementstrNoYesExpression/statement associated with the error (if applicable).

Returns: None

OnPositionEntryPreparationCompleted

Called when an asynchronous "prepare entry" job completes successfully.

Args model: PositionEntryPreparationCompletedEvent

FieldTypeRequiredNullableDefaultDescription
EventIdUUIDNoNoStable unique identifier for this event instance.
EventSeqIdintNoNoServer-assigned event sequence id used for ordering and replay/history APIs.
EventTimedatetimeYesNoUTC timestamp when the event occurred on the server.
JobIdstrYesNoJob id returned by StartPreparePositionEntry.
StrategyIdintYesNoLive strategy id the entry preparation belongs to.
StrategyNamestrYesNoStrategy name at the time of the event.
BrokerAccountIdstrNoYesBroker account id associated with the job (if available).
ResultPreparePositionEntryResultYesNoSuccessful prepare-entry result payload.

Returns: None

OnPositionEntryPreparationFailed

Called when an asynchronous "prepare entry" job fails.

Args model: PositionEntryPreparationFailedEvent

FieldTypeRequiredNullableDefaultDescription
EventIdUUIDNoNoStable unique identifier for this event instance.
EventSeqIdintNoNoServer-assigned event sequence id used for ordering and replay/history APIs.
EventTimedatetimeYesNoUTC timestamp when the event occurred on the server.
JobIdstrYesNoJob id returned by StartPreparePositionEntry.
StrategyIdintYesNoLive strategy id the entry preparation belongs to.
StrategyNamestrYesNoStrategy name at the time of the event.
BrokerAccountIdstrNoYesBroker account id associated with the job (if available).
ErrorstrYesNoError message describing why the job failed.

Returns: None

OnPositionExitPreparationCompleted

Called when an asynchronous "prepare exit" job completes successfully.

Args model: PositionExitPreparationCompletedEvent

FieldTypeRequiredNullableDefaultDescription
EventIdUUIDNoNoStable unique identifier for this event instance.
EventSeqIdintNoNoServer-assigned event sequence id used for ordering and replay/history APIs.
EventTimedatetimeYesNoUTC timestamp when the event occurred on the server.
JobIdstrYesNoJob id returned by StartPreparePositionExit.
StrategyIdintYesNoLive strategy id the exit preparation belongs to.
StrategyNamestrYesNoStrategy name at the time of the event.
BrokerAccountIdstrNoYesBroker account id associated with the job (if available).
ResultPreparePositionExitResultYesNoSuccessful prepare-exit result payload.

Returns: None

OnPositionExitPreparationFailed

Called when an asynchronous "prepare exit" job fails.

Args model: PositionExitPreparationFailedEvent

FieldTypeRequiredNullableDefaultDescription
EventIdUUIDNoNoStable unique identifier for this event instance.
EventSeqIdintNoNoServer-assigned event sequence id used for ordering and replay/history APIs.
EventTimedatetimeYesNoUTC timestamp when the event occurred on the server.
JobIdstrYesNoJob id returned by StartPreparePositionExit.
StrategyIdintYesNoLive strategy id the exit preparation belongs to.
StrategyNamestrYesNoStrategy name at the time of the event.
BrokerAccountIdstrNoYesBroker account id associated with the job (if available).
ErrorstrYesNoError message describing why the job failed.

Returns: None

OnPositionAdjustmentPreparationCompleted

Called when an asynchronous "prepare adjustment" job completes successfully.

Args model: PositionAdjustmentPreparationCompletedEvent

FieldTypeRequiredNullableDefaultDescription
EventIdUUIDNoNoStable unique identifier for this event instance.
EventSeqIdintNoNoServer-assigned event sequence id used for ordering and replay/history APIs.
EventTimedatetimeYesNoUTC timestamp when the event occurred on the server.
JobIdstrYesNoJob id returned by StartPreparePositionAdjustment.
StrategyIdintYesNoLive strategy id the adjustment preparation belongs to.
StrategyNamestrYesNoStrategy name at the time of the event.
BrokerAccountIdstrNoYesBroker account id associated with the job (if available).
ResultPreparePositionAdjustmentResultYesNoSuccessful prepare-adjustment result payload.

Returns: None

OnPositionAdjustmentPreparationFailed

Called when an asynchronous "prepare adjustment" job fails.

Args model: PositionAdjustmentPreparationFailedEvent

FieldTypeRequiredNullableDefaultDescription
EventIdUUIDNoNoStable unique identifier for this event instance.
EventSeqIdintNoNoServer-assigned event sequence id used for ordering and replay/history APIs.
EventTimedatetimeYesNoUTC timestamp when the event occurred on the server.
JobIdstrYesNoJob id returned by StartPreparePositionAdjustment.
StrategyIdintYesNoLive strategy id the adjustment preparation belongs to.
StrategyNamestrYesNoStrategy name at the time of the event.
BrokerAccountIdstrNoYesBroker account id associated with the job (if available).
ErrorstrYesNoError message describing why the job failed.

Returns: None

OnAutoUpdateVarsAdjustmentStarted

Called when an auto-update-vars adjustment workflow starts.

Args model: AutoUpdateVarsAdjustmentStartedEvent

FieldTypeRequiredNullableDefaultDescription
EventIdUUIDNoNoStable unique identifier for this event instance.
EventSeqIdintNoNoServer-assigned event sequence id used for ordering and replay/history APIs.
EventTimedatetimeYesNoUTC timestamp when the event occurred on the server.
JobIdstrYesNoJob id for the adjustment workflow.
StrategyIdintYesNoLive strategy id the workflow belongs to.
StrategyNamestrYesNoStrategy name at the time of the event.
PositionIdintYesNoLive position id the workflow applies to.
PositionNamestrYesNoPosition name at the time of the event.
BrokerAccountIdstrNoYesBroker account id associated with the workflow (if available).
ConditionstrYesNoCondition 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

FieldTypeRequiredNullableDefaultDescription
EventIdUUIDNoNoStable unique identifier for this event instance.
EventSeqIdintNoNoServer-assigned event sequence id used for ordering and replay/history APIs.
EventTimedatetimeYesNoUTC timestamp when the event occurred on the server.
JobIdstrYesNoJob id for the adjustment workflow.
StrategyIdintYesNoLive strategy id the workflow belongs to.
StrategyNamestrYesNoStrategy name at the time of the event.
PositionIdintYesNoLive position id the workflow applies to.
PositionNamestrYesNoPosition name at the time of the event.
BrokerAccountIdstrNoYesBroker account id associated with the workflow (if available).
ConditionstrYesNoCondition identifier/expression used for selecting and validating the adjustment.
UpdatedVarsdict[str, Decimal]YesNoVariables updated by the workflow (var name → new value).

Returns: None

OnAutoUpdateVarsAdjustmentFailed

Called when an auto-update-vars adjustment workflow fails.

Args model: AutoUpdateVarsAdjustmentFailedEvent

FieldTypeRequiredNullableDefaultDescription
EventIdUUIDNoNoStable unique identifier for this event instance.
EventSeqIdintNoNoServer-assigned event sequence id used for ordering and replay/history APIs.
EventTimedatetimeYesNoUTC timestamp when the event occurred on the server.
JobIdstrYesNoJob id for the adjustment workflow.
StrategyIdintYesNoLive strategy id the workflow belongs to.
StrategyNamestrYesNoStrategy name at the time of the event.
PositionIdintYesNoLive position id the workflow applies to.
PositionNamestrYesNoPosition name at the time of the event.
BrokerAccountIdstrNoYesBroker account id associated with the workflow (if available).
ConditionstrYesNoCondition identifier/expression used for selecting and validating the adjustment.
ErrorstrYesNoError message describing why the workflow failed.

Returns: None