Skip to main content

apple_quant_algorithmic/order/
state_goal.rs

1#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
2pub enum StateGoal {
3	#[default]
4	None,
5	CancelAll,
6	CancelFlattenAll,
7	CancelFlattenAllShutdown,
8	CancelFlattenAllRestart,
9}
10
11impl StateGoal {
12	pub fn as_result(
13		&self,
14	) -> StateGoalResult {
15		match self {
16			Self::None => StateGoalResult::Active,
17			Self::CancelAll => StateGoalResult::Inactive,
18			Self::CancelFlattenAll => StateGoalResult::Inactive,
19			Self::CancelFlattenAllShutdown => StateGoalResult::Shutdown,
20			Self::CancelFlattenAllRestart => StateGoalResult::Restart,
21		}
22	}
23}
24
25#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
26pub enum StateGoalResult {
27	Active,
28	Inactive,
29	Shutdown,
30	Restart,
31}