RandomAgents

Struct RandomAgents 

Source
pub struct RandomAgents { /* private fields */ }
Expand description

Agents that place orders with uniformly sampled parameters

A set of agents that place orders on a random side with random volume and price within a given range. Sides, volumes and prices are uniformly sampled.

Each step each agent:

  • Are randomly activated with a given activity rate
  • If active and they have an active order on the market they try to cancel that order
  • If they don’t have an active order then they place a new order on a random side, with a random volume and price
The behaviour of this agent is not based on anything 'realistic' and should probably only be used for testing and benchmarking.

§Examples

use bourse_de::agents::{Agent, RandomAgents, Agents};
use bourse_de::{sim_runner, Env};

#[derive(Agents)]
struct SimAgents {
    pub a: RandomAgents,
}

let mut env = Env::new(0, 1, 1_000_000, true);

let mut agents = SimAgents {
    a: RandomAgents::new(10, (40, 60), (10, 20), 2, 0.8),
};

sim_runner(&mut env, &mut agents, 101, 10, false);

Implementations§

Source§

impl RandomAgents

Source

pub fn new( n_agents: usize, tick_range: (Price, Price), vol_range: (Vol, Vol), tick_size: Price, activity_rate: f32, ) -> Self

Initialise a set of random agents

§Arguments
  • n_agents - Number of agents in the set
  • tick_range - Range of ticks to place orders over
  • vol_range - Order volume range to sample from
  • tick_size - Market tick size
  • activity_rate - Agent activity rate

Trait Implementations§

Source§

impl Agent for RandomAgents

Source§

fn update<R: RngCore>(&mut self, env: &mut Env, rng: &mut R)

Update the state of the agent(s) Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V