IDs
StockMarketABM.IDs manages monotonically increasing identifiers for orders, trades, events, and agents. These wrappers keep counters type-safe and self-describing when they travel through the simulation.
Note: The built-in counters assume single-threaded access. To use the ID generators from multiple threads, replace the global Ref counters with Threads.Atomic values (or similar synchronization) so increments remain race-free.
StockMarketABM.IDs.AgentId — TypeAgentIdIdentifier for agents participating in the simulation. The backing type uses UInt32 because the agent population is typically smaller than the order flow.
StockMarketABM.IDs.EventId — TypeEventIdIdentifier for events emitted during the simulation, for example order submissions or executions.
StockMarketABM.IDs.OrderId — TypeOrderIdWrapper type for uniquely identifying orders. Storing the identifier in a dedicated struct prevents accidental mixing with other numeric counters.
StockMarketABM.IDs.TradeId — TypeTradeIdUnique identifier for trades generated by the matching engine.
StockMarketABM.IDs.next_agent_id! — Methodnext_agent_id!() -> AgentIdReturn the next sequential AgentId for newly created agents.
StockMarketABM.IDs.next_event_id! — Methodnext_event_id!() -> EventIdReturn the next sequential EventId for logging simulation events.
StockMarketABM.IDs.next_order_id! — Methodnext_order_id!() -> OrderIdReturn the next sequential OrderId. The counter is local to the process and assumes single-threaded access.
StockMarketABM.IDs.next_trade_id! — Methodnext_trade_id!() -> TradeIdReturn the next sequential TradeId emitted by the matching engine.
StockMarketABM.IDs.reset_ids! — Methodreset_ids!()Reset all ID counters back to zero. This is primarily useful in tests to ensure deterministic starting identifiers.