Skip to main content

nautilus_binance/spot/sbe/generated/
klines_response_codec.rs

1pub use decoder::KlinesResponseDecoder;
2pub use encoder::KlinesResponseEncoder;
3
4use super::*;
5pub use super::{SBE_SCHEMA_ID, SBE_SCHEMA_VERSION, SBE_SEMANTIC_VERSION};
6
7pub const SBE_BLOCK_LENGTH: u16 = 2;
8pub const SBE_TEMPLATE_ID: u16 = 203;
9
10pub mod encoder {
11    use message_header_codec::*;
12
13    use super::*;
14
15    #[derive(Debug, Default)]
16    pub struct KlinesResponseEncoder<'a> {
17        buf: WriteBuf<'a>,
18        initial_offset: usize,
19        offset: usize,
20        limit: usize,
21    }
22
23    impl<'a> Writer<'a> for KlinesResponseEncoder<'a> {
24        #[inline]
25        fn get_buf_mut(&mut self) -> &mut WriteBuf<'a> {
26            &mut self.buf
27        }
28    }
29
30    impl<'a> Encoder<'a> for KlinesResponseEncoder<'a> {
31        #[inline]
32        fn get_limit(&self) -> usize {
33            self.limit
34        }
35
36        #[inline]
37        fn set_limit(&mut self, limit: usize) {
38            self.limit = limit;
39        }
40    }
41
42    impl<'a> KlinesResponseEncoder<'a> {
43        pub fn wrap(mut self, buf: WriteBuf<'a>, offset: usize) -> Self {
44            let limit = offset + SBE_BLOCK_LENGTH as usize;
45            self.buf = buf;
46            self.initial_offset = offset;
47            self.offset = offset;
48            self.limit = limit;
49            self
50        }
51
52        #[inline]
53        pub fn encoded_length(&self) -> usize {
54            self.limit - self.offset
55        }
56
57        pub fn header(self, offset: usize) -> MessageHeaderEncoder<Self> {
58            let mut header = MessageHeaderEncoder::default().wrap(self, offset);
59            header.block_length(SBE_BLOCK_LENGTH);
60            header.template_id(SBE_TEMPLATE_ID);
61            header.schema_id(SBE_SCHEMA_ID);
62            header.version(SBE_SCHEMA_VERSION);
63            header
64        }
65
66        /// primitive field 'priceExponent'
67        /// - min value: -127
68        /// - max value: 127
69        /// - null value: -128_i8
70        /// - characterEncoding: null
71        /// - semanticType: null
72        /// - encodedOffset: 0
73        /// - encodedLength: 1
74        /// - version: 0
75        #[inline]
76        pub fn price_exponent(&mut self, value: i8) {
77            let offset = self.offset;
78            self.get_buf_mut().put_i8_at(offset, value);
79        }
80
81        /// primitive field 'qtyExponent'
82        /// - min value: -127
83        /// - max value: 127
84        /// - null value: -128_i8
85        /// - characterEncoding: null
86        /// - semanticType: null
87        /// - encodedOffset: 1
88        /// - encodedLength: 1
89        /// - version: 0
90        #[inline]
91        pub fn qty_exponent(&mut self, value: i8) {
92            let offset = self.offset + 1;
93            self.get_buf_mut().put_i8_at(offset, value);
94        }
95
96        /// GROUP ENCODER (id=100)
97        #[inline]
98        pub fn klines_encoder(
99            self,
100            count: u32,
101            klines_encoder: KlinesEncoder<Self>,
102        ) -> KlinesEncoder<Self> {
103            klines_encoder.wrap(self, count)
104        }
105    }
106
107    #[derive(Debug, Default)]
108    pub struct KlinesEncoder<P> {
109        parent: Option<P>,
110        count: u32,
111        index: usize,
112        offset: usize,
113        initial_limit: usize,
114    }
115
116    impl<'a, P> Writer<'a> for KlinesEncoder<P>
117    where
118        P: Writer<'a> + Default,
119    {
120        #[inline]
121        fn get_buf_mut(&mut self) -> &mut WriteBuf<'a> {
122            if let Some(parent) = self.parent.as_mut() {
123                parent.get_buf_mut()
124            } else {
125                panic!("parent was None")
126            }
127        }
128    }
129
130    impl<'a, P> Encoder<'a> for KlinesEncoder<P>
131    where
132        P: Encoder<'a> + Default,
133    {
134        #[inline]
135        fn get_limit(&self) -> usize {
136            self.parent.as_ref().expect("parent missing").get_limit()
137        }
138
139        #[inline]
140        fn set_limit(&mut self, limit: usize) {
141            self.parent
142                .as_mut()
143                .expect("parent missing")
144                .set_limit(limit);
145        }
146    }
147
148    impl<'a, P> KlinesEncoder<P>
149    where
150        P: Encoder<'a> + Default,
151    {
152        #[inline]
153        pub fn wrap(mut self, mut parent: P, count: u32) -> Self {
154            let initial_limit = parent.get_limit();
155            parent.set_limit(initial_limit + 6);
156            parent
157                .get_buf_mut()
158                .put_u16_at(initial_limit, Self::block_length());
159            parent.get_buf_mut().put_u32_at(initial_limit + 2, count);
160            self.parent = Some(parent);
161            self.count = count;
162            self.index = usize::MAX;
163            self.offset = usize::MAX;
164            self.initial_limit = initial_limit;
165            self
166        }
167
168        #[inline]
169        pub fn block_length() -> u16 {
170            120
171        }
172
173        #[inline]
174        pub fn parent(&mut self) -> SbeResult<P> {
175            self.parent.take().ok_or(SbeErr::ParentNotSet)
176        }
177
178        /// will return Some(current index) when successful otherwise None
179        #[inline]
180        pub fn advance(&mut self) -> SbeResult<Option<usize>> {
181            let index = self.index.wrapping_add(1);
182            if index >= self.count as usize {
183                return Ok(None);
184            }
185
186            if let Some(parent) = self.parent.as_mut() {
187                self.offset = parent.get_limit();
188                parent.set_limit(self.offset + Self::block_length() as usize);
189                self.index = index;
190                Ok(Some(index))
191            } else {
192                Err(SbeErr::ParentNotSet)
193            }
194        }
195
196        /// primitive field 'openTime'
197        /// - min value: -9223372036854775807
198        /// - max value: 9223372036854775807
199        /// - null value: -9223372036854775808_i64
200        /// - characterEncoding: null
201        /// - semanticType: null
202        /// - encodedOffset: 0
203        /// - encodedLength: 8
204        /// - version: 0
205        #[inline]
206        pub fn open_time(&mut self, value: i64) {
207            let offset = self.offset;
208            self.get_buf_mut().put_i64_at(offset, value);
209        }
210
211        /// primitive field 'openPrice'
212        /// - min value: -9223372036854775807
213        /// - max value: 9223372036854775807
214        /// - null value: -9223372036854775808_i64
215        /// - characterEncoding: null
216        /// - semanticType: null
217        /// - encodedOffset: 8
218        /// - encodedLength: 8
219        /// - version: 0
220        #[inline]
221        pub fn open_price(&mut self, value: i64) {
222            let offset = self.offset + 8;
223            self.get_buf_mut().put_i64_at(offset, value);
224        }
225
226        /// primitive field 'highPrice'
227        /// - min value: -9223372036854775807
228        /// - max value: 9223372036854775807
229        /// - null value: -9223372036854775808_i64
230        /// - characterEncoding: null
231        /// - semanticType: null
232        /// - encodedOffset: 16
233        /// - encodedLength: 8
234        /// - version: 0
235        #[inline]
236        pub fn high_price(&mut self, value: i64) {
237            let offset = self.offset + 16;
238            self.get_buf_mut().put_i64_at(offset, value);
239        }
240
241        /// primitive field 'lowPrice'
242        /// - min value: -9223372036854775807
243        /// - max value: 9223372036854775807
244        /// - null value: -9223372036854775808_i64
245        /// - characterEncoding: null
246        /// - semanticType: null
247        /// - encodedOffset: 24
248        /// - encodedLength: 8
249        /// - version: 0
250        #[inline]
251        pub fn low_price(&mut self, value: i64) {
252            let offset = self.offset + 24;
253            self.get_buf_mut().put_i64_at(offset, value);
254        }
255
256        /// primitive field 'closePrice'
257        /// - min value: -9223372036854775807
258        /// - max value: 9223372036854775807
259        /// - null value: -9223372036854775808_i64
260        /// - characterEncoding: null
261        /// - semanticType: null
262        /// - encodedOffset: 32
263        /// - encodedLength: 8
264        /// - version: 0
265        #[inline]
266        pub fn close_price(&mut self, value: i64) {
267            let offset = self.offset + 32;
268            self.get_buf_mut().put_i64_at(offset, value);
269        }
270
271        #[inline]
272        pub fn volume_at(&mut self, index: usize, value: u8) {
273            let offset = self.offset + 40;
274            let buf = self.get_buf_mut();
275            buf.put_u8_at(offset + index, value);
276        }
277
278        /// primitive array field 'volume'
279        /// - min value: 0
280        /// - max value: 254
281        /// - null value: 0xff_u8
282        /// - characterEncoding: null
283        /// - semanticType: null
284        /// - encodedOffset: 40
285        /// - encodedLength: 16
286        /// - version: 0
287        #[inline]
288        pub fn volume(&mut self, value: &[u8]) {
289            debug_assert_eq!(16, value.len());
290            let offset = self.offset + 40;
291            let buf = self.get_buf_mut();
292            buf.put_slice_at(offset, value);
293        }
294
295        /// primitive array field 'volume' from an Iterator
296        /// - min value: 0
297        /// - max value: 254
298        /// - null value: 0xff_u8
299        /// - characterEncoding: null
300        /// - semanticType: null
301        /// - encodedOffset: 40
302        /// - encodedLength: 16
303        /// - version: 0
304        #[inline]
305        pub fn volume_from_iter(&mut self, iter: impl Iterator<Item = u8>) {
306            let offset = self.offset + 40;
307            let buf = self.get_buf_mut();
308            for (i, v) in iter.enumerate() {
309                buf.put_u8_at(offset + i, v);
310            }
311        }
312
313        /// primitive array field 'volume' with zero padding
314        /// - min value: 0
315        /// - max value: 254
316        /// - null value: 0xff_u8
317        /// - characterEncoding: null
318        /// - semanticType: null
319        /// - encodedOffset: 40
320        /// - encodedLength: 16
321        /// - version: 0
322        #[inline]
323        pub fn volume_zero_padded(&mut self, value: &[u8]) {
324            let iter = value
325                .iter()
326                .copied()
327                .chain(std::iter::repeat(0_u8))
328                .take(16);
329            self.volume_from_iter(iter);
330        }
331
332        /// primitive field 'closeTime'
333        /// - min value: -9223372036854775807
334        /// - max value: 9223372036854775807
335        /// - null value: -9223372036854775808_i64
336        /// - characterEncoding: null
337        /// - semanticType: null
338        /// - encodedOffset: 56
339        /// - encodedLength: 8
340        /// - version: 0
341        #[inline]
342        pub fn close_time(&mut self, value: i64) {
343            let offset = self.offset + 56;
344            self.get_buf_mut().put_i64_at(offset, value);
345        }
346
347        #[inline]
348        pub fn quote_volume_at(&mut self, index: usize, value: u8) {
349            let offset = self.offset + 64;
350            let buf = self.get_buf_mut();
351            buf.put_u8_at(offset + index, value);
352        }
353
354        /// primitive array field 'quoteVolume'
355        /// - min value: 0
356        /// - max value: 254
357        /// - null value: 0xff_u8
358        /// - characterEncoding: null
359        /// - semanticType: null
360        /// - encodedOffset: 64
361        /// - encodedLength: 16
362        /// - version: 0
363        #[inline]
364        pub fn quote_volume(&mut self, value: &[u8]) {
365            debug_assert_eq!(16, value.len());
366            let offset = self.offset + 64;
367            let buf = self.get_buf_mut();
368            buf.put_slice_at(offset, value);
369        }
370
371        /// primitive array field 'quoteVolume' from an Iterator
372        /// - min value: 0
373        /// - max value: 254
374        /// - null value: 0xff_u8
375        /// - characterEncoding: null
376        /// - semanticType: null
377        /// - encodedOffset: 64
378        /// - encodedLength: 16
379        /// - version: 0
380        #[inline]
381        pub fn quote_volume_from_iter(&mut self, iter: impl Iterator<Item = u8>) {
382            let offset = self.offset + 64;
383            let buf = self.get_buf_mut();
384            for (i, v) in iter.enumerate() {
385                buf.put_u8_at(offset + i, v);
386            }
387        }
388
389        /// primitive array field 'quoteVolume' with zero padding
390        /// - min value: 0
391        /// - max value: 254
392        /// - null value: 0xff_u8
393        /// - characterEncoding: null
394        /// - semanticType: null
395        /// - encodedOffset: 64
396        /// - encodedLength: 16
397        /// - version: 0
398        #[inline]
399        pub fn quote_volume_zero_padded(&mut self, value: &[u8]) {
400            let iter = value
401                .iter()
402                .copied()
403                .chain(std::iter::repeat(0_u8))
404                .take(16);
405            self.quote_volume_from_iter(iter);
406        }
407
408        /// primitive field 'numTrades'
409        /// - min value: -9223372036854775807
410        /// - max value: 9223372036854775807
411        /// - null value: -9223372036854775808_i64
412        /// - characterEncoding: null
413        /// - semanticType: null
414        /// - encodedOffset: 80
415        /// - encodedLength: 8
416        /// - version: 0
417        #[inline]
418        pub fn num_trades(&mut self, value: i64) {
419            let offset = self.offset + 80;
420            self.get_buf_mut().put_i64_at(offset, value);
421        }
422
423        #[inline]
424        pub fn taker_buy_base_volume_at(&mut self, index: usize, value: u8) {
425            let offset = self.offset + 88;
426            let buf = self.get_buf_mut();
427            buf.put_u8_at(offset + index, value);
428        }
429
430        /// primitive array field 'takerBuyBaseVolume'
431        /// - min value: 0
432        /// - max value: 254
433        /// - null value: 0xff_u8
434        /// - characterEncoding: null
435        /// - semanticType: null
436        /// - encodedOffset: 88
437        /// - encodedLength: 16
438        /// - version: 0
439        #[inline]
440        pub fn taker_buy_base_volume(&mut self, value: &[u8]) {
441            debug_assert_eq!(16, value.len());
442            let offset = self.offset + 88;
443            let buf = self.get_buf_mut();
444            buf.put_slice_at(offset, value);
445        }
446
447        /// primitive array field 'takerBuyBaseVolume' from an Iterator
448        /// - min value: 0
449        /// - max value: 254
450        /// - null value: 0xff_u8
451        /// - characterEncoding: null
452        /// - semanticType: null
453        /// - encodedOffset: 88
454        /// - encodedLength: 16
455        /// - version: 0
456        #[inline]
457        pub fn taker_buy_base_volume_from_iter(&mut self, iter: impl Iterator<Item = u8>) {
458            let offset = self.offset + 88;
459            let buf = self.get_buf_mut();
460            for (i, v) in iter.enumerate() {
461                buf.put_u8_at(offset + i, v);
462            }
463        }
464
465        /// primitive array field 'takerBuyBaseVolume' with zero padding
466        /// - min value: 0
467        /// - max value: 254
468        /// - null value: 0xff_u8
469        /// - characterEncoding: null
470        /// - semanticType: null
471        /// - encodedOffset: 88
472        /// - encodedLength: 16
473        /// - version: 0
474        #[inline]
475        pub fn taker_buy_base_volume_zero_padded(&mut self, value: &[u8]) {
476            let iter = value
477                .iter()
478                .copied()
479                .chain(std::iter::repeat(0_u8))
480                .take(16);
481            self.taker_buy_base_volume_from_iter(iter);
482        }
483
484        #[inline]
485        pub fn taker_buy_quote_volume_at(&mut self, index: usize, value: u8) {
486            let offset = self.offset + 104;
487            let buf = self.get_buf_mut();
488            buf.put_u8_at(offset + index, value);
489        }
490
491        /// primitive array field 'takerBuyQuoteVolume'
492        /// - min value: 0
493        /// - max value: 254
494        /// - null value: 0xff_u8
495        /// - characterEncoding: null
496        /// - semanticType: null
497        /// - encodedOffset: 104
498        /// - encodedLength: 16
499        /// - version: 0
500        #[inline]
501        pub fn taker_buy_quote_volume(&mut self, value: &[u8]) {
502            debug_assert_eq!(16, value.len());
503            let offset = self.offset + 104;
504            let buf = self.get_buf_mut();
505            buf.put_slice_at(offset, value);
506        }
507
508        /// primitive array field 'takerBuyQuoteVolume' from an Iterator
509        /// - min value: 0
510        /// - max value: 254
511        /// - null value: 0xff_u8
512        /// - characterEncoding: null
513        /// - semanticType: null
514        /// - encodedOffset: 104
515        /// - encodedLength: 16
516        /// - version: 0
517        #[inline]
518        pub fn taker_buy_quote_volume_from_iter(&mut self, iter: impl Iterator<Item = u8>) {
519            let offset = self.offset + 104;
520            let buf = self.get_buf_mut();
521            for (i, v) in iter.enumerate() {
522                buf.put_u8_at(offset + i, v);
523            }
524        }
525
526        /// primitive array field 'takerBuyQuoteVolume' with zero padding
527        /// - min value: 0
528        /// - max value: 254
529        /// - null value: 0xff_u8
530        /// - characterEncoding: null
531        /// - semanticType: null
532        /// - encodedOffset: 104
533        /// - encodedLength: 16
534        /// - version: 0
535        #[inline]
536        pub fn taker_buy_quote_volume_zero_padded(&mut self, value: &[u8]) {
537            let iter = value
538                .iter()
539                .copied()
540                .chain(std::iter::repeat(0_u8))
541                .take(16);
542            self.taker_buy_quote_volume_from_iter(iter);
543        }
544    }
545} // end encoder
546
547pub mod decoder {
548    use message_header_codec::*;
549
550    use super::*;
551
552    #[derive(Clone, Copy, Debug, Default)]
553    pub struct KlinesResponseDecoder<'a> {
554        buf: ReadBuf<'a>,
555        initial_offset: usize,
556        offset: usize,
557        limit: usize,
558        pub acting_block_length: u16,
559        pub acting_version: u16,
560    }
561
562    impl ActingVersion for KlinesResponseDecoder<'_> {
563        #[inline]
564        fn acting_version(&self) -> u16 {
565            self.acting_version
566        }
567    }
568
569    impl<'a> Reader<'a> for KlinesResponseDecoder<'a> {
570        #[inline]
571        fn get_buf(&self) -> &ReadBuf<'a> {
572            &self.buf
573        }
574    }
575
576    impl<'a> Decoder<'a> for KlinesResponseDecoder<'a> {
577        #[inline]
578        fn get_limit(&self) -> usize {
579            self.limit
580        }
581
582        #[inline]
583        fn set_limit(&mut self, limit: usize) {
584            self.limit = limit;
585        }
586    }
587
588    impl<'a> KlinesResponseDecoder<'a> {
589        pub fn wrap(
590            mut self,
591            buf: ReadBuf<'a>,
592            offset: usize,
593            acting_block_length: u16,
594            acting_version: u16,
595        ) -> Self {
596            let limit = offset + acting_block_length as usize;
597            self.buf = buf;
598            self.initial_offset = offset;
599            self.offset = offset;
600            self.limit = limit;
601            self.acting_block_length = acting_block_length;
602            self.acting_version = acting_version;
603            self
604        }
605
606        #[inline]
607        pub fn encoded_length(&self) -> usize {
608            self.limit - self.offset
609        }
610
611        pub fn header(self, mut header: MessageHeaderDecoder<ReadBuf<'a>>, offset: usize) -> Self {
612            debug_assert_eq!(SBE_TEMPLATE_ID, header.template_id());
613            let acting_block_length = header.block_length();
614            let acting_version = header.version();
615
616            self.wrap(
617                header.parent().unwrap(),
618                offset + message_header_codec::ENCODED_LENGTH,
619                acting_block_length,
620                acting_version,
621            )
622        }
623
624        /// primitive field - 'REQUIRED'
625        #[inline]
626        pub fn price_exponent(&self) -> i8 {
627            self.get_buf().get_i8_at(self.offset)
628        }
629
630        /// primitive field - 'REQUIRED'
631        #[inline]
632        pub fn qty_exponent(&self) -> i8 {
633            self.get_buf().get_i8_at(self.offset + 1)
634        }
635
636        /// GROUP DECODER (id=100)
637        #[inline]
638        pub fn klines_decoder(self) -> KlinesDecoder<Self> {
639            KlinesDecoder::default().wrap(self)
640        }
641    }
642
643    #[derive(Debug, Default)]
644    pub struct KlinesDecoder<P> {
645        parent: Option<P>,
646        block_length: u16,
647        count: u32,
648        index: usize,
649        offset: usize,
650    }
651
652    impl<'a, P> ActingVersion for KlinesDecoder<P>
653    where
654        P: Reader<'a> + ActingVersion + Default,
655    {
656        #[inline]
657        fn acting_version(&self) -> u16 {
658            self.parent.as_ref().unwrap().acting_version()
659        }
660    }
661
662    impl<'a, P> Reader<'a> for KlinesDecoder<P>
663    where
664        P: Reader<'a> + Default,
665    {
666        #[inline]
667        fn get_buf(&self) -> &ReadBuf<'a> {
668            self.parent.as_ref().expect("parent missing").get_buf()
669        }
670    }
671
672    impl<'a, P> Decoder<'a> for KlinesDecoder<P>
673    where
674        P: Decoder<'a> + ActingVersion + Default,
675    {
676        #[inline]
677        fn get_limit(&self) -> usize {
678            self.parent.as_ref().expect("parent missing").get_limit()
679        }
680
681        #[inline]
682        fn set_limit(&mut self, limit: usize) {
683            self.parent
684                .as_mut()
685                .expect("parent missing")
686                .set_limit(limit);
687        }
688    }
689
690    impl<'a, P> KlinesDecoder<P>
691    where
692        P: Decoder<'a> + ActingVersion + Default,
693    {
694        pub fn wrap(mut self, mut parent: P) -> Self {
695            let initial_offset = parent.get_limit();
696            let block_length = parent.get_buf().get_u16_at(initial_offset);
697            let count = parent.get_buf().get_u32_at(initial_offset + 2);
698            parent.set_limit(initial_offset + 6);
699            self.parent = Some(parent);
700            self.block_length = block_length;
701            self.count = count;
702            self.index = usize::MAX;
703            self.offset = 0;
704            self
705        }
706
707        /// group token - Token{signal=BEGIN_GROUP, name='klines', referencedName='null', description='null', packageName='null', id=100, version=0, deprecated=0, encodedLength=120, offset=2, componentTokenCount=39, encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='null', timeUnit=null, semanticType='null'}}
708        #[inline]
709        pub fn parent(&mut self) -> SbeResult<P> {
710            self.parent.take().ok_or(SbeErr::ParentNotSet)
711        }
712
713        #[inline]
714        pub fn acting_version(&mut self) -> u16 {
715            self.parent.as_ref().unwrap().acting_version()
716        }
717
718        #[inline]
719        pub fn count(&self) -> u32 {
720            self.count
721        }
722
723        /// will return Some(current index) when successful otherwise None
724        pub fn advance(&mut self) -> SbeResult<Option<usize>> {
725            let index = self.index.wrapping_add(1);
726            if index >= self.count as usize {
727                return Ok(None);
728            }
729
730            if let Some(parent) = self.parent.as_mut() {
731                self.offset = parent.get_limit();
732                parent.set_limit(self.offset + self.block_length as usize);
733                self.index = index;
734                Ok(Some(index))
735            } else {
736                Err(SbeErr::ParentNotSet)
737            }
738        }
739
740        /// primitive field - 'REQUIRED'
741        #[inline]
742        pub fn open_time(&self) -> i64 {
743            self.get_buf().get_i64_at(self.offset)
744        }
745
746        /// primitive field - 'REQUIRED'
747        #[inline]
748        pub fn open_price(&self) -> i64 {
749            self.get_buf().get_i64_at(self.offset + 8)
750        }
751
752        /// primitive field - 'REQUIRED'
753        #[inline]
754        pub fn high_price(&self) -> i64 {
755            self.get_buf().get_i64_at(self.offset + 16)
756        }
757
758        /// primitive field - 'REQUIRED'
759        #[inline]
760        pub fn low_price(&self) -> i64 {
761            self.get_buf().get_i64_at(self.offset + 24)
762        }
763
764        /// primitive field - 'REQUIRED'
765        #[inline]
766        pub fn close_price(&self) -> i64 {
767            self.get_buf().get_i64_at(self.offset + 32)
768        }
769
770        #[inline]
771        pub fn volume(&self) -> [u8; 16] {
772            let buf = self.get_buf();
773            ReadBuf::get_bytes_at(buf.data, self.offset + 40)
774        }
775
776        /// primitive field - 'REQUIRED'
777        #[inline]
778        pub fn close_time(&self) -> i64 {
779            self.get_buf().get_i64_at(self.offset + 56)
780        }
781
782        #[inline]
783        pub fn quote_volume(&self) -> [u8; 16] {
784            let buf = self.get_buf();
785            ReadBuf::get_bytes_at(buf.data, self.offset + 64)
786        }
787
788        /// primitive field - 'REQUIRED'
789        #[inline]
790        pub fn num_trades(&self) -> i64 {
791            self.get_buf().get_i64_at(self.offset + 80)
792        }
793
794        #[inline]
795        pub fn taker_buy_base_volume(&self) -> [u8; 16] {
796            let buf = self.get_buf();
797            ReadBuf::get_bytes_at(buf.data, self.offset + 88)
798        }
799
800        #[inline]
801        pub fn taker_buy_quote_volume(&self) -> [u8; 16] {
802            let buf = self.get_buf();
803            ReadBuf::get_bytes_at(buf.data, self.offset + 104)
804        }
805    }
806} // end decoder