ib 3.0.0

A Rust client to the Interactive Brokers HTTP REST API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
/* 
 * Client Portal Web API
 *
 * Client Poral Web API
 *
 * OpenAPI spec version: 1.0.0
 * 
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 */


#[allow(unused_imports)]
use serde_json::Value;

#[derive(Debug, Serialize, Deserialize)]
pub struct OrderData {
  /// Account number
  #[serde(rename = "account")]
  account: Option<String>,
  /// Average fill price
  #[serde(rename = "avgPrice")]
  avg_price: Option<String>,
  #[serde(rename = "clientOrderId")]
  client_order_id: Option<String>,
  /// Commission currency
  #[serde(rename = "commCurr")]
  comm_curr: Option<String>,
  /// Commissions
  #[serde(rename = "comms")]
  comms: Option<String>,
  /// Contract identifier from IBKR's database.
  #[serde(rename = "conid")]
  conid: Option<String>,
  /// Cumulative fill quantity
  #[serde(rename = "cumQty")]
  cum_qty: Option<String>,
  /// Trading currency
  #[serde(rename = "currency")]
  currency: Option<String>,
  /// Exchange or venue
  #[serde(rename = "exchange")]
  exchange: Option<String>,
  #[serde(rename = "execId")]
  exec_id: Option<String>,
  #[serde(rename = "execType")]
  exec_type: Option<String>,
  /// Price of the last partial fill
  #[serde(rename = "lastPrice")]
  last_price: Option<String>,
  /// Quantity of the last partial fill
  #[serde(rename = "lastShares")]
  last_shares: Option<String>,
  /// Remaining quantity to be filled
  #[serde(rename = "leavesQty")]
  leaves_qty: Option<String>,
  /// Listing Exchange
  #[serde(rename = "listingExchange")]
  listing_exchange: Option<String>,
  /// Order identifier
  #[serde(rename = "orderId")]
  order_id: Option<String>,
  /// Quantity of active order
  #[serde(rename = "orderQty")]
  order_qty: Option<String>,
  #[serde(rename = "orderStatus")]
  order_status: Option<String>,
  #[serde(rename = "orderType")]
  order_type: Option<String>,
  /// Price of active order
  #[serde(rename = "price")]
  price: Option<String>,
  /// Time of receipt in GMT, format YYYYMMDD-hh:mm:ss
  #[serde(rename = "rcptTime")]
  rcpt_time: Option<String>,
  /// Realized PnL
  #[serde(rename = "realizedPnl")]
  realized_pnl: Option<String>,
  /// Contracts asset class
  #[serde(rename = "secType")]
  sec_type: Option<String>,
  #[serde(rename = "side")]
  side: Option<String>,
  /// Underlying symbol for contract
  #[serde(rename = "symbol")]
  symbol: Option<String>,
  /// error message
  #[serde(rename = "text")]
  text: Option<f32>,
  /// Time in Force
  #[serde(rename = "tif")]
  tif: Option<String>,
  /// Time of transaction in GMT, format YYYYMMDD-hh:m:ss
  #[serde(rename = "txTime")]
  tx_time: Option<String>,
  #[serde(rename = "warnings")]
  warnings: Option<::models::OrderdataWarnings>
}

impl OrderData {
  pub fn new() -> OrderData {
    OrderData {
      account: None,
      avg_price: None,
      client_order_id: None,
      comm_curr: None,
      comms: None,
      conid: None,
      cum_qty: None,
      currency: None,
      exchange: None,
      exec_id: None,
      exec_type: None,
      last_price: None,
      last_shares: None,
      leaves_qty: None,
      listing_exchange: None,
      order_id: None,
      order_qty: None,
      order_status: None,
      order_type: None,
      price: None,
      rcpt_time: None,
      realized_pnl: None,
      sec_type: None,
      side: None,
      symbol: None,
      text: None,
      tif: None,
      tx_time: None,
      warnings: None
    }
  }

  pub fn set_account(&mut self, account: String) {
    self.account = Some(account);
  }

  pub fn with_account(mut self, account: String) -> OrderData {
    self.account = Some(account);
    self
  }

