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
impl RandomAgents
Sourcepub fn new(
n_agents: usize,
tick_range: (Price, Price),
vol_range: (Vol, Vol),
tick_size: Price,
activity_rate: f32,
) -> Self
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 settick_range- Range of ticks to place orders overvol_range- Order volume range to sample fromtick_size- Market tick sizeactivity_rate- Agent activity rate
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RandomAgents
impl RefUnwindSafe for RandomAgents
impl Send for RandomAgents
impl Sync for RandomAgents
impl Unpin for RandomAgents
impl UnwindSafe for RandomAgents
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more