pub mod crossover;
pub mod news;
use std::sync::Arc;
use crate::{
error::ChapatyResult,
gym::{
AgentIdentifier,
trading::{action::Actions, observation::Observation},
},
};
pub trait Agent {
fn act(&mut self, obs: Observation) -> ChapatyResult<Actions>;
fn identifier(&self) -> AgentIdentifier {
AgentIdentifier::Named(Arc::new(
"UnnamedAgent: override Agent::identifier()".to_string(),
))
}
fn reset(&mut self) {}
}
impl Agent for Box<dyn Agent> {
fn act(&mut self, obs: Observation) -> ChapatyResult<Actions> {
(**self).act(obs)
}
fn identifier(&self) -> AgentIdentifier {
(**self).identifier()
}
fn reset(&mut self) {
(**self).reset()
}
}