bourse.step_sim.agents.base_agent.BaseNumpyAgent.update(rng: Generator, level_2_data: ndarray) tuple[ndarray, ndarray, ndarray, ndarray, ndarray, ndarray]

Update the state of the agent and return new market instructions

Update function called at each step of the simulation, should update the state of the agents(s) and return Numpy arrays represent instructions to submit to the market.

Parameters:
rng: Generator

Numpy random generator.

level_2_data: ndarray

Numpy array representing the current state of the market. Contains the following values at positions:

  • 0: Trade volume (in the last step)

  • 1: Bid touch price

  • 2: Ask touch price

  • 3: Bid total volume

  • 4: Ask total volume

the following 40 values are data for each of the 10 price level below/above the touch

  • Bid volume at level

  • Number of buy orders at level

  • Ask volume at level

  • Number of sell orders at level

Returns:

tuple – Tuple of numpy arrays containing:

  • Instruction type, an integer representing

    • 0: No change/null instruction

    • 1: New order

    • 2: Cancel order

  • Order sides (as bool, True for bid side) (used for new orders)

  • Order volumes (used for new orders)

  • Trader ids (used for new orders)

  • Order prices (used for new orders)

  • Order id (used for cancellations)