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/IOC to 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_band setting the maximum distance in price units; the orders rest as GTC orders, 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.RandomAgentType
RandomAgent(; 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 both order_qty_min and order_qty_max).
  • order_qty_min::Qty: smallest random order size (defaults to 1). When equal to order_qty_max the agent submits constant-size orders.
  • order_qty_max::Qty: largest random order size (defaults to 5 when neither order_qty nor order_qty_max is 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 to MersenneTwister()).
source
StockMarketABM.AgentsBase.activate!Method
activate!(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.

source