Market Structures
StockMarketABM.MarketStructures collects the mutable containers used during a session: portfolios per agent and the Market aggregate that binds instruments, order books, tick sizes, telemetry, and expiry tracking.
TelemetryConfig controls how many snapshots the market keeps in memory (tick history, OHLCV bars). The Market struct stores a MarketTelemetry record per instrument so agents can read hot metrics in O(1) and optional flush queues allow long histories to be batched to persistent storage. Depth snapshots are collected lazily via get_depth_levels, avoiding per-tick work when agents do not need order-book depth. Market also maintains a rolling order-flow log (OrderFlowKind / OrderFlowRecord) capturing every add, cancel, trade, or expiry so the entire sequence of book mutations can be exported.
StockMarketABM.MarketStructures.Market — TypeMarketTop-level container for a simulated market session. Maintains the set of instruments, associated order books, tick sizes, agent portfolios, and the store of expirable orders.
StockMarketABM.MarketStructures.Market — MethodMarket(instruments, order_books, tick_sizes, accounts; expiries)Construct a Market from pre-existing dictionaries. The expiries store defaults to a fresh ExpiringOrderStore when omitted.
StockMarketABM.MarketStructures.MarketSnapshot — TypeMarketSnapshotHot metrics for an instrument (best bid/ask, midprice, last trade details).
StockMarketABM.MarketStructures.MarketTelemetry — TypeMarketTelemetryAggregated telemetry for an instrument, including rolling buffers and current bar state.
StockMarketABM.MarketStructures.Portfolio — TypePortfolioTracks an agent's cash balance and instrument holdings. Holdings are stored in a dictionary keyed by instrument symbol.
StockMarketABM.MarketStructures.TelemetryConfig — TypeTelemetryConfigConfiguration for in-memory market telemetry buffers.