Random Agent
StockMarketABM.RandomAgentMod implements a zero-intelligence trader that randomly submits market orders, limit orders, or cancels according to configurable probabilities. Each activation performs at most one action:
- draw an action using per-tick probabilities for market, limit, cancel, and idle behaviour;
- pick a random side (buy/sell);
- market orders use
OrderType.Market/IOCto consume resting depth; - limit orders draw prices relative to the top of book: buys sample down from the best ask and sells sample up from the best bid, with
price_bandsetting the maximum distance in price units; the orders rest asGTCorders, with resting identifiers tracked automatically for future cancels; - cancel actions choose one of the agent's resting quotes uniformly at random.
The agent provides a controllable stream of noise for benchmarking spreads, volatility, and queue dynamics in the auction without strategic behaviour.
StockMarketABM.RandomAgentMod.RandomAgent — TypeRandomAgent(; kwargs...)Zero-intelligence agent that submits random market/limit orders and cancels resting quotes according to configurable per-tick probabilities. The agent uses its own RNG stream, tracks outstanding limit orders, and produces at most one order or cancel per activation.
Keyword Arguments
id::AgentId: unique identifier for the agent.instrument::Instrument: instrument traded by the agent.order_qty::Qty: legacy alias for configuring a fixed order size (sets bothorder_qty_minandorder_qty_max).order_qty_min::Qty: smallest random order size (defaults to 1). When equal toorder_qty_maxthe agent submits constant-size orders.order_qty_max::Qty: largest random order size (defaults to 5 when neitherorder_qtynororder_qty_maxis provided).price_band::Int: maximum distance (in price units) from the best quote (ask for buys, bid for sells) when sampling limit prices.market_prob::Float64: probability of sending a market order on activation.limit_prob::Float64: probability of sending a limit order on activation.cancel_prob::Float64: probability of cancelling one resting order. Ignored when the agent has no resting quotes.activation_mode::Symbol: controls scheduling strategy (:fixed,:poisson, or:exponential). Defaults to:fixed, which relies on the simulation's configured interval.activation_scale::Real: scale/mean parameter for the chosen activation mode.rng::AbstractRNG: random number generator (defaults toMersenneTwister()).
StockMarketABM.AgentsBase.activate! — Methodactivate!(agent::RandomAgent, market, now)Sample a random action (market order, limit order, cancel, or idle) and return an appropriate request for the simulation to execute.
StockMarketABM.AgentsBase.update! — Methodupdate!(agent::RandomAgent, events)Track resting order identifiers based on market events so future cancellations can target valid quotes.