account.margin_state¶
Direction: server → modules. External Moleculer event name: account.margin_state.
Source and occurrence¶
C++ payload: AccountMarginStateRecord. Internal EventBus name: account.margin_state.
Core::OnMarginState captures a level transition while platform processing is active. Equal levels and invalid levels produce no event. Recovery to OK is included; this is not emitted on every quote.
level_type and previous_level_type: OK = 0, MARGINCALL = 1, STOPOUT = 2. The snapshot contains margin values and producer-resolved brand, not balance/credit/bonus.
JSON payload¶
The payload is flat; there is no data wrapper. All listed fields are emitted.
{
"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": 95.4,
"equity": 96.4,
"margin": 88,
"margin_free": 8.4
}
| Domain field | JSON type |
|---|---|
login |
integer |
group |
string |
brand |
string |
previous_level_type |
integer |
level_type |
integer |
margin_level |
number |
equity |
number |
margin |
number |
margin_free |
number |
Common fields: event_id (32-character random hex string), event_code (original integer code), occurred_at (Unix seconds), schema_version (integer, currently 1).
occurred_at uses the source timestamp; zero remains zero. Margin uses transition time.
Subscription and delivery¶
Subscribe through the module's normal Moleculer event handler for account.margin_state.
Enabled with server nats.enable. Publication is asynchronous, fire-and-forget,
without ACK, retry or durable replay. Queue limit: 4096 business messages; JSON limit:
16 KiB. New messages can be dropped at either limit; order is not guaranteed.
event_id supports consumer deduplication, not exactly-once delivery.
See shared outbound rules for lifecycle, observability and trust limits. See outbound catalogue for other event families.