1use std::{ffi::c_char, mem};
2
3use pyo3::{conversion::IntoPyObjectExt, prelude::*};
4
5use crate::{
6 python::WritePyRepr, record::str_to_c_chars, rtype, v1, v2, Action, BboMsg, BidAskPair,
7 CbboMsg, Cmbp1Msg, ConsolidatedBidAskPair, ErrorCode, ErrorMsg, FlagSet, ImbalanceMsg,
8 InstrumentClass, InstrumentDefMsg, MatchAlgorithm, MboMsg, Mbp10Msg, Mbp1Msg, OhlcvMsg, RType,
9 Record, RecordHeader, SType, SecurityUpdateAction, Side, StatMsg, StatType, StatUpdateAction,
10 StatusAction, StatusMsg, StatusReason, SymbolMappingMsg, SystemCode, SystemMsg, TradeMsg,
11 TradingEvent, TriState, UserDefinedInstrument, UNDEF_ORDER_SIZE, UNDEF_PRICE, UNDEF_TIMESTAMP,
12};
13
14use super::{
15 conversions::{char_to_c_char, new_py_timestamp_or_datetime},
16 to_py_err, PyFieldDesc,
17};
18
19#[pymethods]
20impl MboMsg {
21 #[new]
22 #[pyo3(signature = (
23 publisher_id,
24 instrument_id,
25 ts_event,
26 order_id,
27 price,
28 size,
29 action,
30 side,
31 ts_recv,
32 flags = None,
33 channel_id = None,
34 ts_in_delta = 0,
35 sequence = 0,
36 ))]
37 fn py_new(
38 publisher_id: u16,
39 instrument_id: u32,
40 ts_event: u64,
41 order_id: u64,
42 price: i64,
43 size: u32,
44 action: Action,
45 side: Side,
46 ts_recv: u64,
47 flags: Option<FlagSet>,
48 channel_id: Option<u8>,
49 ts_in_delta: i32,
50 sequence: u32,
51 ) -> PyResult<Self> {
52 Ok(Self {
53 hd: RecordHeader::new::<Self>(rtype::MBO, publisher_id, instrument_id, ts_event),
54 order_id,
55 price,
56 size,
57 flags: flags.unwrap_or_default(),
58 channel_id: channel_id.unwrap_or(u8::MAX),
59 action: action as u8 as c_char,
60 side: side as u8 as c_char,
61 ts_recv,
62 ts_in_delta,
63 sequence,
64 })
65 }
66
67 fn __bytes__(&self) -> &[u8] {
68 self.as_ref()
69 }
70
71 fn __repr__(&self) -> String {
72 let mut s = String::new();
73 self.write_py_repr(&mut s).unwrap();
74 s
75 }
76
77 #[getter]
78 fn rtype(&self) -> PyResult<RType> {
79 self.hd.rtype().map_err(to_py_err)
80 }
81
82 #[getter]
83 fn get_publisher_id(&self) -> u16 {
84 self.hd.publisher_id
85 }
86 #[setter]
87 fn set_publisher_id(&mut self, publisher_id: u16) {
88 self.hd.publisher_id = publisher_id;
89 }
90
91 #[getter]
92 fn get_instrument_id(&self) -> u32 {
93 self.hd.instrument_id
94 }
95 #[setter]
96 fn set_instrument_id(&mut self, instrument_id: u32) {
97 self.hd.instrument_id = instrument_id;
98 }
99
100 #[getter]
101 fn ts_event(&self) -> u64 {
102 self.hd.ts_event
103 }
104 #[getter]
105 fn get_pretty_ts_event<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
106 new_py_timestamp_or_datetime(py, self.ts_event())
107 }
108 #[setter]
109 fn set_ts_event(&mut self, ts_event: u64) {
110 self.hd.ts_event = ts_event;
111 }
112
113 #[pyo3(name = "record_size")]
114 fn py_record_size(&self) -> usize {
115 self.record_size()
116 }
117
118 #[classattr]
119 fn size_hint() -> PyResult<usize> {
120 Ok(mem::size_of::<Self>())
121 }
122
123 #[getter]
124 fn ts_index(&self) -> u64 {
125 self.raw_index_ts()
126 }
127 #[getter]
128 fn get_pretty_ts_index<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
129 new_py_timestamp_or_datetime(py, self.raw_index_ts())
130 }
131
132 #[getter]
133 fn get_pretty_price(&self) -> f64 {
134 self.price_f64()
135 }
136
137 #[getter]
138 fn get_action<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
139 self.action()
140 .map(|c| c.into_bound_py_any(py))
141 .unwrap_or_else(|_| (self.action as u8 as char).into_bound_py_any(py))
142 }
143 #[setter]
144 fn set_action(&mut self, action: Action) {
145 self.action = action as u8 as c_char;
146 }
147
148 #[getter]
149 fn get_side<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
150 self.side()
151 .map(|c| c.into_bound_py_any(py))
152 .unwrap_or_else(|_| (self.side as u8 as char).into_bound_py_any(py))
153 }
154 #[setter]
155 fn set_side(&mut self, side: Side) {
156 self.side = side as u8 as c_char;
157 }
158
159 #[getter]
160 fn get_pretty_ts_recv<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
161 new_py_timestamp_or_datetime(py, self.ts_recv)
162 }
163
164 #[classattr]
165 #[pyo3(name = "_dtypes")]
166 fn py_dtypes() -> Vec<(String, String)> {
167 Self::field_dtypes("")
168 }
169
170 #[classattr]
171 #[pyo3(name = "_price_fields")]
172 fn py_price_fields() -> Vec<String> {
173 Self::price_fields("")
174 }
175
176 #[classattr]
177 #[pyo3(name = "_timestamp_fields")]
178 fn py_timestamp_fields() -> Vec<String> {
179 Self::timestamp_fields("")
180 }
181
182 #[classattr]
183 #[pyo3(name = "_hidden_fields")]
184 fn py_hidden_fields() -> Vec<String> {
185 Self::hidden_fields("")
186 }
187
188 #[classattr]
189 #[pyo3(name = "_ordered_fields")]
190 fn py_ordered_fields() -> Vec<String> {
191 Self::ordered_fields("")
192 }
193}
194
195#[pymethods]
196impl BidAskPair {
197 #[new]
198 #[pyo3(signature = (
199 bid_px = UNDEF_PRICE,
200 ask_px = UNDEF_PRICE,
201 bid_sz = 0,
202 ask_sz = 0,
203 bid_ct = 0,
204 ask_ct = 0,
205 ))]
206 fn py_new(
207 bid_px: i64,
208 ask_px: i64,
209 bid_sz: u32,
210 ask_sz: u32,
211 bid_ct: u32,
212 ask_ct: u32,
213 ) -> Self {
214 Self {
215 bid_px,
216 ask_px,
217 bid_sz,
218 ask_sz,
219 bid_ct,
220 ask_ct,
221 }
222 }
223
224 fn __repr__(&self) -> String {
225 let mut s = String::new();
226 self.write_py_repr(&mut s).unwrap();
227 s
228 }
229
230 #[getter]
231 fn get_pretty_bid_px(&self) -> f64 {
232 self.bid_px_f64()
233 }
234
235 #[getter]
236 fn get_pretty_ask_px(&self) -> f64 {
237 self.ask_px_f64()
238 }
239}
240
241#[pymethods]
242impl ConsolidatedBidAskPair {
243 #[new]
244 #[pyo3(signature = (
245 bid_px = UNDEF_PRICE,
246 ask_px = UNDEF_PRICE,
247 bid_sz = 0,
248 ask_sz = 0,
249 bid_pb = 0,
250 ask_pb = 0,
251 ))]
252 fn py_new(
253 bid_px: i64,
254 ask_px: i64,
255 bid_sz: u32,
256 ask_sz: u32,
257 bid_pb: u16,
258 ask_pb: u16,
259 ) -> Self {
260 Self {
261 bid_px,
262 ask_px,
263 bid_sz,
264 ask_sz,
265 bid_pb,
266 _reserved1: Default::default(),
267 ask_pb,
268 _reserved2: Default::default(),
269 }
270 }
271
272 fn __repr__(&self) -> String {
273 let mut s = String::new();
274 self.write_py_repr(&mut s).unwrap();
275 s
276 }
277
278 #[getter]
279 fn get_pretty_bid_px(&self) -> f64 {
280 self.bid_px_f64()
281 }
282
283 #[getter]
284 fn get_pretty_ask_px(&self) -> f64 {
285 self.ask_px_f64()
286 }
287}
288
289#[pymethods]
290impl TradeMsg {
291 #[new]
292 #[pyo3(signature = (
293 publisher_id,
294 instrument_id,
295 ts_event,
296 price,
297 size,
298 action,
299 side,
300 depth,
301 ts_recv,
302 flags = None,
303 ts_in_delta = 0,
304 sequence = 0,
305 ))]
306 fn py_new(
307 publisher_id: u16,
308 instrument_id: u32,
309 ts_event: u64,
310 price: i64,
311 size: u32,
312 action: Action,
313 side: Side,
314 depth: u8,
315 ts_recv: u64,
316 flags: Option<FlagSet>,
317 ts_in_delta: i32,
318 sequence: u32,
319 ) -> PyResult<Self> {
320 Ok(Self {
321 hd: RecordHeader::new::<Self>(rtype::MBP_0, publisher_id, instrument_id, ts_event),
322 price,
323 size,
324 action: action as u8 as c_char,
325 side: side as u8 as c_char,
326 flags: flags.unwrap_or_default(),
327 depth,
328 ts_recv,
329 ts_in_delta,
330 sequence,
331 })
332 }
333
334 fn __bytes__(&self) -> &[u8] {
335 self.as_ref()
336 }
337
338 fn __repr__(&self) -> String {
339 let mut s = String::new();
340 self.write_py_repr(&mut s).unwrap();
341 s
342 }
343
344 #[getter]
345 fn rtype(&self) -> PyResult<RType> {
346 self.hd.rtype().map_err(to_py_err)
347 }
348
349 #[getter]
350 fn get_publisher_id(&self) -> u16 {
351 self.hd.publisher_id
352 }
353 #[setter]
354 fn set_publisher_id(&mut self, publisher_id: u16) {
355 self.hd.publisher_id = publisher_id;
356 }
357
358 #[getter]
359 fn get_instrument_id(&self) -> u32 {
360 self.hd.instrument_id
361 }
362 #[setter]
363 fn set_instrument_id(&mut self, instrument_id: u32) {
364 self.hd.instrument_id = instrument_id;
365 }
366
367 #[getter]
368 fn ts_event(&self) -> u64 {
369 self.hd.ts_event
370 }
371 #[getter]
372 fn get_pretty_ts_event<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
373 new_py_timestamp_or_datetime(py, self.ts_event())
374 }
375 #[setter]
376 fn set_ts_event(&mut self, ts_event: u64) {
377 self.hd.ts_event = ts_event;
378 }
379
380 #[pyo3(name = "record_size")]
381 fn py_record_size(&self) -> usize {
382 self.record_size()
383 }
384
385 #[classattr]
386 fn size_hint() -> PyResult<usize> {
387 Ok(mem::size_of::<Self>())
388 }
389
390 #[getter]
391 fn ts_index(&self) -> u64 {
392 self.raw_index_ts()
393 }
394 #[getter]
395 fn get_pretty_ts_index<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
396 new_py_timestamp_or_datetime(py, self.raw_index_ts())
397 }
398
399 #[getter]
400 fn get_pretty_price(&self) -> f64 {
401 self.price_f64()
402 }
403
404 #[getter]
405 fn get_action<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
406 self.action()
407 .map(|c| c.into_bound_py_any(py))
408 .unwrap_or_else(|_| (self.action as u8 as char).into_bound_py_any(py))
409 }
410 #[setter]
411 fn set_action(&mut self, action: Action) {
412 self.action = action as u8 as c_char;
413 }
414
415 #[getter]
416 fn get_side<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
417 self.side()
418 .map(|c| c.into_bound_py_any(py))
419 .unwrap_or_else(|_| (self.side as u8 as char).into_bound_py_any(py))
420 }
421 #[setter]
422 fn set_side(&mut self, side: Side) {
423 self.side = side as u8 as c_char;
424 }
425
426 #[getter]
427 fn get_pretty_ts_recv<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
428 new_py_timestamp_or_datetime(py, self.ts_recv)
429 }
430
431 #[classattr]
432 #[pyo3(name = "_dtypes")]
433 fn py_dtypes() -> Vec<(String, String)> {
434 Self::field_dtypes("")
435 }
436
437 #[classattr]
438 #[pyo3(name = "_price_fields")]
439 fn py_price_fields() -> Vec<String> {
440 Self::price_fields("")
441 }
442
443 #[classattr]
444 #[pyo3(name = "_timestamp_fields")]
445 fn py_timestamp_fields() -> Vec<String> {
446 Self::timestamp_fields("")
447 }
448
449 #[classattr]
450 #[pyo3(name = "_hidden_fields")]
451 fn py_hidden_fields() -> Vec<String> {
452 Self::hidden_fields("")
453 }
454
455 #[classattr]
456 #[pyo3(name = "_ordered_fields")]
457 fn py_ordered_fields() -> Vec<String> {
458 Self::ordered_fields("")
459 }
460}
461
462#[pymethods]
463impl Mbp1Msg {
464 #[new]
465 #[pyo3(signature = (
466 publisher_id,
467 instrument_id,
468 ts_event,
469 price,
470 size,
471 action,
472 side,
473 depth,
474 ts_recv,
475 flags = None,
476 ts_in_delta = 0,
477 sequence = 0,
478 levels = None,
479 ))]
480 fn py_new(
481 publisher_id: u16,
482 instrument_id: u32,
483 ts_event: u64,
484 price: i64,
485 size: u32,
486 action: Action,
487 side: Side,
488 depth: u8,
489 ts_recv: u64,
490 flags: Option<FlagSet>,
491 ts_in_delta: i32,
492 sequence: u32,
493 levels: Option<BidAskPair>,
494 ) -> PyResult<Self> {
495 Ok(Self {
496 hd: RecordHeader::new::<Self>(rtype::MBP_1, publisher_id, instrument_id, ts_event),
497 price,
498 size,
499 action: action as u8 as c_char,
500 side: side as u8 as c_char,
501 flags: flags.unwrap_or_default(),
502 depth,
503 ts_recv,
504 ts_in_delta,
505 sequence,
506 levels: [levels.unwrap_or_default()],
507 })
508 }
509
510 fn __bytes__(&self) -> &[u8] {
511 self.as_ref()
512 }
513
514 fn __repr__(&self) -> String {
515 let mut s = String::new();
516 self.write_py_repr(&mut s).unwrap();
517 s
518 }
519
520 #[getter]
521 fn rtype(&self) -> PyResult<RType> {
522 self.hd.rtype().map_err(to_py_err)
523 }
524
525 #[getter]
526 fn get_publisher_id(&self) -> u16 {
527 self.hd.publisher_id
528 }
529 #[setter]
530 fn set_publisher_id(&mut self, publisher_id: u16) {
531 self.hd.publisher_id = publisher_id;
532 }
533
534 #[getter]
535 fn get_instrument_id(&self) -> u32 {
536 self.hd.instrument_id
537 }
538 #[setter]
539 fn set_instrument_id(&mut self, instrument_id: u32) {
540 self.hd.instrument_id = instrument_id;
541 }
542
543 #[getter]
544 fn ts_event(&self) -> u64 {
545 self.hd.ts_event
546 }
547 #[getter]
548 fn get_pretty_ts_event<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
549 new_py_timestamp_or_datetime(py, self.ts_event())
550 }
551 #[setter]
552 fn set_ts_event(&mut self, ts_event: u64) {
553 self.hd.ts_event = ts_event;
554 }
555
556 #[pyo3(name = "record_size")]
557 fn py_record_size(&self) -> usize {
558 self.record_size()
559 }
560
561 #[classattr]
562 fn size_hint() -> PyResult<usize> {
563 Ok(mem::size_of::<Self>())
564 }
565
566 #[getter]
567 fn ts_index(&self) -> u64 {
568 self.raw_index_ts()
569 }
570 #[getter]
571 fn get_pretty_ts_index<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
572 new_py_timestamp_or_datetime(py, self.raw_index_ts())
573 }
574
575 #[getter]
576 fn get_pretty_price(&self) -> f64 {
577 self.price_f64()
578 }
579
580 #[getter]
581 fn get_action<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
582 self.action()
583 .map(|c| c.into_bound_py_any(py))
584 .unwrap_or_else(|_| (self.action as u8 as char).into_bound_py_any(py))
585 }
586 #[setter]
587 fn set_action(&mut self, action: Action) {
588 self.action = action as u8 as c_char;
589 }
590
591 #[getter]
592 fn get_side<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
593 self.side()
594 .map(|c| c.into_bound_py_any(py))
595 .unwrap_or_else(|_| (self.side as u8 as char).into_bound_py_any(py))
596 }
597 #[setter]
598 fn set_side(&mut self, side: Side) {
599 self.side = side as u8 as c_char;
600 }
601
602 #[getter]
603 fn get_pretty_ts_recv<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
604 new_py_timestamp_or_datetime(py, self.ts_recv)
605 }
606
607 #[classattr]
608 #[pyo3(name = "_dtypes")]
609 fn py_dtypes() -> Vec<(String, String)> {
610 Self::field_dtypes("")
611 }
612
613 #[classattr]
614 #[pyo3(name = "_price_fields")]
615 fn py_price_fields() -> Vec<String> {
616 Self::price_fields("")
617 }
618
619 #[classattr]
620 #[pyo3(name = "_timestamp_fields")]
621 fn py_timestamp_fields() -> Vec<String> {
622 Self::timestamp_fields("")
623 }
624
625 #[classattr]
626 #[pyo3(name = "_hidden_fields")]
627 fn py_hidden_fields() -> Vec<String> {
628 Self::hidden_fields("")
629 }
630
631 #[classattr]
632 #[pyo3(name = "_ordered_fields")]
633 fn py_ordered_fields() -> Vec<String> {
634 Self::ordered_fields("")
635 }
636}
637
638#[pymethods]
639impl Mbp10Msg {
640 #[new]
641 #[pyo3(signature = (
642 publisher_id,
643 instrument_id,
644 ts_event,
645 price,
646 size,
647 action,
648 side,
649 depth,
650 ts_recv,
651 flags = None,
652 ts_in_delta = 0,
653 sequence = 0,
654 levels = None,
655 ))]
656 fn py_new(
657 publisher_id: u16,
658 instrument_id: u32,
659 ts_event: u64,
660 price: i64,
661 size: u32,
662 action: Action,
663 side: Side,
664 depth: u8,
665 ts_recv: u64,
666 flags: Option<FlagSet>,
667 ts_in_delta: i32,
668 sequence: u32,
669 levels: Option<[BidAskPair; 10]>,
670 ) -> PyResult<Self> {
671 Ok(Self {
672 hd: RecordHeader::new::<Self>(rtype::MBP_10, publisher_id, instrument_id, ts_event),
673 price,
674 size,
675 action: action as u8 as c_char,
676 side: side as u8 as c_char,
677 flags: flags.unwrap_or_default(),
678 depth,
679 ts_recv,
680 ts_in_delta,
681 sequence,
682 levels: levels.unwrap_or_default(),
683 })
684 }
685
686 fn __bytes__(&self) -> &[u8] {
687 self.as_ref()
688 }
689
690 fn __repr__(&self) -> String {
691 let mut s = String::new();
692 self.write_py_repr(&mut s).unwrap();
693 s
694 }
695
696 #[getter]
697 fn rtype(&self) -> PyResult<RType> {
698 self.hd.rtype().map_err(to_py_err)
699 }
700
701 #[getter]
702 fn get_publisher_id(&self) -> u16 {
703 self.hd.publisher_id
704 }
705 #[setter]
706 fn set_publisher_id(&mut self, publisher_id: u16) {
707 self.hd.publisher_id = publisher_id;
708 }
709
710 #[getter]
711 fn get_instrument_id(&self) -> u32 {
712 self.hd.instrument_id
713 }
714 #[setter]
715 fn set_instrument_id(&mut self, instrument_id: u32) {
716 self.hd.instrument_id = instrument_id;
717 }
718
719 #[getter]
720 fn ts_event(&self) -> u64 {
721 self.hd.ts_event
722 }
723 #[getter]
724 fn get_pretty_ts_event<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
725 new_py_timestamp_or_datetime(py, self.ts_event())
726 }
727 #[setter]
728 fn set_ts_event(&mut self, ts_event: u64) {
729 self.hd.ts_event = ts_event;
730 }
731
732 #[pyo3(name = "record_size")]
733 fn py_record_size(&self) -> usize {
734 self.record_size()
735 }
736
737 #[classattr]
738 fn size_hint() -> PyResult<usize> {
739 Ok(mem::size_of::<Self>())
740 }
741
742 #[getter]
743 fn ts_index(&self) -> u64 {
744 self.raw_index_ts()
745 }
746 #[getter]
747 fn get_pretty_ts_index<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
748 new_py_timestamp_or_datetime(py, self.raw_index_ts())
749 }
750
751 #[getter]
752 fn get_pretty_price(&self) -> f64 {
753 self.price_f64()
754 }
755
756 #[getter]
757 fn get_action<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
758 self.action()
759 .map(|c| c.into_bound_py_any(py))
760 .unwrap_or_else(|_| (self.action as u8 as char).into_bound_py_any(py))
761 }
762 #[setter]
763 fn set_action(&mut self, action: Action) {
764 self.action = action as u8 as c_char;
765 }
766
767 #[getter]
768 fn get_side<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
769 self.side()
770 .map(|c| c.into_bound_py_any(py))
771 .unwrap_or_else(|_| (self.side as u8 as char).into_bound_py_any(py))
772 }
773 #[setter]
774 fn set_side(&mut self, side: Side) {
775 self.side = side as u8 as c_char;
776 }
777
778 #[getter]
779 fn get_pretty_ts_recv<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
780 new_py_timestamp_or_datetime(py, self.ts_recv)
781 }
782
783 #[classattr]
784 #[pyo3(name = "_dtypes")]
785 fn py_dtypes() -> Vec<(String, String)> {
786 Self::field_dtypes("")
787 }
788
789 #[classattr]
790 #[pyo3(name = "_price_fields")]
791 fn py_price_fields() -> Vec<String> {
792 Self::price_fields("")
793 }
794
795 #[classattr]
796 #[pyo3(name = "_timestamp_fields")]
797 fn py_timestamp_fields() -> Vec<String> {
798 Self::timestamp_fields("")
799 }
800
801 #[classattr]
802 #[pyo3(name = "_hidden_fields")]
803 fn py_hidden_fields() -> Vec<String> {
804 Self::hidden_fields("")
805 }
806
807 #[classattr]
808 #[pyo3(name = "_ordered_fields")]
809 fn py_ordered_fields() -> Vec<String> {
810 Self::ordered_fields("")
811 }
812}
813
814#[pymethods]
815impl BboMsg {
816 #[new]
817 #[pyo3(signature = (
818 rtype,
819 publisher_id,
820 instrument_id,
821 ts_event,
822 price,
823 size,
824 side,
825 ts_recv,
826 flags = None,
827 sequence = 0,
828 levels = None,
829 ))]
830 fn py_new(
831 rtype: u8,
832 publisher_id: u16,
833 instrument_id: u32,
834 ts_event: u64,
835 price: i64,
836 size: u32,
837 side: Side,
838 ts_recv: u64,
839 flags: Option<FlagSet>,
840 sequence: u32,
841 levels: Option<BidAskPair>,
842 ) -> PyResult<Self> {
843 Ok(Self {
844 hd: RecordHeader::new::<Self>(rtype, publisher_id, instrument_id, ts_event),
845 price,
846 size,
847 _reserved1: Default::default(),
848 side: side as u8 as c_char,
849 flags: flags.unwrap_or_default(),
850 _reserved2: Default::default(),
851 ts_recv,
852 _reserved3: Default::default(),
853 sequence,
854 levels: [levels.unwrap_or_default()],
855 })
856 }
857
858 fn __bytes__(&self) -> &[u8] {
859 self.as_ref()
860 }
861
862 fn __repr__(&self) -> String {
863 let mut s = String::new();
864 self.write_py_repr(&mut s).unwrap();
865 s
866 }
867
868 #[getter]
869 fn rtype(&self) -> PyResult<RType> {
870 self.hd.rtype().map_err(to_py_err)
871 }
872
873 #[getter]
874 fn get_publisher_id(&self) -> u16 {
875 self.hd.publisher_id
876 }
877 #[setter]
878 fn set_publisher_id(&mut self, publisher_id: u16) {
879 self.hd.publisher_id = publisher_id;
880 }
881
882 #[getter]
883 fn get_instrument_id(&self) -> u32 {
884 self.hd.instrument_id
885 }
886 #[setter]
887 fn set_instrument_id(&mut self, instrument_id: u32) {
888 self.hd.instrument_id = instrument_id;
889 }
890
891 #[getter]
892 fn ts_event(&self) -> u64 {
893 self.hd.ts_event
894 }
895 #[getter]
896 fn get_pretty_ts_event<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
897 new_py_timestamp_or_datetime(py, self.ts_event())
898 }
899 #[setter]
900 fn set_ts_event(&mut self, ts_event: u64) {
901 self.hd.ts_event = ts_event;
902 }
903
904 #[pyo3(name = "record_size")]
905 fn py_record_size(&self) -> usize {
906 self.record_size()
907 }
908
909 #[classattr]
910 fn size_hint() -> PyResult<usize> {
911 Ok(mem::size_of::<Self>())
912 }
913
914 #[getter]
915 fn ts_index(&self) -> u64 {
916 self.raw_index_ts()
917 }
918 #[getter]
919 fn get_pretty_ts_index<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
920 new_py_timestamp_or_datetime(py, self.raw_index_ts())
921 }
922
923 #[getter]
924 fn get_pretty_price(&self) -> f64 {
925 self.price_f64()
926 }
927
928 #[getter]
929 fn get_side<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
930 self.side()
931 .map(|c| c.into_bound_py_any(py))
932 .unwrap_or_else(|_| (self.side as u8 as char).into_bound_py_any(py))
933 }
934 #[setter]
935 fn set_side(&mut self, side: Side) {
936 self.side = side as u8 as c_char;
937 }
938
939 #[getter]
940 fn get_pretty_ts_recv<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
941 new_py_timestamp_or_datetime(py, self.ts_recv)
942 }
943
944 #[classattr]
945 #[pyo3(name = "_dtypes")]
946 fn py_dtypes() -> Vec<(String, String)> {
947 Self::field_dtypes("")
948 }
949
950 #[classattr]
951 #[pyo3(name = "_price_fields")]
952 fn py_price_fields() -> Vec<String> {
953 Self::price_fields("")
954 }
955
956 #[classattr]
957 #[pyo3(name = "_timestamp_fields")]
958 fn py_timestamp_fields() -> Vec<String> {
959 Self::timestamp_fields("")
960 }
961
962 #[classattr]
963 #[pyo3(name = "_hidden_fields")]
964 fn py_hidden_fields() -> Vec<String> {
965 Self::hidden_fields("")
966 }
967
968 #[classattr]
969 #[pyo3(name = "_ordered_fields")]
970 fn py_ordered_fields() -> Vec<String> {
971 Self::ordered_fields("")
972 }
973}
974
975#[pymethods]
976impl Cmbp1Msg {
977 #[new]
978 #[pyo3(signature = (
979 rtype,
980 publisher_id,
981 instrument_id,
982 ts_event,
983 price,
984 size,
985 action,
986 side,
987 ts_recv,
988 flags = None,
989 ts_in_delta = 0,
990 levels = None,
991 ))]
992 fn py_new(
993 rtype: u8,
994 publisher_id: u16,
995 instrument_id: u32,
996 ts_event: u64,
997 price: i64,
998 size: u32,
999 action: Action,
1000 side: Side,
1001 ts_recv: u64,
1002 flags: Option<FlagSet>,
1003 ts_in_delta: i32,
1004 levels: Option<ConsolidatedBidAskPair>,
1005 ) -> PyResult<Self> {
1006 Ok(Self {
1007 hd: RecordHeader::new::<Self>(rtype, publisher_id, instrument_id, ts_event),
1008 price,
1009 size,
1010 action: action as u8 as c_char,
1011 side: side as u8 as c_char,
1012 flags: flags.unwrap_or_default(),
1013 _reserved1: Default::default(),
1014 ts_recv,
1015 ts_in_delta,
1016 _reserved2: Default::default(),
1017 levels: [levels.unwrap_or_default()],
1018 })
1019 }
1020
1021 fn __bytes__(&self) -> &[u8] {
1022 self.as_ref()
1023 }
1024
1025 fn __repr__(&self) -> String {
1026 let mut s = String::new();
1027 self.write_py_repr(&mut s).unwrap();
1028 s
1029 }
1030
1031 #[getter]
1032 fn rtype(&self) -> PyResult<RType> {
1033 self.hd.rtype().map_err(to_py_err)
1034 }
1035
1036 #[getter]
1037 fn get_publisher_id(&self) -> u16 {
1038 self.hd.publisher_id
1039 }
1040 #[setter]
1041 fn set_publisher_id(&mut self, publisher_id: u16) {
1042 self.hd.publisher_id = publisher_id;
1043 }
1044
1045 #[getter]
1046 fn get_instrument_id(&self) -> u32 {
1047 self.hd.instrument_id
1048 }
1049 #[setter]
1050 fn set_instrument_id(&mut self, instrument_id: u32) {
1051 self.hd.instrument_id = instrument_id;
1052 }
1053
1054 #[getter]
1055 fn ts_event(&self) -> u64 {
1056 self.hd.ts_event
1057 }
1058 #[getter]
1059 fn get_pretty_ts_event<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
1060 new_py_timestamp_or_datetime(py, self.ts_event())
1061 }
1062 #[setter]
1063 fn set_ts_event(&mut self, ts_event: u64) {
1064 self.hd.ts_event = ts_event;
1065 }
1066
1067 #[pyo3(name = "record_size")]
1068 fn py_record_size(&self) -> usize {
1069 self.record_size()
1070 }
1071
1072 #[classattr]
1073 fn size_hint() -> PyResult<usize> {
1074 Ok(mem::size_of::<Self>())
1075 }
1076
1077 #[getter]
1078 fn ts_index(&self) -> u64 {
1079 self.raw_index_ts()
1080 }
1081 #[getter]
1082 fn get_pretty_ts_index<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
1083 new_py_timestamp_or_datetime(py, self.raw_index_ts())
1084 }
1085
1086 #[getter]
1087 fn get_pretty_price(&self) -> f64 {
1088 self.price_f64()
1089 }
1090
1091 #[getter]
1092 fn get_action<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
1093 self.action()
1094 .map(|c| c.into_bound_py_any(py))
1095 .unwrap_or_else(|_| (self.action as u8 as char).into_bound_py_any(py))
1096 }
1097 #[setter]
1098 fn set_action(&mut self, action: Action) {
1099 self.action = action as u8 as c_char;
1100 }
1101
1102 #[getter]
1103 fn get_side<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
1104 self.side()
1105 .map(|c| c.into_bound_py_any(py))
1106 .unwrap_or_else(|_| (self.side as u8 as char).into_bound_py_any(py))
1107 }
1108 #[setter]
1109 fn set_side(&mut self, side: Side) {
1110 self.side = side as u8 as c_char;
1111 }
1112
1113 #[getter]
1114 fn get_pretty_ts_recv<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
1115 new_py_timestamp_or_datetime(py, self.ts_recv)
1116 }
1117
1118 #[classattr]
1119 #[pyo3(name = "_dtypes")]
1120 fn py_dtypes() -> Vec<(String, String)> {
1121 Self::field_dtypes("")
1122 }
1123
1124 #[classattr]
1125 #[pyo3(name = "_price_fields")]
1126 fn py_price_fields() -> Vec<String> {
1127 Self::price_fields("")
1128 }
1129
1130 #[classattr]
1131 #[pyo3(name = "_timestamp_fields")]
1132 fn py_timestamp_fields() -> Vec<String> {
1133 Self::timestamp_fields("")
1134 }
1135
1136 #[classattr]
1137 #[pyo3(name = "_hidden_fields")]
1138 fn py_hidden_fields() -> Vec<String> {
1139 Self::hidden_fields("")
1140 }
1141
1142 #[classattr]
1143 #[pyo3(name = "_ordered_fields")]
1144 fn py_ordered_fields() -> Vec<String> {
1145 Self::ordered_fields("")
1146 }
1147}
1148
1149#[pymethods]
1150impl CbboMsg {
1151 #[new]
1152 #[pyo3(signature = (
1153 rtype,
1154 publisher_id,
1155 instrument_id,
1156 ts_event,
1157 price,
1158 size,
1159 side,
1160 ts_recv,
1161 flags = None,
1162 levels = None,
1163 ))]
1164 fn py_new(
1165 rtype: u8,
1166 publisher_id: u16,
1167 instrument_id: u32,
1168 ts_event: u64,
1169 price: i64,
1170 size: u32,
1171 side: Side,
1172 ts_recv: u64,
1173 flags: Option<FlagSet>,
1174 levels: Option<ConsolidatedBidAskPair>,
1175 ) -> PyResult<Self> {
1176 Ok(Self {
1177 hd: RecordHeader::new::<Self>(rtype, publisher_id, instrument_id, ts_event),
1178 price,
1179 size,
1180 _reserved1: Default::default(),
1181 side: side as u8 as c_char,
1182 flags: flags.unwrap_or_default(),
1183 _reserved2: Default::default(),
1184 ts_recv,
1185 _reserved3: Default::default(),
1186 levels: [levels.unwrap_or_default()],
1187 })
1188 }
1189
1190 fn __bytes__(&self) -> &[u8] {
1191 self.as_ref()
1192 }
1193
1194 fn __repr__(&self) -> String {
1195 let mut s = String::new();
1196 self.write_py_repr(&mut s).unwrap();
1197 s
1198 }
1199
1200 #[getter]
1201 fn rtype(&self) -> PyResult<RType> {
1202 self.hd.rtype().map_err(to_py_err)
1203 }
1204
1205 #[getter]
1206 fn get_publisher_id(&self) -> u16 {
1207 self.hd.publisher_id
1208 }
1209 #[setter]
1210 fn set_publisher_id(&mut self, publisher_id: u16) {
1211 self.hd.publisher_id = publisher_id;
1212 }
1213
1214 #[getter]
1215 fn get_instrument_id(&self) -> u32 {
1216 self.hd.instrument_id
1217 }
1218 #[setter]
1219 fn set_instrument_id(&mut self, instrument_id: u32) {
1220 self.hd.instrument_id = instrument_id;
1221 }
1222
1223 #[getter]
1224 fn ts_event(&self) -> u64 {
1225 self.hd.ts_event
1226 }
1227 #[getter]
1228 fn get_pretty_ts_event<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
1229 new_py_timestamp_or_datetime(py, self.ts_event())
1230 }
1231 #[setter]
1232 fn set_ts_event(&mut self, ts_event: u64) {
1233 self.hd.ts_event = ts_event;
1234 }
1235
1236 #[pyo3(name = "record_size")]
1237 fn py_record_size(&self) -> usize {
1238 self.record_size()
1239 }
1240
1241 #[classattr]
1242 fn size_hint() -> PyResult<usize> {
1243 Ok(mem::size_of::<Self>())
1244 }
1245
1246 #[getter]
1247 fn ts_index(&self) -> u64 {
1248 self.raw_index_ts()
1249 }
1250 #[getter]
1251 fn get_pretty_ts_index<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
1252 new_py_timestamp_or_datetime(py, self.raw_index_ts())
1253 }
1254
1255 #[getter]
1256 fn get_pretty_price(&self) -> f64 {
1257 self.price_f64()
1258 }
1259
1260 #[getter]
1261 fn get_side<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
1262 self.side()
1263 .map(|c| c.into_bound_py_any(py))
1264 .unwrap_or_else(|_| (self.side as u8 as char).into_bound_py_any(py))
1265 }
1266 #[setter]
1267 fn set_side(&mut self, side: Side) {
1268 self.side = side as u8 as c_char;
1269 }
1270
1271 #[getter]
1272 fn get_pretty_ts_recv<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
1273 new_py_timestamp_or_datetime(py, self.ts_recv)
1274 }
1275
1276 #[classattr]
1277 #[pyo3(name = "_dtypes")]
1278 fn py_dtypes() -> Vec<(String, String)> {
1279 Self::field_dtypes("")
1280 }
1281
1282 #[classattr]
1283 #[pyo3(name = "_price_fields")]
1284 fn py_price_fields() -> Vec<String> {
1285 Self::price_fields("")
1286 }
1287
1288 #[classattr]
1289 #[pyo3(name = "_timestamp_fields")]
1290 fn py_timestamp_fields() -> Vec<String> {
1291 Self::timestamp_fields("")
1292 }
1293
1294 #[classattr]
1295 #[pyo3(name = "_hidden_fields")]
1296 fn py_hidden_fields() -> Vec<String> {
1297 Self::hidden_fields("")
1298 }
1299
1300 #[classattr]
1301 #[pyo3(name = "_ordered_fields")]
1302 fn py_ordered_fields() -> Vec<String> {
1303 Self::ordered_fields("")
1304 }
1305}
1306
1307#[pymethods]
1308impl OhlcvMsg {
1309 #[new]
1310 #[pyo3(signature = (
1311 rtype,
1312 publisher_id,
1313 instrument_id,
1314 ts_event,
1315 open,
1316 high,
1317 low,
1318 close,
1319 volume,
1320 ))]
1321 fn py_new(
1322 rtype: u8,
1323 publisher_id: u16,
1324 instrument_id: u32,
1325 ts_event: u64,
1326 open: i64,
1327 high: i64,
1328 low: i64,
1329 close: i64,
1330 volume: u64,
1331 ) -> PyResult<Self> {
1332 Ok(Self {
1333 hd: RecordHeader::new::<Self>(rtype, publisher_id, instrument_id, ts_event),
1334 open,
1335 high,
1336 low,
1337 close,
1338 volume,
1339 })
1340 }
1341
1342 fn __bytes__(&self) -> &[u8] {
1343 self.as_ref()
1344 }
1345
1346 fn __repr__(&self) -> String {
1347 let mut s = String::new();
1348 self.write_py_repr(&mut s).unwrap();
1349 s
1350 }
1351
1352 #[getter]
1353 fn rtype(&self) -> PyResult<RType> {
1354 self.hd.rtype().map_err(to_py_err)
1355 }
1356
1357 #[getter]
1358 fn get_publisher_id(&self) -> u16 {
1359 self.hd.publisher_id
1360 }
1361 #[setter]
1362 fn set_publisher_id(&mut self, publisher_id: u16) {
1363 self.hd.publisher_id = publisher_id;
1364 }
1365
1366 #[getter]
1367 fn get_instrument_id(&self) -> u32 {
1368 self.hd.instrument_id
1369 }
1370 #[setter]
1371 fn set_instrument_id(&mut self, instrument_id: u32) {
1372 self.hd.instrument_id = instrument_id;
1373 }
1374
1375 #[getter]
1376 fn ts_event(&self) -> u64 {
1377 self.hd.ts_event
1378 }
1379 #[getter]
1380 fn get_pretty_ts_event<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
1381 new_py_timestamp_or_datetime(py, self.ts_event())
1382 }
1383 #[setter]
1384 fn set_ts_event(&mut self, ts_event: u64) {
1385 self.hd.ts_event = ts_event;
1386 }
1387
1388 #[pyo3(name = "record_size")]
1389 fn py_record_size(&self) -> usize {
1390 self.record_size()
1391 }
1392
1393 #[classattr]
1394 fn size_hint() -> PyResult<usize> {
1395 Ok(mem::size_of::<Self>())
1396 }
1397
1398 #[getter]
1399 fn ts_index(&self) -> u64 {
1400 self.raw_index_ts()
1401 }
1402 #[getter]
1403 fn get_pretty_ts_index<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
1404 new_py_timestamp_or_datetime(py, self.raw_index_ts())
1405 }
1406
1407 #[getter]
1408 fn get_pretty_open(&self) -> f64 {
1409 self.open_f64()
1410 }
1411
1412 #[getter]
1413 fn get_pretty_high(&self) -> f64 {
1414 self.high_f64()
1415 }
1416
1417 #[getter]
1418 fn get_pretty_low(&self) -> f64 {
1419 self.low_f64()
1420 }
1421
1422 #[getter]
1423 fn get_pretty_close(&self) -> f64 {
1424 self.close_f64()
1425 }
1426
1427 #[classattr]
1428 #[pyo3(name = "_dtypes")]
1429 fn py_dtypes() -> Vec<(String, String)> {
1430 Self::field_dtypes("")
1431 }
1432
1433 #[classattr]
1434 #[pyo3(name = "_price_fields")]
1435 fn py_price_fields() -> Vec<String> {
1436 Self::price_fields("")
1437 }
1438
1439 #[classattr]
1440 #[pyo3(name = "_timestamp_fields")]
1441 fn py_timestamp_fields() -> Vec<String> {
1442 Self::timestamp_fields("")
1443 }
1444
1445 #[classattr]
1446 #[pyo3(name = "_hidden_fields")]
1447 fn py_hidden_fields() -> Vec<String> {
1448 Self::hidden_fields("")
1449 }
1450
1451 #[classattr]
1452 #[pyo3(name = "_ordered_fields")]
1453 fn py_ordered_fields() -> Vec<String> {
1454 Self::ordered_fields("")
1455 }
1456}
1457
1458#[pymethods]
1459impl StatusMsg {
1460 #[new]
1461 #[pyo3(signature = (
1462 publisher_id,
1463 instrument_id,
1464 ts_event,
1465 ts_recv,
1466 action = None,
1467 reason = None,
1468 trading_event = None,
1469 is_trading = None,
1470 is_quoting = None,
1471 is_short_sell_restricted = None,
1472 ))]
1473 fn py_new(
1474 publisher_id: u16,
1475 instrument_id: u32,
1476 ts_event: u64,
1477 ts_recv: u64,
1478 action: Option<StatusAction>,
1479 reason: Option<StatusReason>,
1480 trading_event: Option<TradingEvent>,
1481 is_trading: Option<TriState>,
1482 is_quoting: Option<TriState>,
1483 is_short_sell_restricted: Option<TriState>,
1484 ) -> PyResult<Self> {
1485 Ok(Self {
1486 hd: RecordHeader::new::<Self>(rtype::STATUS, publisher_id, instrument_id, ts_event),
1487 ts_recv,
1488 action: action.unwrap_or_default() as u16,
1489 reason: reason.unwrap_or_default() as u16,
1490 trading_event: trading_event.unwrap_or_default() as u16,
1491 is_trading: is_trading.unwrap_or_default() as u8 as c_char,
1492 is_quoting: is_quoting.unwrap_or_default() as u8 as c_char,
1493 is_short_sell_restricted: is_short_sell_restricted.unwrap_or_default() as u8 as c_char,
1494 _reserved: Default::default(),
1495 })
1496 }
1497
1498 fn __bytes__(&self) -> &[u8] {
1499 self.as_ref()
1500 }
1501
1502 fn __repr__(&self) -> String {
1503 let mut s = String::new();
1504 self.write_py_repr(&mut s).unwrap();
1505 s
1506 }
1507
1508 #[getter]
1509 fn rtype(&self) -> PyResult<RType> {
1510 self.hd.rtype().map_err(to_py_err)
1511 }
1512
1513 #[getter]
1514 fn get_publisher_id(&self) -> u16 {
1515 self.hd.publisher_id
1516 }
1517 #[setter]
1518 fn set_publisher_id(&mut self, publisher_id: u16) {
1519 self.hd.publisher_id = publisher_id;
1520 }
1521
1522 #[getter]
1523 fn get_instrument_id(&self) -> u32 {
1524 self.hd.instrument_id
1525 }
1526 #[setter]
1527 fn set_instrument_id(&mut self, instrument_id: u32) {
1528 self.hd.instrument_id = instrument_id;
1529 }
1530
1531 #[getter]
1532 fn ts_event(&self) -> u64 {
1533 self.hd.ts_event
1534 }
1535 #[getter]
1536 fn get_pretty_ts_event<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
1537 new_py_timestamp_or_datetime(py, self.ts_event())
1538 }
1539 #[setter]
1540 fn set_ts_event(&mut self, ts_event: u64) {
1541 self.hd.ts_event = ts_event;
1542 }
1543
1544 #[pyo3(name = "record_size")]
1545 fn py_record_size(&self) -> usize {
1546 self.record_size()
1547 }
1548
1549 #[classattr]
1550 fn size_hint() -> PyResult<usize> {
1551 Ok(mem::size_of::<Self>())
1552 }
1553
1554 #[getter]
1555 fn ts_index(&self) -> u64 {
1556 self.raw_index_ts()
1557 }
1558 #[getter]
1559 fn get_pretty_ts_index<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
1560 new_py_timestamp_or_datetime(py, self.raw_index_ts())
1561 }
1562
1563 #[getter]
1564 fn get_pretty_ts_recv<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
1565 new_py_timestamp_or_datetime(py, self.ts_recv)
1566 }
1567
1568 #[getter]
1569 fn get_action<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
1570 self.action()
1571 .map(|c| c.into_bound_py_any(py))
1572 .unwrap_or_else(|_| self.action.into_bound_py_any(py))
1573 }
1574 #[setter]
1575 fn set_action(&mut self, action: StatusAction) {
1576 self.action = action as u16;
1577 }
1578
1579 #[getter]
1580 fn get_reason<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
1581 self.reason()
1582 .map(|c| c.into_bound_py_any(py))
1583 .unwrap_or_else(|_| self.reason.into_bound_py_any(py))
1584 }
1585 #[setter]
1586 fn set_reason(&mut self, reason: StatusReason) {
1587 self.reason = reason as u16;
1588 }
1589
1590 #[getter]
1591 fn get_trading_event<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
1592 self.trading_event()
1593 .map(|c| c.into_bound_py_any(py))
1594 .unwrap_or_else(|_| self.trading_event.into_bound_py_any(py))
1595 }
1596 #[setter]
1597 fn set_trading_event(&mut self, trading_event: TradingEvent) {
1598 self.trading_event = trading_event as u16;
1599 }
1600
1601 #[getter]
1602 fn get_is_trading(&self) -> Option<bool> {
1603 self.is_trading()
1604 }
1605
1606 #[getter]
1607 fn get_is_quoting(&self) -> Option<bool> {
1608 self.is_quoting()
1609 }
1610
1611 #[getter]
1612 fn get_is_short_sell_restricted(&self) -> Option<bool> {
1613 self.is_short_sell_restricted()
1614 }
1615
1616 #[classattr]
1617 #[pyo3(name = "_dtypes")]
1618 fn py_dtypes() -> Vec<(String, String)> {
1619 Self::field_dtypes("")
1620 }
1621
1622 #[classattr]
1623 #[pyo3(name = "_price_fields")]
1624 fn py_price_fields() -> Vec<String> {
1625 Self::price_fields("")
1626 }
1627
1628 #[classattr]
1629 #[pyo3(name = "_timestamp_fields")]
1630 fn py_timestamp_fields() -> Vec<String> {
1631 Self::timestamp_fields("")
1632 }
1633
1634 #[classattr]
1635 #[pyo3(name = "_hidden_fields")]
1636 fn py_hidden_fields() -> Vec<String> {
1637 Self::hidden_fields("")
1638 }
1639
1640 #[classattr]
1641 #[pyo3(name = "_ordered_fields")]
1642 fn py_ordered_fields() -> Vec<String> {
1643 Self::ordered_fields("")
1644 }
1645}
1646
1647#[pymethods]
1648impl InstrumentDefMsg {
1649 #[new]
1650 #[pyo3(signature = (
1651 publisher_id,
1652 instrument_id,
1653 ts_event,
1654 ts_recv,
1655 min_price_increment,
1656 display_factor,
1657 raw_symbol,
1658 asset,
1659 security_type,
1660 instrument_class,
1661 security_update_action,
1662 expiration = UNDEF_TIMESTAMP,
1663 activation = UNDEF_TIMESTAMP,
1664 high_limit_price = UNDEF_PRICE,
1665 low_limit_price = UNDEF_PRICE,
1666 max_price_variation = UNDEF_PRICE,
1667 unit_of_measure_qty = UNDEF_PRICE,
1668 min_price_increment_amount = UNDEF_PRICE,
1669 price_ratio = UNDEF_PRICE,
1670 strike_price = UNDEF_PRICE,
1671 raw_instrument_id = 0,
1672 leg_price = UNDEF_PRICE,
1673 leg_delta = UNDEF_PRICE,
1674 inst_attrib_value = None,
1675 underlying_id = 0,
1676 market_depth_implied = None,
1677 market_depth = None,
1678 market_segment_id = None,
1679 max_trade_vol = None,
1680 min_lot_size = None,
1681 min_lot_size_block = None,
1682 min_lot_size_round_lot = None,
1683 min_trade_vol = None,
1684 contract_multiplier = None,
1685 decay_quantity = None,
1686 original_contract_size = None,
1687 leg_instrument_id = 0,
1688 leg_ratio_price_numerator = 0,
1689 leg_ratio_price_denominator = 0,
1690 leg_ratio_qty_numerator = 0,
1691 leg_ratio_qty_denominator = 0,
1692 leg_underlying_id = 0,
1693 appl_id = None,
1694 maturity_year = None,
1695 decay_start_date = None,
1696 channel_id = None,
1697 leg_count = 0,
1698 leg_index = 0,
1699 currency = "",
1700 settl_currency = "",
1701 secsubtype = "",
1702 group = "",
1703 exchange = "",
1704 cfi = "",
1705 unit_of_measure = "",
1706 underlying = "",
1707 strike_price_currency = "",
1708 leg_raw_symbol = "",
1709 match_algorithm = None,
1710 main_fraction = None,
1711 price_display_format = None,
1712 sub_fraction = None,
1713 underlying_product = None,
1714 maturity_month = None,
1715 maturity_day = None,
1716 maturity_week = None,
1717 user_defined_instrument = None,
1718 contract_multiplier_unit = None,
1719 flow_schedule_type = None,
1720 tick_rule = None,
1721 leg_instrument_class = None,
1722 leg_side = None,
1723 ))]
1724 fn py_new(
1725 publisher_id: u16,
1726 instrument_id: u32,
1727 ts_event: u64,
1728 ts_recv: u64,
1729 min_price_increment: i64,
1730 display_factor: i64,
1731 raw_symbol: &str,
1732 asset: &str,
1733 security_type: &str,
1734 instrument_class: InstrumentClass,
1735 security_update_action: SecurityUpdateAction,
1736 expiration: u64,
1737 activation: u64,
1738 high_limit_price: i64,
1739 low_limit_price: i64,
1740 max_price_variation: i64,
1741 unit_of_measure_qty: i64,
1742 min_price_increment_amount: i64,
1743 price_ratio: i64,
1744 strike_price: i64,
1745 raw_instrument_id: u64,
1746 leg_price: i64,
1747 leg_delta: i64,
1748 inst_attrib_value: Option<i32>,
1749 underlying_id: u32,
1750 market_depth_implied: Option<i32>,
1751 market_depth: Option<i32>,
1752 market_segment_id: Option<u32>,
1753 max_trade_vol: Option<u32>,
1754 min_lot_size: Option<i32>,
1755 min_lot_size_block: Option<i32>,
1756 min_lot_size_round_lot: Option<i32>,
1757 min_trade_vol: Option<u32>,
1758 contract_multiplier: Option<i32>,
1759 decay_quantity: Option<i32>,
1760 original_contract_size: Option<i32>,
1761 leg_instrument_id: u32,
1762 leg_ratio_price_numerator: i32,
1763 leg_ratio_price_denominator: i32,
1764 leg_ratio_qty_numerator: i32,
1765 leg_ratio_qty_denominator: i32,
1766 leg_underlying_id: u32,
1767 appl_id: Option<i16>,
1768 maturity_year: Option<u16>,
1769 decay_start_date: Option<u16>,
1770 channel_id: Option<u16>,
1771 leg_count: u16,
1772 leg_index: u16,
1773 currency: &str,
1774 settl_currency: &str,
1775 secsubtype: &str,
1776 group: &str,
1777 exchange: &str,
1778 cfi: &str,
1779 unit_of_measure: &str,
1780 underlying: &str,
1781 strike_price_currency: &str,
1782 leg_raw_symbol: &str,
1783 match_algorithm: Option<MatchAlgorithm>,
1784 main_fraction: Option<u8>,
1785 price_display_format: Option<u8>,
1786 sub_fraction: Option<u8>,
1787 underlying_product: Option<u8>,
1788 maturity_month: Option<u8>,
1789 maturity_day: Option<u8>,
1790 maturity_week: Option<u8>,
1791 user_defined_instrument: Option<UserDefinedInstrument>,
1792 contract_multiplier_unit: Option<i8>,
1793 flow_schedule_type: Option<i8>,
1794 tick_rule: Option<u8>,
1795 leg_instrument_class: Option<InstrumentClass>,
1796 leg_side: Option<Side>,
1797 ) -> PyResult<Self> {
1798 Ok(Self {
1799 hd: RecordHeader::new::<Self>(
1800 rtype::INSTRUMENT_DEF,
1801 publisher_id,
1802 instrument_id,
1803 ts_event,
1804 ),
1805 ts_recv,
1806 min_price_increment,
1807 display_factor,
1808 expiration,
1809 activation,
1810 high_limit_price,
1811 low_limit_price,
1812 max_price_variation,
1813 unit_of_measure_qty,
1814 min_price_increment_amount,
1815 price_ratio,
1816 strike_price,
1817 raw_instrument_id,
1818 leg_price,
1819 leg_delta,
1820 inst_attrib_value: inst_attrib_value.unwrap_or(i32::MAX),
1821 underlying_id,
1822 market_depth_implied: market_depth_implied.unwrap_or(i32::MAX),
1823 market_depth: market_depth.unwrap_or(i32::MAX),
1824 market_segment_id: market_segment_id.unwrap_or(u32::MAX),
1825 max_trade_vol: max_trade_vol.unwrap_or(u32::MAX),
1826 min_lot_size: min_lot_size.unwrap_or(i32::MAX),
1827 min_lot_size_block: min_lot_size_block.unwrap_or(i32::MAX),
1828 min_lot_size_round_lot: min_lot_size_round_lot.unwrap_or(i32::MAX),
1829 min_trade_vol: min_trade_vol.unwrap_or(u32::MAX),
1830 contract_multiplier: contract_multiplier.unwrap_or(i32::MAX),
1831 decay_quantity: decay_quantity.unwrap_or(i32::MAX),
1832 original_contract_size: original_contract_size.unwrap_or(i32::MAX),
1833 leg_instrument_id,
1834 leg_ratio_price_numerator,
1835 leg_ratio_price_denominator,
1836 leg_ratio_qty_numerator,
1837 leg_ratio_qty_denominator,
1838 leg_underlying_id,
1839 appl_id: appl_id.unwrap_or(i16::MAX),
1840 maturity_year: maturity_year.unwrap_or(u16::MAX),
1841 decay_start_date: decay_start_date.unwrap_or(u16::MAX),
1842 channel_id: channel_id.unwrap_or(u16::MAX),
1843 leg_count,
1844 leg_index,
1845 currency: str_to_c_chars(currency)?,
1846 settl_currency: str_to_c_chars(settl_currency)?,
1847 secsubtype: str_to_c_chars(secsubtype)?,
1848 raw_symbol: str_to_c_chars(raw_symbol)?,
1849 group: str_to_c_chars(group)?,
1850 exchange: str_to_c_chars(exchange)?,
1851 asset: str_to_c_chars(asset)?,
1852 cfi: str_to_c_chars(cfi)?,
1853 security_type: str_to_c_chars(security_type)?,
1854 unit_of_measure: str_to_c_chars(unit_of_measure)?,
1855 underlying: str_to_c_chars(underlying)?,
1856 strike_price_currency: str_to_c_chars(strike_price_currency)?,
1857 leg_raw_symbol: str_to_c_chars(leg_raw_symbol)?,
1858 instrument_class: instrument_class as u8 as c_char,
1859 match_algorithm: match_algorithm.unwrap_or_default() as u8 as c_char,
1860 main_fraction: main_fraction.unwrap_or(u8::MAX),
1861 price_display_format: price_display_format.unwrap_or(u8::MAX),
1862 sub_fraction: sub_fraction.unwrap_or(u8::MAX),
1863 underlying_product: underlying_product.unwrap_or(u8::MAX),
1864 security_update_action: security_update_action as u8 as c_char,
1865 maturity_month: maturity_month.unwrap_or(u8::MAX),
1866 maturity_day: maturity_day.unwrap_or(u8::MAX),
1867 maturity_week: maturity_week.unwrap_or(u8::MAX),
1868 user_defined_instrument: user_defined_instrument.unwrap_or_default() as u8 as c_char,
1869 contract_multiplier_unit: contract_multiplier_unit.unwrap_or(i8::MAX),
1870 flow_schedule_type: flow_schedule_type.unwrap_or(i8::MAX),
1871 tick_rule: tick_rule.unwrap_or(u8::MAX),
1872 leg_instrument_class: leg_instrument_class
1873 .map(|leg_instrument_class| leg_instrument_class as u8 as c_char)
1874 .unwrap_or_default(),
1875 leg_side: leg_side.unwrap_or_default() as u8 as c_char,
1876 _reserved: Default::default(),
1877 })
1878 }
1879
1880 fn __bytes__(&self) -> &[u8] {
1881 self.as_ref()
1882 }
1883
1884 fn __repr__(&self) -> String {
1885 let mut s = String::new();
1886 self.write_py_repr(&mut s).unwrap();
1887 s
1888 }
1889
1890 #[getter]
1891 fn rtype(&self) -> PyResult<RType> {
1892 self.hd.rtype().map_err(to_py_err)
1893 }
1894
1895 #[getter]
1896 fn get_publisher_id(&self) -> u16 {
1897 self.hd.publisher_id
1898 }
1899 #[setter]
1900 fn set_publisher_id(&mut self, publisher_id: u16) {
1901 self.hd.publisher_id = publisher_id;
1902 }
1903
1904 #[getter]
1905 fn get_instrument_id(&self) -> u32 {
1906 self.hd.instrument_id
1907 }
1908 #[setter]
1909 fn set_instrument_id(&mut self, instrument_id: u32) {
1910 self.hd.instrument_id = instrument_id;
1911 }
1912
1913 #[getter]
1914 fn ts_event(&self) -> u64 {
1915 self.hd.ts_event
1916 }
1917 #[getter]
1918 fn get_pretty_ts_event<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
1919 new_py_timestamp_or_datetime(py, self.ts_event())
1920 }
1921 #[setter]
1922 fn set_ts_event(&mut self, ts_event: u64) {
1923 self.hd.ts_event = ts_event;
1924 }
1925
1926 #[pyo3(name = "record_size")]
1927 fn py_record_size(&self) -> usize {
1928 self.record_size()
1929 }
1930
1931 #[classattr]
1932 fn size_hint() -> PyResult<usize> {
1933 Ok(mem::size_of::<Self>())
1934 }
1935
1936 #[getter]
1937 fn ts_index(&self) -> u64 {
1938 self.raw_index_ts()
1939 }
1940 #[getter]
1941 fn get_pretty_ts_index<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
1942 new_py_timestamp_or_datetime(py, self.raw_index_ts())
1943 }
1944
1945 #[getter]
1946 fn get_pretty_ts_recv<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
1947 new_py_timestamp_or_datetime(py, self.ts_recv)
1948 }
1949
1950 #[getter]
1951 fn get_pretty_min_price_increment(&self) -> f64 {
1952 self.min_price_increment_f64()
1953 }
1954
1955 #[getter]
1956 fn get_pretty_display_factor(&self) -> f64 {
1957 self.display_factor_f64()
1958 }
1959
1960 #[getter]
1961 fn get_pretty_expiration<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
1962 new_py_timestamp_or_datetime(py, self.expiration)
1963 }
1964
1965 #[getter]
1966 fn get_pretty_activation<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
1967 new_py_timestamp_or_datetime(py, self.activation)
1968 }
1969
1970 #[getter]
1971 fn get_pretty_high_limit_price(&self) -> f64 {
1972 self.high_limit_price_f64()
1973 }
1974
1975 #[getter]
1976 fn get_pretty_low_limit_price(&self) -> f64 {
1977 self.low_limit_price_f64()
1978 }
1979
1980 #[getter]
1981 fn get_pretty_max_price_variation(&self) -> f64 {
1982 self.max_price_variation_f64()
1983 }
1984
1985 #[getter]
1986 fn get_pretty_unit_of_measure_qty(&self) -> f64 {
1987 self.unit_of_measure_qty_f64()
1988 }
1989
1990 #[getter]
1991 fn get_pretty_min_price_increment_amount(&self) -> f64 {
1992 self.min_price_increment_amount_f64()
1993 }
1994
1995 #[getter]
1996 fn get_pretty_price_ratio(&self) -> f64 {
1997 self.price_ratio_f64()
1998 }
1999
2000 #[getter]
2001 fn get_pretty_strike_price(&self) -> f64 {
2002 self.strike_price_f64()
2003 }
2004
2005 #[getter]
2006 fn get_pretty_leg_price(&self) -> f64 {
2007 self.leg_price_f64()
2008 }
2009
2010 #[getter]
2011 fn get_pretty_leg_delta(&self) -> f64 {
2012 self.leg_delta_f64()
2013 }
2014
2015 #[getter]
2016 fn get_currency(&self) -> PyResult<&str> {
2017 Ok(self.currency()?)
2018 }
2019
2020 #[getter]
2021 fn get_settl_currency(&self) -> PyResult<&str> {
2022 Ok(self.settl_currency()?)
2023 }
2024
2025 #[getter]
2026 fn get_secsubtype(&self) -> PyResult<&str> {
2027 Ok(self.secsubtype()?)
2028 }
2029
2030 #[getter]
2031 fn get_raw_symbol(&self) -> PyResult<&str> {
2032 Ok(self.raw_symbol()?)
2033 }
2034
2035 #[getter]
2036 fn get_group(&self) -> PyResult<&str> {
2037 Ok(self.group()?)
2038 }
2039
2040 #[getter]
2041 fn get_exchange(&self) -> PyResult<&str> {
2042 Ok(self.exchange()?)
2043 }
2044
2045 #[getter]
2046 fn get_asset(&self) -> PyResult<&str> {
2047 Ok(self.asset()?)
2048 }
2049
2050 #[getter]
2051 fn get_cfi(&self) -> PyResult<&str> {
2052 Ok(self.cfi()?)
2053 }
2054
2055 #[getter]
2056 fn get_security_type(&self) -> PyResult<&str> {
2057 Ok(self.security_type()?)
2058 }
2059
2060 #[getter]
2061 fn get_unit_of_measure(&self) -> PyResult<&str> {
2062 Ok(self.unit_of_measure()?)
2063 }
2064
2065 #[getter]
2066 fn get_underlying(&self) -> PyResult<&str> {
2067 Ok(self.underlying()?)
2068 }
2069
2070 #[getter]
2071 fn get_strike_price_currency(&self) -> PyResult<&str> {
2072 Ok(self.strike_price_currency()?)
2073 }
2074
2075 #[getter]
2076 fn get_leg_raw_symbol(&self) -> PyResult<&str> {
2077 Ok(self.leg_raw_symbol()?)
2078 }
2079
2080 #[getter]
2081 fn get_instrument_class<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
2082 self.instrument_class()
2083 .map(|c| c.into_bound_py_any(py))
2084 .unwrap_or_else(|_| (self.instrument_class as u8 as char).into_bound_py_any(py))
2085 }
2086 #[setter]
2087 fn set_instrument_class(&mut self, instrument_class: InstrumentClass) {
2088 self.instrument_class = instrument_class as u8 as c_char;
2089 }
2090
2091 #[getter]
2092 fn get_match_algorithm<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
2093 self.match_algorithm()
2094 .map(|c| c.into_bound_py_any(py))
2095 .unwrap_or_else(|_| (self.match_algorithm as u8 as char).into_bound_py_any(py))
2096 }
2097 #[setter]
2098 fn set_match_algorithm(&mut self, match_algorithm: MatchAlgorithm) {
2099 self.match_algorithm = match_algorithm as u8 as c_char;
2100 }
2101
2102 #[getter]
2103 fn get_security_update_action<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
2104 self.security_update_action()
2105 .map(|c| c.into_bound_py_any(py))
2106 .unwrap_or_else(|_| (self.security_update_action as u8 as char).into_bound_py_any(py))
2107 }
2108 #[setter]
2109 fn set_security_update_action(&mut self, security_update_action: SecurityUpdateAction) {
2110 self.security_update_action = security_update_action as u8 as c_char;
2111 }
2112
2113 #[getter]
2114 fn get_user_defined_instrument<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
2115 self.user_defined_instrument()
2116 .map(|c| c.into_bound_py_any(py))
2117 .unwrap_or_else(|_| (self.user_defined_instrument as u8 as char).into_bound_py_any(py))
2118 }
2119 #[setter]
2120 fn set_user_defined_instrument(&mut self, user_defined_instrument: UserDefinedInstrument) {
2121 self.user_defined_instrument = user_defined_instrument as u8 as c_char;
2122 }
2123
2124 #[getter]
2125 fn get_leg_instrument_class<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
2126 self.leg_instrument_class()
2127 .map(|c| c.into_bound_py_any(py))
2128 .unwrap_or_else(|_| (self.leg_instrument_class as u8 as char).into_bound_py_any(py))
2129 }
2130 #[setter]
2131 fn set_leg_instrument_class(&mut self, leg_instrument_class: InstrumentClass) {
2132 self.leg_instrument_class = leg_instrument_class as u8 as c_char;
2133 }
2134
2135 #[getter]
2136 fn get_leg_side<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
2137 self.leg_side()
2138 .map(|c| c.into_bound_py_any(py))
2139 .unwrap_or_else(|_| (self.leg_side as u8 as char).into_bound_py_any(py))
2140 }
2141 #[setter]
2142 fn set_leg_side(&mut self, leg_side: Side) {
2143 self.leg_side = leg_side as u8 as c_char;
2144 }
2145
2146 #[classattr]
2147 #[pyo3(name = "_dtypes")]
2148 fn py_dtypes() -> Vec<(String, String)> {
2149 Self::field_dtypes("")
2150 }
2151
2152 #[classattr]
2153 #[pyo3(name = "_price_fields")]
2154 fn py_price_fields() -> Vec<String> {
2155 Self::price_fields("")
2156 }
2157
2158 #[classattr]
2159 #[pyo3(name = "_timestamp_fields")]
2160 fn py_timestamp_fields() -> Vec<String> {
2161 Self::timestamp_fields("")
2162 }
2163
2164 #[classattr]
2165 #[pyo3(name = "_hidden_fields")]
2166 fn py_hidden_fields() -> Vec<String> {
2167 Self::hidden_fields("")
2168 }
2169
2170 #[classattr]
2171 #[pyo3(name = "_ordered_fields")]
2172 fn py_ordered_fields() -> Vec<String> {
2173 Self::ordered_fields("")
2174 }
2175}
2176
2177#[pymethods]
2178impl ImbalanceMsg {
2179 #[new]
2180 #[pyo3(signature = (
2181 publisher_id,
2182 instrument_id,
2183 ts_event,
2184 ts_recv,
2185 ref_price,
2186 auction_time,
2187 cont_book_clr_price,
2188 auct_interest_clr_price,
2189 paired_qty,
2190 total_imbalance_qty,
2191 auction_type,
2192 side,
2193 significant_imbalance,
2194 ssr_filling_price = UNDEF_PRICE,
2195 ind_match_price = UNDEF_PRICE,
2196 upper_collar = UNDEF_PRICE,
2197 lower_collar = UNDEF_PRICE,
2198 market_imbalance_qty = UNDEF_ORDER_SIZE,
2199 unpaired_qty = UNDEF_ORDER_SIZE,
2200 auction_status = 0,
2201 freeze_status = 0,
2202 num_extensions = 0,
2203 unpaired_side = None,
2204 ))]
2205 fn py_new(
2206 publisher_id: u16,
2207 instrument_id: u32,
2208 ts_event: u64,
2209 ts_recv: u64,
2210 ref_price: i64,
2211 auction_time: u64,
2212 cont_book_clr_price: i64,
2213 auct_interest_clr_price: i64,
2214 paired_qty: u32,
2215 total_imbalance_qty: u32,
2216 auction_type: char,
2217 side: Side,
2218 significant_imbalance: char,
2219 ssr_filling_price: i64,
2220 ind_match_price: i64,
2221 upper_collar: i64,
2222 lower_collar: i64,
2223 market_imbalance_qty: u32,
2224 unpaired_qty: u32,
2225 auction_status: u8,
2226 freeze_status: u8,
2227 num_extensions: u8,
2228 unpaired_side: Option<Side>,
2229 ) -> PyResult<Self> {
2230 Ok(Self {
2231 hd: RecordHeader::new::<Self>(rtype::IMBALANCE, publisher_id, instrument_id, ts_event),
2232 ts_recv,
2233 ref_price,
2234 auction_time,
2235 cont_book_clr_price,
2236 auct_interest_clr_price,
2237 ssr_filling_price,
2238 ind_match_price,
2239 upper_collar,
2240 lower_collar,
2241 paired_qty,
2242 total_imbalance_qty,
2243 market_imbalance_qty,
2244 unpaired_qty,
2245 auction_type: char_to_c_char(auction_type)?,
2246 side: side as u8 as c_char,
2247 auction_status,
2248 freeze_status,
2249 num_extensions,
2250 unpaired_side: unpaired_side.unwrap_or_default() as u8 as c_char,
2251
2252 significant_imbalance: char_to_c_char(significant_imbalance)?,
2253 _reserved: Default::default(),
2254 })
2255 }
2256
2257 fn __bytes__(&self) -> &[u8] {
2258 self.as_ref()
2259 }
2260
2261 fn __repr__(&self) -> String {
2262 let mut s = String::new();
2263 self.write_py_repr(&mut s).unwrap();
2264 s
2265 }
2266
2267 #[getter]
2268 fn rtype(&self) -> PyResult<RType> {
2269 self.hd.rtype().map_err(to_py_err)
2270 }
2271
2272 #[getter]
2273 fn get_publisher_id(&self) -> u16 {
2274 self.hd.publisher_id
2275 }
2276 #[setter]
2277 fn set_publisher_id(&mut self, publisher_id: u16) {
2278 self.hd.publisher_id = publisher_id;
2279 }
2280
2281 #[getter]
2282 fn get_instrument_id(&self) -> u32 {
2283 self.hd.instrument_id
2284 }
2285 #[setter]
2286 fn set_instrument_id(&mut self, instrument_id: u32) {
2287 self.hd.instrument_id = instrument_id;
2288 }
2289
2290 #[getter]
2291 fn ts_event(&self) -> u64 {
2292 self.hd.ts_event
2293 }
2294 #[getter]
2295 fn get_pretty_ts_event<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
2296 new_py_timestamp_or_datetime(py, self.ts_event())
2297 }
2298 #[setter]
2299 fn set_ts_event(&mut self, ts_event: u64) {
2300 self.hd.ts_event = ts_event;
2301 }
2302
2303 #[pyo3(name = "record_size")]
2304 fn py_record_size(&self) -> usize {
2305 self.record_size()
2306 }
2307
2308 #[classattr]
2309 fn size_hint() -> PyResult<usize> {
2310 Ok(mem::size_of::<Self>())
2311 }
2312
2313 #[getter]
2314 fn ts_index(&self) -> u64 {
2315 self.raw_index_ts()
2316 }
2317 #[getter]
2318 fn get_pretty_ts_index<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
2319 new_py_timestamp_or_datetime(py, self.raw_index_ts())
2320 }
2321
2322 #[getter]
2323 fn get_pretty_ts_recv<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
2324 new_py_timestamp_or_datetime(py, self.ts_recv)
2325 }
2326
2327 #[getter]
2328 fn get_pretty_ref_price(&self) -> f64 {
2329 self.ref_price_f64()
2330 }
2331
2332 #[getter]
2333 fn get_pretty_auction_time<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
2334 new_py_timestamp_or_datetime(py, self.auction_time)
2335 }
2336
2337 #[getter]
2338 fn get_pretty_cont_book_clr_price(&self) -> f64 {
2339 self.cont_book_clr_price_f64()
2340 }
2341
2342 #[getter]
2343 fn get_pretty_auct_interest_clr_price(&self) -> f64 {
2344 self.auct_interest_clr_price_f64()
2345 }
2346
2347 #[getter]
2348 fn get_pretty_ssr_filling_price(&self) -> f64 {
2349 self.ssr_filling_price_f64()
2350 }
2351
2352 #[getter]
2353 fn get_pretty_ind_match_price(&self) -> f64 {
2354 self.ind_match_price_f64()
2355 }
2356
2357 #[getter]
2358 fn get_pretty_upper_collar(&self) -> f64 {
2359 self.upper_collar_f64()
2360 }
2361
2362 #[getter]
2363 fn get_pretty_lower_collar(&self) -> f64 {
2364 self.lower_collar_f64()
2365 }
2366
2367 #[getter]
2368 fn get_auction_type(&self) -> char {
2369 self.auction_type as u8 as char
2370 }
2371 #[setter]
2372 fn set_auction_type(&mut self, auction_type: char) -> PyResult<()> {
2373 self.auction_type = char_to_c_char(auction_type)?;
2374 Ok(())
2375 }
2376
2377 #[getter]
2378 fn get_side<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
2379 self.side()
2380 .map(|c| c.into_bound_py_any(py))
2381 .unwrap_or_else(|_| (self.side as u8 as char).into_bound_py_any(py))
2382 }
2383 #[setter]
2384 fn set_side(&mut self, side: Side) {
2385 self.side = side as u8 as c_char;
2386 }
2387
2388 #[getter]
2389 fn get_unpaired_side<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
2390 self.unpaired_side()
2391 .map(|c| c.into_bound_py_any(py))
2392 .unwrap_or_else(|_| (self.unpaired_side as u8 as char).into_bound_py_any(py))
2393 }
2394 #[setter]
2395 fn set_unpaired_side(&mut self, unpaired_side: Side) {
2396 self.unpaired_side = unpaired_side as u8 as c_char;
2397 }
2398
2399 #[getter]
2400 fn get_significant_imbalance(&self) -> char {
2401 self.significant_imbalance as u8 as char
2402 }
2403 #[setter]
2404 fn set_significant_imbalance(&mut self, significant_imbalance: char) -> PyResult<()> {
2405 self.significant_imbalance = char_to_c_char(significant_imbalance)?;
2406 Ok(())
2407 }
2408
2409 #[classattr]
2410 #[pyo3(name = "_dtypes")]
2411 fn py_dtypes() -> Vec<(String, String)> {
2412 Self::field_dtypes("")
2413 }
2414
2415 #[classattr]
2416 #[pyo3(name = "_price_fields")]
2417 fn py_price_fields() -> Vec<String> {
2418 Self::price_fields("")
2419 }
2420
2421 #[classattr]
2422 #[pyo3(name = "_timestamp_fields")]
2423 fn py_timestamp_fields() -> Vec<String> {
2424 Self::timestamp_fields("")
2425 }
2426
2427 #[classattr]
2428 #[pyo3(name = "_hidden_fields")]
2429 fn py_hidden_fields() -> Vec<String> {
2430 Self::hidden_fields("")
2431 }
2432
2433 #[classattr]
2434 #[pyo3(name = "_ordered_fields")]
2435 fn py_ordered_fields() -> Vec<String> {
2436 Self::ordered_fields("")
2437 }
2438}
2439
2440#[pymethods]
2441impl StatMsg {
2442 #[new]
2443 #[pyo3(signature = (
2444 publisher_id,
2445 instrument_id,
2446 ts_event,
2447 ts_recv,
2448 ts_ref,
2449 price,
2450 quantity,
2451 stat_type,
2452 sequence = 0,
2453 ts_in_delta = 0,
2454 channel_id = None,
2455 update_action = None,
2456 stat_flags = 0,
2457 ))]
2458 fn py_new(
2459 publisher_id: u16,
2460 instrument_id: u32,
2461 ts_event: u64,
2462 ts_recv: u64,
2463 ts_ref: u64,
2464 price: i64,
2465 quantity: i64,
2466 stat_type: StatType,
2467 sequence: u32,
2468 ts_in_delta: i32,
2469 channel_id: Option<u16>,
2470 update_action: Option<StatUpdateAction>,
2471 stat_flags: u8,
2472 ) -> PyResult<Self> {
2473 Ok(Self {
2474 hd: RecordHeader::new::<Self>(rtype::STATISTICS, publisher_id, instrument_id, ts_event),
2475 ts_recv,
2476 ts_ref,
2477 price,
2478 quantity,
2479 sequence,
2480 ts_in_delta,
2481 stat_type: stat_type as u16,
2482 channel_id: channel_id.unwrap_or(u16::MAX),
2483 update_action: update_action.unwrap_or_default() as u8,
2484 stat_flags,
2485 _reserved: Default::default(),
2486 })
2487 }
2488
2489 fn __bytes__(&self) -> &[u8] {
2490 self.as_ref()
2491 }
2492
2493 fn __repr__(&self) -> String {
2494 let mut s = String::new();
2495 self.write_py_repr(&mut s).unwrap();
2496 s
2497 }
2498
2499 #[getter]
2500 fn rtype(&self) -> PyResult<RType> {
2501 self.hd.rtype().map_err(to_py_err)
2502 }
2503
2504 #[getter]
2505 fn get_publisher_id(&self) -> u16 {
2506 self.hd.publisher_id
2507 }
2508 #[setter]
2509 fn set_publisher_id(&mut self, publisher_id: u16) {
2510 self.hd.publisher_id = publisher_id;
2511 }
2512
2513 #[getter]
2514 fn get_instrument_id(&self) -> u32 {
2515 self.hd.instrument_id
2516 }
2517 #[setter]
2518 fn set_instrument_id(&mut self, instrument_id: u32) {
2519 self.hd.instrument_id = instrument_id;
2520 }
2521
2522 #[getter]
2523 fn ts_event(&self) -> u64 {
2524 self.hd.ts_event
2525 }
2526 #[getter]
2527 fn get_pretty_ts_event<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
2528 new_py_timestamp_or_datetime(py, self.ts_event())
2529 }
2530 #[setter]
2531 fn set_ts_event(&mut self, ts_event: u64) {
2532 self.hd.ts_event = ts_event;
2533 }
2534
2535 #[pyo3(name = "record_size")]
2536 fn py_record_size(&self) -> usize {
2537 self.record_size()
2538 }
2539
2540 #[classattr]
2541 fn size_hint() -> PyResult<usize> {
2542 Ok(mem::size_of::<Self>())
2543 }
2544
2545 #[getter]
2546 fn ts_index(&self) -> u64 {
2547 self.raw_index_ts()
2548 }
2549 #[getter]
2550 fn get_pretty_ts_index<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
2551 new_py_timestamp_or_datetime(py, self.raw_index_ts())
2552 }
2553
2554 #[getter]
2555 fn get_pretty_ts_recv<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
2556 new_py_timestamp_or_datetime(py, self.ts_recv)
2557 }
2558
2559 #[getter]
2560 fn get_pretty_ts_ref<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
2561 new_py_timestamp_or_datetime(py, self.ts_ref)
2562 }
2563
2564 #[getter]
2565 fn get_pretty_price(&self) -> f64 {
2566 self.price_f64()
2567 }
2568
2569 #[getter]
2570 fn get_stat_type<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
2571 self.stat_type()
2572 .map(|c| c.into_bound_py_any(py))
2573 .unwrap_or_else(|_| self.stat_type.into_bound_py_any(py))
2574 }
2575 #[setter]
2576 fn set_stat_type(&mut self, stat_type: StatType) {
2577 self.stat_type = stat_type as u16;
2578 }
2579
2580 #[getter]
2581 fn get_update_action<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
2582 self.update_action()
2583 .map(|c| c.into_bound_py_any(py))
2584 .unwrap_or_else(|_| self.update_action.into_bound_py_any(py))
2585 }
2586 #[setter]
2587 fn set_update_action(&mut self, update_action: StatUpdateAction) {
2588 self.update_action = update_action as u8;
2589 }
2590
2591 #[classattr]
2592 #[pyo3(name = "_dtypes")]
2593 fn py_dtypes() -> Vec<(String, String)> {
2594 Self::field_dtypes("")
2595 }
2596
2597 #[classattr]
2598 #[pyo3(name = "_price_fields")]
2599 fn py_price_fields() -> Vec<String> {
2600 Self::price_fields("")
2601 }
2602
2603 #[classattr]
2604 #[pyo3(name = "_timestamp_fields")]
2605 fn py_timestamp_fields() -> Vec<String> {
2606 Self::timestamp_fields("")
2607 }
2608
2609 #[classattr]
2610 #[pyo3(name = "_hidden_fields")]
2611 fn py_hidden_fields() -> Vec<String> {
2612 Self::hidden_fields("")
2613 }
2614
2615 #[classattr]
2616 #[pyo3(name = "_ordered_fields")]
2617 fn py_ordered_fields() -> Vec<String> {
2618 Self::ordered_fields("")
2619 }
2620}
2621
2622#[pymethods]
2623impl ErrorMsg {
2624 #[new]
2625 #[pyo3(signature = (ts_event, err, is_last = true, code = None))]
2626 fn py_new(ts_event: u64, err: &str, is_last: bool, code: Option<ErrorCode>) -> PyResult<Self> {
2627 Ok(Self::new(ts_event, code, err, is_last))
2628 }
2629
2630 fn __bytes__(&self) -> &[u8] {
2631 self.as_ref()
2632 }
2633
2634 fn __repr__(&self) -> String {
2635 let mut s = String::new();
2636 self.write_py_repr(&mut s).unwrap();
2637 s
2638 }
2639
2640 #[getter]
2641 fn rtype(&self) -> PyResult<RType> {
2642 self.hd.rtype().map_err(to_py_err)
2643 }
2644
2645 #[getter]
2646 fn get_publisher_id(&self) -> u16 {
2647 self.hd.publisher_id
2648 }
2649 #[setter]
2650 fn set_publisher_id(&mut self, publisher_id: u16) {
2651 self.hd.publisher_id = publisher_id;
2652 }
2653
2654 #[getter]
2655 fn get_instrument_id(&self) -> u32 {
2656 self.hd.instrument_id
2657 }
2658 #[setter]
2659 fn set_instrument_id(&mut self, instrument_id: u32) {
2660 self.hd.instrument_id = instrument_id;
2661 }
2662
2663 #[getter]
2664 fn ts_event(&self) -> u64 {
2665 self.hd.ts_event
2666 }
2667 #[getter]
2668 fn get_pretty_ts_event<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
2669 new_py_timestamp_or_datetime(py, self.ts_event())
2670 }
2671 #[setter]
2672 fn set_ts_event(&mut self, ts_event: u64) {
2673 self.hd.ts_event = ts_event;
2674 }
2675
2676 #[pyo3(name = "record_size")]
2677 fn py_record_size(&self) -> usize {
2678 self.record_size()
2679 }
2680
2681 #[classattr]
2682 fn size_hint() -> PyResult<usize> {
2683 Ok(mem::size_of::<Self>())
2684 }
2685
2686 #[getter]
2687 fn ts_index(&self) -> u64 {
2688 self.raw_index_ts()
2689 }
2690 #[getter]
2691 fn get_pretty_ts_index<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
2692 new_py_timestamp_or_datetime(py, self.raw_index_ts())
2693 }
2694
2695 #[getter]
2696 fn get_err(&self) -> PyResult<&str> {
2697 Ok(self.err()?)
2698 }
2699
2700 #[getter]
2701 fn get_code<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
2702 self.code()
2703 .map(|c| c.into_bound_py_any(py))
2704 .unwrap_or_else(|_| self.code.into_bound_py_any(py))
2705 }
2706 #[setter]
2707 fn set_code(&mut self, code: ErrorCode) {
2708 self.code = code as u8;
2709 }
2710
2711 #[classattr]
2712 #[pyo3(name = "_dtypes")]
2713 fn py_dtypes() -> Vec<(String, String)> {
2714 Self::field_dtypes("")
2715 }
2716
2717 #[classattr]
2718 #[pyo3(name = "_price_fields")]
2719 fn py_price_fields() -> Vec<String> {
2720 Self::price_fields("")
2721 }
2722
2723 #[classattr]
2724 #[pyo3(name = "_timestamp_fields")]
2725 fn py_timestamp_fields() -> Vec<String> {
2726 Self::timestamp_fields("")
2727 }
2728
2729 #[classattr]
2730 #[pyo3(name = "_hidden_fields")]
2731 fn py_hidden_fields() -> Vec<String> {
2732 Self::hidden_fields("")
2733 }
2734
2735 #[classattr]
2736 #[pyo3(name = "_ordered_fields")]
2737 fn py_ordered_fields() -> Vec<String> {
2738 Self::ordered_fields("")
2739 }
2740}
2741
2742#[pymethods]
2743impl SymbolMappingMsg {
2744 #[new]
2745 #[pyo3(signature = (
2746 publisher_id,
2747 instrument_id,
2748 ts_event,
2749 stype_in,
2750 stype_in_symbol,
2751 stype_out,
2752 stype_out_symbol,
2753 start_ts,
2754 end_ts,
2755 ))]
2756 fn py_new(
2757 publisher_id: u16,
2758 instrument_id: u32,
2759 ts_event: u64,
2760 stype_in: SType,
2761 stype_in_symbol: &str,
2762 stype_out: SType,
2763 stype_out_symbol: &str,
2764 start_ts: u64,
2765 end_ts: u64,
2766 ) -> PyResult<Self> {
2767 Ok(Self {
2768 hd: RecordHeader::new::<Self>(
2769 rtype::SYMBOL_MAPPING,
2770 publisher_id,
2771 instrument_id,
2772 ts_event,
2773 ),
2774 stype_in: stype_in as u8,
2775 stype_in_symbol: str_to_c_chars(stype_in_symbol)?,
2776 stype_out: stype_out as u8,
2777 stype_out_symbol: str_to_c_chars(stype_out_symbol)?,
2778 start_ts,
2779 end_ts,
2780 })
2781 }
2782
2783 fn __bytes__(&self) -> &[u8] {
2784 self.as_ref()
2785 }
2786
2787 fn __repr__(&self) -> String {
2788 let mut s = String::new();
2789 self.write_py_repr(&mut s).unwrap();
2790 s
2791 }
2792
2793 #[getter]
2794 fn rtype(&self) -> PyResult<RType> {
2795 self.hd.rtype().map_err(to_py_err)
2796 }
2797
2798 #[getter]
2799 fn get_publisher_id(&self) -> u16 {
2800 self.hd.publisher_id
2801 }
2802 #[setter]
2803 fn set_publisher_id(&mut self, publisher_id: u16) {
2804 self.hd.publisher_id = publisher_id;
2805 }
2806
2807 #[getter]
2808 fn get_instrument_id(&self) -> u32 {
2809 self.hd.instrument_id
2810 }
2811 #[setter]
2812 fn set_instrument_id(&mut self, instrument_id: u32) {
2813 self.hd.instrument_id = instrument_id;
2814 }
2815
2816 #[getter]
2817 fn ts_event(&self) -> u64 {
2818 self.hd.ts_event
2819 }
2820 #[getter]
2821 fn get_pretty_ts_event<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
2822 new_py_timestamp_or_datetime(py, self.ts_event())
2823 }
2824 #[setter]
2825 fn set_ts_event(&mut self, ts_event: u64) {
2826 self.hd.ts_event = ts_event;
2827 }
2828
2829 #[pyo3(name = "record_size")]
2830 fn py_record_size(&self) -> usize {
2831 self.record_size()
2832 }
2833
2834 #[classattr]
2835 fn size_hint() -> PyResult<usize> {
2836 Ok(mem::size_of::<Self>())
2837 }
2838
2839 #[getter]
2840 fn ts_index(&self) -> u64 {
2841 self.raw_index_ts()
2842 }
2843 #[getter]
2844 fn get_pretty_ts_index<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
2845 new_py_timestamp_or_datetime(py, self.raw_index_ts())
2846 }
2847
2848 #[getter]
2849 fn get_stype_in<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
2850 self.stype_in()
2851 .map(|c| c.into_bound_py_any(py))
2852 .unwrap_or_else(|_| self.stype_in.into_bound_py_any(py))
2853 }
2854 #[setter]
2855 fn set_stype_in(&mut self, stype_in: SType) {
2856 self.stype_in = stype_in as u8;
2857 }
2858
2859 #[getter]
2860 fn get_stype_in_symbol(&self) -> PyResult<&str> {
2861 Ok(self.stype_in_symbol()?)
2862 }
2863
2864 #[getter]
2865 fn get_stype_out<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
2866 self.stype_out()
2867 .map(|c| c.into_bound_py_any(py))
2868 .unwrap_or_else(|_| self.stype_out.into_bound_py_any(py))
2869 }
2870 #[setter]
2871 fn set_stype_out(&mut self, stype_out: SType) {
2872 self.stype_out = stype_out as u8;
2873 }
2874
2875 #[getter]
2876 fn get_stype_out_symbol(&self) -> PyResult<&str> {
2877 Ok(self.stype_out_symbol()?)
2878 }
2879
2880 #[getter]
2881 fn get_pretty_start_ts<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
2882 new_py_timestamp_or_datetime(py, self.start_ts)
2883 }
2884
2885 #[getter]
2886 fn get_pretty_end_ts<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
2887 new_py_timestamp_or_datetime(py, self.end_ts)
2888 }
2889
2890 #[classattr]
2891 #[pyo3(name = "_dtypes")]
2892 fn py_dtypes() -> Vec<(String, String)> {
2893 Self::field_dtypes("")
2894 }
2895
2896 #[classattr]
2897 #[pyo3(name = "_price_fields")]
2898 fn py_price_fields() -> Vec<String> {
2899 Self::price_fields("")
2900 }
2901
2902 #[classattr]
2903 #[pyo3(name = "_timestamp_fields")]
2904 fn py_timestamp_fields() -> Vec<String> {
2905 Self::timestamp_fields("")
2906 }
2907
2908 #[classattr]
2909 #[pyo3(name = "_hidden_fields")]
2910 fn py_hidden_fields() -> Vec<String> {
2911 Self::hidden_fields("")
2912 }
2913
2914 #[classattr]
2915 #[pyo3(name = "_ordered_fields")]
2916 fn py_ordered_fields() -> Vec<String> {
2917 Self::ordered_fields("")
2918 }
2919}
2920
2921#[pymethods]
2922impl SystemMsg {
2923 #[new]
2924 #[pyo3(signature = (ts_event, msg, code = None))]
2925 fn py_new(ts_event: u64, msg: &str, code: Option<SystemCode>) -> PyResult<Self> {
2926 Ok(Self::new(ts_event, code, msg)?)
2927 }
2928
2929 fn __bytes__(&self) -> &[u8] {
2930 self.as_ref()
2931 }
2932
2933 fn __repr__(&self) -> String {
2934 let mut s = String::new();
2935 self.write_py_repr(&mut s).unwrap();
2936 s
2937 }
2938
2939 #[getter]
2940 fn rtype(&self) -> PyResult<RType> {
2941 self.hd.rtype().map_err(to_py_err)
2942 }
2943
2944 #[getter]
2945 fn get_publisher_id(&self) -> u16 {
2946 self.hd.publisher_id
2947 }
2948 #[setter]
2949 fn set_publisher_id(&mut self, publisher_id: u16) {
2950 self.hd.publisher_id = publisher_id;
2951 }
2952
2953 #[getter]
2954 fn get_instrument_id(&self) -> u32 {
2955 self.hd.instrument_id
2956 }
2957 #[setter]
2958 fn set_instrument_id(&mut self, instrument_id: u32) {
2959 self.hd.instrument_id = instrument_id;
2960 }
2961
2962 #[getter]
2963 fn ts_event(&self) -> u64 {
2964 self.hd.ts_event
2965 }
2966 #[getter]
2967 fn get_pretty_ts_event<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
2968 new_py_timestamp_or_datetime(py, self.ts_event())
2969 }
2970 #[setter]
2971 fn set_ts_event(&mut self, ts_event: u64) {
2972 self.hd.ts_event = ts_event;
2973 }
2974
2975 #[pyo3(name = "record_size")]
2976 fn py_record_size(&self) -> usize {
2977 self.record_size()
2978 }
2979
2980 #[classattr]
2981 fn size_hint() -> PyResult<usize> {
2982 Ok(mem::size_of::<Self>())
2983 }
2984
2985 #[getter]
2986 fn ts_index(&self) -> u64 {
2987 self.raw_index_ts()
2988 }
2989 #[getter]
2990 fn get_pretty_ts_index<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
2991 new_py_timestamp_or_datetime(py, self.raw_index_ts())
2992 }
2993
2994 #[pyo3(name = "is_heartbeat")]
2995 fn py_is_heartbeat(&self) -> bool {
2996 self.is_heartbeat()
2997 }
2998
2999 #[getter]
3000 fn get_msg(&self) -> PyResult<&str> {
3001 Ok(self.msg()?)
3002 }
3003
3004 #[getter]
3005 fn get_code<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
3006 self.code()
3007 .map(|c| c.into_bound_py_any(py))
3008 .unwrap_or_else(|_| self.code.into_bound_py_any(py))
3009 }
3010 #[setter]
3011 fn set_code(&mut self, code: SystemCode) {
3012 self.code = code as u8;
3013 }
3014
3015 #[classattr]
3016 #[pyo3(name = "_dtypes")]
3017 fn py_dtypes() -> Vec<(String, String)> {
3018 Self::field_dtypes("")
3019 }
3020
3021 #[classattr]
3022 #[pyo3(name = "_price_fields")]
3023 fn py_price_fields() -> Vec<String> {
3024 Self::price_fields("")
3025 }
3026
3027 #[classattr]
3028 #[pyo3(name = "_timestamp_fields")]
3029 fn py_timestamp_fields() -> Vec<String> {
3030 Self::timestamp_fields("")
3031 }
3032
3033 #[classattr]
3034 #[pyo3(name = "_hidden_fields")]
3035 fn py_hidden_fields() -> Vec<String> {
3036 Self::hidden_fields("")
3037 }
3038
3039 #[classattr]
3040 #[pyo3(name = "_ordered_fields")]
3041 fn py_ordered_fields() -> Vec<String> {
3042 Self::ordered_fields("")
3043 }
3044}
3045
3046#[pymethods]
3047impl v1::ErrorMsg {
3048 #[new]
3049 fn py_new(ts_event: u64, err: &str) -> PyResult<Self> {
3050 Ok(Self::new(ts_event, err))
3051 }
3052
3053 fn __bytes__(&self) -> &[u8] {
3054 self.as_ref()
3055 }
3056
3057 fn __repr__(&self) -> String {
3058 let mut s = String::new();
3059 self.write_py_repr(&mut s).unwrap();
3060 s
3061 }
3062
3063 #[getter]
3064 fn rtype(&self) -> PyResult<RType> {
3065 self.hd.rtype().map_err(to_py_err)
3066 }
3067
3068 #[getter]
3069 fn get_publisher_id(&self) -> u16 {
3070 self.hd.publisher_id
3071 }
3072 #[setter]
3073 fn set_publisher_id(&mut self, publisher_id: u16) {
3074 self.hd.publisher_id = publisher_id;
3075 }
3076
3077 #[getter]
3078 fn get_instrument_id(&self) -> u32 {
3079 self.hd.instrument_id
3080 }
3081 #[setter]
3082 fn set_instrument_id(&mut self, instrument_id: u32) {
3083 self.hd.instrument_id = instrument_id;
3084 }
3085
3086 #[getter]
3087 fn ts_event(&self) -> u64 {
3088 self.hd.ts_event
3089 }
3090 #[getter]
3091 fn get_pretty_ts_event<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
3092 new_py_timestamp_or_datetime(py, self.ts_event())
3093 }
3094 #[setter]
3095 fn set_ts_event(&mut self, ts_event: u64) {
3096 self.hd.ts_event = ts_event;
3097 }
3098
3099 #[pyo3(name = "record_size")]
3100 fn py_record_size(&self) -> usize {
3101 self.record_size()
3102 }
3103
3104 #[classattr]
3105 fn size_hint() -> PyResult<usize> {
3106 Ok(mem::size_of::<Self>())
3107 }
3108
3109 #[getter]
3110 fn ts_index(&self) -> u64 {
3111 self.raw_index_ts()
3112 }
3113 #[getter]
3114 fn get_pretty_ts_index<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
3115 new_py_timestamp_or_datetime(py, self.raw_index_ts())
3116 }
3117
3118 #[getter]
3119 fn get_err(&self) -> PyResult<&str> {
3120 Ok(self.err()?)
3121 }
3122
3123 #[classattr]
3124 #[pyo3(name = "_dtypes")]
3125 fn py_dtypes() -> Vec<(String, String)> {
3126 Self::field_dtypes("")
3127 }
3128
3129 #[classattr]
3130 #[pyo3(name = "_price_fields")]
3131 fn py_price_fields() -> Vec<String> {
3132 Self::price_fields("")
3133 }
3134
3135 #[classattr]
3136 #[pyo3(name = "_timestamp_fields")]
3137 fn py_timestamp_fields() -> Vec<String> {
3138 Self::timestamp_fields("")
3139 }
3140
3141 #[classattr]
3142 #[pyo3(name = "_hidden_fields")]
3143 fn py_hidden_fields() -> Vec<String> {
3144 Self::hidden_fields("")
3145 }
3146
3147 #[classattr]
3148 #[pyo3(name = "_ordered_fields")]
3149 fn py_ordered_fields() -> Vec<String> {
3150 Self::ordered_fields("")
3151 }
3152}
3153
3154#[pymethods]
3155impl v1::InstrumentDefMsg {
3156 #[new]
3157 #[pyo3(signature = (
3158 publisher_id,
3159 instrument_id,
3160 ts_event,
3161 ts_recv,
3162 min_price_increment,
3163 display_factor,
3164 expiration,
3165 activation,
3166 high_limit_price,
3167 low_limit_price,
3168 max_price_variation,
3169 trading_reference_price,
3170 unit_of_measure_qty,
3171 min_price_increment_amount,
3172 price_ratio,
3173 inst_attrib_value,
3174 underlying_id,
3175 raw_instrument_id,
3176 market_depth_implied,
3177 market_depth,
3178 market_segment_id,
3179 max_trade_vol,
3180 min_lot_size,
3181 min_lot_size_block,
3182 min_lot_size_round_lot,
3183 min_trade_vol,
3184 contract_multiplier,
3185 decay_quantity,
3186 original_contract_size,
3187 trading_reference_date,
3188 appl_id,
3189 maturity_year,
3190 decay_start_date,
3191 channel_id,
3192 currency,
3193 settl_currency,
3194 secsubtype,
3195 raw_symbol,
3196 group,
3197 exchange,
3198 asset,
3199 cfi,
3200 security_type,
3201 unit_of_measure,
3202 underlying,
3203 strike_price_currency,
3204 instrument_class,
3205 strike_price,
3206 match_algorithm,
3207 md_security_trading_status,
3208 main_fraction,
3209 price_display_format,
3210 settl_price_type,
3211 sub_fraction,
3212 underlying_product,
3213 security_update_action,
3214 maturity_month,
3215 maturity_day,
3216 maturity_week,
3217 user_defined_instrument,
3218 contract_multiplier_unit,
3219 flow_schedule_type,
3220 tick_rule,
3221 ))]
3222 fn py_new(
3223 publisher_id: u16,
3224 instrument_id: u32,
3225 ts_event: u64,
3226 ts_recv: u64,
3227 min_price_increment: i64,
3228 display_factor: i64,
3229 expiration: u64,
3230 activation: u64,
3231 high_limit_price: i64,
3232 low_limit_price: i64,
3233 max_price_variation: i64,
3234 trading_reference_price: i64,
3235 unit_of_measure_qty: i64,
3236 min_price_increment_amount: i64,
3237 price_ratio: i64,
3238 inst_attrib_value: i32,
3239 underlying_id: u32,
3240 raw_instrument_id: u32,
3241 market_depth_implied: i32,
3242 market_depth: i32,
3243 market_segment_id: u32,
3244 max_trade_vol: u32,
3245 min_lot_size: i32,
3246 min_lot_size_block: i32,
3247 min_lot_size_round_lot: i32,
3248 min_trade_vol: u32,
3249 contract_multiplier: i32,
3250 decay_quantity: i32,
3251 original_contract_size: i32,
3252 trading_reference_date: u16,
3253 appl_id: i16,
3254 maturity_year: u16,
3255 decay_start_date: u16,
3256 channel_id: u16,
3257 currency: &str,
3258 settl_currency: &str,
3259 secsubtype: &str,
3260 raw_symbol: &str,
3261 group: &str,
3262 exchange: &str,
3263 asset: &str,
3264 cfi: &str,
3265 security_type: &str,
3266 unit_of_measure: &str,
3267 underlying: &str,
3268 strike_price_currency: &str,
3269 instrument_class: InstrumentClass,
3270 strike_price: i64,
3271 match_algorithm: MatchAlgorithm,
3272 md_security_trading_status: u8,
3273 main_fraction: u8,
3274 price_display_format: u8,
3275 settl_price_type: u8,
3276 sub_fraction: u8,
3277 underlying_product: u8,
3278 security_update_action: SecurityUpdateAction,
3279 maturity_month: u8,
3280 maturity_day: u8,
3281 maturity_week: u8,
3282 user_defined_instrument: UserDefinedInstrument,
3283 contract_multiplier_unit: i8,
3284 flow_schedule_type: i8,
3285 tick_rule: u8,
3286 ) -> PyResult<Self> {
3287 Ok(Self {
3288 hd: RecordHeader::new::<Self>(
3289 rtype::INSTRUMENT_DEF,
3290 publisher_id,
3291 instrument_id,
3292 ts_event,
3293 ),
3294 ts_recv,
3295 min_price_increment,
3296 display_factor,
3297 expiration,
3298 activation,
3299 high_limit_price,
3300 low_limit_price,
3301 max_price_variation,
3302 trading_reference_price,
3303 unit_of_measure_qty,
3304 min_price_increment_amount,
3305 price_ratio,
3306 inst_attrib_value,
3307 underlying_id,
3308 raw_instrument_id,
3309 market_depth_implied,
3310 market_depth,
3311 market_segment_id,
3312 max_trade_vol,
3313 min_lot_size,
3314 min_lot_size_block,
3315 min_lot_size_round_lot,
3316 min_trade_vol,
3317 _reserved2: Default::default(),
3318 contract_multiplier,
3319 decay_quantity,
3320 original_contract_size,
3321 _reserved3: Default::default(),
3322 trading_reference_date,
3323 appl_id,
3324 maturity_year,
3325 decay_start_date,
3326 channel_id,
3327 currency: str_to_c_chars(currency)?,
3328 settl_currency: str_to_c_chars(settl_currency)?,
3329 secsubtype: str_to_c_chars(secsubtype)?,
3330 raw_symbol: str_to_c_chars(raw_symbol)?,
3331 group: str_to_c_chars(group)?,
3332 exchange: str_to_c_chars(exchange)?,
3333 asset: str_to_c_chars(asset)?,
3334 cfi: str_to_c_chars(cfi)?,
3335 security_type: str_to_c_chars(security_type)?,
3336 unit_of_measure: str_to_c_chars(unit_of_measure)?,
3337 underlying: str_to_c_chars(underlying)?,
3338 strike_price_currency: str_to_c_chars(strike_price_currency)?,
3339 instrument_class: instrument_class as u8 as c_char,
3340 _reserved4: Default::default(),
3341 strike_price,
3342 _reserved5: Default::default(),
3343 match_algorithm: match_algorithm as u8 as c_char,
3344 md_security_trading_status,
3345 main_fraction,
3346 price_display_format,
3347 settl_price_type,
3348 sub_fraction,
3349 underlying_product,
3350 security_update_action,
3351 maturity_month,
3352 maturity_day,
3353 maturity_week,
3354 user_defined_instrument,
3355 contract_multiplier_unit,
3356 flow_schedule_type,
3357 tick_rule,
3358 _dummy: Default::default(),
3359 })
3360 }
3361
3362 fn __bytes__(&self) -> &[u8] {
3363 self.as_ref()
3364 }
3365
3366 fn __repr__(&self) -> String {
3367 let mut s = String::new();
3368 self.write_py_repr(&mut s).unwrap();
3369 s
3370 }
3371
3372 #[getter]
3373 fn rtype(&self) -> PyResult<RType> {
3374 self.hd.rtype().map_err(to_py_err)
3375 }
3376
3377 #[getter]
3378 fn get_publisher_id(&self) -> u16 {
3379 self.hd.publisher_id
3380 }
3381 #[setter]
3382 fn set_publisher_id(&mut self, publisher_id: u16) {
3383 self.hd.publisher_id = publisher_id;
3384 }
3385
3386 #[getter]
3387 fn get_instrument_id(&self) -> u32 {
3388 self.hd.instrument_id
3389 }
3390 #[setter]
3391 fn set_instrument_id(&mut self, instrument_id: u32) {
3392 self.hd.instrument_id = instrument_id;
3393 }
3394
3395 #[getter]
3396 fn ts_event(&self) -> u64 {
3397 self.hd.ts_event
3398 }
3399 #[getter]
3400 fn get_pretty_ts_event<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
3401 new_py_timestamp_or_datetime(py, self.ts_event())
3402 }
3403 #[setter]
3404 fn set_ts_event(&mut self, ts_event: u64) {
3405 self.hd.ts_event = ts_event;
3406 }
3407
3408 #[pyo3(name = "record_size")]
3409 fn py_record_size(&self) -> usize {
3410 self.record_size()
3411 }
3412
3413 #[classattr]
3414 fn size_hint() -> PyResult<usize> {
3415 Ok(mem::size_of::<Self>())
3416 }
3417
3418 #[getter]
3419 fn ts_index(&self) -> u64 {
3420 self.raw_index_ts()
3421 }
3422 #[getter]
3423 fn get_pretty_ts_index<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
3424 new_py_timestamp_or_datetime(py, self.raw_index_ts())
3425 }
3426
3427 #[getter]
3428 fn get_pretty_ts_recv<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
3429 new_py_timestamp_or_datetime(py, self.ts_recv)
3430 }
3431
3432 #[getter]
3433 fn get_pretty_min_price_increment(&self) -> f64 {
3434 self.min_price_increment_f64()
3435 }
3436
3437 #[getter]
3438 fn get_pretty_display_factor(&self) -> f64 {
3439 self.display_factor_f64()
3440 }
3441
3442 #[getter]
3443 fn get_pretty_expiration<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
3444 new_py_timestamp_or_datetime(py, self.expiration)
3445 }
3446
3447 #[getter]
3448 fn get_pretty_activation<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
3449 new_py_timestamp_or_datetime(py, self.activation)
3450 }
3451
3452 #[getter]
3453 fn get_pretty_high_limit_price(&self) -> f64 {
3454 self.high_limit_price_f64()
3455 }
3456
3457 #[getter]
3458 fn get_pretty_low_limit_price(&self) -> f64 {
3459 self.low_limit_price_f64()
3460 }
3461
3462 #[getter]
3463 fn get_pretty_max_price_variation(&self) -> f64 {
3464 self.max_price_variation_f64()
3465 }
3466
3467 #[getter]
3468 fn get_pretty_trading_reference_price(&self) -> f64 {
3469 self.trading_reference_price_f64()
3470 }
3471
3472 #[getter]
3473 fn get_pretty_unit_of_measure_qty(&self) -> f64 {
3474 self.unit_of_measure_qty_f64()
3475 }
3476
3477 #[getter]
3478 fn get_pretty_min_price_increment_amount(&self) -> f64 {
3479 self.min_price_increment_amount_f64()
3480 }
3481
3482 #[getter]
3483 fn get_pretty_price_ratio(&self) -> f64 {
3484 self.price_ratio_f64()
3485 }
3486
3487 #[getter]
3488 fn get_currency(&self) -> PyResult<&str> {
3489 Ok(self.currency()?)
3490 }
3491
3492 #[getter]
3493 fn get_settl_currency(&self) -> PyResult<&str> {
3494 Ok(self.settl_currency()?)
3495 }
3496
3497 #[getter]
3498 fn get_secsubtype(&self) -> PyResult<&str> {
3499 Ok(self.secsubtype()?)
3500 }
3501
3502 #[getter]
3503 fn get_raw_symbol(&self) -> PyResult<&str> {
3504 Ok(self.raw_symbol()?)
3505 }
3506
3507 #[getter]
3508 fn get_group(&self) -> PyResult<&str> {
3509 Ok(self.group()?)
3510 }
3511
3512 #[getter]
3513 fn get_exchange(&self) -> PyResult<&str> {
3514 Ok(self.exchange()?)
3515 }
3516
3517 #[getter]
3518 fn get_asset(&self) -> PyResult<&str> {
3519 Ok(self.asset()?)
3520 }
3521
3522 #[getter]
3523 fn get_cfi(&self) -> PyResult<&str> {
3524 Ok(self.cfi()?)
3525 }
3526
3527 #[getter]
3528 fn get_security_type(&self) -> PyResult<&str> {
3529 Ok(self.security_type()?)
3530 }
3531
3532 #[getter]
3533 fn get_unit_of_measure(&self) -> PyResult<&str> {
3534 Ok(self.unit_of_measure()?)
3535 }
3536
3537 #[getter]
3538 fn get_underlying(&self) -> PyResult<&str> {
3539 Ok(self.underlying()?)
3540 }
3541
3542 #[getter]
3543 fn get_strike_price_currency(&self) -> PyResult<&str> {
3544 Ok(self.strike_price_currency()?)
3545 }
3546
3547 #[getter]
3548 fn get_instrument_class<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
3549 self.instrument_class()
3550 .map(|c| c.into_bound_py_any(py))
3551 .unwrap_or_else(|_| (self.instrument_class as u8 as char).into_bound_py_any(py))
3552 }
3553 #[setter]
3554 fn set_instrument_class(&mut self, instrument_class: InstrumentClass) {
3555 self.instrument_class = instrument_class as u8 as c_char;
3556 }
3557
3558 #[getter]
3559 fn get_pretty_strike_price(&self) -> f64 {
3560 self.strike_price_f64()
3561 }
3562
3563 #[getter]
3564 fn get_match_algorithm<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
3565 self.match_algorithm()
3566 .map(|c| c.into_bound_py_any(py))
3567 .unwrap_or_else(|_| (self.match_algorithm as u8 as char).into_bound_py_any(py))
3568 }
3569 #[setter]
3570 fn set_match_algorithm(&mut self, match_algorithm: MatchAlgorithm) {
3571 self.match_algorithm = match_algorithm as u8 as c_char;
3572 }
3573
3574 #[classattr]
3575 #[pyo3(name = "_dtypes")]
3576 fn py_dtypes() -> Vec<(String, String)> {
3577 Self::field_dtypes("")
3578 }
3579
3580 #[classattr]
3581 #[pyo3(name = "_price_fields")]
3582 fn py_price_fields() -> Vec<String> {
3583 Self::price_fields("")
3584 }
3585
3586 #[classattr]
3587 #[pyo3(name = "_timestamp_fields")]
3588 fn py_timestamp_fields() -> Vec<String> {
3589 Self::timestamp_fields("")
3590 }
3591
3592 #[classattr]
3593 #[pyo3(name = "_hidden_fields")]
3594 fn py_hidden_fields() -> Vec<String> {
3595 Self::hidden_fields("")
3596 }
3597
3598 #[classattr]
3599 #[pyo3(name = "_ordered_fields")]
3600 fn py_ordered_fields() -> Vec<String> {
3601 Self::ordered_fields("")
3602 }
3603}
3604
3605#[pymethods]
3606impl v1::StatMsg {
3607 #[new]
3608 #[pyo3(signature = (
3609 publisher_id,
3610 instrument_id,
3611 ts_event,
3612 ts_recv,
3613 ts_ref,
3614 price,
3615 quantity,
3616 stat_type,
3617 sequence = 0,
3618 ts_in_delta = 0,
3619 channel_id = None,
3620 update_action = None,
3621 stat_flags = 0,
3622 ))]
3623 fn py_new(
3624 publisher_id: u16,
3625 instrument_id: u32,
3626 ts_event: u64,
3627 ts_recv: u64,
3628 ts_ref: u64,
3629 price: i64,
3630 quantity: i32,
3631 stat_type: StatType,
3632 sequence: u32,
3633 ts_in_delta: i32,
3634 channel_id: Option<u16>,
3635 update_action: Option<StatUpdateAction>,
3636 stat_flags: u8,
3637 ) -> PyResult<Self> {
3638 Ok(Self {
3639 hd: RecordHeader::new::<Self>(rtype::STATISTICS, publisher_id, instrument_id, ts_event),
3640 ts_recv,
3641 ts_ref,
3642 price,
3643 quantity,
3644 sequence,
3645 ts_in_delta,
3646 stat_type: stat_type as u16,
3647 channel_id: channel_id.unwrap_or(u16::MAX),
3648 update_action: update_action.unwrap_or_default() as u8,
3649 stat_flags,
3650 _reserved: Default::default(),
3651 })
3652 }
3653
3654 fn __bytes__(&self) -> &[u8] {
3655 self.as_ref()
3656 }
3657
3658 fn __repr__(&self) -> String {
3659 let mut s = String::new();
3660 self.write_py_repr(&mut s).unwrap();
3661 s
3662 }
3663
3664 #[getter]
3665 fn rtype(&self) -> PyResult<RType> {
3666 self.hd.rtype().map_err(to_py_err)
3667 }
3668
3669 #[getter]
3670 fn get_publisher_id(&self) -> u16 {
3671 self.hd.publisher_id
3672 }
3673 #[setter]
3674 fn set_publisher_id(&mut self, publisher_id: u16) {
3675 self.hd.publisher_id = publisher_id;
3676 }
3677
3678 #[getter]
3679 fn get_instrument_id(&self) -> u32 {
3680 self.hd.instrument_id
3681 }
3682 #[setter]
3683 fn set_instrument_id(&mut self, instrument_id: u32) {
3684 self.hd.instrument_id = instrument_id;
3685 }
3686
3687 #[getter]
3688 fn ts_event(&self) -> u64 {
3689 self.hd.ts_event
3690 }
3691 #[getter]
3692 fn get_pretty_ts_event<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
3693 new_py_timestamp_or_datetime(py, self.ts_event())
3694 }
3695 #[setter]
3696 fn set_ts_event(&mut self, ts_event: u64) {
3697 self.hd.ts_event = ts_event;
3698 }
3699
3700 #[pyo3(name = "record_size")]
3701 fn py_record_size(&self) -> usize {
3702 self.record_size()
3703 }
3704
3705 #[classattr]
3706 fn size_hint() -> PyResult<usize> {
3707 Ok(mem::size_of::<Self>())
3708 }
3709
3710 #[getter]
3711 fn ts_index(&self) -> u64 {
3712 self.raw_index_ts()
3713 }
3714 #[getter]
3715 fn get_pretty_ts_index<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
3716 new_py_timestamp_or_datetime(py, self.raw_index_ts())
3717 }
3718
3719 #[getter]
3720 fn get_pretty_ts_recv<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
3721 new_py_timestamp_or_datetime(py, self.ts_recv)
3722 }
3723
3724 #[getter]
3725 fn get_pretty_ts_ref<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
3726 new_py_timestamp_or_datetime(py, self.ts_ref)
3727 }
3728
3729 #[getter]
3730 fn get_pretty_price(&self) -> f64 {
3731 self.price_f64()
3732 }
3733
3734 #[getter]
3735 fn get_stat_type<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
3736 self.stat_type()
3737 .map(|c| c.into_bound_py_any(py))
3738 .unwrap_or_else(|_| self.stat_type.into_bound_py_any(py))
3739 }
3740 #[setter]
3741 fn set_stat_type(&mut self, stat_type: StatType) {
3742 self.stat_type = stat_type as u16;
3743 }
3744
3745 #[getter]
3746 fn get_update_action<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
3747 self.update_action()
3748 .map(|c| c.into_bound_py_any(py))
3749 .unwrap_or_else(|_| self.update_action.into_bound_py_any(py))
3750 }
3751 #[setter]
3752 fn set_update_action(&mut self, update_action: StatUpdateAction) {
3753 self.update_action = update_action as u8;
3754 }
3755
3756 #[classattr]
3757 #[pyo3(name = "_dtypes")]
3758 fn py_dtypes() -> Vec<(String, String)> {
3759 Self::field_dtypes("")
3760 }
3761
3762 #[classattr]
3763 #[pyo3(name = "_price_fields")]
3764 fn py_price_fields() -> Vec<String> {
3765 Self::price_fields("")
3766 }
3767
3768 #[classattr]
3769 #[pyo3(name = "_timestamp_fields")]
3770 fn py_timestamp_fields() -> Vec<String> {
3771 Self::timestamp_fields("")
3772 }
3773
3774 #[classattr]
3775 #[pyo3(name = "_hidden_fields")]
3776 fn py_hidden_fields() -> Vec<String> {
3777 Self::hidden_fields("")
3778 }
3779
3780 #[classattr]
3781 #[pyo3(name = "_ordered_fields")]
3782 fn py_ordered_fields() -> Vec<String> {
3783 Self::ordered_fields("")
3784 }
3785}
3786
3787#[pymethods]
3788impl v1::SymbolMappingMsg {
3789 #[new]
3790 #[pyo3(signature = (
3791 publisher_id,
3792 instrument_id,
3793 ts_event,
3794 stype_in_symbol,
3795 stype_out_symbol,
3796 start_ts,
3797 end_ts,
3798 ))]
3799 fn py_new(
3800 publisher_id: u16,
3801 instrument_id: u32,
3802 ts_event: u64,
3803 stype_in_symbol: &str,
3804 stype_out_symbol: &str,
3805 start_ts: u64,
3806 end_ts: u64,
3807 ) -> PyResult<Self> {
3808 Ok(Self {
3809 hd: RecordHeader::new::<Self>(
3810 rtype::SYMBOL_MAPPING,
3811 publisher_id,
3812 instrument_id,
3813 ts_event,
3814 ),
3815 stype_in_symbol: str_to_c_chars(stype_in_symbol)?,
3816 stype_out_symbol: str_to_c_chars(stype_out_symbol)?,
3817 _dummy: Default::default(),
3818 start_ts,
3819 end_ts,
3820 })
3821 }
3822
3823 fn __bytes__(&self) -> &[u8] {
3824 self.as_ref()
3825 }
3826
3827 fn __repr__(&self) -> String {
3828 let mut s = String::new();
3829 self.write_py_repr(&mut s).unwrap();
3830 s
3831 }
3832
3833 #[getter]
3834 fn rtype(&self) -> PyResult<RType> {
3835 self.hd.rtype().map_err(to_py_err)
3836 }
3837
3838 #[getter]
3839 fn get_publisher_id(&self) -> u16 {
3840 self.hd.publisher_id
3841 }
3842 #[setter]
3843 fn set_publisher_id(&mut self, publisher_id: u16) {
3844 self.hd.publisher_id = publisher_id;
3845 }
3846
3847 #[getter]
3848 fn get_instrument_id(&self) -> u32 {
3849 self.hd.instrument_id
3850 }
3851 #[setter]
3852 fn set_instrument_id(&mut self, instrument_id: u32) {
3853 self.hd.instrument_id = instrument_id;
3854 }
3855
3856 #[getter]
3857 fn ts_event(&self) -> u64 {
3858 self.hd.ts_event
3859 }
3860 #[getter]
3861 fn get_pretty_ts_event<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
3862 new_py_timestamp_or_datetime(py, self.ts_event())
3863 }
3864 #[setter]
3865 fn set_ts_event(&mut self, ts_event: u64) {
3866 self.hd.ts_event = ts_event;
3867 }
3868
3869 #[pyo3(name = "record_size")]
3870 fn py_record_size(&self) -> usize {
3871 self.record_size()
3872 }
3873
3874 #[classattr]
3875 fn size_hint() -> PyResult<usize> {
3876 Ok(mem::size_of::<Self>())
3877 }
3878
3879 #[getter]
3880 fn ts_index(&self) -> u64 {
3881 self.raw_index_ts()
3882 }
3883 #[getter]
3884 fn get_pretty_ts_index<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
3885 new_py_timestamp_or_datetime(py, self.raw_index_ts())
3886 }
3887
3888 #[getter]
3889 fn get_stype_in_symbol(&self) -> PyResult<&str> {
3890 Ok(self.stype_in_symbol()?)
3891 }
3892
3893 #[getter]
3894 fn get_stype_out_symbol(&self) -> PyResult<&str> {
3895 Ok(self.stype_out_symbol()?)
3896 }
3897
3898 #[getter]
3899 fn get_pretty_start_ts<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
3900 new_py_timestamp_or_datetime(py, self.start_ts)
3901 }
3902
3903 #[getter]
3904 fn get_pretty_end_ts<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
3905 new_py_timestamp_or_datetime(py, self.end_ts)
3906 }
3907
3908 #[classattr]
3909 #[pyo3(name = "_dtypes")]
3910 fn py_dtypes() -> Vec<(String, String)> {
3911 Self::field_dtypes("")
3912 }
3913
3914 #[classattr]
3915 #[pyo3(name = "_price_fields")]
3916 fn py_price_fields() -> Vec<String> {
3917 Self::price_fields("")
3918 }
3919
3920 #[classattr]
3921 #[pyo3(name = "_timestamp_fields")]
3922 fn py_timestamp_fields() -> Vec<String> {
3923 Self::timestamp_fields("")
3924 }
3925
3926 #[classattr]
3927 #[pyo3(name = "_hidden_fields")]
3928 fn py_hidden_fields() -> Vec<String> {
3929 Self::hidden_fields("")
3930 }
3931
3932 #[classattr]
3933 #[pyo3(name = "_ordered_fields")]
3934 fn py_ordered_fields() -> Vec<String> {
3935 Self::ordered_fields("")
3936 }
3937}
3938
3939#[pymethods]
3940impl v1::SystemMsg {
3941 #[new]
3942 fn py_new(ts_event: u64, msg: &str) -> PyResult<Self> {
3943 Ok(Self::new(ts_event, msg)?)
3944 }
3945
3946 fn __bytes__(&self) -> &[u8] {
3947 self.as_ref()
3948 }
3949
3950 fn __repr__(&self) -> String {
3951 let mut s = String::new();
3952 self.write_py_repr(&mut s).unwrap();
3953 s
3954 }
3955
3956 #[getter]
3957 fn rtype(&self) -> PyResult<RType> {
3958 self.hd.rtype().map_err(to_py_err)
3959 }
3960
3961 #[getter]
3962 fn get_publisher_id(&self) -> u16 {
3963 self.hd.publisher_id
3964 }
3965 #[setter]
3966 fn set_publisher_id(&mut self, publisher_id: u16) {
3967 self.hd.publisher_id = publisher_id;
3968 }
3969
3970 #[getter]
3971 fn get_instrument_id(&self) -> u32 {
3972 self.hd.instrument_id
3973 }
3974 #[setter]
3975 fn set_instrument_id(&mut self, instrument_id: u32) {
3976 self.hd.instrument_id = instrument_id;
3977 }
3978
3979 #[getter]
3980 fn ts_event(&self) -> u64 {
3981 self.hd.ts_event
3982 }
3983 #[getter]
3984 fn get_pretty_ts_event<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
3985 new_py_timestamp_or_datetime(py, self.ts_event())
3986 }
3987 #[setter]
3988 fn set_ts_event(&mut self, ts_event: u64) {
3989 self.hd.ts_event = ts_event;
3990 }
3991
3992 #[pyo3(name = "record_size")]
3993 fn py_record_size(&self) -> usize {
3994 self.record_size()
3995 }
3996
3997 #[classattr]
3998 fn size_hint() -> PyResult<usize> {
3999 Ok(mem::size_of::<Self>())
4000 }
4001
4002 #[getter]
4003 fn ts_index(&self) -> u64 {
4004 self.raw_index_ts()
4005 }
4006 #[getter]
4007 fn get_pretty_ts_index<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
4008 new_py_timestamp_or_datetime(py, self.raw_index_ts())
4009 }
4010
4011 #[pyo3(name = "is_heartbeat")]
4012 fn py_is_heartbeat(&self) -> bool {
4013 self.is_heartbeat()
4014 }
4015
4016 #[getter]
4017 fn get_msg(&self) -> PyResult<&str> {
4018 Ok(self.msg()?)
4019 }
4020
4021 #[classattr]
4022 #[pyo3(name = "_dtypes")]
4023 fn py_dtypes() -> Vec<(String, String)> {
4024 Self::field_dtypes("")
4025 }
4026
4027 #[classattr]
4028 #[pyo3(name = "_price_fields")]
4029 fn py_price_fields() -> Vec<String> {
4030 Self::price_fields("")
4031 }
4032
4033 #[classattr]
4034 #[pyo3(name = "_timestamp_fields")]
4035 fn py_timestamp_fields() -> Vec<String> {
4036 Self::timestamp_fields("")
4037 }
4038
4039 #[classattr]
4040 #[pyo3(name = "_hidden_fields")]
4041 fn py_hidden_fields() -> Vec<String> {
4042 Self::hidden_fields("")
4043 }
4044
4045 #[classattr]
4046 #[pyo3(name = "_ordered_fields")]
4047 fn py_ordered_fields() -> Vec<String> {
4048 Self::ordered_fields("")
4049 }
4050}
4051
4052#[pymethods]
4053impl v2::InstrumentDefMsg {
4054 #[new]
4055 #[pyo3(signature = (
4056 publisher_id,
4057 instrument_id,
4058 ts_event,
4059 ts_recv,
4060 min_price_increment,
4061 display_factor,
4062 expiration,
4063 activation,
4064 high_limit_price,
4065 low_limit_price,
4066 max_price_variation,
4067 trading_reference_price,
4068 unit_of_measure_qty,
4069 min_price_increment_amount,
4070 price_ratio,
4071 strike_price,
4072 inst_attrib_value,
4073 underlying_id,
4074 raw_instrument_id,
4075 market_depth_implied,
4076 market_depth,
4077 market_segment_id,
4078 max_trade_vol,
4079 min_lot_size,
4080 min_lot_size_block,
4081 min_lot_size_round_lot,
4082 min_trade_vol,
4083 contract_multiplier,
4084 decay_quantity,
4085 original_contract_size,
4086 trading_reference_date,
4087 appl_id,
4088 maturity_year,
4089 decay_start_date,
4090 channel_id,
4091 currency,
4092 settl_currency,
4093 secsubtype,
4094 raw_symbol,
4095 group,
4096 exchange,
4097 asset,
4098 cfi,
4099 security_type,
4100 unit_of_measure,
4101 underlying,
4102 strike_price_currency,
4103 instrument_class,
4104 match_algorithm,
4105 md_security_trading_status,
4106 main_fraction,
4107 price_display_format,
4108 settl_price_type,
4109 sub_fraction,
4110 underlying_product,
4111 security_update_action,
4112 maturity_month,
4113 maturity_day,
4114 maturity_week,
4115 user_defined_instrument,
4116 contract_multiplier_unit,
4117 flow_schedule_type,
4118 tick_rule,
4119 ))]
4120 fn py_new(
4121 publisher_id: u16,
4122 instrument_id: u32,
4123 ts_event: u64,
4124 ts_recv: u64,
4125 min_price_increment: i64,
4126 display_factor: i64,
4127 expiration: u64,
4128 activation: u64,
4129 high_limit_price: i64,
4130 low_limit_price: i64,
4131 max_price_variation: i64,
4132 trading_reference_price: i64,
4133 unit_of_measure_qty: i64,
4134 min_price_increment_amount: i64,
4135 price_ratio: i64,
4136 strike_price: i64,
4137 inst_attrib_value: i32,
4138 underlying_id: u32,
4139 raw_instrument_id: u32,
4140 market_depth_implied: i32,
4141 market_depth: i32,
4142 market_segment_id: u32,
4143 max_trade_vol: u32,
4144 min_lot_size: i32,
4145 min_lot_size_block: i32,
4146 min_lot_size_round_lot: i32,
4147 min_trade_vol: u32,
4148 contract_multiplier: i32,
4149 decay_quantity: i32,
4150 original_contract_size: i32,
4151 trading_reference_date: u16,
4152 appl_id: i16,
4153 maturity_year: u16,
4154 decay_start_date: u16,
4155 channel_id: u16,
4156 currency: &str,
4157 settl_currency: &str,
4158 secsubtype: &str,
4159 raw_symbol: &str,
4160 group: &str,
4161 exchange: &str,
4162 asset: &str,
4163 cfi: &str,
4164 security_type: &str,
4165 unit_of_measure: &str,
4166 underlying: &str,
4167 strike_price_currency: &str,
4168 instrument_class: InstrumentClass,
4169 match_algorithm: MatchAlgorithm,
4170 md_security_trading_status: u8,
4171 main_fraction: u8,
4172 price_display_format: u8,
4173 settl_price_type: u8,
4174 sub_fraction: u8,
4175 underlying_product: u8,
4176 security_update_action: SecurityUpdateAction,
4177 maturity_month: u8,
4178 maturity_day: u8,
4179 maturity_week: u8,
4180 user_defined_instrument: UserDefinedInstrument,
4181 contract_multiplier_unit: i8,
4182 flow_schedule_type: i8,
4183 tick_rule: u8,
4184 ) -> PyResult<Self> {
4185 Ok(Self {
4186 hd: RecordHeader::new::<Self>(
4187 rtype::INSTRUMENT_DEF,
4188 publisher_id,
4189 instrument_id,
4190 ts_event,
4191 ),
4192 ts_recv,
4193 min_price_increment,
4194 display_factor,
4195 expiration,
4196 activation,
4197 high_limit_price,
4198 low_limit_price,
4199 max_price_variation,
4200 trading_reference_price,
4201 unit_of_measure_qty,
4202 min_price_increment_amount,
4203 price_ratio,
4204 strike_price,
4205 inst_attrib_value,
4206 underlying_id,
4207 raw_instrument_id,
4208 market_depth_implied,
4209 market_depth,
4210 market_segment_id,
4211 max_trade_vol,
4212 min_lot_size,
4213 min_lot_size_block,
4214 min_lot_size_round_lot,
4215 min_trade_vol,
4216 contract_multiplier,
4217 decay_quantity,
4218 original_contract_size,
4219 trading_reference_date,
4220 appl_id,
4221 maturity_year,
4222 decay_start_date,
4223 channel_id,
4224 currency: str_to_c_chars(currency)?,
4225 settl_currency: str_to_c_chars(settl_currency)?,
4226 secsubtype: str_to_c_chars(secsubtype)?,
4227 raw_symbol: str_to_c_chars(raw_symbol)?,
4228 group: str_to_c_chars(group)?,
4229 exchange: str_to_c_chars(exchange)?,
4230 asset: str_to_c_chars(asset)?,
4231 cfi: str_to_c_chars(cfi)?,
4232 security_type: str_to_c_chars(security_type)?,
4233 unit_of_measure: str_to_c_chars(unit_of_measure)?,
4234 underlying: str_to_c_chars(underlying)?,
4235 strike_price_currency: str_to_c_chars(strike_price_currency)?,
4236 instrument_class: instrument_class as u8 as c_char,
4237 match_algorithm: match_algorithm as u8 as c_char,
4238 md_security_trading_status,
4239 main_fraction,
4240 price_display_format,
4241 settl_price_type,
4242 sub_fraction,
4243 underlying_product,
4244 security_update_action: security_update_action as u8 as c_char,
4245 maturity_month,
4246 maturity_day,
4247 maturity_week,
4248 user_defined_instrument,
4249 contract_multiplier_unit,
4250 flow_schedule_type,
4251 tick_rule,
4252 _reserved: Default::default(),
4253 })
4254 }
4255
4256 fn __bytes__(&self) -> &[u8] {
4257 self.as_ref()
4258 }
4259
4260 fn __repr__(&self) -> String {
4261 let mut s = String::new();
4262 self.write_py_repr(&mut s).unwrap();
4263 s
4264 }
4265
4266 #[getter]
4267 fn rtype(&self) -> PyResult<RType> {
4268 self.hd.rtype().map_err(to_py_err)
4269 }
4270
4271 #[getter]
4272 fn get_publisher_id(&self) -> u16 {
4273 self.hd.publisher_id
4274 }
4275 #[setter]
4276 fn set_publisher_id(&mut self, publisher_id: u16) {
4277 self.hd.publisher_id = publisher_id;
4278 }
4279
4280 #[getter]
4281 fn get_instrument_id(&self) -> u32 {
4282 self.hd.instrument_id
4283 }
4284 #[setter]
4285 fn set_instrument_id(&mut self, instrument_id: u32) {
4286 self.hd.instrument_id = instrument_id;
4287 }
4288
4289 #[getter]
4290 fn ts_event(&self) -> u64 {
4291 self.hd.ts_event
4292 }
4293 #[getter]
4294 fn get_pretty_ts_event<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
4295 new_py_timestamp_or_datetime(py, self.ts_event())
4296 }
4297 #[setter]
4298 fn set_ts_event(&mut self, ts_event: u64) {
4299 self.hd.ts_event = ts_event;
4300 }
4301
4302 #[pyo3(name = "record_size")]
4303 fn py_record_size(&self) -> usize {
4304 self.record_size()
4305 }
4306
4307 #[classattr]
4308 fn size_hint() -> PyResult<usize> {
4309 Ok(mem::size_of::<Self>())
4310 }
4311
4312 #[getter]
4313 fn ts_index(&self) -> u64 {
4314 self.raw_index_ts()
4315 }
4316 #[getter]
4317 fn get_pretty_ts_index<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
4318 new_py_timestamp_or_datetime(py, self.raw_index_ts())
4319 }
4320
4321 #[getter]
4322 fn get_pretty_ts_recv<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
4323 new_py_timestamp_or_datetime(py, self.ts_recv)
4324 }
4325
4326 #[getter]
4327 fn get_pretty_min_price_increment(&self) -> f64 {
4328 self.min_price_increment_f64()
4329 }
4330
4331 #[getter]
4332 fn get_pretty_display_factor(&self) -> f64 {
4333 self.display_factor_f64()
4334 }
4335
4336 #[getter]
4337 fn get_pretty_expiration<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
4338 new_py_timestamp_or_datetime(py, self.expiration)
4339 }
4340
4341 #[getter]
4342 fn get_pretty_activation<'py>(&self, py: Python<'py>) -> PyResult<Option<Bound<'py, PyAny>>> {
4343 new_py_timestamp_or_datetime(py, self.activation)
4344 }
4345
4346 #[getter]
4347 fn get_pretty_high_limit_price(&self) -> f64 {
4348 self.high_limit_price_f64()
4349 }
4350
4351 #[getter]
4352 fn get_pretty_low_limit_price(&self) -> f64 {
4353 self.low_limit_price_f64()
4354 }
4355
4356 #[getter]
4357 fn get_pretty_max_price_variation(&self) -> f64 {
4358 self.max_price_variation_f64()
4359 }
4360
4361 #[getter]
4362 fn get_pretty_trading_reference_price(&self) -> f64 {
4363 self.trading_reference_price_f64()
4364 }
4365
4366 #[getter]
4367 fn get_pretty_unit_of_measure_qty(&self) -> f64 {
4368 self.unit_of_measure_qty_f64()
4369 }
4370
4371 #[getter]
4372 fn get_pretty_min_price_increment_amount(&self) -> f64 {
4373 self.min_price_increment_amount_f64()
4374 }
4375
4376 #[getter]
4377 fn get_pretty_price_ratio(&self) -> f64 {
4378 self.price_ratio_f64()
4379 }
4380
4381 #[getter]
4382 fn get_pretty_strike_price(&self) -> f64 {
4383 self.strike_price_f64()
4384 }
4385
4386 #[getter]
4387 fn get_currency(&self) -> PyResult<&str> {
4388 Ok(self.currency()?)
4389 }
4390
4391 #[getter]
4392 fn get_settl_currency(&self) -> PyResult<&str> {
4393 Ok(self.settl_currency()?)
4394 }
4395
4396 #[getter]
4397 fn get_secsubtype(&self) -> PyResult<&str> {
4398 Ok(self.secsubtype()?)
4399 }
4400
4401 #[getter]
4402 fn get_raw_symbol(&self) -> PyResult<&str> {
4403 Ok(self.raw_symbol()?)
4404 }
4405
4406 #[getter]
4407 fn get_group(&self) -> PyResult<&str> {
4408 Ok(self.group()?)
4409 }
4410
4411 #[getter]
4412 fn get_exchange(&self) -> PyResult<&str> {
4413 Ok(self.exchange()?)
4414 }
4415
4416 #[getter]
4417 fn get_asset(&self) -> PyResult<&str> {
4418 Ok(self.asset()?)
4419 }
4420
4421 #[getter]
4422 fn get_cfi(&self) -> PyResult<&str> {
4423 Ok(self.cfi()?)
4424 }
4425
4426 #[getter]
4427 fn get_security_type(&self) -> PyResult<&str> {
4428 Ok(self.security_type()?)
4429 }
4430
4431 #[getter]
4432 fn get_unit_of_measure(&self) -> PyResult<&str> {
4433 Ok(self.unit_of_measure()?)
4434 }
4435
4436 #[getter]
4437 fn get_underlying(&self) -> PyResult<&str> {
4438 Ok(self.underlying()?)
4439 }
4440
4441 #[getter]
4442 fn get_strike_price_currency(&self) -> PyResult<&str> {
4443 Ok(self.strike_price_currency()?)
4444 }
4445
4446 #[getter]
4447 fn get_instrument_class<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
4448 self.instrument_class()
4449 .map(|c| c.into_bound_py_any(py))
4450 .unwrap_or_else(|_| (self.instrument_class as u8 as char).into_bound_py_any(py))
4451 }
4452 #[setter]
4453 fn set_instrument_class(&mut self, instrument_class: InstrumentClass) {
4454 self.instrument_class = instrument_class as u8 as c_char;
4455 }
4456
4457 #[getter]
4458 fn get_match_algorithm<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
4459 self.match_algorithm()
4460 .map(|c| c.into_bound_py_any(py))
4461 .unwrap_or_else(|_| (self.match_algorithm as u8 as char).into_bound_py_any(py))
4462 }
4463 #[setter]
4464 fn set_match_algorithm(&mut self, match_algorithm: MatchAlgorithm) {
4465 self.match_algorithm = match_algorithm as u8 as c_char;
4466 }
4467
4468 #[getter]
4469 fn get_security_update_action<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
4470 self.security_update_action()
4471 .map(|c| c.into_bound_py_any(py))
4472 .unwrap_or_else(|_| (self.security_update_action as u8 as char).into_bound_py_any(py))
4473 }
4474 #[setter]
4475 fn set_security_update_action(&mut self, security_update_action: SecurityUpdateAction) {
4476 self.security_update_action = security_update_action as u8 as c_char;
4477 }
4478
4479 #[classattr]
4480 #[pyo3(name = "_dtypes")]
4481 fn py_dtypes() -> Vec<(String, String)> {
4482 Self::field_dtypes("")
4483 }
4484
4485 #[classattr]
4486 #[pyo3(name = "_price_fields")]
4487 fn py_price_fields() -> Vec<String> {
4488 Self::price_fields("")
4489 }
4490
4491 #[classattr]
4492 #[pyo3(name = "_timestamp_fields")]
4493 fn py_timestamp_fields() -> Vec<String> {
4494 Self::timestamp_fields("")
4495 }
4496
4497 #[classattr]
4498 #[pyo3(name = "_hidden_fields")]
4499 fn py_hidden_fields() -> Vec<String> {
4500 Self::hidden_fields("")
4501 }
4502
4503 #[classattr]
4504 #[pyo3(name = "_ordered_fields")]
4505 fn py_ordered_fields() -> Vec<String> {
4506 Self::ordered_fields("")
4507 }
4508}