Skip to content

account.margin_call.alert

Direction: server → modules. External Moleculer event name: account.margin_call.alert.

Source and occurrence

The source is the typed AccountMarginStateRecord emitted by Core::OnMarginState on an actual margin-state transition. Workflow accepts only transitions into MARGINLEVEL_MARGINCALL (level_type = 1) where the previous state was not Margin Call. Recalculations that remain in Margin Call do not start the trigger again.

Workflow trigger: account.margin_call.alert. Action: account.margin_call.publish. The action emits an AccountMarginCallAlertRecord to the internal account.margin_call.workflow_alert bridge, which publishes this external event.

An active matching workflow rule is required. The existing account.margin_state event remains unchanged and continues to describe all margin-state transitions, including Stop Out and recovery to OK.

Workflow conditions

The trigger exposes:

  • brand;
  • margin.login, margin.group;
  • margin.previous_level_type, margin.level_type;
  • margin.margin_level, margin.equity, margin.margin, margin.margin_free;
  • the advertised account and customer context fields returned by MngGetWorkflowConditionsByTrigger.

Account and customer enrichment is best-effort. Conditions that require unavailable enrichment do not match; the margin snapshot itself remains sufficient for margin conditions and publication.

JSON payload

{
  "event_id": "a89e743cf46a4855986aa6769e47a075",
  "event_code": 1,
  "occurred_at": 1789080000,
  "schema_version": 1,
  "login": 2000067,
  "group": "real\\standard",
  "brand": "ion4",
  "previous_level_type": 0,
  "level_type": 1,
  "margin_level": 49.8,
  "equity": 96.4,
  "margin": 193.6,
  "margin_free": -97.2
}
Field Type Meaning
login integer Trading account login
group string Account group from the margin snapshot
brand string Brand resolved by the margin-state producer
previous_level_type integer Previous margin state; never 1 for this alert
level_type integer Always 1 (MARGINLEVEL_MARGINCALL)
margin_level number Calculated margin level
equity number Account equity at the transition
margin number Used margin at the transition
margin_free number Free margin at the transition

occurred_at is the original transition timestamp in Unix seconds. Publication is asynchronous, fire-and-forget, without delivery confirmation, durable replay or retry. See shared outbound rules for queue and payload limits.