kiteconnect_async_wasm/models/common/enums/
trading.rs1use serde::{Deserialize, Serialize};
6
7#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
9pub enum Product {
10 #[serde(rename = "CNC")]
11 CNC, #[serde(rename = "NRML")]
13 NRML, #[serde(rename = "MIS")]
15 MIS, #[serde(rename = "MTF")]
17 MTF, }
19
20impl std::fmt::Display for Product {
21 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22 match self {
23 Product::CNC => write!(f, "CNC"),
24 Product::MIS => write!(f, "MIS"),
25 Product::NRML => write!(f, "NRML"),
26 Product::MTF => write!(f, "MTF"),
27 }
28 }
29}
30
31#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
33pub enum Validity {
34 #[serde(rename = "DAY")]
35 DAY, #[serde(rename = "IOC")]
37 IOC, #[serde(rename = "TTL")]
39 TTL, }
41
42impl std::fmt::Display for Validity {
43 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
44 match self {
45 Validity::DAY => write!(f, "DAY"),
46 Validity::IOC => write!(f, "IOC"),
47 Validity::TTL => write!(f, "TTL"),
48 }
49 }
50}
51
52#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
54pub enum TransactionType {
55 #[serde(rename = "BUY")]
56 BUY,
57 #[serde(rename = "SELL")]
58 SELL,
59}
60
61impl std::fmt::Display for TransactionType {
62 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
63 match self {
64 TransactionType::BUY => write!(f, "BUY"),
65 TransactionType::SELL => write!(f, "SELL"),
66 }
67 }
68}
69
70#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
72pub enum OrderType {
73 #[serde(rename = "MARKET")]
74 MARKET,
75 #[serde(rename = "LIMIT")]
76 LIMIT,
77 #[serde(rename = "SL")]
78 SL, #[serde(rename = "SL-M")]
80 SLM, }
82
83impl std::fmt::Display for OrderType {
84 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
85 match self {
86 OrderType::MARKET => write!(f, "MARKET"),
87 OrderType::LIMIT => write!(f, "LIMIT"),
88 OrderType::SL => write!(f, "SL"),
89 OrderType::SLM => write!(f, "SL-M"),
90 }
91 }
92}
93
94#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
96pub enum Variety {
97 #[serde(rename = "regular")]
98 Regular,
99 #[serde(rename = "co")]
100 CO, #[serde(rename = "amo")]
102 AMO, #[serde(rename = "iceberg")]
104 Iceberg,
105 #[serde(rename = "auction")]
106 Auction,
107}
108
109impl std::fmt::Display for Variety {
110 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
111 match self {
112 Variety::Regular => write!(f, "regular"),
113 Variety::CO => write!(f, "co"),
114 Variety::AMO => write!(f, "amo"),
115 Variety::Iceberg => write!(f, "iceberg"),
116 Variety::Auction => write!(f, "auction"),
117 }
118 }
119}