class bourse.step_sim.agents.base_agent.BaseNumpyAgent

Base discrete event agent using Numpy data

Examples

import numpy as np
from bourse.step_sim.agents import BaseNumpyAgent

class Agent(BaseNumpyAgent):
    # This agent just gets the current touch prices
    #  and places an order either side of the spread
    def update(self, rng, level_2_data):
        bid, ask = level_2_data[1], level_2_data[2]

        return (
            np.array([1, 1], dtype=np.uint32),
            np.array([True, False]),
            np.array([10, 20], dtype=np.uint32),
            np.array([101, 202], dtype=np.uint32),
            np.array([bid, ask], dtype=np.uint32),
            np.array([0, 0], dtype=np.uint64),
        )

BaseNumpyAgent Methods

update(...) tuple[ndarray, ndarray, ndarray, ndarray, ndarray, ndarray]

Update the state of the agent and return new market instructions