gmo_coin_rs/execution_type.rs
1//! 注文方法を定義する。
2
3/// 注文方法
4pub enum ExecutionType {
5 /// 成行注文
6 Market,
7
8 /// 指値注文
9 Limit,
10
11 /// 逆指値注文
12 Stop,
13}
14
15/// 成行注文
16pub const MARKET_ORDER: &str = "MARKET";
17
18/// 指値注文
19pub const LIMIT_ORDER: &str = "LIMIT";
20
21/// 逆指値注文
22pub const STOP_ORDER: &str = "STOP";
23
24impl ExecutionType {
25 /// 注文方法を文字列に変換する。
26 pub fn to_string(&self) -> &str {
27 match self {
28 ExecutionType::Market => MARKET_ORDER,
29 ExecutionType::Limit => LIMIT_ORDER,
30 ExecutionType::Stop => STOP_ORDER,
31 }
32 }
33}