ib/models/
contract.rs

1/* 
2 * Client Portal Web API
3 *
4 * Client Poral Web API
5 *
6 * OpenAPI spec version: 1.0.0
7 * 
8 * Generated by: https://github.com/swagger-api/swagger-codegen.git
9 */
10
11/// Contract : Contains all details of the contract, including rules you can use when placing orders
12
13#[allow(unused_imports)]
14use serde_json::Value;
15
16#[derive(Debug, Serialize, Deserialize)]
17pub struct Contract {
18  #[serde(rename = "category")]
19  category: Option<String>,
20  /// Contracts company name
21  #[serde(rename = "company_name")]
22  company_name: Option<String>,
23  /// same as that in request
24  #[serde(rename = "con_id")]
25  con_id: Option<String>,
26  #[serde(rename = "currency")]
27  currency: Option<String>,
28  #[serde(rename = "exchange")]
29  exchange: Option<String>,
30  #[serde(rename = "industry")]
31  industry: Option<String>,
32  /// for example STK
33  #[serde(rename = "instrument_type")]
34  instrument_type: Option<String>,
35  /// for exmple FB
36  #[serde(rename = "local_symbol")]
37  local_symbol: Option<String>,
38  /// true means you can trade outside RTH(regular trading hours)
39  #[serde(rename = "r_t_h")]
40  r_t_h: Option<bool>,
41  #[serde(rename = "rules")]
42  rules: Option<::models::ContractRules>
43}
44
45impl Contract {
46  /// Contains all details of the contract, including rules you can use when placing orders
47  pub fn new() -> Contract {
48    Contract {
49      category: None,
50      company_name: None,
51      con_id: None,
52      currency: None,
53      exchange: None,
54      industry: None,
55      instrument_type: None,
56      local_symbol: None,
57      r_t_h: None,
58      rules: None
59    }
60  }
61
62  pub fn set_category(&mut self, category: String) {
63    self.category = Some(category);
64  }
65
66  pub fn with_category(mut self, category: String) -> Contract {
67    self.category = Some(category);
68    self
69  }
70
71  pub fn category(&self) -> Option<&String> {
72    self.category.as_ref()
73  }
74
75  pub fn reset_category(&mut self) {
76    self.category = None;
77  }
78
79  pub fn set_company_name(&mut self, company_name: String) {
80    self.company_name = Some(company_name);
81  }
82
83  pub fn with_company_name(mut self, company_name: String) -> Contract {
84    self.company_name = Some(company_name);
85    self
86  }
87
88  pub fn company_name(&self) -> Option<&String> {
89    self.company_name.as_ref()
90  }
91
92  pub fn reset_company_name(&mut self) {
93    self.company_name = None;
94  }
95
96  pub fn set_con_id(&mut self, con_id: String) {
97    self.con_id = Some(con_id);
98  }
99
100  pub fn with_con_id(mut self, con_id: String) -> Contract {
101    self.con_id = Some(con_id);
102    self
103  }
104
105  pub fn con_id(&self) -> Option<&String> {
106    self.con_id.as_ref()
107  }
108
109  pub fn reset_con_id(&mut self) {
110    self.con_id = None;
111  }
112
113  pub fn set_currency(&mut self, currency: String) {
114    self.currency = Some(currency);
115  }
116
117  pub fn with_currency(mut self, currency: String) -> Contract {
118    self.currency = Some(currency);
119    self
120  }
121
122  pub fn currency(&self) -> Option<&String> {
123    self.currency.as_ref()
124  }
125
126  pub fn reset_currency(&mut self) {
127    self.currency = None;
128  }
129
130  pub fn set_exchange(&mut self, exchange: String) {
131    self.exchange = Some(exchange);
132  }
133
134  pub fn with_exchange(mut self, exchange: String) -> Contract {
135    self.exchange = Some(exchange);
136    self
137  }
138
139  pub fn exchange(&self) -> Option<&String> {
140    self.exchange.as_ref()
141  }
142
143  pub fn reset_exchange(&mut self) {
144    self.exchange = None;
145  }
146
147  pub fn set_industry(&mut self, industry: String) {
148    self.industry = Some(industry);
149  }
150
151  pub fn with_industry(mut self, industry: String) -> Contract {
152    self.industry = Some(industry);
153    self
154  }
155
156  pub fn industry(&self) -> Option<&String> {
157    self.industry.as_ref()
158  }
159
160  pub fn reset_industry(&mut self) {
161    self.industry = None;
162  }
163
164  pub fn set_instrument_type(&mut self, instrument_type: String) {
165    self.instrument_type = Some(instrument_type);
166  }
167
168  pub fn with_instrument_type(mut self, instrument_type: String) -> Contract {
169    self.instrument_type = Some(instrument_type);
170    self
171  }
172
173  pub fn instrument_type(&self) -> Option<&String> {
174    self.instrument_type.as_ref()
175  }
176
177  pub fn reset_instrument_type(&mut self) {
178    self.instrument_type = None;
179  }
180
181  pub fn set_local_symbol(&mut self, local_symbol: String) {
182    self.local_symbol = Some(local_symbol);
183  }
184
185  pub fn with_local_symbol(mut self, local_symbol: String) -> Contract {
186    self.local_symbol = Some(local_symbol);
187    self
188  }
189
190  pub fn local_symbol(&self) -> Option<&String> {
191    self.local_symbol.as_ref()
192  }
193
194  pub fn reset_local_symbol(&mut self) {
195    self.local_symbol = None;
196  }
197
198  pub fn set_r_t_h(&mut self, r_t_h: bool) {
199    self.r_t_h = Some(r_t_h);
200  }
201
202  pub fn with_r_t_h(mut self, r_t_h: bool) -> Contract {
203    self.r_t_h = Some(r_t_h);
204    self
205  }
206
207  pub fn r_t_h(&self) -> Option<&bool> {
208    self.r_t_h.as_ref()
209  }
210
211  pub fn reset_r_t_h(&mut self) {
212    self.r_t_h = None;
213  }
214
215  pub fn set_rules(&mut self, rules: ::models::ContractRules) {
216    self.rules = Some(rules);
217  }
218
219  pub fn with_rules(mut self, rules: ::models::ContractRules) -> Contract {
220    self.rules = Some(rules);
221    self
222  }
223
224  pub fn rules(&self) -> Option<&::models::ContractRules> {
225    self.rules.as_ref()
226  }
227
228  pub fn reset_rules(&mut self) {
229    self.rules = None;
230  }
231
232}
233
234
235