  pub fn account(&self) -> Option<&String> {
    self.account.as_ref()
  }

  pub fn reset_account(&mut self) {
    self.account = None;
  }

  pub fn set_avg_price(&mut self, avg_price: String) {
    self.avg_price = Some(avg_price);
  }

  pub fn with_avg_price(mut self, avg_price: String) -> OrderData {
    self.avg_price = Some(avg_price);
    self
  }

  pub fn avg_price(&self) -> Option<&String> {
    self.avg_price.as_ref()
  }

  pub fn reset_avg_price(&mut self) {
    self.avg_price = None;
  }

  pub fn set_client_order_id(&mut self, client_order_id: String) {
    self.client_order_id = Some(client_order_id);
  }

  pub fn with_client_order_id(mut self, client_order_id: String) -> OrderData {
    self.client_order_id = Some(client_order_id);
    self
  }

  pub fn client_order_id(&self) -> Option<&String> {
    self.client_order_id.as_ref()
  }

  pub fn reset_client_order_id(&mut self) {
    self.client_order_id = None;
  }

  pub fn set_comm_curr(&mut self, comm_curr: String) {
    self.comm_curr = Some(comm_curr);
  }

  pub fn with_comm_curr(mut self, comm_curr: String) -> OrderData {
    self.comm_curr = Some(comm_curr);
    self
  }

  pub fn comm_curr(&self) -> Option<&String> {
    self.comm_curr.as_ref()
  }

  pub fn reset_comm_curr(&mut self) {
    self.comm_curr = None;
  }

  pub fn set_comms(&mut self, comms: String) {
    self.comms = Some(comms);
  }

  pub fn with_comms(mut self, comms: String) -> OrderData {
    self.comms = Some(comms);
    self
  }

  pub fn comms(&self) -> Option<&String> {
    self.comms.as_ref()
  }

  pub fn reset_comms(&mut self) {
    self.comms = None;
  }

  pub fn set_conid(&mut self, conid: String) {
    self.conid = Some(conid);
  }

  pub fn with_conid(mut self, conid: String) -> OrderData {
    self.conid = Some(conid);
    self
  }

  pub fn conid(&self) -> Option<&String> {
    self.conid.as_ref()
  }

  pub fn reset_conid(&mut self) {
    self.conid = None;
  }

  pub fn set_cum_qty(&mut self, cum_qty: String) {
    self.cum_qty = Some(cum_qty);
  }

  pub fn with_cum_qty(mut self, cum_qty: String) -> OrderData {
    self.cum_qty = Some(cum_qty);
    self
  }

  pub fn cum_qty(&self) -> Option<&String> {
    self.cum_qty.as_ref()
  }

  pub fn reset_cum_qty(&mut self) {
    self.cum_qty = None;
  }

  pub fn set_currency(&mut self, currency: String) {
    self.currency = Some(currency);
  }

  pub fn with_currency(mut self, currency: String) -> OrderData {
    self.currency = Some(currency);
    self
  }

  pub fn currency(&self) -> Option<&String> {
    self.currency.as_ref()
  }

  pub fn reset_currency(&mut self) {
    self.currency = None;
  }

  pub fn set_exchange(&mut self, exchange: String) {
    self.exchange = Some(exchange);
  }

  pub fn with_exchange(mut self, exchange: String) -> OrderData {
    self.exchange = Some(exchange);
    self
  }

  pub fn exchange(&self) -> Option<&String> {
    self.exchange.as_ref()
  }

  pub fn reset_exchange(&mut self) {
    self.exchange = None;
  }

  pub fn set_exec_id(&mut self, exec_id: String) {
    self.exec_id = Some(exec_id);
  }

  pub fn with_exec_id(mut self, exec_id: String) -> OrderData {
    self.exec_id = Some(exec_id);
    self
  }

  pub fn exec_id(&self) -> Option<&String> {
    self.exec_id.as_ref()
  }

  pub fn reset_exec_id(&mut self) {
    self.exec_id = None;
  }

