pub mod staticweight;
use crate::broker::BrokerTrade;
#[allow(unused)]
use crate::types::{CashValue, StrategySnapshot};
pub trait Strategy: TransferTo {
fn update(&mut self);
fn init(&mut self, initial_cash: &f64);
}
pub enum StrategyEvent {
WithdrawSuccess(CashValue),
WithdrawFailure(CashValue),
DepositSuccess(CashValue),
}
pub trait Audit<T: BrokerTrade> {
fn trades_between(&self, start: &i64, end: &i64) -> Vec<T>;
}
pub trait TransferTo {
fn deposit_cash(&mut self, cash: &f64) -> StrategyEvent;
}
pub trait TransferFrom {
fn withdraw_cash(&mut self, cash: &f64) -> StrategyEvent;
fn withdraw_cash_with_liquidation(&mut self, cash: &f64) -> StrategyEvent;
}
pub trait History {
fn get_history(&self) -> Vec<StrategySnapshot>;
}