  pub fn set_exec_type(&mut self, exec_type: String) {
    self.exec_type = Some(exec_type);
  }

  pub fn with_exec_type(mut self, exec_type: String) -> OrderData {
    self.exec_type = Some(exec_type);
    self
  }

  pub fn exec_type(&self) -> Option<&String> {
    self.exec_type.as_ref()
  }

  pub fn reset_exec_type(&mut self) {
    self.exec_type = None;
  }

  pub fn set_last_price(&mut self, last_price: String) {
    self.last_price = Some(last_price);
  }

  pub fn with_last_price(mut self, last_price: String) -> OrderData {
    self.last_price = Some(last_price);
    self
  }

  pub fn last_price(&self) -> Option<&String> {
    self.last_price.as_ref()
  }

  pub fn reset_last_price(&mut self) {
    self.last_price = None;
  }

  pub fn set_last_shares(&mut self, last_shares: String) {
    self.last_shares = Some(last_shares);
  }

  pub fn with_last_shares(mut self, last_shares: String) -> OrderData {
    self.last_shares = Some(last_shares);
    self
  }

  pub fn last_shares(&self) -> Option<&String> {
    self.last_shares.as_ref()
  }

  pub fn reset_last_shares(&mut self) {
    self.last_shares = None;
  }

  pub fn set_leaves_qty(&mut self, leaves_qty: String) {
    self.leaves_qty = Some(leaves_qty);
  }

  pub fn with_leaves_qty(mut self, leaves_qty: String) -> OrderData {
    self.leaves_qty = Some(leaves_qty);
    self
  }

  pub fn leaves_qty(&self) -> Option<&String> {
    self.leaves_qty.as_ref()
  }

  pub fn reset_leaves_qty(&mut self) {
    self.leaves_qty = None;
  }

  pub fn set_listing_exchange(&mut self, listing_exchange: String) {
    self.listing_exchange = Some(listing_exchange);
  }

  pub fn with_listing_exchange(mut self, listing_exchange: String) -> OrderData {
    self.listing_exchange = Some(listing_exchange);
    self
  }

  pub fn listing_exchange(&self) -> Option<&String> {
    self.listing_exchange.as_ref()
  }

  pub fn reset_listing_exchange(&mut self) {
    self.listing_exchange = None;
  }

  pub fn set_order_id(&mut self, order_id: String) {
    self.order_id = Some(order_id);
  }

  pub fn with_order_id(mut self, order_id: String) -> OrderData {
    self.order_id = Some(order_id);
    self
  }

  pub fn order_id(&self) -> Option<&String> {
    self.order_id.as_ref()
  }

  pub fn reset_order_id(&mut self) {
    self.order_id = None;
  }

  pub fn set_order_qty(&mut self, order_qty: String) {
    self.order_qty = Some(order_qty);
  }

  pub fn with_order_qty(mut self, order_qty: String) -> OrderData {
    self.order_qty = Some(order_qty);
    self
  }

  pub fn order_qty(&self) -> Option<&String> {
    self.order_qty.as_ref()
  }

  pub fn reset_order_qty(&mut self) {
    self.order_qty = None;
  }

  pub fn set_order_status(&mut self, order_status: String) {
    self.order_status = Some(order_status);
  }

  pub fn with_order_status(mut self, order_status: String) -> OrderData {
    self.order_status = Some(order_status);
    self
  }

  pub fn order_status(&self) -> Option<&String> {
    self.order_status.as_ref()
  }

  pub fn reset_order_status(&mut self) {
    self.order_status = None;
  }

  pub fn set_order_type(&mut self, order_type: String) {
    self.order_type = Some(order_type);
  }

  pub fn with_order_type(mut self, order_type: String) -> OrderData {
    self.order_type = Some(order_type);
    self
  }

  pub fn order_type(&self) -> Option<&String> {
    self.order_type.as_ref()
  }

  pub fn reset_order_type(&mut self) {
    self.order_type = None;
  }

  pub fn set_price(&mut self, price: String) {
    self.price = Some(price);
  }

  pub fn with_price(mut self, price: String) -> OrderData {
    self.price = Some(price);
    self
  }

  pub fn price(&self) -> Option<&String> {
    self.price.as_ref()
  }

  pub fn reset_price(&mut self) {
    self.price = None;
  }

  pub fn set_rcpt_time(&mut self, rcpt_time: String) {
    self.rcpt_time = Some(rcpt_time);
  }

  pub fn with_rcpt_time(mut self, rcpt_time: String) -> OrderData {
    self.rcpt_time = Some(rcpt_time);
    self
  }

  pub fn rcpt_time(&self) -> Option<&String> {
    self.rcpt_time.as_ref()
  }

  pub fn reset_rcpt_time(&mut self) {
    self.rcpt_time = None;
  }

  pub fn set_realized_pnl(&mut self, realized_pnl: String) {
    self.realized_pnl = Some(realized_pnl);
  }

  pub fn with_realized_pnl(mut self, realized_pnl: String) -> OrderData {
    self.realized_pnl = Some(realized_pnl);
    self
  }

  pub fn realized_pnl(&self) -> Option<&String> {
    self.realized_pnl.as_ref()
  }

  pub fn reset_realized_pnl(&mut self) {
    self.realized_pnl = None;
  }

  pub fn set_sec_type(&mut self, sec_type: String) {
    self.sec_type = Some(sec_type);
  }

  pub fn with_sec_type(mut self, sec_type: String) -> OrderData {
    self.sec_type = Some(sec_type);
    self
  }

  pub fn sec_type(&self) -> Option<&String> {
    self.sec_type.as_ref()
  }

  pub fn reset_sec_type(&mut self) {
    self.sec_type = None;
  }

  pub fn set_side(&mut self, side: String) {
    self.side = Some(side);
  }

  pub fn with_side(mut self, side: String) -> OrderData {
    self.side = Some(side);
    self
  }

  pub fn side(&self) -> Option<&String> {
    self.side.as_ref()
  }

  pub fn reset_side(&mut self) {
    self.side = None;
  }

  pub fn set_symbol(&mut self, symbol: String) {
    self.symbol = Some(symbol);
  }

  pub fn with_symbol(mut self, symbol: String) -> OrderData {
    self.symbol = Some(symbol);
    self
  }

  pub fn symbol(&self) -> Option<&String> {
    self.symbol.as_ref()
  }

  pub fn reset_symbol(&mut self) {
    self.symbol = None;
  }

  pub fn set_text(&mut self, text: f32) {
    self.text = Some(text);
  }

  pub fn with_text(mut self, text: f32) -> OrderData {
    self.text = Some(text);
    self
  }

  pub fn text(&self) -> Option<&f32> {
    self.text.as_ref()
  }

  pub fn reset_text(&mut self) {
    self.text = None;
  }

  pub fn set_tif(&mut self, tif: String) {
    self.tif = Some(tif);
  }

  pub fn with_tif(mut self, tif: String) -> OrderData {
    self.tif = Some(tif);
    self
  }

  pub fn tif(&self) -> Option<&String> {
    self.tif.as_ref()
  }

  pub fn reset_tif(&mut self) {
    self.tif = None;
  }

  pub fn set_tx_time(&mut self, tx_time: String) {
    self.tx_time = Some(tx_time);
  }

  pub fn with_tx_time(mut self, tx_time: String) -> OrderData {
    self.tx_time = Some(tx_time);
    self
  }

  pub fn tx_time(&self) -> Option<&String> {
    self.tx_time.as_ref()
  }

  pub fn reset_tx_time(&mut self) {
    self.tx_time = None;
  }

  pub fn set_warnings(&mut self, warnings: ::models::OrderdataWarnings) {
    self.warnings = Some(warnings);
  }

  pub fn with_warnings(mut self, warnings: ::models::OrderdataWarnings) -> OrderData {
    self.warnings = Some(warnings);
    self
  }

  pub fn warnings(&self) -> Option<&::models::OrderdataWarnings> {
    self.warnings.as_ref()
  }

  pub fn reset_warnings(&mut self) {
    self.warnings = None;
  }

}