Skip to main content

polyester/gen/buffa/
marketdata.v1.rs

1// @generated by buffa-codegen. DO NOT EDIT.
2
3/// HeatmapInterval controls bucket resolution for historical orderbook heatmap.
4#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
5#[repr(i32)]
6pub enum HeatmapInterval {
7    INTERVAL_UNSPECIFIED = 0i32,
8    INTERVAL_1S = 1i32,
9    INTERVAL_1M = 2i32,
10    INTERVAL_5M = 3i32,
11    INTERVAL_1H = 4i32,
12}
13impl HeatmapInterval {
14    ///Idiomatic alias for [`Self::INTERVAL_UNSPECIFIED`]; `Debug` prints the variant name.
15    #[allow(non_upper_case_globals)]
16    pub const IntervalUnspecified: Self = Self::INTERVAL_UNSPECIFIED;
17    ///Idiomatic alias for [`Self::INTERVAL_1S`]; `Debug` prints the variant name.
18    #[allow(non_upper_case_globals)]
19    pub const Interval1s: Self = Self::INTERVAL_1S;
20    ///Idiomatic alias for [`Self::INTERVAL_1M`]; `Debug` prints the variant name.
21    #[allow(non_upper_case_globals)]
22    pub const Interval1m: Self = Self::INTERVAL_1M;
23    ///Idiomatic alias for [`Self::INTERVAL_5M`]; `Debug` prints the variant name.
24    #[allow(non_upper_case_globals)]
25    pub const Interval5m: Self = Self::INTERVAL_5M;
26    ///Idiomatic alias for [`Self::INTERVAL_1H`]; `Debug` prints the variant name.
27    #[allow(non_upper_case_globals)]
28    pub const Interval1h: Self = Self::INTERVAL_1H;
29}
30impl ::core::default::Default for HeatmapInterval {
31    fn default() -> Self {
32        Self::INTERVAL_UNSPECIFIED
33    }
34}
35impl ::serde::Serialize for HeatmapInterval {
36    fn serialize<S: ::serde::Serializer>(
37        &self,
38        s: S,
39    ) -> ::core::result::Result<S::Ok, S::Error> {
40        s.serialize_str(::buffa::Enumeration::proto_name(self))
41    }
42}
43impl<'de> ::serde::Deserialize<'de> for HeatmapInterval {
44    fn deserialize<D: ::serde::Deserializer<'de>>(
45        d: D,
46    ) -> ::core::result::Result<Self, D::Error> {
47        struct _V;
48        impl ::serde::de::Visitor<'_> for _V {
49            type Value = HeatmapInterval;
50            fn expecting(
51                &self,
52                f: &mut ::core::fmt::Formatter<'_>,
53            ) -> ::core::fmt::Result {
54                f.write_str(
55                    concat!(
56                        "a string, integer, or null for ", stringify!(HeatmapInterval)
57                    ),
58                )
59            }
60            fn visit_str<E: ::serde::de::Error>(
61                self,
62                v: &str,
63            ) -> ::core::result::Result<HeatmapInterval, E> {
64                <HeatmapInterval as ::buffa::Enumeration>::from_proto_name(v)
65                    .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
66            }
67            fn visit_i64<E: ::serde::de::Error>(
68                self,
69                v: i64,
70            ) -> ::core::result::Result<HeatmapInterval, E> {
71                let v32 = i32::try_from(v)
72                    .map_err(|_| {
73                        ::serde::de::Error::custom(
74                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
75                        )
76                    })?;
77                <HeatmapInterval as ::buffa::Enumeration>::from_i32(v32)
78                    .ok_or_else(|| {
79                        ::serde::de::Error::custom(
80                            ::buffa::alloc::format!("unknown enum value {v32}"),
81                        )
82                    })
83            }
84            fn visit_u64<E: ::serde::de::Error>(
85                self,
86                v: u64,
87            ) -> ::core::result::Result<HeatmapInterval, E> {
88                let v32 = i32::try_from(v)
89                    .map_err(|_| {
90                        ::serde::de::Error::custom(
91                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
92                        )
93                    })?;
94                <HeatmapInterval as ::buffa::Enumeration>::from_i32(v32)
95                    .ok_or_else(|| {
96                        ::serde::de::Error::custom(
97                            ::buffa::alloc::format!("unknown enum value {v32}"),
98                        )
99                    })
100            }
101            fn visit_unit<E: ::serde::de::Error>(
102                self,
103            ) -> ::core::result::Result<HeatmapInterval, E> {
104                ::core::result::Result::Ok(::core::default::Default::default())
105            }
106        }
107        d.deserialize_any(_V)
108    }
109}
110impl ::buffa::json_helpers::ProtoElemJson for HeatmapInterval {
111    fn serialize_proto_json<S: ::serde::Serializer>(
112        v: &Self,
113        s: S,
114    ) -> ::core::result::Result<S::Ok, S::Error> {
115        ::serde::Serialize::serialize(v, s)
116    }
117    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
118        d: D,
119    ) -> ::core::result::Result<Self, D::Error> {
120        <Self as ::serde::Deserialize>::deserialize(d)
121    }
122}
123impl ::buffa::Enumeration for HeatmapInterval {
124    fn from_i32(value: i32) -> ::core::option::Option<Self> {
125        match value {
126            0i32 => ::core::option::Option::Some(Self::INTERVAL_UNSPECIFIED),
127            1i32 => ::core::option::Option::Some(Self::INTERVAL_1S),
128            2i32 => ::core::option::Option::Some(Self::INTERVAL_1M),
129            3i32 => ::core::option::Option::Some(Self::INTERVAL_5M),
130            4i32 => ::core::option::Option::Some(Self::INTERVAL_1H),
131            _ => ::core::option::Option::None,
132        }
133    }
134    fn to_i32(&self) -> i32 {
135        *self as i32
136    }
137    fn proto_name(&self) -> &'static str {
138        match self {
139            Self::INTERVAL_UNSPECIFIED => "INTERVAL_UNSPECIFIED",
140            Self::INTERVAL_1S => "INTERVAL_1S",
141            Self::INTERVAL_1M => "INTERVAL_1M",
142            Self::INTERVAL_5M => "INTERVAL_5M",
143            Self::INTERVAL_1H => "INTERVAL_1H",
144        }
145    }
146    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
147        match name {
148            "INTERVAL_UNSPECIFIED" => {
149                ::core::option::Option::Some(Self::INTERVAL_UNSPECIFIED)
150            }
151            "INTERVAL_1S" => ::core::option::Option::Some(Self::INTERVAL_1S),
152            "INTERVAL_1M" => ::core::option::Option::Some(Self::INTERVAL_1M),
153            "INTERVAL_5M" => ::core::option::Option::Some(Self::INTERVAL_5M),
154            "INTERVAL_1H" => ::core::option::Option::Some(Self::INTERVAL_1H),
155            _ => ::core::option::Option::None,
156        }
157    }
158    fn values() -> &'static [Self] {
159        &[
160            Self::INTERVAL_UNSPECIFIED,
161            Self::INTERVAL_1S,
162            Self::INTERVAL_1M,
163            Self::INTERVAL_5M,
164            Self::INTERVAL_1H,
165        ]
166    }
167}
168/// HeatmapDepth controls top-N levels included per side in each heatmap bucket.
169///
170/// Values intentionally mirror orderbook.v1.Depth for FE ergonomics, while
171/// keeping this contract decoupled from orderbook service protos.
172#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
173#[repr(i32)]
174pub enum HeatmapDepth {
175    DEPTH_UNSPECIFIED = 0i32,
176    DEPTH_1 = 1i32,
177    DEPTH_5 = 2i32,
178    DEPTH_10 = 3i32,
179    DEPTH_20 = 4i32,
180    DEPTH_50 = 5i32,
181    DEPTH_100 = 6i32,
182    DEPTH_200 = 7i32,
183    DEPTH_500 = 8i32,
184    DEPTH_1000 = 9i32,
185}
186impl HeatmapDepth {
187    ///Idiomatic alias for [`Self::DEPTH_UNSPECIFIED`]; `Debug` prints the variant name.
188    #[allow(non_upper_case_globals)]
189    pub const DepthUnspecified: Self = Self::DEPTH_UNSPECIFIED;
190    ///Idiomatic alias for [`Self::DEPTH_1`]; `Debug` prints the variant name.
191    #[allow(non_upper_case_globals)]
192    pub const Depth1: Self = Self::DEPTH_1;
193    ///Idiomatic alias for [`Self::DEPTH_5`]; `Debug` prints the variant name.
194    #[allow(non_upper_case_globals)]
195    pub const Depth5: Self = Self::DEPTH_5;
196    ///Idiomatic alias for [`Self::DEPTH_10`]; `Debug` prints the variant name.
197    #[allow(non_upper_case_globals)]
198    pub const Depth10: Self = Self::DEPTH_10;
199    ///Idiomatic alias for [`Self::DEPTH_20`]; `Debug` prints the variant name.
200    #[allow(non_upper_case_globals)]
201    pub const Depth20: Self = Self::DEPTH_20;
202    ///Idiomatic alias for [`Self::DEPTH_50`]; `Debug` prints the variant name.
203    #[allow(non_upper_case_globals)]
204    pub const Depth50: Self = Self::DEPTH_50;
205    ///Idiomatic alias for [`Self::DEPTH_100`]; `Debug` prints the variant name.
206    #[allow(non_upper_case_globals)]
207    pub const Depth100: Self = Self::DEPTH_100;
208    ///Idiomatic alias for [`Self::DEPTH_200`]; `Debug` prints the variant name.
209    #[allow(non_upper_case_globals)]
210    pub const Depth200: Self = Self::DEPTH_200;
211    ///Idiomatic alias for [`Self::DEPTH_500`]; `Debug` prints the variant name.
212    #[allow(non_upper_case_globals)]
213    pub const Depth500: Self = Self::DEPTH_500;
214    ///Idiomatic alias for [`Self::DEPTH_1000`]; `Debug` prints the variant name.
215    #[allow(non_upper_case_globals)]
216    pub const Depth1000: Self = Self::DEPTH_1000;
217}
218impl ::core::default::Default for HeatmapDepth {
219    fn default() -> Self {
220        Self::DEPTH_UNSPECIFIED
221    }
222}
223impl ::serde::Serialize for HeatmapDepth {
224    fn serialize<S: ::serde::Serializer>(
225        &self,
226        s: S,
227    ) -> ::core::result::Result<S::Ok, S::Error> {
228        s.serialize_str(::buffa::Enumeration::proto_name(self))
229    }
230}
231impl<'de> ::serde::Deserialize<'de> for HeatmapDepth {
232    fn deserialize<D: ::serde::Deserializer<'de>>(
233        d: D,
234    ) -> ::core::result::Result<Self, D::Error> {
235        struct _V;
236        impl ::serde::de::Visitor<'_> for _V {
237            type Value = HeatmapDepth;
238            fn expecting(
239                &self,
240                f: &mut ::core::fmt::Formatter<'_>,
241            ) -> ::core::fmt::Result {
242                f.write_str(
243                    concat!("a string, integer, or null for ", stringify!(HeatmapDepth)),
244                )
245            }
246            fn visit_str<E: ::serde::de::Error>(
247                self,
248                v: &str,
249            ) -> ::core::result::Result<HeatmapDepth, E> {
250                <HeatmapDepth as ::buffa::Enumeration>::from_proto_name(v)
251                    .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
252            }
253            fn visit_i64<E: ::serde::de::Error>(
254                self,
255                v: i64,
256            ) -> ::core::result::Result<HeatmapDepth, E> {
257                let v32 = i32::try_from(v)
258                    .map_err(|_| {
259                        ::serde::de::Error::custom(
260                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
261                        )
262                    })?;
263                <HeatmapDepth as ::buffa::Enumeration>::from_i32(v32)
264                    .ok_or_else(|| {
265                        ::serde::de::Error::custom(
266                            ::buffa::alloc::format!("unknown enum value {v32}"),
267                        )
268                    })
269            }
270            fn visit_u64<E: ::serde::de::Error>(
271                self,
272                v: u64,
273            ) -> ::core::result::Result<HeatmapDepth, E> {
274                let v32 = i32::try_from(v)
275                    .map_err(|_| {
276                        ::serde::de::Error::custom(
277                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
278                        )
279                    })?;
280                <HeatmapDepth as ::buffa::Enumeration>::from_i32(v32)
281                    .ok_or_else(|| {
282                        ::serde::de::Error::custom(
283                            ::buffa::alloc::format!("unknown enum value {v32}"),
284                        )
285                    })
286            }
287            fn visit_unit<E: ::serde::de::Error>(
288                self,
289            ) -> ::core::result::Result<HeatmapDepth, E> {
290                ::core::result::Result::Ok(::core::default::Default::default())
291            }
292        }
293        d.deserialize_any(_V)
294    }
295}
296impl ::buffa::json_helpers::ProtoElemJson for HeatmapDepth {
297    fn serialize_proto_json<S: ::serde::Serializer>(
298        v: &Self,
299        s: S,
300    ) -> ::core::result::Result<S::Ok, S::Error> {
301        ::serde::Serialize::serialize(v, s)
302    }
303    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
304        d: D,
305    ) -> ::core::result::Result<Self, D::Error> {
306        <Self as ::serde::Deserialize>::deserialize(d)
307    }
308}
309impl ::buffa::Enumeration for HeatmapDepth {
310    fn from_i32(value: i32) -> ::core::option::Option<Self> {
311        match value {
312            0i32 => ::core::option::Option::Some(Self::DEPTH_UNSPECIFIED),
313            1i32 => ::core::option::Option::Some(Self::DEPTH_1),
314            2i32 => ::core::option::Option::Some(Self::DEPTH_5),
315            3i32 => ::core::option::Option::Some(Self::DEPTH_10),
316            4i32 => ::core::option::Option::Some(Self::DEPTH_20),
317            5i32 => ::core::option::Option::Some(Self::DEPTH_50),
318            6i32 => ::core::option::Option::Some(Self::DEPTH_100),
319            7i32 => ::core::option::Option::Some(Self::DEPTH_200),
320            8i32 => ::core::option::Option::Some(Self::DEPTH_500),
321            9i32 => ::core::option::Option::Some(Self::DEPTH_1000),
322            _ => ::core::option::Option::None,
323        }
324    }
325    fn to_i32(&self) -> i32 {
326        *self as i32
327    }
328    fn proto_name(&self) -> &'static str {
329        match self {
330            Self::DEPTH_UNSPECIFIED => "DEPTH_UNSPECIFIED",
331            Self::DEPTH_1 => "DEPTH_1",
332            Self::DEPTH_5 => "DEPTH_5",
333            Self::DEPTH_10 => "DEPTH_10",
334            Self::DEPTH_20 => "DEPTH_20",
335            Self::DEPTH_50 => "DEPTH_50",
336            Self::DEPTH_100 => "DEPTH_100",
337            Self::DEPTH_200 => "DEPTH_200",
338            Self::DEPTH_500 => "DEPTH_500",
339            Self::DEPTH_1000 => "DEPTH_1000",
340        }
341    }
342    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
343        match name {
344            "DEPTH_UNSPECIFIED" => ::core::option::Option::Some(Self::DEPTH_UNSPECIFIED),
345            "DEPTH_1" => ::core::option::Option::Some(Self::DEPTH_1),
346            "DEPTH_5" => ::core::option::Option::Some(Self::DEPTH_5),
347            "DEPTH_10" => ::core::option::Option::Some(Self::DEPTH_10),
348            "DEPTH_20" => ::core::option::Option::Some(Self::DEPTH_20),
349            "DEPTH_50" => ::core::option::Option::Some(Self::DEPTH_50),
350            "DEPTH_100" => ::core::option::Option::Some(Self::DEPTH_100),
351            "DEPTH_200" => ::core::option::Option::Some(Self::DEPTH_200),
352            "DEPTH_500" => ::core::option::Option::Some(Self::DEPTH_500),
353            "DEPTH_1000" => ::core::option::Option::Some(Self::DEPTH_1000),
354            _ => ::core::option::Option::None,
355        }
356    }
357    fn values() -> &'static [Self] {
358        &[
359            Self::DEPTH_UNSPECIFIED,
360            Self::DEPTH_1,
361            Self::DEPTH_5,
362            Self::DEPTH_10,
363            Self::DEPTH_20,
364            Self::DEPTH_50,
365            Self::DEPTH_100,
366            Self::DEPTH_200,
367            Self::DEPTH_500,
368            Self::DEPTH_1000,
369        ]
370    }
371}
372/// HeatmapQuantityMode controls what qty_scaled means in returned levels.
373#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
374#[repr(i32)]
375pub enum HeatmapQuantityMode {
376    QTY_MODE_UNSPECIFIED = 0i32,
377    CLOSE = 1i32,
378    PEAK = 2i32,
379}
380impl HeatmapQuantityMode {
381    ///Idiomatic alias for [`Self::QTY_MODE_UNSPECIFIED`]; `Debug` prints the variant name.
382    #[allow(non_upper_case_globals)]
383    pub const QtyModeUnspecified: Self = Self::QTY_MODE_UNSPECIFIED;
384    ///Idiomatic alias for [`Self::CLOSE`]; `Debug` prints the variant name.
385    #[allow(non_upper_case_globals)]
386    pub const Close: Self = Self::CLOSE;
387    ///Idiomatic alias for [`Self::PEAK`]; `Debug` prints the variant name.
388    #[allow(non_upper_case_globals)]
389    pub const Peak: Self = Self::PEAK;
390}
391impl ::core::default::Default for HeatmapQuantityMode {
392    fn default() -> Self {
393        Self::QTY_MODE_UNSPECIFIED
394    }
395}
396impl ::serde::Serialize for HeatmapQuantityMode {
397    fn serialize<S: ::serde::Serializer>(
398        &self,
399        s: S,
400    ) -> ::core::result::Result<S::Ok, S::Error> {
401        s.serialize_str(::buffa::Enumeration::proto_name(self))
402    }
403}
404impl<'de> ::serde::Deserialize<'de> for HeatmapQuantityMode {
405    fn deserialize<D: ::serde::Deserializer<'de>>(
406        d: D,
407    ) -> ::core::result::Result<Self, D::Error> {
408        struct _V;
409        impl ::serde::de::Visitor<'_> for _V {
410            type Value = HeatmapQuantityMode;
411            fn expecting(
412                &self,
413                f: &mut ::core::fmt::Formatter<'_>,
414            ) -> ::core::fmt::Result {
415                f.write_str(
416                    concat!(
417                        "a string, integer, or null for ",
418                        stringify!(HeatmapQuantityMode)
419                    ),
420                )
421            }
422            fn visit_str<E: ::serde::de::Error>(
423                self,
424                v: &str,
425            ) -> ::core::result::Result<HeatmapQuantityMode, E> {
426                <HeatmapQuantityMode as ::buffa::Enumeration>::from_proto_name(v)
427                    .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
428            }
429            fn visit_i64<E: ::serde::de::Error>(
430                self,
431                v: i64,
432            ) -> ::core::result::Result<HeatmapQuantityMode, E> {
433                let v32 = i32::try_from(v)
434                    .map_err(|_| {
435                        ::serde::de::Error::custom(
436                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
437                        )
438                    })?;
439                <HeatmapQuantityMode as ::buffa::Enumeration>::from_i32(v32)
440                    .ok_or_else(|| {
441                        ::serde::de::Error::custom(
442                            ::buffa::alloc::format!("unknown enum value {v32}"),
443                        )
444                    })
445            }
446            fn visit_u64<E: ::serde::de::Error>(
447                self,
448                v: u64,
449            ) -> ::core::result::Result<HeatmapQuantityMode, E> {
450                let v32 = i32::try_from(v)
451                    .map_err(|_| {
452                        ::serde::de::Error::custom(
453                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
454                        )
455                    })?;
456                <HeatmapQuantityMode as ::buffa::Enumeration>::from_i32(v32)
457                    .ok_or_else(|| {
458                        ::serde::de::Error::custom(
459                            ::buffa::alloc::format!("unknown enum value {v32}"),
460                        )
461                    })
462            }
463            fn visit_unit<E: ::serde::de::Error>(
464                self,
465            ) -> ::core::result::Result<HeatmapQuantityMode, E> {
466                ::core::result::Result::Ok(::core::default::Default::default())
467            }
468        }
469        d.deserialize_any(_V)
470    }
471}
472impl ::buffa::json_helpers::ProtoElemJson for HeatmapQuantityMode {
473    fn serialize_proto_json<S: ::serde::Serializer>(
474        v: &Self,
475        s: S,
476    ) -> ::core::result::Result<S::Ok, S::Error> {
477        ::serde::Serialize::serialize(v, s)
478    }
479    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
480        d: D,
481    ) -> ::core::result::Result<Self, D::Error> {
482        <Self as ::serde::Deserialize>::deserialize(d)
483    }
484}
485impl ::buffa::Enumeration for HeatmapQuantityMode {
486    fn from_i32(value: i32) -> ::core::option::Option<Self> {
487        match value {
488            0i32 => ::core::option::Option::Some(Self::QTY_MODE_UNSPECIFIED),
489            1i32 => ::core::option::Option::Some(Self::CLOSE),
490            2i32 => ::core::option::Option::Some(Self::PEAK),
491            _ => ::core::option::Option::None,
492        }
493    }
494    fn to_i32(&self) -> i32 {
495        *self as i32
496    }
497    fn proto_name(&self) -> &'static str {
498        match self {
499            Self::QTY_MODE_UNSPECIFIED => "QTY_MODE_UNSPECIFIED",
500            Self::CLOSE => "CLOSE",
501            Self::PEAK => "PEAK",
502        }
503    }
504    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
505        match name {
506            "QTY_MODE_UNSPECIFIED" => {
507                ::core::option::Option::Some(Self::QTY_MODE_UNSPECIFIED)
508            }
509            "CLOSE" => ::core::option::Option::Some(Self::CLOSE),
510            "PEAK" => ::core::option::Option::Some(Self::PEAK),
511            _ => ::core::option::Option::None,
512        }
513    }
514    fn values() -> &'static [Self] {
515        &[Self::QTY_MODE_UNSPECIFIED, Self::CLOSE, Self::PEAK]
516    }
517}
518/// HeatmapTimeRange selects historical buckets by \[start_time, end_time\] (UTC).
519/// At least one bound is required.
520#[derive(Clone, PartialEq, Default)]
521#[derive(::serde::Serialize, ::serde::Deserialize)]
522#[serde(default)]
523pub struct HeatmapTimeRange {
524    /// Inclusive lower bound in UTC. Omit to leave the lower bound open.
525    ///
526    /// Field 1: `start_time`
527    #[serde(
528        rename = "startTime",
529        alias = "start_time",
530        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
531    )]
532    pub start_time: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
533    /// Inclusive upper bound in UTC. Omit to leave the upper bound open.
534    ///
535    /// Field 2: `end_time`
536    #[serde(
537        rename = "endTime",
538        alias = "end_time",
539        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
540    )]
541    pub end_time: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
542    #[serde(skip)]
543    #[doc(hidden)]
544    pub __buffa_unknown_fields: ::buffa::UnknownFields,
545}
546impl ::core::fmt::Debug for HeatmapTimeRange {
547    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
548        f.debug_struct("HeatmapTimeRange")
549            .field("start_time", &self.start_time)
550            .field("end_time", &self.end_time)
551            .finish()
552    }
553}
554impl HeatmapTimeRange {
555    /// Protobuf type URL for this message, for use with `Any::pack` and
556    /// `Any::unpack_if`.
557    ///
558    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
559    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.HeatmapTimeRange";
560}
561::buffa::impl_default_instance!(HeatmapTimeRange);
562impl ::buffa::MessageName for HeatmapTimeRange {
563    const PACKAGE: &'static str = "marketdata.v1";
564    const NAME: &'static str = "HeatmapTimeRange";
565    const FULL_NAME: &'static str = "marketdata.v1.HeatmapTimeRange";
566    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.HeatmapTimeRange";
567}
568impl ::buffa::Message for HeatmapTimeRange {
569    /// Returns the total encoded size in bytes.
570    ///
571    /// The result is a `u32`; the protobuf specification requires all
572    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
573    /// compliant message will never overflow this type.
574    #[allow(clippy::let_and_return)]
575    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
576        #[allow(unused_imports)]
577        use ::buffa::Enumeration as _;
578        let mut size = 0u32;
579        if self.start_time.is_set() {
580            let __slot = __cache.reserve();
581            let inner_size = self.start_time.compute_size(__cache);
582            __cache.set(__slot, inner_size);
583            size
584                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
585                    + inner_size;
586        }
587        if self.end_time.is_set() {
588            let __slot = __cache.reserve();
589            let inner_size = self.end_time.compute_size(__cache);
590            __cache.set(__slot, inner_size);
591            size
592                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
593                    + inner_size;
594        }
595        size += self.__buffa_unknown_fields.encoded_len() as u32;
596        size
597    }
598    fn write_to(
599        &self,
600        __cache: &mut ::buffa::SizeCache,
601        buf: &mut impl ::buffa::bytes::BufMut,
602    ) {
603        #[allow(unused_imports)]
604        use ::buffa::Enumeration as _;
605        if self.start_time.is_set() {
606            ::buffa::types::put_len_delimited_header(1u32, __cache.consume_next(), buf);
607            self.start_time.write_to(__cache, buf);
608        }
609        if self.end_time.is_set() {
610            ::buffa::types::put_len_delimited_header(2u32, __cache.consume_next(), buf);
611            self.end_time.write_to(__cache, buf);
612        }
613        self.__buffa_unknown_fields.write_to(buf);
614    }
615    fn merge_field(
616        &mut self,
617        tag: ::buffa::encoding::Tag,
618        buf: &mut impl ::buffa::bytes::Buf,
619        ctx: ::buffa::DecodeContext<'_>,
620    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
621        #[allow(unused_imports)]
622        use ::buffa::bytes::Buf as _;
623        #[allow(unused_imports)]
624        use ::buffa::Enumeration as _;
625        match tag.field_number() {
626            1u32 => {
627                ::buffa::encoding::check_wire_type(
628                    tag,
629                    ::buffa::encoding::WireType::LengthDelimited,
630                )?;
631                ::buffa::Message::merge_length_delimited(
632                    self.start_time.get_or_insert_default(),
633                    buf,
634                    ctx,
635                )?;
636            }
637            2u32 => {
638                ::buffa::encoding::check_wire_type(
639                    tag,
640                    ::buffa::encoding::WireType::LengthDelimited,
641                )?;
642                ::buffa::Message::merge_length_delimited(
643                    self.end_time.get_or_insert_default(),
644                    buf,
645                    ctx,
646                )?;
647            }
648            _ => {
649                self.__buffa_unknown_fields
650                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
651            }
652        }
653        ::core::result::Result::Ok(())
654    }
655    fn clear(&mut self) {
656        self.start_time = ::buffa::MessageField::none();
657        self.end_time = ::buffa::MessageField::none();
658        self.__buffa_unknown_fields.clear();
659    }
660}
661impl ::buffa::ExtensionSet for HeatmapTimeRange {
662    const PROTO_FQN: &'static str = "marketdata.v1.HeatmapTimeRange";
663    fn unknown_fields(&self) -> &::buffa::UnknownFields {
664        &self.__buffa_unknown_fields
665    }
666    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
667        &mut self.__buffa_unknown_fields
668    }
669}
670impl ::buffa::json_helpers::ProtoElemJson for HeatmapTimeRange {
671    fn serialize_proto_json<S: ::serde::Serializer>(
672        v: &Self,
673        s: S,
674    ) -> ::core::result::Result<S::Ok, S::Error> {
675        ::serde::Serialize::serialize(v, s)
676    }
677    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
678        d: D,
679    ) -> ::core::result::Result<Self, D::Error> {
680        <Self as ::serde::Deserialize>::deserialize(d)
681    }
682}
683#[doc(hidden)]
684pub const __HEATMAP_TIME_RANGE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
685    type_url: "type.googleapis.com/marketdata.v1.HeatmapTimeRange",
686    to_json: ::buffa::type_registry::any_to_json::<HeatmapTimeRange>,
687    from_json: ::buffa::type_registry::any_from_json::<HeatmapTimeRange>,
688    is_wkt: false,
689};
690/// GetOrderbookHeatmapRequest fetches historical heatmap buckets.
691#[derive(Clone, PartialEq, Default)]
692#[derive(::serde::Serialize, ::serde::Deserialize)]
693#[serde(default)]
694pub struct GetOrderbookHeatmapRequest {
695    /// Numeric spot market identifier.
696    ///
697    /// Field 1: `symbol_id`
698    #[serde(
699        rename = "symbolId",
700        alias = "symbol_id",
701        with = "::buffa::json_helpers::uint32",
702        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
703    )]
704    pub symbol_id: u32,
705    /// Heatmap bucket interval.
706    ///
707    /// Field 2: `interval`
708    #[serde(
709        rename = "interval",
710        with = "::buffa::json_helpers::proto_enum",
711        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
712    )]
713    pub interval: ::buffa::EnumValue<HeatmapInterval>,
714    /// Top-N levels per side included in each bucket.
715    ///
716    /// Field 3: `depth`
717    #[serde(
718        rename = "depth",
719        with = "::buffa::json_helpers::proto_enum",
720        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
721    )]
722    pub depth: ::buffa::EnumValue<HeatmapDepth>,
723    /// Absolute time range for the first page. Reuse the same request filters and
724    /// pass page_token from the prior response to continue older buckets.
725    ///
726    /// Field 4: `time_range`
727    #[serde(
728        rename = "timeRange",
729        alias = "time_range",
730        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
731    )]
732    pub time_range: ::buffa::MessageField<HeatmapTimeRange>,
733    /// Opaque keyset cursor from a previous response. The cursor is exclusive and
734    /// bound to symbol, interval, depth, quantity mode, and the original time
735    /// range.
736    ///
737    /// Field 5: `page_token`
738    #[serde(
739        rename = "pageToken",
740        alias = "page_token",
741        with = "::buffa::json_helpers::proto_string",
742        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
743    )]
744    pub page_token: ::buffa::alloc::string::String,
745    /// Maximum number of delta buckets returned (min 1, max 20000).
746    /// This limit counts only `chain.deltas`; `chain.base_keyframe` is not counted.
747    ///
748    /// Field 6: `limit`
749    #[serde(
750        rename = "limit",
751        with = "::buffa::json_helpers::uint32",
752        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
753    )]
754    pub limit: u32,
755    /// Quantity mode used for qty_scaled in snapshot/delta levels:
756    /// - CLOSE: end-of-bucket quantity
757    /// - PEAK: intra-bucket peak quantity
758    ///
759    /// Field 7: `quantity_mode`
760    #[serde(
761        rename = "quantityMode",
762        alias = "quantity_mode",
763        with = "::buffa::json_helpers::proto_enum",
764        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
765    )]
766    pub quantity_mode: ::buffa::EnumValue<HeatmapQuantityMode>,
767    #[serde(skip)]
768    #[doc(hidden)]
769    pub __buffa_unknown_fields: ::buffa::UnknownFields,
770}
771impl ::core::fmt::Debug for GetOrderbookHeatmapRequest {
772    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
773        f.debug_struct("GetOrderbookHeatmapRequest")
774            .field("symbol_id", &self.symbol_id)
775            .field("interval", &self.interval)
776            .field("depth", &self.depth)
777            .field("time_range", &self.time_range)
778            .field("page_token", &self.page_token)
779            .field("limit", &self.limit)
780            .field("quantity_mode", &self.quantity_mode)
781            .finish()
782    }
783}
784impl GetOrderbookHeatmapRequest {
785    /// Protobuf type URL for this message, for use with `Any::pack` and
786    /// `Any::unpack_if`.
787    ///
788    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
789    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetOrderbookHeatmapRequest";
790}
791::buffa::impl_default_instance!(GetOrderbookHeatmapRequest);
792impl ::buffa::MessageName for GetOrderbookHeatmapRequest {
793    const PACKAGE: &'static str = "marketdata.v1";
794    const NAME: &'static str = "GetOrderbookHeatmapRequest";
795    const FULL_NAME: &'static str = "marketdata.v1.GetOrderbookHeatmapRequest";
796    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetOrderbookHeatmapRequest";
797}
798impl ::buffa::Message for GetOrderbookHeatmapRequest {
799    /// Returns the total encoded size in bytes.
800    ///
801    /// The result is a `u32`; the protobuf specification requires all
802    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
803    /// compliant message will never overflow this type.
804    #[allow(clippy::let_and_return)]
805    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
806        #[allow(unused_imports)]
807        use ::buffa::Enumeration as _;
808        let mut size = 0u32;
809        if self.symbol_id != 0u32 {
810            size += 1u32 + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
811        }
812        {
813            let val = self.interval.to_i32();
814            if val != 0 {
815                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
816            }
817        }
818        {
819            let val = self.depth.to_i32();
820            if val != 0 {
821                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
822            }
823        }
824        if self.time_range.is_set() {
825            let __slot = __cache.reserve();
826            let inner_size = self.time_range.compute_size(__cache);
827            __cache.set(__slot, inner_size);
828            size
829                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
830                    + inner_size;
831        }
832        if !self.page_token.is_empty() {
833            size += 1u32 + ::buffa::types::string_encoded_len(&self.page_token) as u32;
834        }
835        if self.limit != 0u32 {
836            size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
837        }
838        {
839            let val = self.quantity_mode.to_i32();
840            if val != 0 {
841                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
842            }
843        }
844        size += self.__buffa_unknown_fields.encoded_len() as u32;
845        size
846    }
847    fn write_to(
848        &self,
849        __cache: &mut ::buffa::SizeCache,
850        buf: &mut impl ::buffa::bytes::BufMut,
851    ) {
852        #[allow(unused_imports)]
853        use ::buffa::Enumeration as _;
854        if self.symbol_id != 0u32 {
855            ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
856        }
857        {
858            let val = self.interval.to_i32();
859            if val != 0 {
860                ::buffa::types::put_int32_field(2u32, val, buf);
861            }
862        }
863        {
864            let val = self.depth.to_i32();
865            if val != 0 {
866                ::buffa::types::put_int32_field(3u32, val, buf);
867            }
868        }
869        if self.time_range.is_set() {
870            ::buffa::types::put_len_delimited_header(4u32, __cache.consume_next(), buf);
871            self.time_range.write_to(__cache, buf);
872        }
873        if !self.page_token.is_empty() {
874            ::buffa::types::put_string_field(5u32, &self.page_token, buf);
875        }
876        if self.limit != 0u32 {
877            ::buffa::types::put_uint32_field(6u32, self.limit, buf);
878        }
879        {
880            let val = self.quantity_mode.to_i32();
881            if val != 0 {
882                ::buffa::types::put_int32_field(7u32, val, buf);
883            }
884        }
885        self.__buffa_unknown_fields.write_to(buf);
886    }
887    fn merge_field(
888        &mut self,
889        tag: ::buffa::encoding::Tag,
890        buf: &mut impl ::buffa::bytes::Buf,
891        ctx: ::buffa::DecodeContext<'_>,
892    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
893        #[allow(unused_imports)]
894        use ::buffa::bytes::Buf as _;
895        #[allow(unused_imports)]
896        use ::buffa::Enumeration as _;
897        match tag.field_number() {
898            1u32 => {
899                ::buffa::encoding::check_wire_type(
900                    tag,
901                    ::buffa::encoding::WireType::Varint,
902                )?;
903                self.symbol_id = ::buffa::types::decode_uint32(buf)?;
904            }
905            2u32 => {
906                ::buffa::encoding::check_wire_type(
907                    tag,
908                    ::buffa::encoding::WireType::Varint,
909                )?;
910                self.interval = ::buffa::EnumValue::from(
911                    ::buffa::types::decode_int32(buf)?,
912                );
913            }
914            3u32 => {
915                ::buffa::encoding::check_wire_type(
916                    tag,
917                    ::buffa::encoding::WireType::Varint,
918                )?;
919                self.depth = ::buffa::EnumValue::from(
920                    ::buffa::types::decode_int32(buf)?,
921                );
922            }
923            4u32 => {
924                ::buffa::encoding::check_wire_type(
925                    tag,
926                    ::buffa::encoding::WireType::LengthDelimited,
927                )?;
928                ::buffa::Message::merge_length_delimited(
929                    self.time_range.get_or_insert_default(),
930                    buf,
931                    ctx,
932                )?;
933            }
934            5u32 => {
935                ::buffa::encoding::check_wire_type(
936                    tag,
937                    ::buffa::encoding::WireType::LengthDelimited,
938                )?;
939                ::buffa::types::merge_string(&mut self.page_token, buf)?;
940            }
941            6u32 => {
942                ::buffa::encoding::check_wire_type(
943                    tag,
944                    ::buffa::encoding::WireType::Varint,
945                )?;
946                self.limit = ::buffa::types::decode_uint32(buf)?;
947            }
948            7u32 => {
949                ::buffa::encoding::check_wire_type(
950                    tag,
951                    ::buffa::encoding::WireType::Varint,
952                )?;
953                self.quantity_mode = ::buffa::EnumValue::from(
954                    ::buffa::types::decode_int32(buf)?,
955                );
956            }
957            _ => {
958                self.__buffa_unknown_fields
959                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
960            }
961        }
962        ::core::result::Result::Ok(())
963    }
964    fn clear(&mut self) {
965        self.symbol_id = 0u32;
966        self.interval = ::buffa::EnumValue::from(0);
967        self.depth = ::buffa::EnumValue::from(0);
968        self.time_range = ::buffa::MessageField::none();
969        self.page_token.clear();
970        self.limit = 0u32;
971        self.quantity_mode = ::buffa::EnumValue::from(0);
972        self.__buffa_unknown_fields.clear();
973    }
974}
975impl ::buffa::ExtensionSet for GetOrderbookHeatmapRequest {
976    const PROTO_FQN: &'static str = "marketdata.v1.GetOrderbookHeatmapRequest";
977    fn unknown_fields(&self) -> &::buffa::UnknownFields {
978        &self.__buffa_unknown_fields
979    }
980    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
981        &mut self.__buffa_unknown_fields
982    }
983}
984impl ::buffa::json_helpers::ProtoElemJson for GetOrderbookHeatmapRequest {
985    fn serialize_proto_json<S: ::serde::Serializer>(
986        v: &Self,
987        s: S,
988    ) -> ::core::result::Result<S::Ok, S::Error> {
989        ::serde::Serialize::serialize(v, s)
990    }
991    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
992        d: D,
993    ) -> ::core::result::Result<Self, D::Error> {
994        <Self as ::serde::Deserialize>::deserialize(d)
995    }
996}
997#[doc(hidden)]
998pub const __GET_ORDERBOOK_HEATMAP_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
999    type_url: "type.googleapis.com/marketdata.v1.GetOrderbookHeatmapRequest",
1000    to_json: ::buffa::type_registry::any_to_json::<GetOrderbookHeatmapRequest>,
1001    from_json: ::buffa::type_registry::any_from_json::<GetOrderbookHeatmapRequest>,
1002    is_wkt: false,
1003};
1004/// HeatmapLevels represents one side of the orderbook for snapshots.
1005/// Arrays are aligned by index and prices are sorted ascending for both sides:
1006/// - price_ticks\[i\] \<-\> qty_scaled\[i\]
1007#[derive(Clone, PartialEq, Default)]
1008#[derive(::serde::Serialize, ::serde::Deserialize)]
1009#[serde(default)]
1010pub struct HeatmapLevels {
1011    /// Price levels in quote units scaled by 1e6.
1012    ///
1013    /// Field 1: `price_ticks`
1014    #[serde(
1015        rename = "priceTicks",
1016        alias = "price_ticks",
1017        with = "::buffa::json_helpers::proto_seq",
1018        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
1019    )]
1020    pub price_ticks: ::buffa::alloc::vec::Vec<i64>,
1021    /// Quantity at each price level according to quantity_mode, scaled by the
1022    /// pair's base_quantity_scale from GetSpotConfig.
1023    ///
1024    /// Field 2: `qty_scaled`
1025    #[serde(
1026        rename = "qtyScaled",
1027        alias = "qty_scaled",
1028        with = "::buffa::json_helpers::proto_seq",
1029        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
1030    )]
1031    pub qty_scaled: ::buffa::alloc::vec::Vec<i64>,
1032    #[serde(skip)]
1033    #[doc(hidden)]
1034    pub __buffa_unknown_fields: ::buffa::UnknownFields,
1035}
1036impl ::core::fmt::Debug for HeatmapLevels {
1037    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1038        f.debug_struct("HeatmapLevels")
1039            .field("price_ticks", &self.price_ticks)
1040            .field("qty_scaled", &self.qty_scaled)
1041            .finish()
1042    }
1043}
1044impl HeatmapLevels {
1045    /// Protobuf type URL for this message, for use with `Any::pack` and
1046    /// `Any::unpack_if`.
1047    ///
1048    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
1049    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.HeatmapLevels";
1050}
1051::buffa::impl_default_instance!(HeatmapLevels);
1052impl ::buffa::MessageName for HeatmapLevels {
1053    const PACKAGE: &'static str = "marketdata.v1";
1054    const NAME: &'static str = "HeatmapLevels";
1055    const FULL_NAME: &'static str = "marketdata.v1.HeatmapLevels";
1056    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.HeatmapLevels";
1057}
1058impl ::buffa::Message for HeatmapLevels {
1059    /// Returns the total encoded size in bytes.
1060    ///
1061    /// The result is a `u32`; the protobuf specification requires all
1062    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
1063    /// compliant message will never overflow this type.
1064    #[allow(clippy::let_and_return)]
1065    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1066        #[allow(unused_imports)]
1067        use ::buffa::Enumeration as _;
1068        let mut size = 0u32;
1069        if !self.price_ticks.is_empty() {
1070            let payload: u32 = self
1071                .price_ticks
1072                .iter()
1073                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
1074                .sum::<u32>();
1075            size
1076                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
1077        }
1078        if !self.qty_scaled.is_empty() {
1079            let payload: u32 = self
1080                .qty_scaled
1081                .iter()
1082                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
1083                .sum::<u32>();
1084            size
1085                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
1086        }
1087        size += self.__buffa_unknown_fields.encoded_len() as u32;
1088        size
1089    }
1090    fn write_to(
1091        &self,
1092        _cache: &mut ::buffa::SizeCache,
1093        buf: &mut impl ::buffa::bytes::BufMut,
1094    ) {
1095        #[allow(unused_imports)]
1096        use ::buffa::Enumeration as _;
1097        if !self.price_ticks.is_empty() {
1098            let payload: u32 = self
1099                .price_ticks
1100                .iter()
1101                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
1102                .sum::<u32>();
1103            ::buffa::types::put_len_delimited_header(1u32, payload, buf);
1104            for &v in &self.price_ticks {
1105                ::buffa::types::encode_int64(v, buf);
1106            }
1107        }
1108        if !self.qty_scaled.is_empty() {
1109            let payload: u32 = self
1110                .qty_scaled
1111                .iter()
1112                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
1113                .sum::<u32>();
1114            ::buffa::types::put_len_delimited_header(2u32, payload, buf);
1115            for &v in &self.qty_scaled {
1116                ::buffa::types::encode_int64(v, buf);
1117            }
1118        }
1119        self.__buffa_unknown_fields.write_to(buf);
1120    }
1121    fn merge_field(
1122        &mut self,
1123        tag: ::buffa::encoding::Tag,
1124        buf: &mut impl ::buffa::bytes::Buf,
1125        ctx: ::buffa::DecodeContext<'_>,
1126    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1127        #[allow(unused_imports)]
1128        use ::buffa::bytes::Buf as _;
1129        #[allow(unused_imports)]
1130        use ::buffa::Enumeration as _;
1131        match tag.field_number() {
1132            1u32 => {
1133                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
1134                    let len = ::buffa::encoding::decode_varint(buf)?;
1135                    let len = usize::try_from(len)
1136                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
1137                    if buf.remaining() < len {
1138                        return ::core::result::Result::Err(
1139                            ::buffa::DecodeError::UnexpectedEof,
1140                        );
1141                    }
1142                    self.price_ticks.reserve(len);
1143                    let mut limited = buf.take(len);
1144                    while limited.has_remaining() {
1145                        self.price_ticks
1146                            .push(::buffa::types::decode_int64(&mut limited)?);
1147                    }
1148                    let leftover = limited.remaining();
1149                    if leftover > 0 {
1150                        limited.advance(leftover);
1151                    }
1152                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
1153                    self.price_ticks.push(::buffa::types::decode_int64(buf)?);
1154                } else {
1155                    return ::core::result::Result::Err(
1156                        ::buffa::encoding::wire_type_mismatch(
1157                            tag,
1158                            ::buffa::encoding::WireType::LengthDelimited,
1159                        ),
1160                    );
1161                }
1162            }
1163            2u32 => {
1164                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
1165                    let len = ::buffa::encoding::decode_varint(buf)?;
1166                    let len = usize::try_from(len)
1167                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
1168                    if buf.remaining() < len {
1169                        return ::core::result::Result::Err(
1170                            ::buffa::DecodeError::UnexpectedEof,
1171                        );
1172                    }
1173                    self.qty_scaled.reserve(len);
1174                    let mut limited = buf.take(len);
1175                    while limited.has_remaining() {
1176                        self.qty_scaled
1177                            .push(::buffa::types::decode_int64(&mut limited)?);
1178                    }
1179                    let leftover = limited.remaining();
1180                    if leftover > 0 {
1181                        limited.advance(leftover);
1182                    }
1183                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
1184                    self.qty_scaled.push(::buffa::types::decode_int64(buf)?);
1185                } else {
1186                    return ::core::result::Result::Err(
1187                        ::buffa::encoding::wire_type_mismatch(
1188                            tag,
1189                            ::buffa::encoding::WireType::LengthDelimited,
1190                        ),
1191                    );
1192                }
1193            }
1194            _ => {
1195                self.__buffa_unknown_fields
1196                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
1197            }
1198        }
1199        ::core::result::Result::Ok(())
1200    }
1201    fn clear(&mut self) {
1202        self.price_ticks.clear();
1203        self.qty_scaled.clear();
1204        self.__buffa_unknown_fields.clear();
1205    }
1206}
1207impl ::buffa::ExtensionSet for HeatmapLevels {
1208    const PROTO_FQN: &'static str = "marketdata.v1.HeatmapLevels";
1209    fn unknown_fields(&self) -> &::buffa::UnknownFields {
1210        &self.__buffa_unknown_fields
1211    }
1212    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1213        &mut self.__buffa_unknown_fields
1214    }
1215}
1216impl ::buffa::json_helpers::ProtoElemJson for HeatmapLevels {
1217    fn serialize_proto_json<S: ::serde::Serializer>(
1218        v: &Self,
1219        s: S,
1220    ) -> ::core::result::Result<S::Ok, S::Error> {
1221        ::serde::Serialize::serialize(v, s)
1222    }
1223    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1224        d: D,
1225    ) -> ::core::result::Result<Self, D::Error> {
1226        <Self as ::serde::Deserialize>::deserialize(d)
1227    }
1228}
1229#[doc(hidden)]
1230pub const __HEATMAP_LEVELS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1231    type_url: "type.googleapis.com/marketdata.v1.HeatmapLevels",
1232    to_json: ::buffa::type_registry::any_to_json::<HeatmapLevels>,
1233    from_json: ::buffa::type_registry::any_from_json::<HeatmapLevels>,
1234    is_wkt: false,
1235};
1236/// HeatmapDeltaLevels represents sparse per-bucket level changes for one side.
1237/// Arrays are aligned by index and prices are sorted ascending for both sides:
1238/// - price_ticks\[i\] \<-\> qty_scaled\[i\]
1239/// Delete semantics: qty_scaled\[i\] = 0 means delete level at price_ticks\[i\].
1240#[derive(Clone, PartialEq, Default)]
1241#[derive(::serde::Serialize, ::serde::Deserialize)]
1242#[serde(default)]
1243pub struct HeatmapDeltaLevels {
1244    /// Price levels in quote units scaled by 1e6.
1245    ///
1246    /// Field 1: `price_ticks`
1247    #[serde(
1248        rename = "priceTicks",
1249        alias = "price_ticks",
1250        with = "::buffa::json_helpers::proto_seq",
1251        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
1252    )]
1253    pub price_ticks: ::buffa::alloc::vec::Vec<i64>,
1254    /// Quantity at each price level, scaled by the pair's base_quantity_scale from
1255    /// GetSpotConfig. A zero value deletes the level at the matching price_ticks
1256    /// index.
1257    ///
1258    /// Field 2: `qty_scaled`
1259    #[serde(
1260        rename = "qtyScaled",
1261        alias = "qty_scaled",
1262        with = "::buffa::json_helpers::proto_seq",
1263        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
1264    )]
1265    pub qty_scaled: ::buffa::alloc::vec::Vec<i64>,
1266    #[serde(skip)]
1267    #[doc(hidden)]
1268    pub __buffa_unknown_fields: ::buffa::UnknownFields,
1269}
1270impl ::core::fmt::Debug for HeatmapDeltaLevels {
1271    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1272        f.debug_struct("HeatmapDeltaLevels")
1273            .field("price_ticks", &self.price_ticks)
1274            .field("qty_scaled", &self.qty_scaled)
1275            .finish()
1276    }
1277}
1278impl HeatmapDeltaLevels {
1279    /// Protobuf type URL for this message, for use with `Any::pack` and
1280    /// `Any::unpack_if`.
1281    ///
1282    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
1283    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.HeatmapDeltaLevels";
1284}
1285::buffa::impl_default_instance!(HeatmapDeltaLevels);
1286impl ::buffa::MessageName for HeatmapDeltaLevels {
1287    const PACKAGE: &'static str = "marketdata.v1";
1288    const NAME: &'static str = "HeatmapDeltaLevels";
1289    const FULL_NAME: &'static str = "marketdata.v1.HeatmapDeltaLevels";
1290    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.HeatmapDeltaLevels";
1291}
1292impl ::buffa::Message for HeatmapDeltaLevels {
1293    /// Returns the total encoded size in bytes.
1294    ///
1295    /// The result is a `u32`; the protobuf specification requires all
1296    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
1297    /// compliant message will never overflow this type.
1298    #[allow(clippy::let_and_return)]
1299    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1300        #[allow(unused_imports)]
1301        use ::buffa::Enumeration as _;
1302        let mut size = 0u32;
1303        if !self.price_ticks.is_empty() {
1304            let payload: u32 = self
1305                .price_ticks
1306                .iter()
1307                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
1308                .sum::<u32>();
1309            size
1310                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
1311        }
1312        if !self.qty_scaled.is_empty() {
1313            let payload: u32 = self
1314                .qty_scaled
1315                .iter()
1316                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
1317                .sum::<u32>();
1318            size
1319                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
1320        }
1321        size += self.__buffa_unknown_fields.encoded_len() as u32;
1322        size
1323    }
1324    fn write_to(
1325        &self,
1326        _cache: &mut ::buffa::SizeCache,
1327        buf: &mut impl ::buffa::bytes::BufMut,
1328    ) {
1329        #[allow(unused_imports)]
1330        use ::buffa::Enumeration as _;
1331        if !self.price_ticks.is_empty() {
1332            let payload: u32 = self
1333                .price_ticks
1334                .iter()
1335                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
1336                .sum::<u32>();
1337            ::buffa::types::put_len_delimited_header(1u32, payload, buf);
1338            for &v in &self.price_ticks {
1339                ::buffa::types::encode_int64(v, buf);
1340            }
1341        }
1342        if !self.qty_scaled.is_empty() {
1343            let payload: u32 = self
1344                .qty_scaled
1345                .iter()
1346                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
1347                .sum::<u32>();
1348            ::buffa::types::put_len_delimited_header(2u32, payload, buf);
1349            for &v in &self.qty_scaled {
1350                ::buffa::types::encode_int64(v, buf);
1351            }
1352        }
1353        self.__buffa_unknown_fields.write_to(buf);
1354    }
1355    fn merge_field(
1356        &mut self,
1357        tag: ::buffa::encoding::Tag,
1358        buf: &mut impl ::buffa::bytes::Buf,
1359        ctx: ::buffa::DecodeContext<'_>,
1360    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1361        #[allow(unused_imports)]
1362        use ::buffa::bytes::Buf as _;
1363        #[allow(unused_imports)]
1364        use ::buffa::Enumeration as _;
1365        match tag.field_number() {
1366            1u32 => {
1367                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
1368                    let len = ::buffa::encoding::decode_varint(buf)?;
1369                    let len = usize::try_from(len)
1370                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
1371                    if buf.remaining() < len {
1372                        return ::core::result::Result::Err(
1373                            ::buffa::DecodeError::UnexpectedEof,
1374                        );
1375                    }
1376                    self.price_ticks.reserve(len);
1377                    let mut limited = buf.take(len);
1378                    while limited.has_remaining() {
1379                        self.price_ticks
1380                            .push(::buffa::types::decode_int64(&mut limited)?);
1381                    }
1382                    let leftover = limited.remaining();
1383                    if leftover > 0 {
1384                        limited.advance(leftover);
1385                    }
1386                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
1387                    self.price_ticks.push(::buffa::types::decode_int64(buf)?);
1388                } else {
1389                    return ::core::result::Result::Err(
1390                        ::buffa::encoding::wire_type_mismatch(
1391                            tag,
1392                            ::buffa::encoding::WireType::LengthDelimited,
1393                        ),
1394                    );
1395                }
1396            }
1397            2u32 => {
1398                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
1399                    let len = ::buffa::encoding::decode_varint(buf)?;
1400                    let len = usize::try_from(len)
1401                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
1402                    if buf.remaining() < len {
1403                        return ::core::result::Result::Err(
1404                            ::buffa::DecodeError::UnexpectedEof,
1405                        );
1406                    }
1407                    self.qty_scaled.reserve(len);
1408                    let mut limited = buf.take(len);
1409                    while limited.has_remaining() {
1410                        self.qty_scaled
1411                            .push(::buffa::types::decode_int64(&mut limited)?);
1412                    }
1413                    let leftover = limited.remaining();
1414                    if leftover > 0 {
1415                        limited.advance(leftover);
1416                    }
1417                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
1418                    self.qty_scaled.push(::buffa::types::decode_int64(buf)?);
1419                } else {
1420                    return ::core::result::Result::Err(
1421                        ::buffa::encoding::wire_type_mismatch(
1422                            tag,
1423                            ::buffa::encoding::WireType::LengthDelimited,
1424                        ),
1425                    );
1426                }
1427            }
1428            _ => {
1429                self.__buffa_unknown_fields
1430                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
1431            }
1432        }
1433        ::core::result::Result::Ok(())
1434    }
1435    fn clear(&mut self) {
1436        self.price_ticks.clear();
1437        self.qty_scaled.clear();
1438        self.__buffa_unknown_fields.clear();
1439    }
1440}
1441impl ::buffa::ExtensionSet for HeatmapDeltaLevels {
1442    const PROTO_FQN: &'static str = "marketdata.v1.HeatmapDeltaLevels";
1443    fn unknown_fields(&self) -> &::buffa::UnknownFields {
1444        &self.__buffa_unknown_fields
1445    }
1446    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1447        &mut self.__buffa_unknown_fields
1448    }
1449}
1450impl ::buffa::json_helpers::ProtoElemJson for HeatmapDeltaLevels {
1451    fn serialize_proto_json<S: ::serde::Serializer>(
1452        v: &Self,
1453        s: S,
1454    ) -> ::core::result::Result<S::Ok, S::Error> {
1455        ::serde::Serialize::serialize(v, s)
1456    }
1457    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1458        d: D,
1459    ) -> ::core::result::Result<Self, D::Error> {
1460        <Self as ::serde::Deserialize>::deserialize(d)
1461    }
1462}
1463#[doc(hidden)]
1464pub const __HEATMAP_DELTA_LEVELS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1465    type_url: "type.googleapis.com/marketdata.v1.HeatmapDeltaLevels",
1466    to_json: ::buffa::type_registry::any_to_json::<HeatmapDeltaLevels>,
1467    from_json: ::buffa::type_registry::any_from_json::<HeatmapDeltaLevels>,
1468    is_wkt: false,
1469};
1470/// HeatmapKeyframe is a full-book snapshot anchor.
1471#[derive(Clone, PartialEq, Default)]
1472#[derive(::serde::Serialize, ::serde::Deserialize)]
1473#[serde(default)]
1474pub struct HeatmapKeyframe {
1475    /// Snapshot timestamp (seconds since epoch, UTC).
1476    ///
1477    /// Field 1: `ts_sec`
1478    #[serde(
1479        rename = "tsSec",
1480        alias = "ts_sec",
1481        with = "::buffa::json_helpers::uint64",
1482        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
1483    )]
1484    pub ts_sec: u64,
1485    /// Best bid price in quote units scaled by 1e6.
1486    ///
1487    /// Field 2: `best_bid_ticks`
1488    #[serde(
1489        rename = "bestBidTicks",
1490        alias = "best_bid_ticks",
1491        with = "::buffa::json_helpers::int64",
1492        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
1493    )]
1494    pub best_bid_ticks: i64,
1495    /// Best ask price in quote units scaled by 1e6.
1496    ///
1497    /// Field 3: `best_ask_ticks`
1498    #[serde(
1499        rename = "bestAskTicks",
1500        alias = "best_ask_ticks",
1501        with = "::buffa::json_helpers::int64",
1502        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
1503    )]
1504    pub best_ask_ticks: i64,
1505    /// Mid price in quote units scaled by 1e6.
1506    ///
1507    /// Field 4: `mid_ticks`
1508    #[serde(
1509        rename = "midTicks",
1510        alias = "mid_ticks",
1511        with = "::buffa::json_helpers::int64",
1512        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
1513    )]
1514    pub mid_ticks: i64,
1515    /// Complete bid-side levels at the snapshot.
1516    ///
1517    /// Field 5: `bids`
1518    #[serde(
1519        rename = "bids",
1520        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
1521    )]
1522    pub bids: ::buffa::MessageField<HeatmapLevels>,
1523    /// Complete ask-side levels at the snapshot.
1524    ///
1525    /// Field 6: `asks`
1526    #[serde(
1527        rename = "asks",
1528        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
1529    )]
1530    pub asks: ::buffa::MessageField<HeatmapLevels>,
1531    /// Monotonic order book sequence at the snapshot.
1532    ///
1533    /// Field 7: `book_seq`
1534    #[serde(
1535        rename = "bookSeq",
1536        alias = "book_seq",
1537        with = "::buffa::json_helpers::uint64",
1538        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
1539    )]
1540    pub book_seq: u64,
1541    #[serde(skip)]
1542    #[doc(hidden)]
1543    pub __buffa_unknown_fields: ::buffa::UnknownFields,
1544}
1545impl ::core::fmt::Debug for HeatmapKeyframe {
1546    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1547        f.debug_struct("HeatmapKeyframe")
1548            .field("ts_sec", &self.ts_sec)
1549            .field("best_bid_ticks", &self.best_bid_ticks)
1550            .field("best_ask_ticks", &self.best_ask_ticks)
1551            .field("mid_ticks", &self.mid_ticks)
1552            .field("bids", &self.bids)
1553            .field("asks", &self.asks)
1554            .field("book_seq", &self.book_seq)
1555            .finish()
1556    }
1557}
1558impl HeatmapKeyframe {
1559    /// Protobuf type URL for this message, for use with `Any::pack` and
1560    /// `Any::unpack_if`.
1561    ///
1562    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
1563    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.HeatmapKeyframe";
1564}
1565::buffa::impl_default_instance!(HeatmapKeyframe);
1566impl ::buffa::MessageName for HeatmapKeyframe {
1567    const PACKAGE: &'static str = "marketdata.v1";
1568    const NAME: &'static str = "HeatmapKeyframe";
1569    const FULL_NAME: &'static str = "marketdata.v1.HeatmapKeyframe";
1570    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.HeatmapKeyframe";
1571}
1572impl ::buffa::Message for HeatmapKeyframe {
1573    /// Returns the total encoded size in bytes.
1574    ///
1575    /// The result is a `u32`; the protobuf specification requires all
1576    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
1577    /// compliant message will never overflow this type.
1578    #[allow(clippy::let_and_return)]
1579    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
1580        #[allow(unused_imports)]
1581        use ::buffa::Enumeration as _;
1582        let mut size = 0u32;
1583        if self.ts_sec != 0u64 {
1584            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_sec) as u32;
1585        }
1586        if self.best_bid_ticks != 0i64 {
1587            size += 1u32 + ::buffa::types::int64_encoded_len(self.best_bid_ticks) as u32;
1588        }
1589        if self.best_ask_ticks != 0i64 {
1590            size += 1u32 + ::buffa::types::int64_encoded_len(self.best_ask_ticks) as u32;
1591        }
1592        if self.mid_ticks != 0i64 {
1593            size += 1u32 + ::buffa::types::int64_encoded_len(self.mid_ticks) as u32;
1594        }
1595        if self.bids.is_set() {
1596            let __slot = __cache.reserve();
1597            let inner_size = self.bids.compute_size(__cache);
1598            __cache.set(__slot, inner_size);
1599            size
1600                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1601                    + inner_size;
1602        }
1603        if self.asks.is_set() {
1604            let __slot = __cache.reserve();
1605            let inner_size = self.asks.compute_size(__cache);
1606            __cache.set(__slot, inner_size);
1607            size
1608                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1609                    + inner_size;
1610        }
1611        if self.book_seq != 0u64 {
1612            size += 1u32 + ::buffa::types::uint64_encoded_len(self.book_seq) as u32;
1613        }
1614        size += self.__buffa_unknown_fields.encoded_len() as u32;
1615        size
1616    }
1617    fn write_to(
1618        &self,
1619        __cache: &mut ::buffa::SizeCache,
1620        buf: &mut impl ::buffa::bytes::BufMut,
1621    ) {
1622        #[allow(unused_imports)]
1623        use ::buffa::Enumeration as _;
1624        if self.ts_sec != 0u64 {
1625            ::buffa::types::put_uint64_field(1u32, self.ts_sec, buf);
1626        }
1627        if self.best_bid_ticks != 0i64 {
1628            ::buffa::types::put_int64_field(2u32, self.best_bid_ticks, buf);
1629        }
1630        if self.best_ask_ticks != 0i64 {
1631            ::buffa::types::put_int64_field(3u32, self.best_ask_ticks, buf);
1632        }
1633        if self.mid_ticks != 0i64 {
1634            ::buffa::types::put_int64_field(4u32, self.mid_ticks, buf);
1635        }
1636        if self.bids.is_set() {
1637            ::buffa::types::put_len_delimited_header(5u32, __cache.consume_next(), buf);
1638            self.bids.write_to(__cache, buf);
1639        }
1640        if self.asks.is_set() {
1641            ::buffa::types::put_len_delimited_header(6u32, __cache.consume_next(), buf);
1642            self.asks.write_to(__cache, buf);
1643        }
1644        if self.book_seq != 0u64 {
1645            ::buffa::types::put_uint64_field(7u32, self.book_seq, buf);
1646        }
1647        self.__buffa_unknown_fields.write_to(buf);
1648    }
1649    fn merge_field(
1650        &mut self,
1651        tag: ::buffa::encoding::Tag,
1652        buf: &mut impl ::buffa::bytes::Buf,
1653        ctx: ::buffa::DecodeContext<'_>,
1654    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1655        #[allow(unused_imports)]
1656        use ::buffa::bytes::Buf as _;
1657        #[allow(unused_imports)]
1658        use ::buffa::Enumeration as _;
1659        match tag.field_number() {
1660            1u32 => {
1661                ::buffa::encoding::check_wire_type(
1662                    tag,
1663                    ::buffa::encoding::WireType::Varint,
1664                )?;
1665                self.ts_sec = ::buffa::types::decode_uint64(buf)?;
1666            }
1667            2u32 => {
1668                ::buffa::encoding::check_wire_type(
1669                    tag,
1670                    ::buffa::encoding::WireType::Varint,
1671                )?;
1672                self.best_bid_ticks = ::buffa::types::decode_int64(buf)?;
1673            }
1674            3u32 => {
1675                ::buffa::encoding::check_wire_type(
1676                    tag,
1677                    ::buffa::encoding::WireType::Varint,
1678                )?;
1679                self.best_ask_ticks = ::buffa::types::decode_int64(buf)?;
1680            }
1681            4u32 => {
1682                ::buffa::encoding::check_wire_type(
1683                    tag,
1684                    ::buffa::encoding::WireType::Varint,
1685                )?;
1686                self.mid_ticks = ::buffa::types::decode_int64(buf)?;
1687            }
1688            5u32 => {
1689                ::buffa::encoding::check_wire_type(
1690                    tag,
1691                    ::buffa::encoding::WireType::LengthDelimited,
1692                )?;
1693                ::buffa::Message::merge_length_delimited(
1694                    self.bids.get_or_insert_default(),
1695                    buf,
1696                    ctx,
1697                )?;
1698            }
1699            6u32 => {
1700                ::buffa::encoding::check_wire_type(
1701                    tag,
1702                    ::buffa::encoding::WireType::LengthDelimited,
1703                )?;
1704                ::buffa::Message::merge_length_delimited(
1705                    self.asks.get_or_insert_default(),
1706                    buf,
1707                    ctx,
1708                )?;
1709            }
1710            7u32 => {
1711                ::buffa::encoding::check_wire_type(
1712                    tag,
1713                    ::buffa::encoding::WireType::Varint,
1714                )?;
1715                self.book_seq = ::buffa::types::decode_uint64(buf)?;
1716            }
1717            _ => {
1718                self.__buffa_unknown_fields
1719                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
1720            }
1721        }
1722        ::core::result::Result::Ok(())
1723    }
1724    fn clear(&mut self) {
1725        self.ts_sec = 0u64;
1726        self.best_bid_ticks = 0i64;
1727        self.best_ask_ticks = 0i64;
1728        self.mid_ticks = 0i64;
1729        self.bids = ::buffa::MessageField::none();
1730        self.asks = ::buffa::MessageField::none();
1731        self.book_seq = 0u64;
1732        self.__buffa_unknown_fields.clear();
1733    }
1734}
1735impl ::buffa::ExtensionSet for HeatmapKeyframe {
1736    const PROTO_FQN: &'static str = "marketdata.v1.HeatmapKeyframe";
1737    fn unknown_fields(&self) -> &::buffa::UnknownFields {
1738        &self.__buffa_unknown_fields
1739    }
1740    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1741        &mut self.__buffa_unknown_fields
1742    }
1743}
1744impl ::buffa::json_helpers::ProtoElemJson for HeatmapKeyframe {
1745    fn serialize_proto_json<S: ::serde::Serializer>(
1746        v: &Self,
1747        s: S,
1748    ) -> ::core::result::Result<S::Ok, S::Error> {
1749        ::serde::Serialize::serialize(v, s)
1750    }
1751    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1752        d: D,
1753    ) -> ::core::result::Result<Self, D::Error> {
1754        <Self as ::serde::Deserialize>::deserialize(d)
1755    }
1756}
1757#[doc(hidden)]
1758pub const __HEATMAP_KEYFRAME_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1759    type_url: "type.googleapis.com/marketdata.v1.HeatmapKeyframe",
1760    to_json: ::buffa::type_registry::any_to_json::<HeatmapKeyframe>,
1761    from_json: ::buffa::type_registry::any_from_json::<HeatmapKeyframe>,
1762    is_wkt: false,
1763};
1764/// HeatmapDeltaBucket is one sparse update bucket containing both sides.
1765#[derive(Clone, PartialEq, Default)]
1766#[derive(::serde::Serialize, ::serde::Deserialize)]
1767#[serde(default)]
1768pub struct HeatmapDeltaBucket {
1769    /// Bucket start timestamp (seconds since epoch, UTC), aligned to `interval`.
1770    ///
1771    /// Field 1: `ts_sec`
1772    #[serde(
1773        rename = "tsSec",
1774        alias = "ts_sec",
1775        with = "::buffa::json_helpers::uint64",
1776        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
1777    )]
1778    pub ts_sec: u64,
1779    /// Sparse bid-side level changes in this bucket.
1780    ///
1781    /// Field 2: `bids`
1782    #[serde(
1783        rename = "bids",
1784        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
1785    )]
1786    pub bids: ::buffa::MessageField<HeatmapDeltaLevels>,
1787    /// Sparse ask-side level changes in this bucket.
1788    ///
1789    /// Field 3: `asks`
1790    #[serde(
1791        rename = "asks",
1792        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
1793    )]
1794    pub asks: ::buffa::MessageField<HeatmapDeltaLevels>,
1795    /// Number of upstream L2 updates aggregated into this interval bucket.
1796    ///
1797    /// Field 4: `updates_in_bucket`
1798    #[serde(
1799        rename = "updatesInBucket",
1800        alias = "updates_in_bucket",
1801        with = "::buffa::json_helpers::uint32",
1802        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
1803    )]
1804    pub updates_in_bucket: u32,
1805    /// Earliest monotonic order book sequence represented by this bucket.
1806    ///
1807    /// Field 5: `book_seq_start`
1808    #[serde(
1809        rename = "bookSeqStart",
1810        alias = "book_seq_start",
1811        with = "::buffa::json_helpers::uint64",
1812        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
1813    )]
1814    pub book_seq_start: u64,
1815    /// Latest monotonic order book sequence represented by this bucket.
1816    ///
1817    /// Field 6: `book_seq_end`
1818    #[serde(
1819        rename = "bookSeqEnd",
1820        alias = "book_seq_end",
1821        with = "::buffa::json_helpers::uint64",
1822        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
1823    )]
1824    pub book_seq_end: u64,
1825    #[serde(skip)]
1826    #[doc(hidden)]
1827    pub __buffa_unknown_fields: ::buffa::UnknownFields,
1828}
1829impl ::core::fmt::Debug for HeatmapDeltaBucket {
1830    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1831        f.debug_struct("HeatmapDeltaBucket")
1832            .field("ts_sec", &self.ts_sec)
1833            .field("bids", &self.bids)
1834            .field("asks", &self.asks)
1835            .field("updates_in_bucket", &self.updates_in_bucket)
1836            .field("book_seq_start", &self.book_seq_start)
1837            .field("book_seq_end", &self.book_seq_end)
1838            .finish()
1839    }
1840}
1841impl HeatmapDeltaBucket {
1842    /// Protobuf type URL for this message, for use with `Any::pack` and
1843    /// `Any::unpack_if`.
1844    ///
1845    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
1846    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.HeatmapDeltaBucket";
1847}
1848::buffa::impl_default_instance!(HeatmapDeltaBucket);
1849impl ::buffa::MessageName for HeatmapDeltaBucket {
1850    const PACKAGE: &'static str = "marketdata.v1";
1851    const NAME: &'static str = "HeatmapDeltaBucket";
1852    const FULL_NAME: &'static str = "marketdata.v1.HeatmapDeltaBucket";
1853    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.HeatmapDeltaBucket";
1854}
1855impl ::buffa::Message for HeatmapDeltaBucket {
1856    /// Returns the total encoded size in bytes.
1857    ///
1858    /// The result is a `u32`; the protobuf specification requires all
1859    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
1860    /// compliant message will never overflow this type.
1861    #[allow(clippy::let_and_return)]
1862    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
1863        #[allow(unused_imports)]
1864        use ::buffa::Enumeration as _;
1865        let mut size = 0u32;
1866        if self.ts_sec != 0u64 {
1867            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_sec) as u32;
1868        }
1869        if self.bids.is_set() {
1870            let __slot = __cache.reserve();
1871            let inner_size = self.bids.compute_size(__cache);
1872            __cache.set(__slot, inner_size);
1873            size
1874                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1875                    + inner_size;
1876        }
1877        if self.asks.is_set() {
1878            let __slot = __cache.reserve();
1879            let inner_size = self.asks.compute_size(__cache);
1880            __cache.set(__slot, inner_size);
1881            size
1882                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1883                    + inner_size;
1884        }
1885        if self.updates_in_bucket != 0u32 {
1886            size
1887                += 1u32
1888                    + ::buffa::types::uint32_encoded_len(self.updates_in_bucket) as u32;
1889        }
1890        if self.book_seq_start != 0u64 {
1891            size
1892                += 1u32 + ::buffa::types::uint64_encoded_len(self.book_seq_start) as u32;
1893        }
1894        if self.book_seq_end != 0u64 {
1895            size += 1u32 + ::buffa::types::uint64_encoded_len(self.book_seq_end) as u32;
1896        }
1897        size += self.__buffa_unknown_fields.encoded_len() as u32;
1898        size
1899    }
1900    fn write_to(
1901        &self,
1902        __cache: &mut ::buffa::SizeCache,
1903        buf: &mut impl ::buffa::bytes::BufMut,
1904    ) {
1905        #[allow(unused_imports)]
1906        use ::buffa::Enumeration as _;
1907        if self.ts_sec != 0u64 {
1908            ::buffa::types::put_uint64_field(1u32, self.ts_sec, buf);
1909        }
1910        if self.bids.is_set() {
1911            ::buffa::types::put_len_delimited_header(2u32, __cache.consume_next(), buf);
1912            self.bids.write_to(__cache, buf);
1913        }
1914        if self.asks.is_set() {
1915            ::buffa::types::put_len_delimited_header(3u32, __cache.consume_next(), buf);
1916            self.asks.write_to(__cache, buf);
1917        }
1918        if self.updates_in_bucket != 0u32 {
1919            ::buffa::types::put_uint32_field(4u32, self.updates_in_bucket, buf);
1920        }
1921        if self.book_seq_start != 0u64 {
1922            ::buffa::types::put_uint64_field(5u32, self.book_seq_start, buf);
1923        }
1924        if self.book_seq_end != 0u64 {
1925            ::buffa::types::put_uint64_field(6u32, self.book_seq_end, buf);
1926        }
1927        self.__buffa_unknown_fields.write_to(buf);
1928    }
1929    fn merge_field(
1930        &mut self,
1931        tag: ::buffa::encoding::Tag,
1932        buf: &mut impl ::buffa::bytes::Buf,
1933        ctx: ::buffa::DecodeContext<'_>,
1934    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1935        #[allow(unused_imports)]
1936        use ::buffa::bytes::Buf as _;
1937        #[allow(unused_imports)]
1938        use ::buffa::Enumeration as _;
1939        match tag.field_number() {
1940            1u32 => {
1941                ::buffa::encoding::check_wire_type(
1942                    tag,
1943                    ::buffa::encoding::WireType::Varint,
1944                )?;
1945                self.ts_sec = ::buffa::types::decode_uint64(buf)?;
1946            }
1947            2u32 => {
1948                ::buffa::encoding::check_wire_type(
1949                    tag,
1950                    ::buffa::encoding::WireType::LengthDelimited,
1951                )?;
1952                ::buffa::Message::merge_length_delimited(
1953                    self.bids.get_or_insert_default(),
1954                    buf,
1955                    ctx,
1956                )?;
1957            }
1958            3u32 => {
1959                ::buffa::encoding::check_wire_type(
1960                    tag,
1961                    ::buffa::encoding::WireType::LengthDelimited,
1962                )?;
1963                ::buffa::Message::merge_length_delimited(
1964                    self.asks.get_or_insert_default(),
1965                    buf,
1966                    ctx,
1967                )?;
1968            }
1969            4u32 => {
1970                ::buffa::encoding::check_wire_type(
1971                    tag,
1972                    ::buffa::encoding::WireType::Varint,
1973                )?;
1974                self.updates_in_bucket = ::buffa::types::decode_uint32(buf)?;
1975            }
1976            5u32 => {
1977                ::buffa::encoding::check_wire_type(
1978                    tag,
1979                    ::buffa::encoding::WireType::Varint,
1980                )?;
1981                self.book_seq_start = ::buffa::types::decode_uint64(buf)?;
1982            }
1983            6u32 => {
1984                ::buffa::encoding::check_wire_type(
1985                    tag,
1986                    ::buffa::encoding::WireType::Varint,
1987                )?;
1988                self.book_seq_end = ::buffa::types::decode_uint64(buf)?;
1989            }
1990            _ => {
1991                self.__buffa_unknown_fields
1992                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
1993            }
1994        }
1995        ::core::result::Result::Ok(())
1996    }
1997    fn clear(&mut self) {
1998        self.ts_sec = 0u64;
1999        self.bids = ::buffa::MessageField::none();
2000        self.asks = ::buffa::MessageField::none();
2001        self.updates_in_bucket = 0u32;
2002        self.book_seq_start = 0u64;
2003        self.book_seq_end = 0u64;
2004        self.__buffa_unknown_fields.clear();
2005    }
2006}
2007impl ::buffa::ExtensionSet for HeatmapDeltaBucket {
2008    const PROTO_FQN: &'static str = "marketdata.v1.HeatmapDeltaBucket";
2009    fn unknown_fields(&self) -> &::buffa::UnknownFields {
2010        &self.__buffa_unknown_fields
2011    }
2012    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2013        &mut self.__buffa_unknown_fields
2014    }
2015}
2016impl ::buffa::json_helpers::ProtoElemJson for HeatmapDeltaBucket {
2017    fn serialize_proto_json<S: ::serde::Serializer>(
2018        v: &Self,
2019        s: S,
2020    ) -> ::core::result::Result<S::Ok, S::Error> {
2021        ::serde::Serialize::serialize(v, s)
2022    }
2023    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2024        d: D,
2025    ) -> ::core::result::Result<Self, D::Error> {
2026        <Self as ::serde::Deserialize>::deserialize(d)
2027    }
2028}
2029#[doc(hidden)]
2030pub const __HEATMAP_DELTA_BUCKET_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2031    type_url: "type.googleapis.com/marketdata.v1.HeatmapDeltaBucket",
2032    to_json: ::buffa::type_registry::any_to_json::<HeatmapDeltaBucket>,
2033    from_json: ::buffa::type_registry::any_from_json::<HeatmapDeltaBucket>,
2034    is_wkt: false,
2035};
2036/// HeatmapLiveBucket is the canonical live payload for real-time heatmap updates.
2037/// It represents the latest state of one bucket (open or finalized).
2038#[derive(Clone, PartialEq, Default)]
2039#[derive(::serde::Serialize, ::serde::Deserialize)]
2040#[serde(default)]
2041pub struct HeatmapLiveBucket {
2042    /// Numeric spot market identifier.
2043    ///
2044    /// Field 1: `symbol_id`
2045    #[serde(
2046        rename = "symbolId",
2047        alias = "symbol_id",
2048        with = "::buffa::json_helpers::uint32",
2049        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
2050    )]
2051    pub symbol_id: u32,
2052    /// Bucket interval for this payload.
2053    ///
2054    /// Field 2: `interval`
2055    #[serde(
2056        rename = "interval",
2057        with = "::buffa::json_helpers::proto_enum",
2058        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
2059    )]
2060    pub interval: ::buffa::EnumValue<HeatmapInterval>,
2061    /// Bucket start timestamp (seconds since epoch, UTC), aligned to `interval`.
2062    ///
2063    /// Field 3: `ts_sec`
2064    #[serde(
2065        rename = "tsSec",
2066        alias = "ts_sec",
2067        with = "::buffa::json_helpers::uint64",
2068        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
2069    )]
2070    pub ts_sec: u64,
2071    /// True when this bucket is finalized; false for provisional updates to an
2072    /// open bucket.
2073    ///
2074    /// Field 4: `is_final`
2075    #[serde(
2076        rename = "isFinal",
2077        alias = "is_final",
2078        with = "::buffa::json_helpers::proto_bool",
2079        skip_serializing_if = "::buffa::json_helpers::skip_if::is_false"
2080    )]
2081    pub is_final: bool,
2082    /// Sparse bid-side level changes represented by this bucket.
2083    ///
2084    /// Field 5: `bids`
2085    #[serde(
2086        rename = "bids",
2087        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
2088    )]
2089    pub bids: ::buffa::MessageField<HeatmapDeltaLevels>,
2090    /// Sparse ask-side level changes represented by this bucket.
2091    ///
2092    /// Field 6: `asks`
2093    #[serde(
2094        rename = "asks",
2095        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
2096    )]
2097    pub asks: ::buffa::MessageField<HeatmapDeltaLevels>,
2098    /// Number of upstream L2 updates aggregated into this interval bucket.
2099    ///
2100    /// Field 7: `updates_in_bucket`
2101    #[serde(
2102        rename = "updatesInBucket",
2103        alias = "updates_in_bucket",
2104        with = "::buffa::json_helpers::uint32",
2105        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
2106    )]
2107    pub updates_in_bucket: u32,
2108    /// Earliest monotonic order book sequence represented by this bucket.
2109    ///
2110    /// Field 8: `book_seq_start`
2111    #[serde(
2112        rename = "bookSeqStart",
2113        alias = "book_seq_start",
2114        with = "::buffa::json_helpers::uint64",
2115        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
2116    )]
2117    pub book_seq_start: u64,
2118    /// Latest monotonic order book sequence represented by this bucket.
2119    ///
2120    /// Field 9: `book_seq_end`
2121    #[serde(
2122        rename = "bookSeqEnd",
2123        alias = "book_seq_end",
2124        with = "::buffa::json_helpers::uint64",
2125        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
2126    )]
2127    pub book_seq_end: u64,
2128    /// Quantity semantics for qty_scaled in bids and asks.
2129    ///
2130    /// Field 10: `quantity_mode`
2131    #[serde(
2132        rename = "quantityMode",
2133        alias = "quantity_mode",
2134        with = "::buffa::json_helpers::proto_enum",
2135        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
2136    )]
2137    pub quantity_mode: ::buffa::EnumValue<HeatmapQuantityMode>,
2138    /// Effective bin stride for this symbol as a price delta in 1e-6 quote-unit
2139    /// ticks.
2140    ///
2141    /// Field 11: `effective_bin_ticks`
2142    #[serde(
2143        rename = "effectiveBinTicks",
2144        alias = "effective_bin_ticks",
2145        with = "::buffa::json_helpers::uint64",
2146        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
2147    )]
2148    pub effective_bin_ticks: u64,
2149    #[serde(skip)]
2150    #[doc(hidden)]
2151    pub __buffa_unknown_fields: ::buffa::UnknownFields,
2152}
2153impl ::core::fmt::Debug for HeatmapLiveBucket {
2154    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2155        f.debug_struct("HeatmapLiveBucket")
2156            .field("symbol_id", &self.symbol_id)
2157            .field("interval", &self.interval)
2158            .field("ts_sec", &self.ts_sec)
2159            .field("is_final", &self.is_final)
2160            .field("bids", &self.bids)
2161            .field("asks", &self.asks)
2162            .field("updates_in_bucket", &self.updates_in_bucket)
2163            .field("book_seq_start", &self.book_seq_start)
2164            .field("book_seq_end", &self.book_seq_end)
2165            .field("quantity_mode", &self.quantity_mode)
2166            .field("effective_bin_ticks", &self.effective_bin_ticks)
2167            .finish()
2168    }
2169}
2170impl HeatmapLiveBucket {
2171    /// Protobuf type URL for this message, for use with `Any::pack` and
2172    /// `Any::unpack_if`.
2173    ///
2174    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
2175    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.HeatmapLiveBucket";
2176}
2177::buffa::impl_default_instance!(HeatmapLiveBucket);
2178impl ::buffa::MessageName for HeatmapLiveBucket {
2179    const PACKAGE: &'static str = "marketdata.v1";
2180    const NAME: &'static str = "HeatmapLiveBucket";
2181    const FULL_NAME: &'static str = "marketdata.v1.HeatmapLiveBucket";
2182    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.HeatmapLiveBucket";
2183}
2184impl ::buffa::Message for HeatmapLiveBucket {
2185    /// Returns the total encoded size in bytes.
2186    ///
2187    /// The result is a `u32`; the protobuf specification requires all
2188    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
2189    /// compliant message will never overflow this type.
2190    #[allow(clippy::let_and_return)]
2191    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
2192        #[allow(unused_imports)]
2193        use ::buffa::Enumeration as _;
2194        let mut size = 0u32;
2195        if self.symbol_id != 0u32 {
2196            size += 1u32 + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
2197        }
2198        {
2199            let val = self.interval.to_i32();
2200            if val != 0 {
2201                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
2202            }
2203        }
2204        if self.ts_sec != 0u64 {
2205            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_sec) as u32;
2206        }
2207        if self.is_final {
2208            size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
2209        }
2210        if self.bids.is_set() {
2211            let __slot = __cache.reserve();
2212            let inner_size = self.bids.compute_size(__cache);
2213            __cache.set(__slot, inner_size);
2214            size
2215                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
2216                    + inner_size;
2217        }
2218        if self.asks.is_set() {
2219            let __slot = __cache.reserve();
2220            let inner_size = self.asks.compute_size(__cache);
2221            __cache.set(__slot, inner_size);
2222            size
2223                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
2224                    + inner_size;
2225        }
2226        if self.updates_in_bucket != 0u32 {
2227            size
2228                += 1u32
2229                    + ::buffa::types::uint32_encoded_len(self.updates_in_bucket) as u32;
2230        }
2231        if self.book_seq_start != 0u64 {
2232            size
2233                += 1u32 + ::buffa::types::uint64_encoded_len(self.book_seq_start) as u32;
2234        }
2235        if self.book_seq_end != 0u64 {
2236            size += 1u32 + ::buffa::types::uint64_encoded_len(self.book_seq_end) as u32;
2237        }
2238        {
2239            let val = self.quantity_mode.to_i32();
2240            if val != 0 {
2241                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
2242            }
2243        }
2244        if self.effective_bin_ticks != 0u64 {
2245            size
2246                += 1u32
2247                    + ::buffa::types::uint64_encoded_len(self.effective_bin_ticks)
2248                        as u32;
2249        }
2250        size += self.__buffa_unknown_fields.encoded_len() as u32;
2251        size
2252    }
2253    fn write_to(
2254        &self,
2255        __cache: &mut ::buffa::SizeCache,
2256        buf: &mut impl ::buffa::bytes::BufMut,
2257    ) {
2258        #[allow(unused_imports)]
2259        use ::buffa::Enumeration as _;
2260        if self.symbol_id != 0u32 {
2261            ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
2262        }
2263        {
2264            let val = self.interval.to_i32();
2265            if val != 0 {
2266                ::buffa::types::put_int32_field(2u32, val, buf);
2267            }
2268        }
2269        if self.ts_sec != 0u64 {
2270            ::buffa::types::put_uint64_field(3u32, self.ts_sec, buf);
2271        }
2272        if self.is_final {
2273            ::buffa::types::put_bool_field(4u32, self.is_final, buf);
2274        }
2275        if self.bids.is_set() {
2276            ::buffa::types::put_len_delimited_header(5u32, __cache.consume_next(), buf);
2277            self.bids.write_to(__cache, buf);
2278        }
2279        if self.asks.is_set() {
2280            ::buffa::types::put_len_delimited_header(6u32, __cache.consume_next(), buf);
2281            self.asks.write_to(__cache, buf);
2282        }
2283        if self.updates_in_bucket != 0u32 {
2284            ::buffa::types::put_uint32_field(7u32, self.updates_in_bucket, buf);
2285        }
2286        if self.book_seq_start != 0u64 {
2287            ::buffa::types::put_uint64_field(8u32, self.book_seq_start, buf);
2288        }
2289        if self.book_seq_end != 0u64 {
2290            ::buffa::types::put_uint64_field(9u32, self.book_seq_end, buf);
2291        }
2292        {
2293            let val = self.quantity_mode.to_i32();
2294            if val != 0 {
2295                ::buffa::types::put_int32_field(10u32, val, buf);
2296            }
2297        }
2298        if self.effective_bin_ticks != 0u64 {
2299            ::buffa::types::put_uint64_field(11u32, self.effective_bin_ticks, buf);
2300        }
2301        self.__buffa_unknown_fields.write_to(buf);
2302    }
2303    fn merge_field(
2304        &mut self,
2305        tag: ::buffa::encoding::Tag,
2306        buf: &mut impl ::buffa::bytes::Buf,
2307        ctx: ::buffa::DecodeContext<'_>,
2308    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2309        #[allow(unused_imports)]
2310        use ::buffa::bytes::Buf as _;
2311        #[allow(unused_imports)]
2312        use ::buffa::Enumeration as _;
2313        match tag.field_number() {
2314            1u32 => {
2315                ::buffa::encoding::check_wire_type(
2316                    tag,
2317                    ::buffa::encoding::WireType::Varint,
2318                )?;
2319                self.symbol_id = ::buffa::types::decode_uint32(buf)?;
2320            }
2321            2u32 => {
2322                ::buffa::encoding::check_wire_type(
2323                    tag,
2324                    ::buffa::encoding::WireType::Varint,
2325                )?;
2326                self.interval = ::buffa::EnumValue::from(
2327                    ::buffa::types::decode_int32(buf)?,
2328                );
2329            }
2330            3u32 => {
2331                ::buffa::encoding::check_wire_type(
2332                    tag,
2333                    ::buffa::encoding::WireType::Varint,
2334                )?;
2335                self.ts_sec = ::buffa::types::decode_uint64(buf)?;
2336            }
2337            4u32 => {
2338                ::buffa::encoding::check_wire_type(
2339                    tag,
2340                    ::buffa::encoding::WireType::Varint,
2341                )?;
2342                self.is_final = ::buffa::types::decode_bool(buf)?;
2343            }
2344            5u32 => {
2345                ::buffa::encoding::check_wire_type(
2346                    tag,
2347                    ::buffa::encoding::WireType::LengthDelimited,
2348                )?;
2349                ::buffa::Message::merge_length_delimited(
2350                    self.bids.get_or_insert_default(),
2351                    buf,
2352                    ctx,
2353                )?;
2354            }
2355            6u32 => {
2356                ::buffa::encoding::check_wire_type(
2357                    tag,
2358                    ::buffa::encoding::WireType::LengthDelimited,
2359                )?;
2360                ::buffa::Message::merge_length_delimited(
2361                    self.asks.get_or_insert_default(),
2362                    buf,
2363                    ctx,
2364                )?;
2365            }
2366            7u32 => {
2367                ::buffa::encoding::check_wire_type(
2368                    tag,
2369                    ::buffa::encoding::WireType::Varint,
2370                )?;
2371                self.updates_in_bucket = ::buffa::types::decode_uint32(buf)?;
2372            }
2373            8u32 => {
2374                ::buffa::encoding::check_wire_type(
2375                    tag,
2376                    ::buffa::encoding::WireType::Varint,
2377                )?;
2378                self.book_seq_start = ::buffa::types::decode_uint64(buf)?;
2379            }
2380            9u32 => {
2381                ::buffa::encoding::check_wire_type(
2382                    tag,
2383                    ::buffa::encoding::WireType::Varint,
2384                )?;
2385                self.book_seq_end = ::buffa::types::decode_uint64(buf)?;
2386            }
2387            10u32 => {
2388                ::buffa::encoding::check_wire_type(
2389                    tag,
2390                    ::buffa::encoding::WireType::Varint,
2391                )?;
2392                self.quantity_mode = ::buffa::EnumValue::from(
2393                    ::buffa::types::decode_int32(buf)?,
2394                );
2395            }
2396            11u32 => {
2397                ::buffa::encoding::check_wire_type(
2398                    tag,
2399                    ::buffa::encoding::WireType::Varint,
2400                )?;
2401                self.effective_bin_ticks = ::buffa::types::decode_uint64(buf)?;
2402            }
2403            _ => {
2404                self.__buffa_unknown_fields
2405                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
2406            }
2407        }
2408        ::core::result::Result::Ok(())
2409    }
2410    fn clear(&mut self) {
2411        self.symbol_id = 0u32;
2412        self.interval = ::buffa::EnumValue::from(0);
2413        self.ts_sec = 0u64;
2414        self.is_final = false;
2415        self.bids = ::buffa::MessageField::none();
2416        self.asks = ::buffa::MessageField::none();
2417        self.updates_in_bucket = 0u32;
2418        self.book_seq_start = 0u64;
2419        self.book_seq_end = 0u64;
2420        self.quantity_mode = ::buffa::EnumValue::from(0);
2421        self.effective_bin_ticks = 0u64;
2422        self.__buffa_unknown_fields.clear();
2423    }
2424}
2425impl ::buffa::ExtensionSet for HeatmapLiveBucket {
2426    const PROTO_FQN: &'static str = "marketdata.v1.HeatmapLiveBucket";
2427    fn unknown_fields(&self) -> &::buffa::UnknownFields {
2428        &self.__buffa_unknown_fields
2429    }
2430    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2431        &mut self.__buffa_unknown_fields
2432    }
2433}
2434impl ::buffa::json_helpers::ProtoElemJson for HeatmapLiveBucket {
2435    fn serialize_proto_json<S: ::serde::Serializer>(
2436        v: &Self,
2437        s: S,
2438    ) -> ::core::result::Result<S::Ok, S::Error> {
2439        ::serde::Serialize::serialize(v, s)
2440    }
2441    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2442        d: D,
2443    ) -> ::core::result::Result<Self, D::Error> {
2444        <Self as ::serde::Deserialize>::deserialize(d)
2445    }
2446}
2447#[doc(hidden)]
2448pub const __HEATMAP_LIVE_BUCKET_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2449    type_url: "type.googleapis.com/marketdata.v1.HeatmapLiveBucket",
2450    to_json: ::buffa::type_registry::any_to_json::<HeatmapLiveBucket>,
2451    from_json: ::buffa::type_registry::any_from_json::<HeatmapLiveBucket>,
2452    is_wkt: false,
2453};
2454/// HeatmapDeltaChain is the historical payload for all intervals.
2455/// Reconstruct by applying deltas over base_keyframe.
2456/// Deltas are ordered oldest-first by ts_sec.
2457#[derive(Clone, PartialEq, Default)]
2458#[derive(::serde::Serialize, ::serde::Deserialize)]
2459#[serde(default)]
2460pub struct HeatmapDeltaChain {
2461    /// Full-book snapshot from which to apply the returned deltas.
2462    ///
2463    /// Field 1: `base_keyframe`
2464    #[serde(
2465        rename = "baseKeyframe",
2466        alias = "base_keyframe",
2467        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
2468    )]
2469    pub base_keyframe: ::buffa::MessageField<HeatmapKeyframe>,
2470    /// Sparse update buckets ordered oldest-first by timestamp.
2471    ///
2472    /// Field 2: `deltas`
2473    #[serde(
2474        rename = "deltas",
2475        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
2476        deserialize_with = "::buffa::json_helpers::null_as_default"
2477    )]
2478    pub deltas: ::buffa::alloc::vec::Vec<HeatmapDeltaBucket>,
2479    #[serde(skip)]
2480    #[doc(hidden)]
2481    pub __buffa_unknown_fields: ::buffa::UnknownFields,
2482}
2483impl ::core::fmt::Debug for HeatmapDeltaChain {
2484    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2485        f.debug_struct("HeatmapDeltaChain")
2486            .field("base_keyframe", &self.base_keyframe)
2487            .field("deltas", &self.deltas)
2488            .finish()
2489    }
2490}
2491impl HeatmapDeltaChain {
2492    /// Protobuf type URL for this message, for use with `Any::pack` and
2493    /// `Any::unpack_if`.
2494    ///
2495    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
2496    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.HeatmapDeltaChain";
2497}
2498::buffa::impl_default_instance!(HeatmapDeltaChain);
2499impl ::buffa::MessageName for HeatmapDeltaChain {
2500    const PACKAGE: &'static str = "marketdata.v1";
2501    const NAME: &'static str = "HeatmapDeltaChain";
2502    const FULL_NAME: &'static str = "marketdata.v1.HeatmapDeltaChain";
2503    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.HeatmapDeltaChain";
2504}
2505impl ::buffa::Message for HeatmapDeltaChain {
2506    /// Returns the total encoded size in bytes.
2507    ///
2508    /// The result is a `u32`; the protobuf specification requires all
2509    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
2510    /// compliant message will never overflow this type.
2511    #[allow(clippy::let_and_return)]
2512    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
2513        #[allow(unused_imports)]
2514        use ::buffa::Enumeration as _;
2515        let mut size = 0u32;
2516        if self.base_keyframe.is_set() {
2517            let __slot = __cache.reserve();
2518            let inner_size = self.base_keyframe.compute_size(__cache);
2519            __cache.set(__slot, inner_size);
2520            size
2521                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
2522                    + inner_size;
2523        }
2524        for v in &self.deltas {
2525            let __slot = __cache.reserve();
2526            let inner_size = v.compute_size(__cache);
2527            __cache.set(__slot, inner_size);
2528            size
2529                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
2530                    + inner_size;
2531        }
2532        size += self.__buffa_unknown_fields.encoded_len() as u32;
2533        size
2534    }
2535    fn write_to(
2536        &self,
2537        __cache: &mut ::buffa::SizeCache,
2538        buf: &mut impl ::buffa::bytes::BufMut,
2539    ) {
2540        #[allow(unused_imports)]
2541        use ::buffa::Enumeration as _;
2542        if self.base_keyframe.is_set() {
2543            ::buffa::types::put_len_delimited_header(1u32, __cache.consume_next(), buf);
2544            self.base_keyframe.write_to(__cache, buf);
2545        }
2546        for v in &self.deltas {
2547            ::buffa::types::put_len_delimited_header(2u32, __cache.consume_next(), buf);
2548            v.write_to(__cache, buf);
2549        }
2550        self.__buffa_unknown_fields.write_to(buf);
2551    }
2552    fn merge_field(
2553        &mut self,
2554        tag: ::buffa::encoding::Tag,
2555        buf: &mut impl ::buffa::bytes::Buf,
2556        ctx: ::buffa::DecodeContext<'_>,
2557    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2558        #[allow(unused_imports)]
2559        use ::buffa::bytes::Buf as _;
2560        #[allow(unused_imports)]
2561        use ::buffa::Enumeration as _;
2562        match tag.field_number() {
2563            1u32 => {
2564                ::buffa::encoding::check_wire_type(
2565                    tag,
2566                    ::buffa::encoding::WireType::LengthDelimited,
2567                )?;
2568                ::buffa::Message::merge_length_delimited(
2569                    self.base_keyframe.get_or_insert_default(),
2570                    buf,
2571                    ctx,
2572                )?;
2573            }
2574            2u32 => {
2575                ::buffa::encoding::check_wire_type(
2576                    tag,
2577                    ::buffa::encoding::WireType::LengthDelimited,
2578                )?;
2579                let mut elem = ::core::default::Default::default();
2580                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
2581                self.deltas.push(elem);
2582            }
2583            _ => {
2584                self.__buffa_unknown_fields
2585                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
2586            }
2587        }
2588        ::core::result::Result::Ok(())
2589    }
2590    fn clear(&mut self) {
2591        self.base_keyframe = ::buffa::MessageField::none();
2592        self.deltas.clear();
2593        self.__buffa_unknown_fields.clear();
2594    }
2595}
2596impl ::buffa::ExtensionSet for HeatmapDeltaChain {
2597    const PROTO_FQN: &'static str = "marketdata.v1.HeatmapDeltaChain";
2598    fn unknown_fields(&self) -> &::buffa::UnknownFields {
2599        &self.__buffa_unknown_fields
2600    }
2601    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2602        &mut self.__buffa_unknown_fields
2603    }
2604}
2605impl ::buffa::json_helpers::ProtoElemJson for HeatmapDeltaChain {
2606    fn serialize_proto_json<S: ::serde::Serializer>(
2607        v: &Self,
2608        s: S,
2609    ) -> ::core::result::Result<S::Ok, S::Error> {
2610        ::serde::Serialize::serialize(v, s)
2611    }
2612    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2613        d: D,
2614    ) -> ::core::result::Result<Self, D::Error> {
2615        <Self as ::serde::Deserialize>::deserialize(d)
2616    }
2617}
2618#[doc(hidden)]
2619pub const __HEATMAP_DELTA_CHAIN_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2620    type_url: "type.googleapis.com/marketdata.v1.HeatmapDeltaChain",
2621    to_json: ::buffa::type_registry::any_to_json::<HeatmapDeltaChain>,
2622    from_json: ::buffa::type_registry::any_from_json::<HeatmapDeltaChain>,
2623    is_wkt: false,
2624};
2625/// GetOrderbookHeatmapResponse returns a historical replay chain plus optional
2626/// live bucket state for explicit realtime stitching.
2627#[derive(Clone, PartialEq, Default)]
2628#[derive(::serde::Serialize, ::serde::Deserialize)]
2629#[serde(default)]
2630pub struct GetOrderbookHeatmapResponse {
2631    /// Numeric spot market identifier returned for the requested market.
2632    ///
2633    /// Field 1: `symbol_id`
2634    #[serde(
2635        rename = "symbolId",
2636        alias = "symbol_id",
2637        with = "::buffa::json_helpers::uint32",
2638        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
2639    )]
2640    pub symbol_id: u32,
2641    /// Bucket interval used for the returned chain.
2642    ///
2643    /// Field 2: `interval`
2644    #[serde(
2645        rename = "interval",
2646        with = "::buffa::json_helpers::proto_enum",
2647        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
2648    )]
2649    pub interval: ::buffa::EnumValue<HeatmapInterval>,
2650    /// Top-N depth requested per side.
2651    ///
2652    /// Field 3: `depth`
2653    #[serde(
2654        rename = "depth",
2655        with = "::buffa::json_helpers::proto_enum",
2656        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
2657    )]
2658    pub depth: ::buffa::EnumValue<HeatmapDepth>,
2659    /// Always returned as snapshot + sparse deltas for the requested interval.
2660    ///
2661    /// Field 4: `chain`
2662    #[serde(
2663        rename = "chain",
2664        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
2665    )]
2666    pub chain: ::buffa::MessageField<HeatmapDeltaChain>,
2667    /// Latest finalized historical bucket timestamp in seconds since epoch (UTC).
2668    ///
2669    /// Field 5: `last_persisted_ts_sec`
2670    #[serde(
2671        rename = "lastPersistedTsSec",
2672        alias = "last_persisted_ts_sec",
2673        with = "::buffa::json_helpers::uint64",
2674        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
2675    )]
2676    pub last_persisted_ts_sec: u64,
2677    /// Book sequence anchor for realtime continuation; apply live updates where book_seq_end is greater than this value.
2678    ///
2679    /// Field 6: `live_from_book_seq_end`
2680    #[serde(
2681        rename = "liveFromBookSeqEnd",
2682        alias = "live_from_book_seq_end",
2683        with = "::buffa::json_helpers::uint64",
2684        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
2685    )]
2686    pub live_from_book_seq_end: u64,
2687    /// True when live_from_book_seq_end is available and can be used as a realtime continuation anchor.
2688    ///
2689    /// Field 7: `has_live_anchor`
2690    #[serde(
2691        rename = "hasLiveAnchor",
2692        alias = "has_live_anchor",
2693        with = "::buffa::json_helpers::proto_bool",
2694        skip_serializing_if = "::buffa::json_helpers::skip_if::is_false"
2695    )]
2696    pub has_live_anchor: bool,
2697    /// Opaque cursor for the next page. Empty when no more results exist.
2698    ///
2699    /// Field 8: `next_page_token`
2700    #[serde(
2701        rename = "nextPageToken",
2702        alias = "next_page_token",
2703        with = "::buffa::json_helpers::proto_string",
2704        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
2705    )]
2706    pub next_page_token: ::buffa::alloc::string::String,
2707    /// Server response time in seconds since epoch (UTC).
2708    ///
2709    /// Field 10: `server_time_sec`
2710    #[serde(
2711        rename = "serverTimeSec",
2712        alias = "server_time_sec",
2713        with = "::buffa::json_helpers::uint64",
2714        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
2715    )]
2716    pub server_time_sec: u64,
2717    /// Quantity mode used for all qty_scaled values in the response.
2718    ///
2719    /// Field 11: `quantity_mode`
2720    #[serde(
2721        rename = "quantityMode",
2722        alias = "quantity_mode",
2723        with = "::buffa::json_helpers::proto_enum",
2724        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
2725    )]
2726    pub quantity_mode: ::buffa::EnumValue<HeatmapQuantityMode>,
2727    /// Optional latest live bucket for the requested interval and depth.
2728    /// Present only when it is newer than the historical anchor and its quantity semantics match quantity_mode.
2729    ///
2730    /// Field 12: `live_bucket`
2731    #[serde(
2732        rename = "liveBucket",
2733        alias = "live_bucket",
2734        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
2735    )]
2736    pub live_bucket: ::buffa::MessageField<HeatmapLiveBucket>,
2737    #[serde(skip)]
2738    #[doc(hidden)]
2739    pub __buffa_unknown_fields: ::buffa::UnknownFields,
2740}
2741impl ::core::fmt::Debug for GetOrderbookHeatmapResponse {
2742    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2743        f.debug_struct("GetOrderbookHeatmapResponse")
2744            .field("symbol_id", &self.symbol_id)
2745            .field("interval", &self.interval)
2746            .field("depth", &self.depth)
2747            .field("chain", &self.chain)
2748            .field("last_persisted_ts_sec", &self.last_persisted_ts_sec)
2749            .field("live_from_book_seq_end", &self.live_from_book_seq_end)
2750            .field("has_live_anchor", &self.has_live_anchor)
2751            .field("next_page_token", &self.next_page_token)
2752            .field("server_time_sec", &self.server_time_sec)
2753            .field("quantity_mode", &self.quantity_mode)
2754            .field("live_bucket", &self.live_bucket)
2755            .finish()
2756    }
2757}
2758impl GetOrderbookHeatmapResponse {
2759    /// Protobuf type URL for this message, for use with `Any::pack` and
2760    /// `Any::unpack_if`.
2761    ///
2762    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
2763    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetOrderbookHeatmapResponse";
2764}
2765::buffa::impl_default_instance!(GetOrderbookHeatmapResponse);
2766impl ::buffa::MessageName for GetOrderbookHeatmapResponse {
2767    const PACKAGE: &'static str = "marketdata.v1";
2768    const NAME: &'static str = "GetOrderbookHeatmapResponse";
2769    const FULL_NAME: &'static str = "marketdata.v1.GetOrderbookHeatmapResponse";
2770    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetOrderbookHeatmapResponse";
2771}
2772impl ::buffa::Message for GetOrderbookHeatmapResponse {
2773    /// Returns the total encoded size in bytes.
2774    ///
2775    /// The result is a `u32`; the protobuf specification requires all
2776    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
2777    /// compliant message will never overflow this type.
2778    #[allow(clippy::let_and_return)]
2779    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
2780        #[allow(unused_imports)]
2781        use ::buffa::Enumeration as _;
2782        let mut size = 0u32;
2783        if self.symbol_id != 0u32 {
2784            size += 1u32 + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
2785        }
2786        {
2787            let val = self.interval.to_i32();
2788            if val != 0 {
2789                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
2790            }
2791        }
2792        {
2793            let val = self.depth.to_i32();
2794            if val != 0 {
2795                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
2796            }
2797        }
2798        if self.chain.is_set() {
2799            let __slot = __cache.reserve();
2800            let inner_size = self.chain.compute_size(__cache);
2801            __cache.set(__slot, inner_size);
2802            size
2803                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
2804                    + inner_size;
2805        }
2806        if self.last_persisted_ts_sec != 0u64 {
2807            size
2808                += 1u32
2809                    + ::buffa::types::uint64_encoded_len(self.last_persisted_ts_sec)
2810                        as u32;
2811        }
2812        if self.live_from_book_seq_end != 0u64 {
2813            size
2814                += 1u32
2815                    + ::buffa::types::uint64_encoded_len(self.live_from_book_seq_end)
2816                        as u32;
2817        }
2818        if self.has_live_anchor {
2819            size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
2820        }
2821        if !self.next_page_token.is_empty() {
2822            size
2823                += 1u32
2824                    + ::buffa::types::string_encoded_len(&self.next_page_token) as u32;
2825        }
2826        if self.server_time_sec != 0u64 {
2827            size
2828                += 1u32
2829                    + ::buffa::types::uint64_encoded_len(self.server_time_sec) as u32;
2830        }
2831        {
2832            let val = self.quantity_mode.to_i32();
2833            if val != 0 {
2834                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
2835            }
2836        }
2837        if self.live_bucket.is_set() {
2838            let __slot = __cache.reserve();
2839            let inner_size = self.live_bucket.compute_size(__cache);
2840            __cache.set(__slot, inner_size);
2841            size
2842                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
2843                    + inner_size;
2844        }
2845        size += self.__buffa_unknown_fields.encoded_len() as u32;
2846        size
2847    }
2848    fn write_to(
2849        &self,
2850        __cache: &mut ::buffa::SizeCache,
2851        buf: &mut impl ::buffa::bytes::BufMut,
2852    ) {
2853        #[allow(unused_imports)]
2854        use ::buffa::Enumeration as _;
2855        if self.symbol_id != 0u32 {
2856            ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
2857        }
2858        {
2859            let val = self.interval.to_i32();
2860            if val != 0 {
2861                ::buffa::types::put_int32_field(2u32, val, buf);
2862            }
2863        }
2864        {
2865            let val = self.depth.to_i32();
2866            if val != 0 {
2867                ::buffa::types::put_int32_field(3u32, val, buf);
2868            }
2869        }
2870        if self.chain.is_set() {
2871            ::buffa::types::put_len_delimited_header(4u32, __cache.consume_next(), buf);
2872            self.chain.write_to(__cache, buf);
2873        }
2874        if self.last_persisted_ts_sec != 0u64 {
2875            ::buffa::types::put_uint64_field(5u32, self.last_persisted_ts_sec, buf);
2876        }
2877        if self.live_from_book_seq_end != 0u64 {
2878            ::buffa::types::put_uint64_field(6u32, self.live_from_book_seq_end, buf);
2879        }
2880        if self.has_live_anchor {
2881            ::buffa::types::put_bool_field(7u32, self.has_live_anchor, buf);
2882        }
2883        if !self.next_page_token.is_empty() {
2884            ::buffa::types::put_string_field(8u32, &self.next_page_token, buf);
2885        }
2886        if self.server_time_sec != 0u64 {
2887            ::buffa::types::put_uint64_field(10u32, self.server_time_sec, buf);
2888        }
2889        {
2890            let val = self.quantity_mode.to_i32();
2891            if val != 0 {
2892                ::buffa::types::put_int32_field(11u32, val, buf);
2893            }
2894        }
2895        if self.live_bucket.is_set() {
2896            ::buffa::types::put_len_delimited_header(12u32, __cache.consume_next(), buf);
2897            self.live_bucket.write_to(__cache, buf);
2898        }
2899        self.__buffa_unknown_fields.write_to(buf);
2900    }
2901    fn merge_field(
2902        &mut self,
2903        tag: ::buffa::encoding::Tag,
2904        buf: &mut impl ::buffa::bytes::Buf,
2905        ctx: ::buffa::DecodeContext<'_>,
2906    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2907        #[allow(unused_imports)]
2908        use ::buffa::bytes::Buf as _;
2909        #[allow(unused_imports)]
2910        use ::buffa::Enumeration as _;
2911        match tag.field_number() {
2912            1u32 => {
2913                ::buffa::encoding::check_wire_type(
2914                    tag,
2915                    ::buffa::encoding::WireType::Varint,
2916                )?;
2917                self.symbol_id = ::buffa::types::decode_uint32(buf)?;
2918            }
2919            2u32 => {
2920                ::buffa::encoding::check_wire_type(
2921                    tag,
2922                    ::buffa::encoding::WireType::Varint,
2923                )?;
2924                self.interval = ::buffa::EnumValue::from(
2925                    ::buffa::types::decode_int32(buf)?,
2926                );
2927            }
2928            3u32 => {
2929                ::buffa::encoding::check_wire_type(
2930                    tag,
2931                    ::buffa::encoding::WireType::Varint,
2932                )?;
2933                self.depth = ::buffa::EnumValue::from(
2934                    ::buffa::types::decode_int32(buf)?,
2935                );
2936            }
2937            4u32 => {
2938                ::buffa::encoding::check_wire_type(
2939                    tag,
2940                    ::buffa::encoding::WireType::LengthDelimited,
2941                )?;
2942                ::buffa::Message::merge_length_delimited(
2943                    self.chain.get_or_insert_default(),
2944                    buf,
2945                    ctx,
2946                )?;
2947            }
2948            5u32 => {
2949                ::buffa::encoding::check_wire_type(
2950                    tag,
2951                    ::buffa::encoding::WireType::Varint,
2952                )?;
2953                self.last_persisted_ts_sec = ::buffa::types::decode_uint64(buf)?;
2954            }
2955            6u32 => {
2956                ::buffa::encoding::check_wire_type(
2957                    tag,
2958                    ::buffa::encoding::WireType::Varint,
2959                )?;
2960                self.live_from_book_seq_end = ::buffa::types::decode_uint64(buf)?;
2961            }
2962            7u32 => {
2963                ::buffa::encoding::check_wire_type(
2964                    tag,
2965                    ::buffa::encoding::WireType::Varint,
2966                )?;
2967                self.has_live_anchor = ::buffa::types::decode_bool(buf)?;
2968            }
2969            8u32 => {
2970                ::buffa::encoding::check_wire_type(
2971                    tag,
2972                    ::buffa::encoding::WireType::LengthDelimited,
2973                )?;
2974                ::buffa::types::merge_string(&mut self.next_page_token, buf)?;
2975            }
2976            10u32 => {
2977                ::buffa::encoding::check_wire_type(
2978                    tag,
2979                    ::buffa::encoding::WireType::Varint,
2980                )?;
2981                self.server_time_sec = ::buffa::types::decode_uint64(buf)?;
2982            }
2983            11u32 => {
2984                ::buffa::encoding::check_wire_type(
2985                    tag,
2986                    ::buffa::encoding::WireType::Varint,
2987                )?;
2988                self.quantity_mode = ::buffa::EnumValue::from(
2989                    ::buffa::types::decode_int32(buf)?,
2990                );
2991            }
2992            12u32 => {
2993                ::buffa::encoding::check_wire_type(
2994                    tag,
2995                    ::buffa::encoding::WireType::LengthDelimited,
2996                )?;
2997                ::buffa::Message::merge_length_delimited(
2998                    self.live_bucket.get_or_insert_default(),
2999                    buf,
3000                    ctx,
3001                )?;
3002            }
3003            _ => {
3004                self.__buffa_unknown_fields
3005                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
3006            }
3007        }
3008        ::core::result::Result::Ok(())
3009    }
3010    fn clear(&mut self) {
3011        self.symbol_id = 0u32;
3012        self.interval = ::buffa::EnumValue::from(0);
3013        self.depth = ::buffa::EnumValue::from(0);
3014        self.chain = ::buffa::MessageField::none();
3015        self.last_persisted_ts_sec = 0u64;
3016        self.live_from_book_seq_end = 0u64;
3017        self.has_live_anchor = false;
3018        self.next_page_token.clear();
3019        self.server_time_sec = 0u64;
3020        self.quantity_mode = ::buffa::EnumValue::from(0);
3021        self.live_bucket = ::buffa::MessageField::none();
3022        self.__buffa_unknown_fields.clear();
3023    }
3024}
3025impl ::buffa::ExtensionSet for GetOrderbookHeatmapResponse {
3026    const PROTO_FQN: &'static str = "marketdata.v1.GetOrderbookHeatmapResponse";
3027    fn unknown_fields(&self) -> &::buffa::UnknownFields {
3028        &self.__buffa_unknown_fields
3029    }
3030    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
3031        &mut self.__buffa_unknown_fields
3032    }
3033}
3034impl ::buffa::json_helpers::ProtoElemJson for GetOrderbookHeatmapResponse {
3035    fn serialize_proto_json<S: ::serde::Serializer>(
3036        v: &Self,
3037        s: S,
3038    ) -> ::core::result::Result<S::Ok, S::Error> {
3039        ::serde::Serialize::serialize(v, s)
3040    }
3041    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
3042        d: D,
3043    ) -> ::core::result::Result<Self, D::Error> {
3044        <Self as ::serde::Deserialize>::deserialize(d)
3045    }
3046}
3047#[doc(hidden)]
3048pub const __GET_ORDERBOOK_HEATMAP_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
3049    type_url: "type.googleapis.com/marketdata.v1.GetOrderbookHeatmapResponse",
3050    to_json: ::buffa::type_registry::any_to_json::<GetOrderbookHeatmapResponse>,
3051    from_json: ::buffa::type_registry::any_from_json::<GetOrderbookHeatmapResponse>,
3052    is_wkt: false,
3053};
3054/// SideFilter controls which aggressor side of trades to return.
3055#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
3056#[repr(i32)]
3057pub enum SideFilter {
3058    /// Return trades from both BUY and SELL aggressors.
3059    SIDE_UNSPECIFIED = 0i32,
3060    /// Return trades where the taker/aggressor was buying the base asset.
3061    BUY = 1i32,
3062    /// Return trades where the taker/aggressor was selling the base asset.
3063    SELL = 2i32,
3064}
3065impl SideFilter {
3066    ///Idiomatic alias for [`Self::SIDE_UNSPECIFIED`]; `Debug` prints the variant name.
3067    #[allow(non_upper_case_globals)]
3068    pub const SideUnspecified: Self = Self::SIDE_UNSPECIFIED;
3069    ///Idiomatic alias for [`Self::BUY`]; `Debug` prints the variant name.
3070    #[allow(non_upper_case_globals)]
3071    pub const Buy: Self = Self::BUY;
3072    ///Idiomatic alias for [`Self::SELL`]; `Debug` prints the variant name.
3073    #[allow(non_upper_case_globals)]
3074    pub const Sell: Self = Self::SELL;
3075}
3076impl ::core::default::Default for SideFilter {
3077    fn default() -> Self {
3078        Self::SIDE_UNSPECIFIED
3079    }
3080}
3081impl ::serde::Serialize for SideFilter {
3082    fn serialize<S: ::serde::Serializer>(
3083        &self,
3084        s: S,
3085    ) -> ::core::result::Result<S::Ok, S::Error> {
3086        s.serialize_str(::buffa::Enumeration::proto_name(self))
3087    }
3088}
3089impl<'de> ::serde::Deserialize<'de> for SideFilter {
3090    fn deserialize<D: ::serde::Deserializer<'de>>(
3091        d: D,
3092    ) -> ::core::result::Result<Self, D::Error> {
3093        struct _V;
3094        impl ::serde::de::Visitor<'_> for _V {
3095            type Value = SideFilter;
3096            fn expecting(
3097                &self,
3098                f: &mut ::core::fmt::Formatter<'_>,
3099            ) -> ::core::fmt::Result {
3100                f.write_str(
3101                    concat!("a string, integer, or null for ", stringify!(SideFilter)),
3102                )
3103            }
3104            fn visit_str<E: ::serde::de::Error>(
3105                self,
3106                v: &str,
3107            ) -> ::core::result::Result<SideFilter, E> {
3108                <SideFilter as ::buffa::Enumeration>::from_proto_name(v)
3109                    .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
3110            }
3111            fn visit_i64<E: ::serde::de::Error>(
3112                self,
3113                v: i64,
3114            ) -> ::core::result::Result<SideFilter, E> {
3115                let v32 = i32::try_from(v)
3116                    .map_err(|_| {
3117                        ::serde::de::Error::custom(
3118                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
3119                        )
3120                    })?;
3121                <SideFilter as ::buffa::Enumeration>::from_i32(v32)
3122                    .ok_or_else(|| {
3123                        ::serde::de::Error::custom(
3124                            ::buffa::alloc::format!("unknown enum value {v32}"),
3125                        )
3126                    })
3127            }
3128            fn visit_u64<E: ::serde::de::Error>(
3129                self,
3130                v: u64,
3131            ) -> ::core::result::Result<SideFilter, E> {
3132                let v32 = i32::try_from(v)
3133                    .map_err(|_| {
3134                        ::serde::de::Error::custom(
3135                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
3136                        )
3137                    })?;
3138                <SideFilter as ::buffa::Enumeration>::from_i32(v32)
3139                    .ok_or_else(|| {
3140                        ::serde::de::Error::custom(
3141                            ::buffa::alloc::format!("unknown enum value {v32}"),
3142                        )
3143                    })
3144            }
3145            fn visit_unit<E: ::serde::de::Error>(
3146                self,
3147            ) -> ::core::result::Result<SideFilter, E> {
3148                ::core::result::Result::Ok(::core::default::Default::default())
3149            }
3150        }
3151        d.deserialize_any(_V)
3152    }
3153}
3154impl ::buffa::json_helpers::ProtoElemJson for SideFilter {
3155    fn serialize_proto_json<S: ::serde::Serializer>(
3156        v: &Self,
3157        s: S,
3158    ) -> ::core::result::Result<S::Ok, S::Error> {
3159        ::serde::Serialize::serialize(v, s)
3160    }
3161    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
3162        d: D,
3163    ) -> ::core::result::Result<Self, D::Error> {
3164        <Self as ::serde::Deserialize>::deserialize(d)
3165    }
3166}
3167impl ::buffa::Enumeration for SideFilter {
3168    fn from_i32(value: i32) -> ::core::option::Option<Self> {
3169        match value {
3170            0i32 => ::core::option::Option::Some(Self::SIDE_UNSPECIFIED),
3171            1i32 => ::core::option::Option::Some(Self::BUY),
3172            2i32 => ::core::option::Option::Some(Self::SELL),
3173            _ => ::core::option::Option::None,
3174        }
3175    }
3176    fn to_i32(&self) -> i32 {
3177        *self as i32
3178    }
3179    fn proto_name(&self) -> &'static str {
3180        match self {
3181            Self::SIDE_UNSPECIFIED => "SIDE_UNSPECIFIED",
3182            Self::BUY => "BUY",
3183            Self::SELL => "SELL",
3184        }
3185    }
3186    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
3187        match name {
3188            "SIDE_UNSPECIFIED" => ::core::option::Option::Some(Self::SIDE_UNSPECIFIED),
3189            "BUY" => ::core::option::Option::Some(Self::BUY),
3190            "SELL" => ::core::option::Option::Some(Self::SELL),
3191            _ => ::core::option::Option::None,
3192        }
3193    }
3194    fn values() -> &'static [Self] {
3195        &[Self::SIDE_UNSPECIFIED, Self::BUY, Self::SELL]
3196    }
3197}
3198/// Timeframe represents an OHLCV candle bucket.
3199///
3200/// Most values are fixed-duration buckets. `MONTH_1` is calendar-based (UTC
3201/// month boundaries).
3202#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
3203#[repr(i32)]
3204pub enum Timeframe {
3205    TIMEFRAME_UNSPECIFIED = 0i32,
3206    /// 1 second
3207    SEC_1 = 1i32,
3208    /// 1 minute
3209    MIN_1 = 2i32,
3210    /// 5 minutes
3211    MIN_5 = 3i32,
3212    /// 15 minutes
3213    MIN_15 = 4i32,
3214    /// 30 minutes
3215    MIN_30 = 5i32,
3216    /// 1 hour
3217    HOUR_1 = 6i32,
3218    /// 4 hours
3219    HOUR_4 = 7i32,
3220    /// 1 day
3221    DAY_1 = 8i32,
3222    /// 12 hours
3223    HOUR_12 = 9i32,
3224    /// 1 week
3225    WEEK_1 = 10i32,
3226    /// 1 month (calendar month, UTC)
3227    MONTH_1 = 11i32,
3228}
3229impl Timeframe {
3230    ///Idiomatic alias for [`Self::TIMEFRAME_UNSPECIFIED`]; `Debug` prints the variant name.
3231    #[allow(non_upper_case_globals)]
3232    pub const TimeframeUnspecified: Self = Self::TIMEFRAME_UNSPECIFIED;
3233    ///Idiomatic alias for [`Self::SEC_1`]; `Debug` prints the variant name.
3234    #[allow(non_upper_case_globals)]
3235    pub const Sec1: Self = Self::SEC_1;
3236    ///Idiomatic alias for [`Self::MIN_1`]; `Debug` prints the variant name.
3237    #[allow(non_upper_case_globals)]
3238    pub const Min1: Self = Self::MIN_1;
3239    ///Idiomatic alias for [`Self::MIN_5`]; `Debug` prints the variant name.
3240    #[allow(non_upper_case_globals)]
3241    pub const Min5: Self = Self::MIN_5;
3242    ///Idiomatic alias for [`Self::MIN_15`]; `Debug` prints the variant name.
3243    #[allow(non_upper_case_globals)]
3244    pub const Min15: Self = Self::MIN_15;
3245    ///Idiomatic alias for [`Self::MIN_30`]; `Debug` prints the variant name.
3246    #[allow(non_upper_case_globals)]
3247    pub const Min30: Self = Self::MIN_30;
3248    ///Idiomatic alias for [`Self::HOUR_1`]; `Debug` prints the variant name.
3249    #[allow(non_upper_case_globals)]
3250    pub const Hour1: Self = Self::HOUR_1;
3251    ///Idiomatic alias for [`Self::HOUR_4`]; `Debug` prints the variant name.
3252    #[allow(non_upper_case_globals)]
3253    pub const Hour4: Self = Self::HOUR_4;
3254    ///Idiomatic alias for [`Self::DAY_1`]; `Debug` prints the variant name.
3255    #[allow(non_upper_case_globals)]
3256    pub const Day1: Self = Self::DAY_1;
3257    ///Idiomatic alias for [`Self::HOUR_12`]; `Debug` prints the variant name.
3258    #[allow(non_upper_case_globals)]
3259    pub const Hour12: Self = Self::HOUR_12;
3260    ///Idiomatic alias for [`Self::WEEK_1`]; `Debug` prints the variant name.
3261    #[allow(non_upper_case_globals)]
3262    pub const Week1: Self = Self::WEEK_1;
3263    ///Idiomatic alias for [`Self::MONTH_1`]; `Debug` prints the variant name.
3264    #[allow(non_upper_case_globals)]
3265    pub const Month1: Self = Self::MONTH_1;
3266}
3267impl ::core::default::Default for Timeframe {
3268    fn default() -> Self {
3269        Self::TIMEFRAME_UNSPECIFIED
3270    }
3271}
3272impl ::serde::Serialize for Timeframe {
3273    fn serialize<S: ::serde::Serializer>(
3274        &self,
3275        s: S,
3276    ) -> ::core::result::Result<S::Ok, S::Error> {
3277        s.serialize_str(::buffa::Enumeration::proto_name(self))
3278    }
3279}
3280impl<'de> ::serde::Deserialize<'de> for Timeframe {
3281    fn deserialize<D: ::serde::Deserializer<'de>>(
3282        d: D,
3283    ) -> ::core::result::Result<Self, D::Error> {
3284        struct _V;
3285        impl ::serde::de::Visitor<'_> for _V {
3286            type Value = Timeframe;
3287            fn expecting(
3288                &self,
3289                f: &mut ::core::fmt::Formatter<'_>,
3290            ) -> ::core::fmt::Result {
3291                f.write_str(
3292                    concat!("a string, integer, or null for ", stringify!(Timeframe)),
3293                )
3294            }
3295            fn visit_str<E: ::serde::de::Error>(
3296                self,
3297                v: &str,
3298            ) -> ::core::result::Result<Timeframe, E> {
3299                <Timeframe as ::buffa::Enumeration>::from_proto_name(v)
3300                    .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
3301            }
3302            fn visit_i64<E: ::serde::de::Error>(
3303                self,
3304                v: i64,
3305            ) -> ::core::result::Result<Timeframe, E> {
3306                let v32 = i32::try_from(v)
3307                    .map_err(|_| {
3308                        ::serde::de::Error::custom(
3309                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
3310                        )
3311                    })?;
3312                <Timeframe as ::buffa::Enumeration>::from_i32(v32)
3313                    .ok_or_else(|| {
3314                        ::serde::de::Error::custom(
3315                            ::buffa::alloc::format!("unknown enum value {v32}"),
3316                        )
3317                    })
3318            }
3319            fn visit_u64<E: ::serde::de::Error>(
3320                self,
3321                v: u64,
3322            ) -> ::core::result::Result<Timeframe, E> {
3323                let v32 = i32::try_from(v)
3324                    .map_err(|_| {
3325                        ::serde::de::Error::custom(
3326                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
3327                        )
3328                    })?;
3329                <Timeframe as ::buffa::Enumeration>::from_i32(v32)
3330                    .ok_or_else(|| {
3331                        ::serde::de::Error::custom(
3332                            ::buffa::alloc::format!("unknown enum value {v32}"),
3333                        )
3334                    })
3335            }
3336            fn visit_unit<E: ::serde::de::Error>(
3337                self,
3338            ) -> ::core::result::Result<Timeframe, E> {
3339                ::core::result::Result::Ok(::core::default::Default::default())
3340            }
3341        }
3342        d.deserialize_any(_V)
3343    }
3344}
3345impl ::buffa::json_helpers::ProtoElemJson for Timeframe {
3346    fn serialize_proto_json<S: ::serde::Serializer>(
3347        v: &Self,
3348        s: S,
3349    ) -> ::core::result::Result<S::Ok, S::Error> {
3350        ::serde::Serialize::serialize(v, s)
3351    }
3352    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
3353        d: D,
3354    ) -> ::core::result::Result<Self, D::Error> {
3355        <Self as ::serde::Deserialize>::deserialize(d)
3356    }
3357}
3358impl ::buffa::Enumeration for Timeframe {
3359    fn from_i32(value: i32) -> ::core::option::Option<Self> {
3360        match value {
3361            0i32 => ::core::option::Option::Some(Self::TIMEFRAME_UNSPECIFIED),
3362            1i32 => ::core::option::Option::Some(Self::SEC_1),
3363            2i32 => ::core::option::Option::Some(Self::MIN_1),
3364            3i32 => ::core::option::Option::Some(Self::MIN_5),
3365            4i32 => ::core::option::Option::Some(Self::MIN_15),
3366            5i32 => ::core::option::Option::Some(Self::MIN_30),
3367            6i32 => ::core::option::Option::Some(Self::HOUR_1),
3368            7i32 => ::core::option::Option::Some(Self::HOUR_4),
3369            8i32 => ::core::option::Option::Some(Self::DAY_1),
3370            9i32 => ::core::option::Option::Some(Self::HOUR_12),
3371            10i32 => ::core::option::Option::Some(Self::WEEK_1),
3372            11i32 => ::core::option::Option::Some(Self::MONTH_1),
3373            _ => ::core::option::Option::None,
3374        }
3375    }
3376    fn to_i32(&self) -> i32 {
3377        *self as i32
3378    }
3379    fn proto_name(&self) -> &'static str {
3380        match self {
3381            Self::TIMEFRAME_UNSPECIFIED => "TIMEFRAME_UNSPECIFIED",
3382            Self::SEC_1 => "SEC_1",
3383            Self::MIN_1 => "MIN_1",
3384            Self::MIN_5 => "MIN_5",
3385            Self::MIN_15 => "MIN_15",
3386            Self::MIN_30 => "MIN_30",
3387            Self::HOUR_1 => "HOUR_1",
3388            Self::HOUR_4 => "HOUR_4",
3389            Self::DAY_1 => "DAY_1",
3390            Self::HOUR_12 => "HOUR_12",
3391            Self::WEEK_1 => "WEEK_1",
3392            Self::MONTH_1 => "MONTH_1",
3393        }
3394    }
3395    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
3396        match name {
3397            "TIMEFRAME_UNSPECIFIED" => {
3398                ::core::option::Option::Some(Self::TIMEFRAME_UNSPECIFIED)
3399            }
3400            "SEC_1" => ::core::option::Option::Some(Self::SEC_1),
3401            "MIN_1" => ::core::option::Option::Some(Self::MIN_1),
3402            "MIN_5" => ::core::option::Option::Some(Self::MIN_5),
3403            "MIN_15" => ::core::option::Option::Some(Self::MIN_15),
3404            "MIN_30" => ::core::option::Option::Some(Self::MIN_30),
3405            "HOUR_1" => ::core::option::Option::Some(Self::HOUR_1),
3406            "HOUR_4" => ::core::option::Option::Some(Self::HOUR_4),
3407            "DAY_1" => ::core::option::Option::Some(Self::DAY_1),
3408            "HOUR_12" => ::core::option::Option::Some(Self::HOUR_12),
3409            "WEEK_1" => ::core::option::Option::Some(Self::WEEK_1),
3410            "MONTH_1" => ::core::option::Option::Some(Self::MONTH_1),
3411            _ => ::core::option::Option::None,
3412        }
3413    }
3414    fn values() -> &'static [Self] {
3415        &[
3416            Self::TIMEFRAME_UNSPECIFIED,
3417            Self::SEC_1,
3418            Self::MIN_1,
3419            Self::MIN_5,
3420            Self::MIN_15,
3421            Self::MIN_30,
3422            Self::HOUR_1,
3423            Self::HOUR_4,
3424            Self::DAY_1,
3425            Self::HOUR_12,
3426            Self::WEEK_1,
3427            Self::MONTH_1,
3428        ]
3429    }
3430}
3431/// PairStatus describes which order mutations a spot pair currently accepts.
3432#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
3433#[repr(i32)]
3434pub enum PairStatus {
3435    /// Pair status was not provided.
3436    PAIR_STATUS_UNSPECIFIED = 0i32,
3437    /// New orders and cancellations are accepted.
3438    PAIR_STATUS_ENABLED = 1i32,
3439    /// New orders are temporarily disabled.
3440    PAIR_STATUS_DISABLED = 2i32,
3441    /// Only cancellations are accepted.
3442    PAIR_STATUS_CANCEL_ONLY = 3i32,
3443    /// New orders must use a post-only execution variant.
3444    PAIR_STATUS_POST_ONLY = 4i32,
3445    /// New spot orders are blocked by reduce-only policy.
3446    PAIR_STATUS_REDUCE_ONLY = 5i32,
3447}
3448impl PairStatus {
3449    ///Idiomatic alias for [`Self::PAIR_STATUS_UNSPECIFIED`]; `Debug` prints the variant name.
3450    #[allow(non_upper_case_globals)]
3451    pub const Unspecified: Self = Self::PAIR_STATUS_UNSPECIFIED;
3452    ///Idiomatic alias for [`Self::PAIR_STATUS_ENABLED`]; `Debug` prints the variant name.
3453    #[allow(non_upper_case_globals)]
3454    pub const Enabled: Self = Self::PAIR_STATUS_ENABLED;
3455    ///Idiomatic alias for [`Self::PAIR_STATUS_DISABLED`]; `Debug` prints the variant name.
3456    #[allow(non_upper_case_globals)]
3457    pub const Disabled: Self = Self::PAIR_STATUS_DISABLED;
3458    ///Idiomatic alias for [`Self::PAIR_STATUS_CANCEL_ONLY`]; `Debug` prints the variant name.
3459    #[allow(non_upper_case_globals)]
3460    pub const CancelOnly: Self = Self::PAIR_STATUS_CANCEL_ONLY;
3461    ///Idiomatic alias for [`Self::PAIR_STATUS_POST_ONLY`]; `Debug` prints the variant name.
3462    #[allow(non_upper_case_globals)]
3463    pub const PostOnly: Self = Self::PAIR_STATUS_POST_ONLY;
3464    ///Idiomatic alias for [`Self::PAIR_STATUS_REDUCE_ONLY`]; `Debug` prints the variant name.
3465    #[allow(non_upper_case_globals)]
3466    pub const ReduceOnly: Self = Self::PAIR_STATUS_REDUCE_ONLY;
3467}
3468impl ::core::default::Default for PairStatus {
3469    fn default() -> Self {
3470        Self::PAIR_STATUS_UNSPECIFIED
3471    }
3472}
3473impl ::serde::Serialize for PairStatus {
3474    fn serialize<S: ::serde::Serializer>(
3475        &self,
3476        s: S,
3477    ) -> ::core::result::Result<S::Ok, S::Error> {
3478        s.serialize_str(::buffa::Enumeration::proto_name(self))
3479    }
3480}
3481impl<'de> ::serde::Deserialize<'de> for PairStatus {
3482    fn deserialize<D: ::serde::Deserializer<'de>>(
3483        d: D,
3484    ) -> ::core::result::Result<Self, D::Error> {
3485        struct _V;
3486        impl ::serde::de::Visitor<'_> for _V {
3487            type Value = PairStatus;
3488            fn expecting(
3489                &self,
3490                f: &mut ::core::fmt::Formatter<'_>,
3491            ) -> ::core::fmt::Result {
3492                f.write_str(
3493                    concat!("a string, integer, or null for ", stringify!(PairStatus)),
3494                )
3495            }
3496            fn visit_str<E: ::serde::de::Error>(
3497                self,
3498                v: &str,
3499            ) -> ::core::result::Result<PairStatus, E> {
3500                <PairStatus as ::buffa::Enumeration>::from_proto_name(v)
3501                    .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
3502            }
3503            fn visit_i64<E: ::serde::de::Error>(
3504                self,
3505                v: i64,
3506            ) -> ::core::result::Result<PairStatus, E> {
3507                let v32 = i32::try_from(v)
3508                    .map_err(|_| {
3509                        ::serde::de::Error::custom(
3510                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
3511                        )
3512                    })?;
3513                <PairStatus as ::buffa::Enumeration>::from_i32(v32)
3514                    .ok_or_else(|| {
3515                        ::serde::de::Error::custom(
3516                            ::buffa::alloc::format!("unknown enum value {v32}"),
3517                        )
3518                    })
3519            }
3520            fn visit_u64<E: ::serde::de::Error>(
3521                self,
3522                v: u64,
3523            ) -> ::core::result::Result<PairStatus, E> {
3524                let v32 = i32::try_from(v)
3525                    .map_err(|_| {
3526                        ::serde::de::Error::custom(
3527                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
3528                        )
3529                    })?;
3530                <PairStatus as ::buffa::Enumeration>::from_i32(v32)
3531                    .ok_or_else(|| {
3532                        ::serde::de::Error::custom(
3533                            ::buffa::alloc::format!("unknown enum value {v32}"),
3534                        )
3535                    })
3536            }
3537            fn visit_unit<E: ::serde::de::Error>(
3538                self,
3539            ) -> ::core::result::Result<PairStatus, E> {
3540                ::core::result::Result::Ok(::core::default::Default::default())
3541            }
3542        }
3543        d.deserialize_any(_V)
3544    }
3545}
3546impl ::buffa::json_helpers::ProtoElemJson for PairStatus {
3547    fn serialize_proto_json<S: ::serde::Serializer>(
3548        v: &Self,
3549        s: S,
3550    ) -> ::core::result::Result<S::Ok, S::Error> {
3551        ::serde::Serialize::serialize(v, s)
3552    }
3553    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
3554        d: D,
3555    ) -> ::core::result::Result<Self, D::Error> {
3556        <Self as ::serde::Deserialize>::deserialize(d)
3557    }
3558}
3559impl ::buffa::Enumeration for PairStatus {
3560    fn from_i32(value: i32) -> ::core::option::Option<Self> {
3561        match value {
3562            0i32 => ::core::option::Option::Some(Self::PAIR_STATUS_UNSPECIFIED),
3563            1i32 => ::core::option::Option::Some(Self::PAIR_STATUS_ENABLED),
3564            2i32 => ::core::option::Option::Some(Self::PAIR_STATUS_DISABLED),
3565            3i32 => ::core::option::Option::Some(Self::PAIR_STATUS_CANCEL_ONLY),
3566            4i32 => ::core::option::Option::Some(Self::PAIR_STATUS_POST_ONLY),
3567            5i32 => ::core::option::Option::Some(Self::PAIR_STATUS_REDUCE_ONLY),
3568            _ => ::core::option::Option::None,
3569        }
3570    }
3571    fn to_i32(&self) -> i32 {
3572        *self as i32
3573    }
3574    fn proto_name(&self) -> &'static str {
3575        match self {
3576            Self::PAIR_STATUS_UNSPECIFIED => "PAIR_STATUS_UNSPECIFIED",
3577            Self::PAIR_STATUS_ENABLED => "PAIR_STATUS_ENABLED",
3578            Self::PAIR_STATUS_DISABLED => "PAIR_STATUS_DISABLED",
3579            Self::PAIR_STATUS_CANCEL_ONLY => "PAIR_STATUS_CANCEL_ONLY",
3580            Self::PAIR_STATUS_POST_ONLY => "PAIR_STATUS_POST_ONLY",
3581            Self::PAIR_STATUS_REDUCE_ONLY => "PAIR_STATUS_REDUCE_ONLY",
3582        }
3583    }
3584    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
3585        match name {
3586            "PAIR_STATUS_UNSPECIFIED" => {
3587                ::core::option::Option::Some(Self::PAIR_STATUS_UNSPECIFIED)
3588            }
3589            "PAIR_STATUS_ENABLED" => {
3590                ::core::option::Option::Some(Self::PAIR_STATUS_ENABLED)
3591            }
3592            "PAIR_STATUS_DISABLED" => {
3593                ::core::option::Option::Some(Self::PAIR_STATUS_DISABLED)
3594            }
3595            "PAIR_STATUS_CANCEL_ONLY" => {
3596                ::core::option::Option::Some(Self::PAIR_STATUS_CANCEL_ONLY)
3597            }
3598            "PAIR_STATUS_POST_ONLY" => {
3599                ::core::option::Option::Some(Self::PAIR_STATUS_POST_ONLY)
3600            }
3601            "PAIR_STATUS_REDUCE_ONLY" => {
3602                ::core::option::Option::Some(Self::PAIR_STATUS_REDUCE_ONLY)
3603            }
3604            _ => ::core::option::Option::None,
3605        }
3606    }
3607    fn values() -> &'static [Self] {
3608        &[
3609            Self::PAIR_STATUS_UNSPECIFIED,
3610            Self::PAIR_STATUS_ENABLED,
3611            Self::PAIR_STATUS_DISABLED,
3612            Self::PAIR_STATUS_CANCEL_ONLY,
3613            Self::PAIR_STATUS_POST_ONLY,
3614            Self::PAIR_STATUS_REDUCE_ONLY,
3615        ]
3616    }
3617}
3618/// ---------------------------------------------------------------------------
3619/// GetTrades: Binary (protobuf) request/response with scaled integers.
3620/// REST responses expose decimal strings.
3621/// ---------------------------------------------------------------------------
3622///
3623/// GetTradesRequest selects recent public trades for one spot market.
3624///
3625/// Results are ordered newest-first by execution timestamp, with match_id as a
3626/// tie-breaker. When both start_time and end_time are set, both bounds are
3627/// inclusive.
3628#[derive(Clone, PartialEq, Default)]
3629#[derive(::serde::Serialize, ::serde::Deserialize)]
3630#[serde(default)]
3631pub struct GetTradesRequest {
3632    /// Stable numeric pair id from GetSpotConfig.
3633    ///
3634    /// Field 1: `symbol_id`
3635    #[serde(
3636        rename = "symbolId",
3637        alias = "symbol_id",
3638        with = "::buffa::json_helpers::uint32",
3639        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
3640    )]
3641    pub symbol_id: u32,
3642    /// Maximum number of trades to return. Defaults to 100 when unset; max 1000.
3643    ///
3644    /// Field 2: `limit`
3645    #[serde(
3646        rename = "limit",
3647        with = "::buffa::json_helpers::uint32",
3648        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
3649    )]
3650    pub limit: u32,
3651    /// Inclusive lower bound for trade execution time. Must not be more than
3652    /// 5 minutes in the future.
3653    ///
3654    /// Field 3: `start_time`
3655    #[serde(
3656        rename = "startTime",
3657        alias = "start_time",
3658        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
3659    )]
3660    pub start_time: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
3661    /// Inclusive upper bound for trade execution time. Must be greater than or
3662    /// equal to start_time when both are set, and must not be more than 5 minutes
3663    /// in the future.
3664    ///
3665    /// Field 4: `end_time`
3666    #[serde(
3667        rename = "endTime",
3668        alias = "end_time",
3669        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
3670    )]
3671    pub end_time: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
3672    /// Optional filter by trade aggressor side. Unspecified returns both sides.
3673    ///
3674    /// Field 5: `side`
3675    #[serde(
3676        rename = "side",
3677        with = "::buffa::json_helpers::proto_enum",
3678        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
3679    )]
3680    pub side: ::buffa::EnumValue<SideFilter>,
3681    /// Opaque keyset cursor from a previous response. The cursor is exclusive and
3682    /// bound to symbol, time bounds, side filter, and newest-first sort order.
3683    ///
3684    /// Field 6: `page_token`
3685    #[serde(
3686        rename = "pageToken",
3687        alias = "page_token",
3688        with = "::buffa::json_helpers::proto_string",
3689        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
3690    )]
3691    pub page_token: ::buffa::alloc::string::String,
3692    #[serde(skip)]
3693    #[doc(hidden)]
3694    pub __buffa_unknown_fields: ::buffa::UnknownFields,
3695}
3696impl ::core::fmt::Debug for GetTradesRequest {
3697    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3698        f.debug_struct("GetTradesRequest")
3699            .field("symbol_id", &self.symbol_id)
3700            .field("limit", &self.limit)
3701            .field("start_time", &self.start_time)
3702            .field("end_time", &self.end_time)
3703            .field("side", &self.side)
3704            .field("page_token", &self.page_token)
3705            .finish()
3706    }
3707}
3708impl GetTradesRequest {
3709    /// Protobuf type URL for this message, for use with `Any::pack` and
3710    /// `Any::unpack_if`.
3711    ///
3712    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
3713    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetTradesRequest";
3714}
3715::buffa::impl_default_instance!(GetTradesRequest);
3716impl ::buffa::MessageName for GetTradesRequest {
3717    const PACKAGE: &'static str = "marketdata.v1";
3718    const NAME: &'static str = "GetTradesRequest";
3719    const FULL_NAME: &'static str = "marketdata.v1.GetTradesRequest";
3720    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetTradesRequest";
3721}
3722impl ::buffa::Message for GetTradesRequest {
3723    /// Returns the total encoded size in bytes.
3724    ///
3725    /// The result is a `u32`; the protobuf specification requires all
3726    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
3727    /// compliant message will never overflow this type.
3728    #[allow(clippy::let_and_return)]
3729    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
3730        #[allow(unused_imports)]
3731        use ::buffa::Enumeration as _;
3732        let mut size = 0u32;
3733        if self.symbol_id != 0u32 {
3734            size += 1u32 + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
3735        }
3736        if self.limit != 0u32 {
3737            size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
3738        }
3739        if self.start_time.is_set() {
3740            let __slot = __cache.reserve();
3741            let inner_size = self.start_time.compute_size(__cache);
3742            __cache.set(__slot, inner_size);
3743            size
3744                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
3745                    + inner_size;
3746        }
3747        if self.end_time.is_set() {
3748            let __slot = __cache.reserve();
3749            let inner_size = self.end_time.compute_size(__cache);
3750            __cache.set(__slot, inner_size);
3751            size
3752                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
3753                    + inner_size;
3754        }
3755        {
3756            let val = self.side.to_i32();
3757            if val != 0 {
3758                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
3759            }
3760        }
3761        if !self.page_token.is_empty() {
3762            size += 1u32 + ::buffa::types::string_encoded_len(&self.page_token) as u32;
3763        }
3764        size += self.__buffa_unknown_fields.encoded_len() as u32;
3765        size
3766    }
3767    fn write_to(
3768        &self,
3769        __cache: &mut ::buffa::SizeCache,
3770        buf: &mut impl ::buffa::bytes::BufMut,
3771    ) {
3772        #[allow(unused_imports)]
3773        use ::buffa::Enumeration as _;
3774        if self.symbol_id != 0u32 {
3775            ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
3776        }
3777        if self.limit != 0u32 {
3778            ::buffa::types::put_uint32_field(2u32, self.limit, buf);
3779        }
3780        if self.start_time.is_set() {
3781            ::buffa::types::put_len_delimited_header(3u32, __cache.consume_next(), buf);
3782            self.start_time.write_to(__cache, buf);
3783        }
3784        if self.end_time.is_set() {
3785            ::buffa::types::put_len_delimited_header(4u32, __cache.consume_next(), buf);
3786            self.end_time.write_to(__cache, buf);
3787        }
3788        {
3789            let val = self.side.to_i32();
3790            if val != 0 {
3791                ::buffa::types::put_int32_field(5u32, val, buf);
3792            }
3793        }
3794        if !self.page_token.is_empty() {
3795            ::buffa::types::put_string_field(6u32, &self.page_token, buf);
3796        }
3797        self.__buffa_unknown_fields.write_to(buf);
3798    }
3799    fn merge_field(
3800        &mut self,
3801        tag: ::buffa::encoding::Tag,
3802        buf: &mut impl ::buffa::bytes::Buf,
3803        ctx: ::buffa::DecodeContext<'_>,
3804    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
3805        #[allow(unused_imports)]
3806        use ::buffa::bytes::Buf as _;
3807        #[allow(unused_imports)]
3808        use ::buffa::Enumeration as _;
3809        match tag.field_number() {
3810            1u32 => {
3811                ::buffa::encoding::check_wire_type(
3812                    tag,
3813                    ::buffa::encoding::WireType::Varint,
3814                )?;
3815                self.symbol_id = ::buffa::types::decode_uint32(buf)?;
3816            }
3817            2u32 => {
3818                ::buffa::encoding::check_wire_type(
3819                    tag,
3820                    ::buffa::encoding::WireType::Varint,
3821                )?;
3822                self.limit = ::buffa::types::decode_uint32(buf)?;
3823            }
3824            3u32 => {
3825                ::buffa::encoding::check_wire_type(
3826                    tag,
3827                    ::buffa::encoding::WireType::LengthDelimited,
3828                )?;
3829                ::buffa::Message::merge_length_delimited(
3830                    self.start_time.get_or_insert_default(),
3831                    buf,
3832                    ctx,
3833                )?;
3834            }
3835            4u32 => {
3836                ::buffa::encoding::check_wire_type(
3837                    tag,
3838                    ::buffa::encoding::WireType::LengthDelimited,
3839                )?;
3840                ::buffa::Message::merge_length_delimited(
3841                    self.end_time.get_or_insert_default(),
3842                    buf,
3843                    ctx,
3844                )?;
3845            }
3846            5u32 => {
3847                ::buffa::encoding::check_wire_type(
3848                    tag,
3849                    ::buffa::encoding::WireType::Varint,
3850                )?;
3851                self.side = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?);
3852            }
3853            6u32 => {
3854                ::buffa::encoding::check_wire_type(
3855                    tag,
3856                    ::buffa::encoding::WireType::LengthDelimited,
3857                )?;
3858                ::buffa::types::merge_string(&mut self.page_token, buf)?;
3859            }
3860            _ => {
3861                self.__buffa_unknown_fields
3862                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
3863            }
3864        }
3865        ::core::result::Result::Ok(())
3866    }
3867    fn clear(&mut self) {
3868        self.symbol_id = 0u32;
3869        self.limit = 0u32;
3870        self.start_time = ::buffa::MessageField::none();
3871        self.end_time = ::buffa::MessageField::none();
3872        self.side = ::buffa::EnumValue::from(0);
3873        self.page_token.clear();
3874        self.__buffa_unknown_fields.clear();
3875    }
3876}
3877impl ::buffa::ExtensionSet for GetTradesRequest {
3878    const PROTO_FQN: &'static str = "marketdata.v1.GetTradesRequest";
3879    fn unknown_fields(&self) -> &::buffa::UnknownFields {
3880        &self.__buffa_unknown_fields
3881    }
3882    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
3883        &mut self.__buffa_unknown_fields
3884    }
3885}
3886impl ::buffa::json_helpers::ProtoElemJson for GetTradesRequest {
3887    fn serialize_proto_json<S: ::serde::Serializer>(
3888        v: &Self,
3889        s: S,
3890    ) -> ::core::result::Result<S::Ok, S::Error> {
3891        ::serde::Serialize::serialize(v, s)
3892    }
3893    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
3894        d: D,
3895    ) -> ::core::result::Result<Self, D::Error> {
3896        <Self as ::serde::Deserialize>::deserialize(d)
3897    }
3898}
3899#[doc(hidden)]
3900pub const __GET_TRADES_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
3901    type_url: "type.googleapis.com/marketdata.v1.GetTradesRequest",
3902    to_json: ::buffa::type_registry::any_to_json::<GetTradesRequest>,
3903    from_json: ::buffa::type_registry::any_from_json::<GetTradesRequest>,
3904    is_wkt: false,
3905};
3906/// MarketTrade is one public trade print represented with scaled integers.
3907///
3908/// REST responses render price and quantity as decimal strings.
3909#[derive(Clone, PartialEq, Default)]
3910#[derive(::serde::Serialize, ::serde::Deserialize)]
3911#[serde(default)]
3912pub struct MarketTrade {
3913    /// Stable numeric pair id from GetSpotConfig.
3914    ///
3915    /// Field 1: `symbol_id`
3916    #[serde(
3917        rename = "symbolId",
3918        alias = "symbol_id",
3919        with = "::buffa::json_helpers::uint32",
3920        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
3921    )]
3922    pub symbol_id: u32,
3923    /// Stable trade id within the symbol, suitable for pagination and de-duplication.
3924    ///
3925    /// Field 2: `match_id`
3926    #[serde(
3927        rename = "matchId",
3928        alias = "match_id",
3929        with = "::buffa::json_helpers::uint64",
3930        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
3931    )]
3932    pub match_id: u64,
3933    /// True when the taker/aggressor bought the base asset; false when the
3934    /// taker/aggressor sold the base asset.
3935    ///
3936    /// Field 3: `is_buy`
3937    #[serde(
3938        rename = "isBuy",
3939        alias = "is_buy",
3940        with = "::buffa::json_helpers::proto_bool",
3941        skip_serializing_if = "::buffa::json_helpers::skip_if::is_false"
3942    )]
3943    pub is_buy: bool,
3944    /// Trade price in quote-asset units scaled by 1e6.
3945    ///
3946    /// Field 4: `price_ticks`
3947    #[serde(
3948        rename = "priceTicks",
3949        alias = "price_ticks",
3950        with = "::buffa::json_helpers::int64",
3951        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
3952    )]
3953    pub price_ticks: i64,
3954    /// Traded base-asset quantity scaled by the pair's base_quantity_scale from
3955    /// GetSpotConfig.
3956    ///
3957    /// Field 5: `qty_scaled`
3958    #[serde(
3959        rename = "qtyScaled",
3960        alias = "qty_scaled",
3961        with = "::buffa::json_helpers::int64",
3962        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
3963    )]
3964    pub qty_scaled: i64,
3965    /// Trade execution timestamp, in nanoseconds since the Unix epoch (UTC).
3966    ///
3967    /// Field 6: `ts_ns`
3968    #[serde(
3969        rename = "tsNs",
3970        alias = "ts_ns",
3971        with = "::buffa::json_helpers::uint64",
3972        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
3973    )]
3974    pub ts_ns: u64,
3975    #[serde(skip)]
3976    #[doc(hidden)]
3977    pub __buffa_unknown_fields: ::buffa::UnknownFields,
3978}
3979impl ::core::fmt::Debug for MarketTrade {
3980    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3981        f.debug_struct("MarketTrade")
3982            .field("symbol_id", &self.symbol_id)
3983            .field("match_id", &self.match_id)
3984            .field("is_buy", &self.is_buy)
3985            .field("price_ticks", &self.price_ticks)
3986            .field("qty_scaled", &self.qty_scaled)
3987            .field("ts_ns", &self.ts_ns)
3988            .finish()
3989    }
3990}
3991impl MarketTrade {
3992    /// Protobuf type URL for this message, for use with `Any::pack` and
3993    /// `Any::unpack_if`.
3994    ///
3995    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
3996    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.MarketTrade";
3997}
3998::buffa::impl_default_instance!(MarketTrade);
3999impl ::buffa::MessageName for MarketTrade {
4000    const PACKAGE: &'static str = "marketdata.v1";
4001    const NAME: &'static str = "MarketTrade";
4002    const FULL_NAME: &'static str = "marketdata.v1.MarketTrade";
4003    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.MarketTrade";
4004}
4005impl ::buffa::Message for MarketTrade {
4006    /// Returns the total encoded size in bytes.
4007    ///
4008    /// The result is a `u32`; the protobuf specification requires all
4009    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
4010    /// compliant message will never overflow this type.
4011    #[allow(clippy::let_and_return)]
4012    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
4013        #[allow(unused_imports)]
4014        use ::buffa::Enumeration as _;
4015        let mut size = 0u32;
4016        if self.symbol_id != 0u32 {
4017            size += 1u32 + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
4018        }
4019        if self.match_id != 0u64 {
4020            size += 1u32 + ::buffa::types::uint64_encoded_len(self.match_id) as u32;
4021        }
4022        if self.is_buy {
4023            size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
4024        }
4025        if self.price_ticks != 0i64 {
4026            size += 1u32 + ::buffa::types::int64_encoded_len(self.price_ticks) as u32;
4027        }
4028        if self.qty_scaled != 0i64 {
4029            size += 1u32 + ::buffa::types::int64_encoded_len(self.qty_scaled) as u32;
4030        }
4031        if self.ts_ns != 0u64 {
4032            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
4033        }
4034        size += self.__buffa_unknown_fields.encoded_len() as u32;
4035        size
4036    }
4037    fn write_to(
4038        &self,
4039        _cache: &mut ::buffa::SizeCache,
4040        buf: &mut impl ::buffa::bytes::BufMut,
4041    ) {
4042        #[allow(unused_imports)]
4043        use ::buffa::Enumeration as _;
4044        if self.symbol_id != 0u32 {
4045            ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
4046        }
4047        if self.match_id != 0u64 {
4048            ::buffa::types::put_uint64_field(2u32, self.match_id, buf);
4049        }
4050        if self.is_buy {
4051            ::buffa::types::put_bool_field(3u32, self.is_buy, buf);
4052        }
4053        if self.price_ticks != 0i64 {
4054            ::buffa::types::put_int64_field(4u32, self.price_ticks, buf);
4055        }
4056        if self.qty_scaled != 0i64 {
4057            ::buffa::types::put_int64_field(5u32, self.qty_scaled, buf);
4058        }
4059        if self.ts_ns != 0u64 {
4060            ::buffa::types::put_uint64_field(6u32, self.ts_ns, buf);
4061        }
4062        self.__buffa_unknown_fields.write_to(buf);
4063    }
4064    fn merge_field(
4065        &mut self,
4066        tag: ::buffa::encoding::Tag,
4067        buf: &mut impl ::buffa::bytes::Buf,
4068        ctx: ::buffa::DecodeContext<'_>,
4069    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
4070        #[allow(unused_imports)]
4071        use ::buffa::bytes::Buf as _;
4072        #[allow(unused_imports)]
4073        use ::buffa::Enumeration as _;
4074        match tag.field_number() {
4075            1u32 => {
4076                ::buffa::encoding::check_wire_type(
4077                    tag,
4078                    ::buffa::encoding::WireType::Varint,
4079                )?;
4080                self.symbol_id = ::buffa::types::decode_uint32(buf)?;
4081            }
4082            2u32 => {
4083                ::buffa::encoding::check_wire_type(
4084                    tag,
4085                    ::buffa::encoding::WireType::Varint,
4086                )?;
4087                self.match_id = ::buffa::types::decode_uint64(buf)?;
4088            }
4089            3u32 => {
4090                ::buffa::encoding::check_wire_type(
4091                    tag,
4092                    ::buffa::encoding::WireType::Varint,
4093                )?;
4094                self.is_buy = ::buffa::types::decode_bool(buf)?;
4095            }
4096            4u32 => {
4097                ::buffa::encoding::check_wire_type(
4098                    tag,
4099                    ::buffa::encoding::WireType::Varint,
4100                )?;
4101                self.price_ticks = ::buffa::types::decode_int64(buf)?;
4102            }
4103            5u32 => {
4104                ::buffa::encoding::check_wire_type(
4105                    tag,
4106                    ::buffa::encoding::WireType::Varint,
4107                )?;
4108                self.qty_scaled = ::buffa::types::decode_int64(buf)?;
4109            }
4110            6u32 => {
4111                ::buffa::encoding::check_wire_type(
4112                    tag,
4113                    ::buffa::encoding::WireType::Varint,
4114                )?;
4115                self.ts_ns = ::buffa::types::decode_uint64(buf)?;
4116            }
4117            _ => {
4118                self.__buffa_unknown_fields
4119                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
4120            }
4121        }
4122        ::core::result::Result::Ok(())
4123    }
4124    fn clear(&mut self) {
4125        self.symbol_id = 0u32;
4126        self.match_id = 0u64;
4127        self.is_buy = false;
4128        self.price_ticks = 0i64;
4129        self.qty_scaled = 0i64;
4130        self.ts_ns = 0u64;
4131        self.__buffa_unknown_fields.clear();
4132    }
4133}
4134impl ::buffa::ExtensionSet for MarketTrade {
4135    const PROTO_FQN: &'static str = "marketdata.v1.MarketTrade";
4136    fn unknown_fields(&self) -> &::buffa::UnknownFields {
4137        &self.__buffa_unknown_fields
4138    }
4139    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
4140        &mut self.__buffa_unknown_fields
4141    }
4142}
4143impl ::buffa::json_helpers::ProtoElemJson for MarketTrade {
4144    fn serialize_proto_json<S: ::serde::Serializer>(
4145        v: &Self,
4146        s: S,
4147    ) -> ::core::result::Result<S::Ok, S::Error> {
4148        ::serde::Serialize::serialize(v, s)
4149    }
4150    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
4151        d: D,
4152    ) -> ::core::result::Result<Self, D::Error> {
4153        <Self as ::serde::Deserialize>::deserialize(d)
4154    }
4155}
4156#[doc(hidden)]
4157pub const __MARKET_TRADE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
4158    type_url: "type.googleapis.com/marketdata.v1.MarketTrade",
4159    to_json: ::buffa::type_registry::any_to_json::<MarketTrade>,
4160    from_json: ::buffa::type_registry::any_from_json::<MarketTrade>,
4161    is_wkt: false,
4162};
4163/// GetTradesResponse contains public trades for one spot market.
4164#[derive(Clone, PartialEq, Default)]
4165#[derive(::serde::Serialize, ::serde::Deserialize)]
4166#[serde(default)]
4167pub struct GetTradesResponse {
4168    /// Trades ordered newest-first by execution timestamp, with match_id as a
4169    /// tie-breaker.
4170    ///
4171    /// Field 1: `trades`
4172    #[serde(
4173        rename = "trades",
4174        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
4175        deserialize_with = "::buffa::json_helpers::null_as_default"
4176    )]
4177    pub trades: ::buffa::alloc::vec::Vec<MarketTrade>,
4178    /// Opaque cursor for the next page. Empty when no more results exist.
4179    ///
4180    /// Field 2: `next_page_token`
4181    #[serde(
4182        rename = "nextPageToken",
4183        alias = "next_page_token",
4184        with = "::buffa::json_helpers::proto_string",
4185        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
4186    )]
4187    pub next_page_token: ::buffa::alloc::string::String,
4188    #[serde(skip)]
4189    #[doc(hidden)]
4190    pub __buffa_unknown_fields: ::buffa::UnknownFields,
4191}
4192impl ::core::fmt::Debug for GetTradesResponse {
4193    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4194        f.debug_struct("GetTradesResponse")
4195            .field("trades", &self.trades)
4196            .field("next_page_token", &self.next_page_token)
4197            .finish()
4198    }
4199}
4200impl GetTradesResponse {
4201    /// Protobuf type URL for this message, for use with `Any::pack` and
4202    /// `Any::unpack_if`.
4203    ///
4204    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
4205    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetTradesResponse";
4206}
4207::buffa::impl_default_instance!(GetTradesResponse);
4208impl ::buffa::MessageName for GetTradesResponse {
4209    const PACKAGE: &'static str = "marketdata.v1";
4210    const NAME: &'static str = "GetTradesResponse";
4211    const FULL_NAME: &'static str = "marketdata.v1.GetTradesResponse";
4212    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetTradesResponse";
4213}
4214impl ::buffa::Message for GetTradesResponse {
4215    /// Returns the total encoded size in bytes.
4216    ///
4217    /// The result is a `u32`; the protobuf specification requires all
4218    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
4219    /// compliant message will never overflow this type.
4220    #[allow(clippy::let_and_return)]
4221    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
4222        #[allow(unused_imports)]
4223        use ::buffa::Enumeration as _;
4224        let mut size = 0u32;
4225        for v in &self.trades {
4226            let __slot = __cache.reserve();
4227            let inner_size = v.compute_size(__cache);
4228            __cache.set(__slot, inner_size);
4229            size
4230                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
4231                    + inner_size;
4232        }
4233        if !self.next_page_token.is_empty() {
4234            size
4235                += 1u32
4236                    + ::buffa::types::string_encoded_len(&self.next_page_token) as u32;
4237        }
4238        size += self.__buffa_unknown_fields.encoded_len() as u32;
4239        size
4240    }
4241    fn write_to(
4242        &self,
4243        __cache: &mut ::buffa::SizeCache,
4244        buf: &mut impl ::buffa::bytes::BufMut,
4245    ) {
4246        #[allow(unused_imports)]
4247        use ::buffa::Enumeration as _;
4248        for v in &self.trades {
4249            ::buffa::types::put_len_delimited_header(1u32, __cache.consume_next(), buf);
4250            v.write_to(__cache, buf);
4251        }
4252        if !self.next_page_token.is_empty() {
4253            ::buffa::types::put_string_field(2u32, &self.next_page_token, buf);
4254        }
4255        self.__buffa_unknown_fields.write_to(buf);
4256    }
4257    fn merge_field(
4258        &mut self,
4259        tag: ::buffa::encoding::Tag,
4260        buf: &mut impl ::buffa::bytes::Buf,
4261        ctx: ::buffa::DecodeContext<'_>,
4262    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
4263        #[allow(unused_imports)]
4264        use ::buffa::bytes::Buf as _;
4265        #[allow(unused_imports)]
4266        use ::buffa::Enumeration as _;
4267        match tag.field_number() {
4268            1u32 => {
4269                ::buffa::encoding::check_wire_type(
4270                    tag,
4271                    ::buffa::encoding::WireType::LengthDelimited,
4272                )?;
4273                let mut elem = ::core::default::Default::default();
4274                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
4275                self.trades.push(elem);
4276            }
4277            2u32 => {
4278                ::buffa::encoding::check_wire_type(
4279                    tag,
4280                    ::buffa::encoding::WireType::LengthDelimited,
4281                )?;
4282                ::buffa::types::merge_string(&mut self.next_page_token, buf)?;
4283            }
4284            _ => {
4285                self.__buffa_unknown_fields
4286                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
4287            }
4288        }
4289        ::core::result::Result::Ok(())
4290    }
4291    fn clear(&mut self) {
4292        self.trades.clear();
4293        self.next_page_token.clear();
4294        self.__buffa_unknown_fields.clear();
4295    }
4296}
4297impl ::buffa::ExtensionSet for GetTradesResponse {
4298    const PROTO_FQN: &'static str = "marketdata.v1.GetTradesResponse";
4299    fn unknown_fields(&self) -> &::buffa::UnknownFields {
4300        &self.__buffa_unknown_fields
4301    }
4302    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
4303        &mut self.__buffa_unknown_fields
4304    }
4305}
4306impl ::buffa::json_helpers::ProtoElemJson for GetTradesResponse {
4307    fn serialize_proto_json<S: ::serde::Serializer>(
4308        v: &Self,
4309        s: S,
4310    ) -> ::core::result::Result<S::Ok, S::Error> {
4311        ::serde::Serialize::serialize(v, s)
4312    }
4313    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
4314        d: D,
4315    ) -> ::core::result::Result<Self, D::Error> {
4316        <Self as ::serde::Deserialize>::deserialize(d)
4317    }
4318}
4319#[doc(hidden)]
4320pub const __GET_TRADES_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
4321    type_url: "type.googleapis.com/marketdata.v1.GetTradesResponse",
4322    to_json: ::buffa::type_registry::any_to_json::<GetTradesResponse>,
4323    from_json: ::buffa::type_registry::any_from_json::<GetTradesResponse>,
4324    is_wkt: false,
4325};
4326/// ---------------------------------------------------------------------------
4327/// GetCandles: Binary (protobuf) request/response with scaled integers.
4328/// REST responses expose decimal strings.
4329/// ---------------------------------------------------------------------------
4330///
4331/// GetCandlesRequest selects a spot market candle series.
4332///
4333/// The response is ordered newest-first by candle bucket start time. When both
4334/// start_time and end_time are set, both bounds are inclusive.
4335#[derive(Clone, PartialEq, Default)]
4336#[derive(::serde::Serialize, ::serde::Deserialize)]
4337#[serde(default)]
4338pub struct GetCandlesRequest {
4339    /// Numeric spot market identifier.
4340    ///
4341    /// Field 1: `symbol_id`
4342    #[serde(
4343        rename = "symbolId",
4344        alias = "symbol_id",
4345        with = "::buffa::json_helpers::uint32",
4346        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
4347    )]
4348    pub symbol_id: u32,
4349    /// Candle bucket size. Required for ConnectRPC clients.
4350    ///
4351    /// Field 2: `timeframe`
4352    #[serde(
4353        rename = "timeframe",
4354        with = "::buffa::json_helpers::proto_enum",
4355        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
4356    )]
4357    pub timeframe: ::buffa::EnumValue<Timeframe>,
4358    /// Maximum number of closed candles to return. Defaults to 500 when unset;
4359    /// max 10000.
4360    ///
4361    /// Field 3: `limit`
4362    #[serde(
4363        rename = "limit",
4364        with = "::buffa::json_helpers::uint32",
4365        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
4366    )]
4367    pub limit: u32,
4368    /// Inclusive lower bound for candle bucket start time, as a UTC timestamp.
4369    /// Must not be more than 5 minutes in the future.
4370    ///
4371    /// Field 4: `start_time`
4372    #[serde(
4373        rename = "startTime",
4374        alias = "start_time",
4375        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
4376    )]
4377    pub start_time: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
4378    /// Inclusive upper bound for candle bucket start time, as a UTC timestamp.
4379    /// Must be greater than or equal to start_time when both are set, and must not
4380    /// be more than 5 minutes in the future.
4381    ///
4382    /// Field 5: `end_time`
4383    #[serde(
4384        rename = "endTime",
4385        alias = "end_time",
4386        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
4387    )]
4388    pub end_time: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
4389    /// Include the current open candle when it is available and inside the
4390    /// requested range.
4391    /// The open candle is prepended to the newest-first candle list and does not
4392    /// count toward the closed-candle limit.
4393    ///
4394    /// Field 6: `include_incomplete`
4395    #[serde(
4396        rename = "includeIncomplete",
4397        alias = "include_incomplete",
4398        with = "::buffa::json_helpers::proto_bool",
4399        skip_serializing_if = "::buffa::json_helpers::skip_if::is_false"
4400    )]
4401    pub include_incomplete: bool,
4402    /// Include the composite reference market candle series for the same market,
4403    /// timeframe, and time range.
4404    /// The reference series can be empty when no reference series is available for
4405    /// the requested timeframe.
4406    ///
4407    /// Field 7: `include_reference`
4408    #[serde(
4409        rename = "includeReference",
4410        alias = "include_reference",
4411        with = "::buffa::json_helpers::proto_bool",
4412        skip_serializing_if = "::buffa::json_helpers::skip_if::is_false"
4413    )]
4414    pub include_reference: bool,
4415    /// Opaque keyset cursor from a previous response. The cursor is exclusive and
4416    /// bound to symbol, timeframe, time bounds, and newest-first candle ordering.
4417    /// Inclusion flags affect response enrichment and may change between pages.
4418    ///
4419    /// Field 8: `page_token`
4420    #[serde(
4421        rename = "pageToken",
4422        alias = "page_token",
4423        with = "::buffa::json_helpers::proto_string",
4424        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
4425    )]
4426    pub page_token: ::buffa::alloc::string::String,
4427    #[serde(skip)]
4428    #[doc(hidden)]
4429    pub __buffa_unknown_fields: ::buffa::UnknownFields,
4430}
4431impl ::core::fmt::Debug for GetCandlesRequest {
4432    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4433        f.debug_struct("GetCandlesRequest")
4434            .field("symbol_id", &self.symbol_id)
4435            .field("timeframe", &self.timeframe)
4436            .field("limit", &self.limit)
4437            .field("start_time", &self.start_time)
4438            .field("end_time", &self.end_time)
4439            .field("include_incomplete", &self.include_incomplete)
4440            .field("include_reference", &self.include_reference)
4441            .field("page_token", &self.page_token)
4442            .finish()
4443    }
4444}
4445impl GetCandlesRequest {
4446    /// Protobuf type URL for this message, for use with `Any::pack` and
4447    /// `Any::unpack_if`.
4448    ///
4449    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
4450    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetCandlesRequest";
4451}
4452::buffa::impl_default_instance!(GetCandlesRequest);
4453impl ::buffa::MessageName for GetCandlesRequest {
4454    const PACKAGE: &'static str = "marketdata.v1";
4455    const NAME: &'static str = "GetCandlesRequest";
4456    const FULL_NAME: &'static str = "marketdata.v1.GetCandlesRequest";
4457    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetCandlesRequest";
4458}
4459impl ::buffa::Message for GetCandlesRequest {
4460    /// Returns the total encoded size in bytes.
4461    ///
4462    /// The result is a `u32`; the protobuf specification requires all
4463    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
4464    /// compliant message will never overflow this type.
4465    #[allow(clippy::let_and_return)]
4466    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
4467        #[allow(unused_imports)]
4468        use ::buffa::Enumeration as _;
4469        let mut size = 0u32;
4470        if self.symbol_id != 0u32 {
4471            size += 1u32 + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
4472        }
4473        {
4474            let val = self.timeframe.to_i32();
4475            if val != 0 {
4476                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
4477            }
4478        }
4479        if self.limit != 0u32 {
4480            size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
4481        }
4482        if self.start_time.is_set() {
4483            let __slot = __cache.reserve();
4484            let inner_size = self.start_time.compute_size(__cache);
4485            __cache.set(__slot, inner_size);
4486            size
4487                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
4488                    + inner_size;
4489        }
4490        if self.end_time.is_set() {
4491            let __slot = __cache.reserve();
4492            let inner_size = self.end_time.compute_size(__cache);
4493            __cache.set(__slot, inner_size);
4494            size
4495                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
4496                    + inner_size;
4497        }
4498        if self.include_incomplete {
4499            size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
4500        }
4501        if self.include_reference {
4502            size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
4503        }
4504        if !self.page_token.is_empty() {
4505            size += 1u32 + ::buffa::types::string_encoded_len(&self.page_token) as u32;
4506        }
4507        size += self.__buffa_unknown_fields.encoded_len() as u32;
4508        size
4509    }
4510    fn write_to(
4511        &self,
4512        __cache: &mut ::buffa::SizeCache,
4513        buf: &mut impl ::buffa::bytes::BufMut,
4514    ) {
4515        #[allow(unused_imports)]
4516        use ::buffa::Enumeration as _;
4517        if self.symbol_id != 0u32 {
4518            ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
4519        }
4520        {
4521            let val = self.timeframe.to_i32();
4522            if val != 0 {
4523                ::buffa::types::put_int32_field(2u32, val, buf);
4524            }
4525        }
4526        if self.limit != 0u32 {
4527            ::buffa::types::put_uint32_field(3u32, self.limit, buf);
4528        }
4529        if self.start_time.is_set() {
4530            ::buffa::types::put_len_delimited_header(4u32, __cache.consume_next(), buf);
4531            self.start_time.write_to(__cache, buf);
4532        }
4533        if self.end_time.is_set() {
4534            ::buffa::types::put_len_delimited_header(5u32, __cache.consume_next(), buf);
4535            self.end_time.write_to(__cache, buf);
4536        }
4537        if self.include_incomplete {
4538            ::buffa::types::put_bool_field(6u32, self.include_incomplete, buf);
4539        }
4540        if self.include_reference {
4541            ::buffa::types::put_bool_field(7u32, self.include_reference, buf);
4542        }
4543        if !self.page_token.is_empty() {
4544            ::buffa::types::put_string_field(8u32, &self.page_token, buf);
4545        }
4546        self.__buffa_unknown_fields.write_to(buf);
4547    }
4548    fn merge_field(
4549        &mut self,
4550        tag: ::buffa::encoding::Tag,
4551        buf: &mut impl ::buffa::bytes::Buf,
4552        ctx: ::buffa::DecodeContext<'_>,
4553    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
4554        #[allow(unused_imports)]
4555        use ::buffa::bytes::Buf as _;
4556        #[allow(unused_imports)]
4557        use ::buffa::Enumeration as _;
4558        match tag.field_number() {
4559            1u32 => {
4560                ::buffa::encoding::check_wire_type(
4561                    tag,
4562                    ::buffa::encoding::WireType::Varint,
4563                )?;
4564                self.symbol_id = ::buffa::types::decode_uint32(buf)?;
4565            }
4566            2u32 => {
4567                ::buffa::encoding::check_wire_type(
4568                    tag,
4569                    ::buffa::encoding::WireType::Varint,
4570                )?;
4571                self.timeframe = ::buffa::EnumValue::from(
4572                    ::buffa::types::decode_int32(buf)?,
4573                );
4574            }
4575            3u32 => {
4576                ::buffa::encoding::check_wire_type(
4577                    tag,
4578                    ::buffa::encoding::WireType::Varint,
4579                )?;
4580                self.limit = ::buffa::types::decode_uint32(buf)?;
4581            }
4582            4u32 => {
4583                ::buffa::encoding::check_wire_type(
4584                    tag,
4585                    ::buffa::encoding::WireType::LengthDelimited,
4586                )?;
4587                ::buffa::Message::merge_length_delimited(
4588                    self.start_time.get_or_insert_default(),
4589                    buf,
4590                    ctx,
4591                )?;
4592            }
4593            5u32 => {
4594                ::buffa::encoding::check_wire_type(
4595                    tag,
4596                    ::buffa::encoding::WireType::LengthDelimited,
4597                )?;
4598                ::buffa::Message::merge_length_delimited(
4599                    self.end_time.get_or_insert_default(),
4600                    buf,
4601                    ctx,
4602                )?;
4603            }
4604            6u32 => {
4605                ::buffa::encoding::check_wire_type(
4606                    tag,
4607                    ::buffa::encoding::WireType::Varint,
4608                )?;
4609                self.include_incomplete = ::buffa::types::decode_bool(buf)?;
4610            }
4611            7u32 => {
4612                ::buffa::encoding::check_wire_type(
4613                    tag,
4614                    ::buffa::encoding::WireType::Varint,
4615                )?;
4616                self.include_reference = ::buffa::types::decode_bool(buf)?;
4617            }
4618            8u32 => {
4619                ::buffa::encoding::check_wire_type(
4620                    tag,
4621                    ::buffa::encoding::WireType::LengthDelimited,
4622                )?;
4623                ::buffa::types::merge_string(&mut self.page_token, buf)?;
4624            }
4625            _ => {
4626                self.__buffa_unknown_fields
4627                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
4628            }
4629        }
4630        ::core::result::Result::Ok(())
4631    }
4632    fn clear(&mut self) {
4633        self.symbol_id = 0u32;
4634        self.timeframe = ::buffa::EnumValue::from(0);
4635        self.limit = 0u32;
4636        self.start_time = ::buffa::MessageField::none();
4637        self.end_time = ::buffa::MessageField::none();
4638        self.include_incomplete = false;
4639        self.include_reference = false;
4640        self.page_token.clear();
4641        self.__buffa_unknown_fields.clear();
4642    }
4643}
4644impl ::buffa::ExtensionSet for GetCandlesRequest {
4645    const PROTO_FQN: &'static str = "marketdata.v1.GetCandlesRequest";
4646    fn unknown_fields(&self) -> &::buffa::UnknownFields {
4647        &self.__buffa_unknown_fields
4648    }
4649    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
4650        &mut self.__buffa_unknown_fields
4651    }
4652}
4653impl ::buffa::json_helpers::ProtoElemJson for GetCandlesRequest {
4654    fn serialize_proto_json<S: ::serde::Serializer>(
4655        v: &Self,
4656        s: S,
4657    ) -> ::core::result::Result<S::Ok, S::Error> {
4658        ::serde::Serialize::serialize(v, s)
4659    }
4660    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
4661        d: D,
4662    ) -> ::core::result::Result<Self, D::Error> {
4663        <Self as ::serde::Deserialize>::deserialize(d)
4664    }
4665}
4666#[doc(hidden)]
4667pub const __GET_CANDLES_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
4668    type_url: "type.googleapis.com/marketdata.v1.GetCandlesRequest",
4669    to_json: ::buffa::type_registry::any_to_json::<GetCandlesRequest>,
4670    from_json: ::buffa::type_registry::any_from_json::<GetCandlesRequest>,
4671    is_wkt: false,
4672};
4673/// GetCandlesColumnsRequest selects a spot market candle series for columnar output.
4674///
4675/// The response is ordered oldest-first for efficient chart ingestion. When both
4676/// start_time and end_time are set, both bounds are inclusive.
4677#[derive(Clone, PartialEq, Default)]
4678#[derive(::serde::Serialize, ::serde::Deserialize)]
4679#[serde(default)]
4680pub struct GetCandlesColumnsRequest {
4681    /// Numeric spot market identifier.
4682    ///
4683    /// Field 1: `symbol_id`
4684    #[serde(
4685        rename = "symbolId",
4686        alias = "symbol_id",
4687        with = "::buffa::json_helpers::uint32",
4688        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
4689    )]
4690    pub symbol_id: u32,
4691    /// Candle bucket size. Required for ConnectRPC clients.
4692    ///
4693    /// Field 2: `timeframe`
4694    #[serde(
4695        rename = "timeframe",
4696        with = "::buffa::json_helpers::proto_enum",
4697        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
4698    )]
4699    pub timeframe: ::buffa::EnumValue<Timeframe>,
4700    /// Maximum number of closed candles to return. Defaults to 500 when unset;
4701    /// max 10000.
4702    ///
4703    /// Field 3: `limit`
4704    #[serde(
4705        rename = "limit",
4706        with = "::buffa::json_helpers::uint32",
4707        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
4708    )]
4709    pub limit: u32,
4710    /// Inclusive lower bound for candle bucket start time, as a UTC timestamp.
4711    /// Must not be more than 5 minutes in the future.
4712    ///
4713    /// Field 4: `start_time`
4714    #[serde(
4715        rename = "startTime",
4716        alias = "start_time",
4717        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
4718    )]
4719    pub start_time: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
4720    /// Inclusive upper bound for candle bucket start time, as a UTC timestamp.
4721    /// Must be greater than or equal to start_time when both are set, and must not
4722    /// be more than 5 minutes in the future.
4723    ///
4724    /// Field 5: `end_time`
4725    #[serde(
4726        rename = "endTime",
4727        alias = "end_time",
4728        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
4729    )]
4730    pub end_time: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
4731    /// Include the current open candle when it is available and inside the
4732    /// requested range.
4733    /// The open candle is prepended to the newest-first candle list and does not
4734    /// count toward the closed-candle limit.
4735    ///
4736    /// Field 6: `include_incomplete`
4737    #[serde(
4738        rename = "includeIncomplete",
4739        alias = "include_incomplete",
4740        with = "::buffa::json_helpers::proto_bool",
4741        skip_serializing_if = "::buffa::json_helpers::skip_if::is_false"
4742    )]
4743    pub include_incomplete: bool,
4744    /// Include the composite reference market candle series for the same market,
4745    /// timeframe, and time range.
4746    /// The reference series can be empty when no reference series is available for
4747    /// the requested timeframe.
4748    ///
4749    /// Field 7: `include_reference`
4750    #[serde(
4751        rename = "includeReference",
4752        alias = "include_reference",
4753        with = "::buffa::json_helpers::proto_bool",
4754        skip_serializing_if = "::buffa::json_helpers::skip_if::is_false"
4755    )]
4756    pub include_reference: bool,
4757    /// Opaque keyset cursor from a previous response. The cursor is exclusive and
4758    /// bound to symbol, timeframe, time bounds, and oldest-first candle ordering.
4759    /// Inclusion flags and columnar response shape may change between pages.
4760    ///
4761    /// Field 8: `page_token`
4762    #[serde(
4763        rename = "pageToken",
4764        alias = "page_token",
4765        with = "::buffa::json_helpers::proto_string",
4766        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
4767    )]
4768    pub page_token: ::buffa::alloc::string::String,
4769    #[serde(skip)]
4770    #[doc(hidden)]
4771    pub __buffa_unknown_fields: ::buffa::UnknownFields,
4772}
4773impl ::core::fmt::Debug for GetCandlesColumnsRequest {
4774    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4775        f.debug_struct("GetCandlesColumnsRequest")
4776            .field("symbol_id", &self.symbol_id)
4777            .field("timeframe", &self.timeframe)
4778            .field("limit", &self.limit)
4779            .field("start_time", &self.start_time)
4780            .field("end_time", &self.end_time)
4781            .field("include_incomplete", &self.include_incomplete)
4782            .field("include_reference", &self.include_reference)
4783            .field("page_token", &self.page_token)
4784            .finish()
4785    }
4786}
4787impl GetCandlesColumnsRequest {
4788    /// Protobuf type URL for this message, for use with `Any::pack` and
4789    /// `Any::unpack_if`.
4790    ///
4791    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
4792    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetCandlesColumnsRequest";
4793}
4794::buffa::impl_default_instance!(GetCandlesColumnsRequest);
4795impl ::buffa::MessageName for GetCandlesColumnsRequest {
4796    const PACKAGE: &'static str = "marketdata.v1";
4797    const NAME: &'static str = "GetCandlesColumnsRequest";
4798    const FULL_NAME: &'static str = "marketdata.v1.GetCandlesColumnsRequest";
4799    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetCandlesColumnsRequest";
4800}
4801impl ::buffa::Message for GetCandlesColumnsRequest {
4802    /// Returns the total encoded size in bytes.
4803    ///
4804    /// The result is a `u32`; the protobuf specification requires all
4805    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
4806    /// compliant message will never overflow this type.
4807    #[allow(clippy::let_and_return)]
4808    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
4809        #[allow(unused_imports)]
4810        use ::buffa::Enumeration as _;
4811        let mut size = 0u32;
4812        if self.symbol_id != 0u32 {
4813            size += 1u32 + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
4814        }
4815        {
4816            let val = self.timeframe.to_i32();
4817            if val != 0 {
4818                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
4819            }
4820        }
4821        if self.limit != 0u32 {
4822            size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
4823        }
4824        if self.start_time.is_set() {
4825            let __slot = __cache.reserve();
4826            let inner_size = self.start_time.compute_size(__cache);
4827            __cache.set(__slot, inner_size);
4828            size
4829                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
4830                    + inner_size;
4831        }
4832        if self.end_time.is_set() {
4833            let __slot = __cache.reserve();
4834            let inner_size = self.end_time.compute_size(__cache);
4835            __cache.set(__slot, inner_size);
4836            size
4837                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
4838                    + inner_size;
4839        }
4840        if self.include_incomplete {
4841            size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
4842        }
4843        if self.include_reference {
4844            size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
4845        }
4846        if !self.page_token.is_empty() {
4847            size += 1u32 + ::buffa::types::string_encoded_len(&self.page_token) as u32;
4848        }
4849        size += self.__buffa_unknown_fields.encoded_len() as u32;
4850        size
4851    }
4852    fn write_to(
4853        &self,
4854        __cache: &mut ::buffa::SizeCache,
4855        buf: &mut impl ::buffa::bytes::BufMut,
4856    ) {
4857        #[allow(unused_imports)]
4858        use ::buffa::Enumeration as _;
4859        if self.symbol_id != 0u32 {
4860            ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
4861        }
4862        {
4863            let val = self.timeframe.to_i32();
4864            if val != 0 {
4865                ::buffa::types::put_int32_field(2u32, val, buf);
4866            }
4867        }
4868        if self.limit != 0u32 {
4869            ::buffa::types::put_uint32_field(3u32, self.limit, buf);
4870        }
4871        if self.start_time.is_set() {
4872            ::buffa::types::put_len_delimited_header(4u32, __cache.consume_next(), buf);
4873            self.start_time.write_to(__cache, buf);
4874        }
4875        if self.end_time.is_set() {
4876            ::buffa::types::put_len_delimited_header(5u32, __cache.consume_next(), buf);
4877            self.end_time.write_to(__cache, buf);
4878        }
4879        if self.include_incomplete {
4880            ::buffa::types::put_bool_field(6u32, self.include_incomplete, buf);
4881        }
4882        if self.include_reference {
4883            ::buffa::types::put_bool_field(7u32, self.include_reference, buf);
4884        }
4885        if !self.page_token.is_empty() {
4886            ::buffa::types::put_string_field(8u32, &self.page_token, buf);
4887        }
4888        self.__buffa_unknown_fields.write_to(buf);
4889    }
4890    fn merge_field(
4891        &mut self,
4892        tag: ::buffa::encoding::Tag,
4893        buf: &mut impl ::buffa::bytes::Buf,
4894        ctx: ::buffa::DecodeContext<'_>,
4895    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
4896        #[allow(unused_imports)]
4897        use ::buffa::bytes::Buf as _;
4898        #[allow(unused_imports)]
4899        use ::buffa::Enumeration as _;
4900        match tag.field_number() {
4901            1u32 => {
4902                ::buffa::encoding::check_wire_type(
4903                    tag,
4904                    ::buffa::encoding::WireType::Varint,
4905                )?;
4906                self.symbol_id = ::buffa::types::decode_uint32(buf)?;
4907            }
4908            2u32 => {
4909                ::buffa::encoding::check_wire_type(
4910                    tag,
4911                    ::buffa::encoding::WireType::Varint,
4912                )?;
4913                self.timeframe = ::buffa::EnumValue::from(
4914                    ::buffa::types::decode_int32(buf)?,
4915                );
4916            }
4917            3u32 => {
4918                ::buffa::encoding::check_wire_type(
4919                    tag,
4920                    ::buffa::encoding::WireType::Varint,
4921                )?;
4922                self.limit = ::buffa::types::decode_uint32(buf)?;
4923            }
4924            4u32 => {
4925                ::buffa::encoding::check_wire_type(
4926                    tag,
4927                    ::buffa::encoding::WireType::LengthDelimited,
4928                )?;
4929                ::buffa::Message::merge_length_delimited(
4930                    self.start_time.get_or_insert_default(),
4931                    buf,
4932                    ctx,
4933                )?;
4934            }
4935            5u32 => {
4936                ::buffa::encoding::check_wire_type(
4937                    tag,
4938                    ::buffa::encoding::WireType::LengthDelimited,
4939                )?;
4940                ::buffa::Message::merge_length_delimited(
4941                    self.end_time.get_or_insert_default(),
4942                    buf,
4943                    ctx,
4944                )?;
4945            }
4946            6u32 => {
4947                ::buffa::encoding::check_wire_type(
4948                    tag,
4949                    ::buffa::encoding::WireType::Varint,
4950                )?;
4951                self.include_incomplete = ::buffa::types::decode_bool(buf)?;
4952            }
4953            7u32 => {
4954                ::buffa::encoding::check_wire_type(
4955                    tag,
4956                    ::buffa::encoding::WireType::Varint,
4957                )?;
4958                self.include_reference = ::buffa::types::decode_bool(buf)?;
4959            }
4960            8u32 => {
4961                ::buffa::encoding::check_wire_type(
4962                    tag,
4963                    ::buffa::encoding::WireType::LengthDelimited,
4964                )?;
4965                ::buffa::types::merge_string(&mut self.page_token, buf)?;
4966            }
4967            _ => {
4968                self.__buffa_unknown_fields
4969                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
4970            }
4971        }
4972        ::core::result::Result::Ok(())
4973    }
4974    fn clear(&mut self) {
4975        self.symbol_id = 0u32;
4976        self.timeframe = ::buffa::EnumValue::from(0);
4977        self.limit = 0u32;
4978        self.start_time = ::buffa::MessageField::none();
4979        self.end_time = ::buffa::MessageField::none();
4980        self.include_incomplete = false;
4981        self.include_reference = false;
4982        self.page_token.clear();
4983        self.__buffa_unknown_fields.clear();
4984    }
4985}
4986impl ::buffa::ExtensionSet for GetCandlesColumnsRequest {
4987    const PROTO_FQN: &'static str = "marketdata.v1.GetCandlesColumnsRequest";
4988    fn unknown_fields(&self) -> &::buffa::UnknownFields {
4989        &self.__buffa_unknown_fields
4990    }
4991    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
4992        &mut self.__buffa_unknown_fields
4993    }
4994}
4995impl ::buffa::json_helpers::ProtoElemJson for GetCandlesColumnsRequest {
4996    fn serialize_proto_json<S: ::serde::Serializer>(
4997        v: &Self,
4998        s: S,
4999    ) -> ::core::result::Result<S::Ok, S::Error> {
5000        ::serde::Serialize::serialize(v, s)
5001    }
5002    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
5003        d: D,
5004    ) -> ::core::result::Result<Self, D::Error> {
5005        <Self as ::serde::Deserialize>::deserialize(d)
5006    }
5007}
5008#[doc(hidden)]
5009pub const __GET_CANDLES_COLUMNS_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
5010    type_url: "type.googleapis.com/marketdata.v1.GetCandlesColumnsRequest",
5011    to_json: ::buffa::type_registry::any_to_json::<GetCandlesColumnsRequest>,
5012    from_json: ::buffa::type_registry::any_from_json::<GetCandlesColumnsRequest>,
5013    is_wkt: false,
5014};
5015/// CandlePoint is one OHLCV bucket represented with scaled integers.
5016///
5017/// REST responses render these values as decimal strings in tuple order:
5018/// \[ts_sec, open, high, low, close, volume\].
5019#[derive(Clone, PartialEq, Default)]
5020#[derive(::serde::Serialize, ::serde::Deserialize)]
5021#[serde(default)]
5022pub struct CandlePoint {
5023    /// Candle bucket start timestamp, in seconds since epoch (UTC).
5024    ///
5025    /// Field 1: `ts_sec`
5026    #[serde(
5027        rename = "tsSec",
5028        alias = "ts_sec",
5029        with = "::buffa::json_helpers::uint64",
5030        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
5031    )]
5032    pub ts_sec: u64,
5033    /// Opening price in quote units scaled by 1e6.
5034    ///
5035    /// Field 2: `open`
5036    #[serde(
5037        rename = "open",
5038        with = "::buffa::json_helpers::int64",
5039        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
5040    )]
5041    pub open: i64,
5042    /// Highest traded price in quote units scaled by 1e6.
5043    ///
5044    /// Field 3: `high`
5045    #[serde(
5046        rename = "high",
5047        with = "::buffa::json_helpers::int64",
5048        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
5049    )]
5050    pub high: i64,
5051    /// Lowest traded price in quote units scaled by 1e6.
5052    ///
5053    /// Field 4: `low`
5054    #[serde(
5055        rename = "low",
5056        with = "::buffa::json_helpers::int64",
5057        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
5058    )]
5059    pub low: i64,
5060    /// Closing price in quote units scaled by 1e6.
5061    ///
5062    /// Field 5: `close`
5063    #[serde(
5064        rename = "close",
5065        with = "::buffa::json_helpers::int64",
5066        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
5067    )]
5068    pub close: i64,
5069    /// Traded base-asset quantity scaled by the market's base asset quantity_scale
5070    /// from GetSpotConfig.
5071    ///
5072    /// Field 6: `volume`
5073    #[serde(
5074        rename = "volume",
5075        with = "::buffa::json_helpers::int64",
5076        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
5077    )]
5078    pub volume: i64,
5079    /// True only for WebSocket terminal updates of a closed bucket.
5080    /// Historical API rows and current open-candle rows set this to false.
5081    ///
5082    /// Field 7: `is_closed`
5083    #[serde(
5084        rename = "isClosed",
5085        alias = "is_closed",
5086        with = "::buffa::json_helpers::proto_bool",
5087        skip_serializing_if = "::buffa::json_helpers::skip_if::is_false"
5088    )]
5089    pub is_closed: bool,
5090    #[serde(skip)]
5091    #[doc(hidden)]
5092    pub __buffa_unknown_fields: ::buffa::UnknownFields,
5093}
5094impl ::core::fmt::Debug for CandlePoint {
5095    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5096        f.debug_struct("CandlePoint")
5097            .field("ts_sec", &self.ts_sec)
5098            .field("open", &self.open)
5099            .field("high", &self.high)
5100            .field("low", &self.low)
5101            .field("close", &self.close)
5102            .field("volume", &self.volume)
5103            .field("is_closed", &self.is_closed)
5104            .finish()
5105    }
5106}
5107impl CandlePoint {
5108    /// Protobuf type URL for this message, for use with `Any::pack` and
5109    /// `Any::unpack_if`.
5110    ///
5111    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
5112    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.CandlePoint";
5113}
5114::buffa::impl_default_instance!(CandlePoint);
5115impl ::buffa::MessageName for CandlePoint {
5116    const PACKAGE: &'static str = "marketdata.v1";
5117    const NAME: &'static str = "CandlePoint";
5118    const FULL_NAME: &'static str = "marketdata.v1.CandlePoint";
5119    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.CandlePoint";
5120}
5121impl ::buffa::Message for CandlePoint {
5122    /// Returns the total encoded size in bytes.
5123    ///
5124    /// The result is a `u32`; the protobuf specification requires all
5125    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
5126    /// compliant message will never overflow this type.
5127    #[allow(clippy::let_and_return)]
5128    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
5129        #[allow(unused_imports)]
5130        use ::buffa::Enumeration as _;
5131        let mut size = 0u32;
5132        if self.ts_sec != 0u64 {
5133            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_sec) as u32;
5134        }
5135        if self.open != 0i64 {
5136            size += 1u32 + ::buffa::types::int64_encoded_len(self.open) as u32;
5137        }
5138        if self.high != 0i64 {
5139            size += 1u32 + ::buffa::types::int64_encoded_len(self.high) as u32;
5140        }
5141        if self.low != 0i64 {
5142            size += 1u32 + ::buffa::types::int64_encoded_len(self.low) as u32;
5143        }
5144        if self.close != 0i64 {
5145            size += 1u32 + ::buffa::types::int64_encoded_len(self.close) as u32;
5146        }
5147        if self.volume != 0i64 {
5148            size += 1u32 + ::buffa::types::int64_encoded_len(self.volume) as u32;
5149        }
5150        if self.is_closed {
5151            size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
5152        }
5153        size += self.__buffa_unknown_fields.encoded_len() as u32;
5154        size
5155    }
5156    fn write_to(
5157        &self,
5158        _cache: &mut ::buffa::SizeCache,
5159        buf: &mut impl ::buffa::bytes::BufMut,
5160    ) {
5161        #[allow(unused_imports)]
5162        use ::buffa::Enumeration as _;
5163        if self.ts_sec != 0u64 {
5164            ::buffa::types::put_uint64_field(1u32, self.ts_sec, buf);
5165        }
5166        if self.open != 0i64 {
5167            ::buffa::types::put_int64_field(2u32, self.open, buf);
5168        }
5169        if self.high != 0i64 {
5170            ::buffa::types::put_int64_field(3u32, self.high, buf);
5171        }
5172        if self.low != 0i64 {
5173            ::buffa::types::put_int64_field(4u32, self.low, buf);
5174        }
5175        if self.close != 0i64 {
5176            ::buffa::types::put_int64_field(5u32, self.close, buf);
5177        }
5178        if self.volume != 0i64 {
5179            ::buffa::types::put_int64_field(6u32, self.volume, buf);
5180        }
5181        if self.is_closed {
5182            ::buffa::types::put_bool_field(7u32, self.is_closed, buf);
5183        }
5184        self.__buffa_unknown_fields.write_to(buf);
5185    }
5186    fn merge_field(
5187        &mut self,
5188        tag: ::buffa::encoding::Tag,
5189        buf: &mut impl ::buffa::bytes::Buf,
5190        ctx: ::buffa::DecodeContext<'_>,
5191    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
5192        #[allow(unused_imports)]
5193        use ::buffa::bytes::Buf as _;
5194        #[allow(unused_imports)]
5195        use ::buffa::Enumeration as _;
5196        match tag.field_number() {
5197            1u32 => {
5198                ::buffa::encoding::check_wire_type(
5199                    tag,
5200                    ::buffa::encoding::WireType::Varint,
5201                )?;
5202                self.ts_sec = ::buffa::types::decode_uint64(buf)?;
5203            }
5204            2u32 => {
5205                ::buffa::encoding::check_wire_type(
5206                    tag,
5207                    ::buffa::encoding::WireType::Varint,
5208                )?;
5209                self.open = ::buffa::types::decode_int64(buf)?;
5210            }
5211            3u32 => {
5212                ::buffa::encoding::check_wire_type(
5213                    tag,
5214                    ::buffa::encoding::WireType::Varint,
5215                )?;
5216                self.high = ::buffa::types::decode_int64(buf)?;
5217            }
5218            4u32 => {
5219                ::buffa::encoding::check_wire_type(
5220                    tag,
5221                    ::buffa::encoding::WireType::Varint,
5222                )?;
5223                self.low = ::buffa::types::decode_int64(buf)?;
5224            }
5225            5u32 => {
5226                ::buffa::encoding::check_wire_type(
5227                    tag,
5228                    ::buffa::encoding::WireType::Varint,
5229                )?;
5230                self.close = ::buffa::types::decode_int64(buf)?;
5231            }
5232            6u32 => {
5233                ::buffa::encoding::check_wire_type(
5234                    tag,
5235                    ::buffa::encoding::WireType::Varint,
5236                )?;
5237                self.volume = ::buffa::types::decode_int64(buf)?;
5238            }
5239            7u32 => {
5240                ::buffa::encoding::check_wire_type(
5241                    tag,
5242                    ::buffa::encoding::WireType::Varint,
5243                )?;
5244                self.is_closed = ::buffa::types::decode_bool(buf)?;
5245            }
5246            _ => {
5247                self.__buffa_unknown_fields
5248                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
5249            }
5250        }
5251        ::core::result::Result::Ok(())
5252    }
5253    fn clear(&mut self) {
5254        self.ts_sec = 0u64;
5255        self.open = 0i64;
5256        self.high = 0i64;
5257        self.low = 0i64;
5258        self.close = 0i64;
5259        self.volume = 0i64;
5260        self.is_closed = false;
5261        self.__buffa_unknown_fields.clear();
5262    }
5263}
5264impl ::buffa::ExtensionSet for CandlePoint {
5265    const PROTO_FQN: &'static str = "marketdata.v1.CandlePoint";
5266    fn unknown_fields(&self) -> &::buffa::UnknownFields {
5267        &self.__buffa_unknown_fields
5268    }
5269    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
5270        &mut self.__buffa_unknown_fields
5271    }
5272}
5273impl ::buffa::json_helpers::ProtoElemJson for CandlePoint {
5274    fn serialize_proto_json<S: ::serde::Serializer>(
5275        v: &Self,
5276        s: S,
5277    ) -> ::core::result::Result<S::Ok, S::Error> {
5278        ::serde::Serialize::serialize(v, s)
5279    }
5280    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
5281        d: D,
5282    ) -> ::core::result::Result<Self, D::Error> {
5283        <Self as ::serde::Deserialize>::deserialize(d)
5284    }
5285}
5286#[doc(hidden)]
5287pub const __CANDLE_POINT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
5288    type_url: "type.googleapis.com/marketdata.v1.CandlePoint",
5289    to_json: ::buffa::type_registry::any_to_json::<CandlePoint>,
5290    from_json: ::buffa::type_registry::any_from_json::<CandlePoint>,
5291    is_wkt: false,
5292};
5293/// GetCandlesResponse contains OHLCV candles for one spot market and timeframe.
5294///
5295/// Candles and reference_candles are ordered newest-first by ts_sec. REST
5296/// responses render price and volume values as decimal strings.
5297#[derive(Clone, PartialEq, Default)]
5298#[derive(::serde::Serialize, ::serde::Deserialize)]
5299#[serde(default)]
5300pub struct GetCandlesResponse {
5301    /// Numeric spot market identifier echoed from the request.
5302    ///
5303    /// Field 1: `symbol_id`
5304    #[serde(
5305        rename = "symbolId",
5306        alias = "symbol_id",
5307        with = "::buffa::json_helpers::uint32",
5308        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
5309    )]
5310    pub symbol_id: u32,
5311    /// Candle bucket size used for the returned series.
5312    ///
5313    /// Field 2: `timeframe`
5314    #[serde(
5315        rename = "timeframe",
5316        with = "::buffa::json_helpers::proto_enum",
5317        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
5318    )]
5319    pub timeframe: ::buffa::EnumValue<Timeframe>,
5320    /// Primary market candle series, ordered newest-first by ts_sec.
5321    ///
5322    /// Field 3: `candles`
5323    #[serde(
5324        rename = "candles",
5325        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
5326        deserialize_with = "::buffa::json_helpers::null_as_default"
5327    )]
5328    pub candles: ::buffa::alloc::vec::Vec<CandlePoint>,
5329    /// Composite reference market candle series, ordered newest-first by ts_sec.
5330    /// Populated only when include_reference is true and reference data is
5331    /// available.
5332    ///
5333    /// Field 4: `reference_candles`
5334    #[serde(
5335        rename = "referenceCandles",
5336        alias = "reference_candles",
5337        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
5338        deserialize_with = "::buffa::json_helpers::null_as_default"
5339    )]
5340    pub reference_candles: ::buffa::alloc::vec::Vec<CandlePoint>,
5341    /// Opaque cursor for the next page. Empty when no more results exist.
5342    ///
5343    /// Field 5: `next_page_token`
5344    #[serde(
5345        rename = "nextPageToken",
5346        alias = "next_page_token",
5347        with = "::buffa::json_helpers::proto_string",
5348        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
5349    )]
5350    pub next_page_token: ::buffa::alloc::string::String,
5351    #[serde(skip)]
5352    #[doc(hidden)]
5353    pub __buffa_unknown_fields: ::buffa::UnknownFields,
5354}
5355impl ::core::fmt::Debug for GetCandlesResponse {
5356    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5357        f.debug_struct("GetCandlesResponse")
5358            .field("symbol_id", &self.symbol_id)
5359            .field("timeframe", &self.timeframe)
5360            .field("candles", &self.candles)
5361            .field("reference_candles", &self.reference_candles)
5362            .field("next_page_token", &self.next_page_token)
5363            .finish()
5364    }
5365}
5366impl GetCandlesResponse {
5367    /// Protobuf type URL for this message, for use with `Any::pack` and
5368    /// `Any::unpack_if`.
5369    ///
5370    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
5371    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetCandlesResponse";
5372}
5373::buffa::impl_default_instance!(GetCandlesResponse);
5374impl ::buffa::MessageName for GetCandlesResponse {
5375    const PACKAGE: &'static str = "marketdata.v1";
5376    const NAME: &'static str = "GetCandlesResponse";
5377    const FULL_NAME: &'static str = "marketdata.v1.GetCandlesResponse";
5378    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetCandlesResponse";
5379}
5380impl ::buffa::Message for GetCandlesResponse {
5381    /// Returns the total encoded size in bytes.
5382    ///
5383    /// The result is a `u32`; the protobuf specification requires all
5384    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
5385    /// compliant message will never overflow this type.
5386    #[allow(clippy::let_and_return)]
5387    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
5388        #[allow(unused_imports)]
5389        use ::buffa::Enumeration as _;
5390        let mut size = 0u32;
5391        if self.symbol_id != 0u32 {
5392            size += 1u32 + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
5393        }
5394        {
5395            let val = self.timeframe.to_i32();
5396            if val != 0 {
5397                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
5398            }
5399        }
5400        for v in &self.candles {
5401            let __slot = __cache.reserve();
5402            let inner_size = v.compute_size(__cache);
5403            __cache.set(__slot, inner_size);
5404            size
5405                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
5406                    + inner_size;
5407        }
5408        for v in &self.reference_candles {
5409            let __slot = __cache.reserve();
5410            let inner_size = v.compute_size(__cache);
5411            __cache.set(__slot, inner_size);
5412            size
5413                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
5414                    + inner_size;
5415        }
5416        if !self.next_page_token.is_empty() {
5417            size
5418                += 1u32
5419                    + ::buffa::types::string_encoded_len(&self.next_page_token) as u32;
5420        }
5421        size += self.__buffa_unknown_fields.encoded_len() as u32;
5422        size
5423    }
5424    fn write_to(
5425        &self,
5426        __cache: &mut ::buffa::SizeCache,
5427        buf: &mut impl ::buffa::bytes::BufMut,
5428    ) {
5429        #[allow(unused_imports)]
5430        use ::buffa::Enumeration as _;
5431        if self.symbol_id != 0u32 {
5432            ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
5433        }
5434        {
5435            let val = self.timeframe.to_i32();
5436            if val != 0 {
5437                ::buffa::types::put_int32_field(2u32, val, buf);
5438            }
5439        }
5440        for v in &self.candles {
5441            ::buffa::types::put_len_delimited_header(3u32, __cache.consume_next(), buf);
5442            v.write_to(__cache, buf);
5443        }
5444        for v in &self.reference_candles {
5445            ::buffa::types::put_len_delimited_header(4u32, __cache.consume_next(), buf);
5446            v.write_to(__cache, buf);
5447        }
5448        if !self.next_page_token.is_empty() {
5449            ::buffa::types::put_string_field(5u32, &self.next_page_token, buf);
5450        }
5451        self.__buffa_unknown_fields.write_to(buf);
5452    }
5453    fn merge_field(
5454        &mut self,
5455        tag: ::buffa::encoding::Tag,
5456        buf: &mut impl ::buffa::bytes::Buf,
5457        ctx: ::buffa::DecodeContext<'_>,
5458    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
5459        #[allow(unused_imports)]
5460        use ::buffa::bytes::Buf as _;
5461        #[allow(unused_imports)]
5462        use ::buffa::Enumeration as _;
5463        match tag.field_number() {
5464            1u32 => {
5465                ::buffa::encoding::check_wire_type(
5466                    tag,
5467                    ::buffa::encoding::WireType::Varint,
5468                )?;
5469                self.symbol_id = ::buffa::types::decode_uint32(buf)?;
5470            }
5471            2u32 => {
5472                ::buffa::encoding::check_wire_type(
5473                    tag,
5474                    ::buffa::encoding::WireType::Varint,
5475                )?;
5476                self.timeframe = ::buffa::EnumValue::from(
5477                    ::buffa::types::decode_int32(buf)?,
5478                );
5479            }
5480            3u32 => {
5481                ::buffa::encoding::check_wire_type(
5482                    tag,
5483                    ::buffa::encoding::WireType::LengthDelimited,
5484                )?;
5485                let mut elem = ::core::default::Default::default();
5486                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
5487                self.candles.push(elem);
5488            }
5489            4u32 => {
5490                ::buffa::encoding::check_wire_type(
5491                    tag,
5492                    ::buffa::encoding::WireType::LengthDelimited,
5493                )?;
5494                let mut elem = ::core::default::Default::default();
5495                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
5496                self.reference_candles.push(elem);
5497            }
5498            5u32 => {
5499                ::buffa::encoding::check_wire_type(
5500                    tag,
5501                    ::buffa::encoding::WireType::LengthDelimited,
5502                )?;
5503                ::buffa::types::merge_string(&mut self.next_page_token, buf)?;
5504            }
5505            _ => {
5506                self.__buffa_unknown_fields
5507                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
5508            }
5509        }
5510        ::core::result::Result::Ok(())
5511    }
5512    fn clear(&mut self) {
5513        self.symbol_id = 0u32;
5514        self.timeframe = ::buffa::EnumValue::from(0);
5515        self.candles.clear();
5516        self.reference_candles.clear();
5517        self.next_page_token.clear();
5518        self.__buffa_unknown_fields.clear();
5519    }
5520}
5521impl ::buffa::ExtensionSet for GetCandlesResponse {
5522    const PROTO_FQN: &'static str = "marketdata.v1.GetCandlesResponse";
5523    fn unknown_fields(&self) -> &::buffa::UnknownFields {
5524        &self.__buffa_unknown_fields
5525    }
5526    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
5527        &mut self.__buffa_unknown_fields
5528    }
5529}
5530impl ::buffa::json_helpers::ProtoElemJson for GetCandlesResponse {
5531    fn serialize_proto_json<S: ::serde::Serializer>(
5532        v: &Self,
5533        s: S,
5534    ) -> ::core::result::Result<S::Ok, S::Error> {
5535        ::serde::Serialize::serialize(v, s)
5536    }
5537    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
5538        d: D,
5539    ) -> ::core::result::Result<Self, D::Error> {
5540        <Self as ::serde::Deserialize>::deserialize(d)
5541    }
5542}
5543#[doc(hidden)]
5544pub const __GET_CANDLES_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
5545    type_url: "type.googleapis.com/marketdata.v1.GetCandlesResponse",
5546    to_json: ::buffa::type_registry::any_to_json::<GetCandlesResponse>,
5547    from_json: ::buffa::type_registry::any_from_json::<GetCandlesResponse>,
5548    is_wkt: false,
5549};
5550/// GetCandlesColumnsResponse returns the same candle series as GetCandles but in columnar form.
5551/// This is optimized for charting clients that ingest arrays of each field (binary only).
5552///
5553/// Ordering: values are returned oldest-first (ascending ts_sec).
5554#[derive(Clone, PartialEq, Default)]
5555#[derive(::serde::Serialize, ::serde::Deserialize)]
5556#[serde(default)]
5557pub struct GetCandlesColumnsResponse {
5558    /// Numeric spot market identifier.
5559    ///
5560    /// Field 1: `symbol_id`
5561    #[serde(
5562        rename = "symbolId",
5563        alias = "symbol_id",
5564        with = "::buffa::json_helpers::uint32",
5565        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
5566    )]
5567    pub symbol_id: u32,
5568    /// Timeframe of this series.
5569    ///
5570    /// Field 2: `timeframe`
5571    #[serde(
5572        rename = "timeframe",
5573        with = "::buffa::json_helpers::proto_enum",
5574        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
5575    )]
5576    pub timeframe: ::buffa::EnumValue<Timeframe>,
5577    /// Candle bucket start timestamps (seconds since epoch, UTC).
5578    ///
5579    /// Field 3: `ts_sec`
5580    #[serde(
5581        rename = "tsSec",
5582        alias = "ts_sec",
5583        with = "::buffa::json_helpers::proto_seq",
5584        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
5585    )]
5586    pub ts_sec: ::buffa::alloc::vec::Vec<u64>,
5587    /// Opening prices in quote units scaled by 1e6.
5588    ///
5589    /// Field 4: `open`
5590    #[serde(
5591        rename = "open",
5592        with = "::buffa::json_helpers::proto_seq",
5593        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
5594    )]
5595    pub open: ::buffa::alloc::vec::Vec<i64>,
5596    /// Highest traded prices in quote units scaled by 1e6.
5597    ///
5598    /// Field 5: `high`
5599    #[serde(
5600        rename = "high",
5601        with = "::buffa::json_helpers::proto_seq",
5602        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
5603    )]
5604    pub high: ::buffa::alloc::vec::Vec<i64>,
5605    /// Lowest traded prices in quote units scaled by 1e6.
5606    ///
5607    /// Field 6: `low`
5608    #[serde(
5609        rename = "low",
5610        with = "::buffa::json_helpers::proto_seq",
5611        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
5612    )]
5613    pub low: ::buffa::alloc::vec::Vec<i64>,
5614    /// Closing prices in quote units scaled by 1e6.
5615    ///
5616    /// Field 7: `close`
5617    #[serde(
5618        rename = "close",
5619        with = "::buffa::json_helpers::proto_seq",
5620        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
5621    )]
5622    pub close: ::buffa::alloc::vec::Vec<i64>,
5623    /// Traded base-asset quantities scaled by the pair's base_quantity_scale from
5624    /// GetSpotConfig.
5625    ///
5626    /// Field 8: `volume`
5627    #[serde(
5628        rename = "volume",
5629        with = "::buffa::json_helpers::proto_seq",
5630        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
5631    )]
5632    pub volume: ::buffa::alloc::vec::Vec<i64>,
5633    /// Reference candle series in columnar form (same ordering as ts_sec: oldest-first).
5634    /// Only populated when request.include_reference=true.
5635    ///
5636    /// Field 9: `reference_ts_sec`
5637    #[serde(
5638        rename = "referenceTsSec",
5639        alias = "reference_ts_sec",
5640        with = "::buffa::json_helpers::proto_seq",
5641        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
5642    )]
5643    pub reference_ts_sec: ::buffa::alloc::vec::Vec<u64>,
5644    /// Reference opening prices in quote units scaled by 1e6.
5645    ///
5646    /// Field 10: `reference_open`
5647    #[serde(
5648        rename = "referenceOpen",
5649        alias = "reference_open",
5650        with = "::buffa::json_helpers::proto_seq",
5651        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
5652    )]
5653    pub reference_open: ::buffa::alloc::vec::Vec<i64>,
5654    /// Reference high prices in quote units scaled by 1e6.
5655    ///
5656    /// Field 11: `reference_high`
5657    #[serde(
5658        rename = "referenceHigh",
5659        alias = "reference_high",
5660        with = "::buffa::json_helpers::proto_seq",
5661        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
5662    )]
5663    pub reference_high: ::buffa::alloc::vec::Vec<i64>,
5664    /// Reference low prices in quote units scaled by 1e6.
5665    ///
5666    /// Field 12: `reference_low`
5667    #[serde(
5668        rename = "referenceLow",
5669        alias = "reference_low",
5670        with = "::buffa::json_helpers::proto_seq",
5671        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
5672    )]
5673    pub reference_low: ::buffa::alloc::vec::Vec<i64>,
5674    /// Reference closing prices in quote units scaled by 1e6.
5675    ///
5676    /// Field 13: `reference_close`
5677    #[serde(
5678        rename = "referenceClose",
5679        alias = "reference_close",
5680        with = "::buffa::json_helpers::proto_seq",
5681        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
5682    )]
5683    pub reference_close: ::buffa::alloc::vec::Vec<i64>,
5684    /// Reference traded base-asset quantities scaled by the pair's
5685    /// base_quantity_scale from GetSpotConfig.
5686    ///
5687    /// Field 14: `reference_volume`
5688    #[serde(
5689        rename = "referenceVolume",
5690        alias = "reference_volume",
5691        with = "::buffa::json_helpers::proto_seq",
5692        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
5693    )]
5694    pub reference_volume: ::buffa::alloc::vec::Vec<i64>,
5695    /// Opaque cursor for the next page. Empty when no more results exist.
5696    ///
5697    /// Field 15: `next_page_token`
5698    #[serde(
5699        rename = "nextPageToken",
5700        alias = "next_page_token",
5701        with = "::buffa::json_helpers::proto_string",
5702        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
5703    )]
5704    pub next_page_token: ::buffa::alloc::string::String,
5705    #[serde(skip)]
5706    #[doc(hidden)]
5707    pub __buffa_unknown_fields: ::buffa::UnknownFields,
5708}
5709impl ::core::fmt::Debug for GetCandlesColumnsResponse {
5710    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5711        f.debug_struct("GetCandlesColumnsResponse")
5712            .field("symbol_id", &self.symbol_id)
5713            .field("timeframe", &self.timeframe)
5714            .field("ts_sec", &self.ts_sec)
5715            .field("open", &self.open)
5716            .field("high", &self.high)
5717            .field("low", &self.low)
5718            .field("close", &self.close)
5719            .field("volume", &self.volume)
5720            .field("reference_ts_sec", &self.reference_ts_sec)
5721            .field("reference_open", &self.reference_open)
5722            .field("reference_high", &self.reference_high)
5723            .field("reference_low", &self.reference_low)
5724            .field("reference_close", &self.reference_close)
5725            .field("reference_volume", &self.reference_volume)
5726            .field("next_page_token", &self.next_page_token)
5727            .finish()
5728    }
5729}
5730impl GetCandlesColumnsResponse {
5731    /// Protobuf type URL for this message, for use with `Any::pack` and
5732    /// `Any::unpack_if`.
5733    ///
5734    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
5735    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetCandlesColumnsResponse";
5736}
5737::buffa::impl_default_instance!(GetCandlesColumnsResponse);
5738impl ::buffa::MessageName for GetCandlesColumnsResponse {
5739    const PACKAGE: &'static str = "marketdata.v1";
5740    const NAME: &'static str = "GetCandlesColumnsResponse";
5741    const FULL_NAME: &'static str = "marketdata.v1.GetCandlesColumnsResponse";
5742    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetCandlesColumnsResponse";
5743}
5744impl ::buffa::Message for GetCandlesColumnsResponse {
5745    /// Returns the total encoded size in bytes.
5746    ///
5747    /// The result is a `u32`; the protobuf specification requires all
5748    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
5749    /// compliant message will never overflow this type.
5750    #[allow(clippy::let_and_return)]
5751    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
5752        #[allow(unused_imports)]
5753        use ::buffa::Enumeration as _;
5754        let mut size = 0u32;
5755        if self.symbol_id != 0u32 {
5756            size += 1u32 + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
5757        }
5758        {
5759            let val = self.timeframe.to_i32();
5760            if val != 0 {
5761                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
5762            }
5763        }
5764        if !self.ts_sec.is_empty() {
5765            let payload: u32 = self
5766                .ts_sec
5767                .iter()
5768                .map(|&v| ::buffa::types::uint64_encoded_len(v) as u32)
5769                .sum::<u32>();
5770            size
5771                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
5772        }
5773        if !self.open.is_empty() {
5774            let payload: u32 = self
5775                .open
5776                .iter()
5777                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
5778                .sum::<u32>();
5779            size
5780                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
5781        }
5782        if !self.high.is_empty() {
5783            let payload: u32 = self
5784                .high
5785                .iter()
5786                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
5787                .sum::<u32>();
5788            size
5789                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
5790        }
5791        if !self.low.is_empty() {
5792            let payload: u32 = self
5793                .low
5794                .iter()
5795                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
5796                .sum::<u32>();
5797            size
5798                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
5799        }
5800        if !self.close.is_empty() {
5801            let payload: u32 = self
5802                .close
5803                .iter()
5804                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
5805                .sum::<u32>();
5806            size
5807                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
5808        }
5809        if !self.volume.is_empty() {
5810            let payload: u32 = self
5811                .volume
5812                .iter()
5813                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
5814                .sum::<u32>();
5815            size
5816                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
5817        }
5818        if !self.reference_ts_sec.is_empty() {
5819            let payload: u32 = self
5820                .reference_ts_sec
5821                .iter()
5822                .map(|&v| ::buffa::types::uint64_encoded_len(v) as u32)
5823                .sum::<u32>();
5824            size
5825                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
5826        }
5827        if !self.reference_open.is_empty() {
5828            let payload: u32 = self
5829                .reference_open
5830                .iter()
5831                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
5832                .sum::<u32>();
5833            size
5834                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
5835        }
5836        if !self.reference_high.is_empty() {
5837            let payload: u32 = self
5838                .reference_high
5839                .iter()
5840                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
5841                .sum::<u32>();
5842            size
5843                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
5844        }
5845        if !self.reference_low.is_empty() {
5846            let payload: u32 = self
5847                .reference_low
5848                .iter()
5849                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
5850                .sum::<u32>();
5851            size
5852                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
5853        }
5854        if !self.reference_close.is_empty() {
5855            let payload: u32 = self
5856                .reference_close
5857                .iter()
5858                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
5859                .sum::<u32>();
5860            size
5861                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
5862        }
5863        if !self.reference_volume.is_empty() {
5864            let payload: u32 = self
5865                .reference_volume
5866                .iter()
5867                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
5868                .sum::<u32>();
5869            size
5870                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
5871        }
5872        if !self.next_page_token.is_empty() {
5873            size
5874                += 1u32
5875                    + ::buffa::types::string_encoded_len(&self.next_page_token) as u32;
5876        }
5877        size += self.__buffa_unknown_fields.encoded_len() as u32;
5878        size
5879    }
5880    fn write_to(
5881        &self,
5882        _cache: &mut ::buffa::SizeCache,
5883        buf: &mut impl ::buffa::bytes::BufMut,
5884    ) {
5885        #[allow(unused_imports)]
5886        use ::buffa::Enumeration as _;
5887        if self.symbol_id != 0u32 {
5888            ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
5889        }
5890        {
5891            let val = self.timeframe.to_i32();
5892            if val != 0 {
5893                ::buffa::types::put_int32_field(2u32, val, buf);
5894            }
5895        }
5896        if !self.ts_sec.is_empty() {
5897            let payload: u32 = self
5898                .ts_sec
5899                .iter()
5900                .map(|&v| ::buffa::types::uint64_encoded_len(v) as u32)
5901                .sum::<u32>();
5902            ::buffa::types::put_len_delimited_header(3u32, payload, buf);
5903            for &v in &self.ts_sec {
5904                ::buffa::types::encode_uint64(v, buf);
5905            }
5906        }
5907        if !self.open.is_empty() {
5908            let payload: u32 = self
5909                .open
5910                .iter()
5911                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
5912                .sum::<u32>();
5913            ::buffa::types::put_len_delimited_header(4u32, payload, buf);
5914            for &v in &self.open {
5915                ::buffa::types::encode_int64(v, buf);
5916            }
5917        }
5918        if !self.high.is_empty() {
5919            let payload: u32 = self
5920                .high
5921                .iter()
5922                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
5923                .sum::<u32>();
5924            ::buffa::types::put_len_delimited_header(5u32, payload, buf);
5925            for &v in &self.high {
5926                ::buffa::types::encode_int64(v, buf);
5927            }
5928        }
5929        if !self.low.is_empty() {
5930            let payload: u32 = self
5931                .low
5932                .iter()
5933                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
5934                .sum::<u32>();
5935            ::buffa::types::put_len_delimited_header(6u32, payload, buf);
5936            for &v in &self.low {
5937                ::buffa::types::encode_int64(v, buf);
5938            }
5939        }
5940        if !self.close.is_empty() {
5941            let payload: u32 = self
5942                .close
5943                .iter()
5944                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
5945                .sum::<u32>();
5946            ::buffa::types::put_len_delimited_header(7u32, payload, buf);
5947            for &v in &self.close {
5948                ::buffa::types::encode_int64(v, buf);
5949            }
5950        }
5951        if !self.volume.is_empty() {
5952            let payload: u32 = self
5953                .volume
5954                .iter()
5955                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
5956                .sum::<u32>();
5957            ::buffa::types::put_len_delimited_header(8u32, payload, buf);
5958            for &v in &self.volume {
5959                ::buffa::types::encode_int64(v, buf);
5960            }
5961        }
5962        if !self.reference_ts_sec.is_empty() {
5963            let payload: u32 = self
5964                .reference_ts_sec
5965                .iter()
5966                .map(|&v| ::buffa::types::uint64_encoded_len(v) as u32)
5967                .sum::<u32>();
5968            ::buffa::types::put_len_delimited_header(9u32, payload, buf);
5969            for &v in &self.reference_ts_sec {
5970                ::buffa::types::encode_uint64(v, buf);
5971            }
5972        }
5973        if !self.reference_open.is_empty() {
5974            let payload: u32 = self
5975                .reference_open
5976                .iter()
5977                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
5978                .sum::<u32>();
5979            ::buffa::types::put_len_delimited_header(10u32, payload, buf);
5980            for &v in &self.reference_open {
5981                ::buffa::types::encode_int64(v, buf);
5982            }
5983        }
5984        if !self.reference_high.is_empty() {
5985            let payload: u32 = self
5986                .reference_high
5987                .iter()
5988                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
5989                .sum::<u32>();
5990            ::buffa::types::put_len_delimited_header(11u32, payload, buf);
5991            for &v in &self.reference_high {
5992                ::buffa::types::encode_int64(v, buf);
5993            }
5994        }
5995        if !self.reference_low.is_empty() {
5996            let payload: u32 = self
5997                .reference_low
5998                .iter()
5999                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
6000                .sum::<u32>();
6001            ::buffa::types::put_len_delimited_header(12u32, payload, buf);
6002            for &v in &self.reference_low {
6003                ::buffa::types::encode_int64(v, buf);
6004            }
6005        }
6006        if !self.reference_close.is_empty() {
6007            let payload: u32 = self
6008                .reference_close
6009                .iter()
6010                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
6011                .sum::<u32>();
6012            ::buffa::types::put_len_delimited_header(13u32, payload, buf);
6013            for &v in &self.reference_close {
6014                ::buffa::types::encode_int64(v, buf);
6015            }
6016        }
6017        if !self.reference_volume.is_empty() {
6018            let payload: u32 = self
6019                .reference_volume
6020                .iter()
6021                .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
6022                .sum::<u32>();
6023            ::buffa::types::put_len_delimited_header(14u32, payload, buf);
6024            for &v in &self.reference_volume {
6025                ::buffa::types::encode_int64(v, buf);
6026            }
6027        }
6028        if !self.next_page_token.is_empty() {
6029            ::buffa::types::put_string_field(15u32, &self.next_page_token, buf);
6030        }
6031        self.__buffa_unknown_fields.write_to(buf);
6032    }
6033    fn merge_field(
6034        &mut self,
6035        tag: ::buffa::encoding::Tag,
6036        buf: &mut impl ::buffa::bytes::Buf,
6037        ctx: ::buffa::DecodeContext<'_>,
6038    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
6039        #[allow(unused_imports)]
6040        use ::buffa::bytes::Buf as _;
6041        #[allow(unused_imports)]
6042        use ::buffa::Enumeration as _;
6043        match tag.field_number() {
6044            1u32 => {
6045                ::buffa::encoding::check_wire_type(
6046                    tag,
6047                    ::buffa::encoding::WireType::Varint,
6048                )?;
6049                self.symbol_id = ::buffa::types::decode_uint32(buf)?;
6050            }
6051            2u32 => {
6052                ::buffa::encoding::check_wire_type(
6053                    tag,
6054                    ::buffa::encoding::WireType::Varint,
6055                )?;
6056                self.timeframe = ::buffa::EnumValue::from(
6057                    ::buffa::types::decode_int32(buf)?,
6058                );
6059            }
6060            3u32 => {
6061                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
6062                    let len = ::buffa::encoding::decode_varint(buf)?;
6063                    let len = usize::try_from(len)
6064                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
6065                    if buf.remaining() < len {
6066                        return ::core::result::Result::Err(
6067                            ::buffa::DecodeError::UnexpectedEof,
6068                        );
6069                    }
6070                    self.ts_sec.reserve(len);
6071                    let mut limited = buf.take(len);
6072                    while limited.has_remaining() {
6073                        self.ts_sec.push(::buffa::types::decode_uint64(&mut limited)?);
6074                    }
6075                    let leftover = limited.remaining();
6076                    if leftover > 0 {
6077                        limited.advance(leftover);
6078                    }
6079                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
6080                    self.ts_sec.push(::buffa::types::decode_uint64(buf)?);
6081                } else {
6082                    return ::core::result::Result::Err(
6083                        ::buffa::encoding::wire_type_mismatch(
6084                            tag,
6085                            ::buffa::encoding::WireType::LengthDelimited,
6086                        ),
6087                    );
6088                }
6089            }
6090            4u32 => {
6091                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
6092                    let len = ::buffa::encoding::decode_varint(buf)?;
6093                    let len = usize::try_from(len)
6094                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
6095                    if buf.remaining() < len {
6096                        return ::core::result::Result::Err(
6097                            ::buffa::DecodeError::UnexpectedEof,
6098                        );
6099                    }
6100                    self.open.reserve(len);
6101                    let mut limited = buf.take(len);
6102                    while limited.has_remaining() {
6103                        self.open.push(::buffa::types::decode_int64(&mut limited)?);
6104                    }
6105                    let leftover = limited.remaining();
6106                    if leftover > 0 {
6107                        limited.advance(leftover);
6108                    }
6109                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
6110                    self.open.push(::buffa::types::decode_int64(buf)?);
6111                } else {
6112                    return ::core::result::Result::Err(
6113                        ::buffa::encoding::wire_type_mismatch(
6114                            tag,
6115                            ::buffa::encoding::WireType::LengthDelimited,
6116                        ),
6117                    );
6118                }
6119            }
6120            5u32 => {
6121                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
6122                    let len = ::buffa::encoding::decode_varint(buf)?;
6123                    let len = usize::try_from(len)
6124                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
6125                    if buf.remaining() < len {
6126                        return ::core::result::Result::Err(
6127                            ::buffa::DecodeError::UnexpectedEof,
6128                        );
6129                    }
6130                    self.high.reserve(len);
6131                    let mut limited = buf.take(len);
6132                    while limited.has_remaining() {
6133                        self.high.push(::buffa::types::decode_int64(&mut limited)?);
6134                    }
6135                    let leftover = limited.remaining();
6136                    if leftover > 0 {
6137                        limited.advance(leftover);
6138                    }
6139                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
6140                    self.high.push(::buffa::types::decode_int64(buf)?);
6141                } else {
6142                    return ::core::result::Result::Err(
6143                        ::buffa::encoding::wire_type_mismatch(
6144                            tag,
6145                            ::buffa::encoding::WireType::LengthDelimited,
6146                        ),
6147                    );
6148                }
6149            }
6150            6u32 => {
6151                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
6152                    let len = ::buffa::encoding::decode_varint(buf)?;
6153                    let len = usize::try_from(len)
6154                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
6155                    if buf.remaining() < len {
6156                        return ::core::result::Result::Err(
6157                            ::buffa::DecodeError::UnexpectedEof,
6158                        );
6159                    }
6160                    self.low.reserve(len);
6161                    let mut limited = buf.take(len);
6162                    while limited.has_remaining() {
6163                        self.low.push(::buffa::types::decode_int64(&mut limited)?);
6164                    }
6165                    let leftover = limited.remaining();
6166                    if leftover > 0 {
6167                        limited.advance(leftover);
6168                    }
6169                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
6170                    self.low.push(::buffa::types::decode_int64(buf)?);
6171                } else {
6172                    return ::core::result::Result::Err(
6173                        ::buffa::encoding::wire_type_mismatch(
6174                            tag,
6175                            ::buffa::encoding::WireType::LengthDelimited,
6176                        ),
6177                    );
6178                }
6179            }
6180            7u32 => {
6181                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
6182                    let len = ::buffa::encoding::decode_varint(buf)?;
6183                    let len = usize::try_from(len)
6184                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
6185                    if buf.remaining() < len {
6186                        return ::core::result::Result::Err(
6187                            ::buffa::DecodeError::UnexpectedEof,
6188                        );
6189                    }
6190                    self.close.reserve(len);
6191                    let mut limited = buf.take(len);
6192                    while limited.has_remaining() {
6193                        self.close.push(::buffa::types::decode_int64(&mut limited)?);
6194                    }
6195                    let leftover = limited.remaining();
6196                    if leftover > 0 {
6197                        limited.advance(leftover);
6198                    }
6199                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
6200                    self.close.push(::buffa::types::decode_int64(buf)?);
6201                } else {
6202                    return ::core::result::Result::Err(
6203                        ::buffa::encoding::wire_type_mismatch(
6204                            tag,
6205                            ::buffa::encoding::WireType::LengthDelimited,
6206                        ),
6207                    );
6208                }
6209            }
6210            8u32 => {
6211                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
6212                    let len = ::buffa::encoding::decode_varint(buf)?;
6213                    let len = usize::try_from(len)
6214                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
6215                    if buf.remaining() < len {
6216                        return ::core::result::Result::Err(
6217                            ::buffa::DecodeError::UnexpectedEof,
6218                        );
6219                    }
6220                    self.volume.reserve(len);
6221                    let mut limited = buf.take(len);
6222                    while limited.has_remaining() {
6223                        self.volume.push(::buffa::types::decode_int64(&mut limited)?);
6224                    }
6225                    let leftover = limited.remaining();
6226                    if leftover > 0 {
6227                        limited.advance(leftover);
6228                    }
6229                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
6230                    self.volume.push(::buffa::types::decode_int64(buf)?);
6231                } else {
6232                    return ::core::result::Result::Err(
6233                        ::buffa::encoding::wire_type_mismatch(
6234                            tag,
6235                            ::buffa::encoding::WireType::LengthDelimited,
6236                        ),
6237                    );
6238                }
6239            }
6240            9u32 => {
6241                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
6242                    let len = ::buffa::encoding::decode_varint(buf)?;
6243                    let len = usize::try_from(len)
6244                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
6245                    if buf.remaining() < len {
6246                        return ::core::result::Result::Err(
6247                            ::buffa::DecodeError::UnexpectedEof,
6248                        );
6249                    }
6250                    self.reference_ts_sec.reserve(len);
6251                    let mut limited = buf.take(len);
6252                    while limited.has_remaining() {
6253                        self.reference_ts_sec
6254                            .push(::buffa::types::decode_uint64(&mut limited)?);
6255                    }
6256                    let leftover = limited.remaining();
6257                    if leftover > 0 {
6258                        limited.advance(leftover);
6259                    }
6260                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
6261                    self.reference_ts_sec.push(::buffa::types::decode_uint64(buf)?);
6262                } else {
6263                    return ::core::result::Result::Err(
6264                        ::buffa::encoding::wire_type_mismatch(
6265                            tag,
6266                            ::buffa::encoding::WireType::LengthDelimited,
6267                        ),
6268                    );
6269                }
6270            }
6271            10u32 => {
6272                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
6273                    let len = ::buffa::encoding::decode_varint(buf)?;
6274                    let len = usize::try_from(len)
6275                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
6276                    if buf.remaining() < len {
6277                        return ::core::result::Result::Err(
6278                            ::buffa::DecodeError::UnexpectedEof,
6279                        );
6280                    }
6281                    self.reference_open.reserve(len);
6282                    let mut limited = buf.take(len);
6283                    while limited.has_remaining() {
6284                        self.reference_open
6285                            .push(::buffa::types::decode_int64(&mut limited)?);
6286                    }
6287                    let leftover = limited.remaining();
6288                    if leftover > 0 {
6289                        limited.advance(leftover);
6290                    }
6291                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
6292                    self.reference_open.push(::buffa::types::decode_int64(buf)?);
6293                } else {
6294                    return ::core::result::Result::Err(
6295                        ::buffa::encoding::wire_type_mismatch(
6296                            tag,
6297                            ::buffa::encoding::WireType::LengthDelimited,
6298                        ),
6299                    );
6300                }
6301            }
6302            11u32 => {
6303                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
6304                    let len = ::buffa::encoding::decode_varint(buf)?;
6305                    let len = usize::try_from(len)
6306                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
6307                    if buf.remaining() < len {
6308                        return ::core::result::Result::Err(
6309                            ::buffa::DecodeError::UnexpectedEof,
6310                        );
6311                    }
6312                    self.reference_high.reserve(len);
6313                    let mut limited = buf.take(len);
6314                    while limited.has_remaining() {
6315                        self.reference_high
6316                            .push(::buffa::types::decode_int64(&mut limited)?);
6317                    }
6318                    let leftover = limited.remaining();
6319                    if leftover > 0 {
6320                        limited.advance(leftover);
6321                    }
6322                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
6323                    self.reference_high.push(::buffa::types::decode_int64(buf)?);
6324                } else {
6325                    return ::core::result::Result::Err(
6326                        ::buffa::encoding::wire_type_mismatch(
6327                            tag,
6328                            ::buffa::encoding::WireType::LengthDelimited,
6329                        ),
6330                    );
6331                }
6332            }
6333            12u32 => {
6334                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
6335                    let len = ::buffa::encoding::decode_varint(buf)?;
6336                    let len = usize::try_from(len)
6337                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
6338                    if buf.remaining() < len {
6339                        return ::core::result::Result::Err(
6340                            ::buffa::DecodeError::UnexpectedEof,
6341                        );
6342                    }
6343                    self.reference_low.reserve(len);
6344                    let mut limited = buf.take(len);
6345                    while limited.has_remaining() {
6346                        self.reference_low
6347                            .push(::buffa::types::decode_int64(&mut limited)?);
6348                    }
6349                    let leftover = limited.remaining();
6350                    if leftover > 0 {
6351                        limited.advance(leftover);
6352                    }
6353                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
6354                    self.reference_low.push(::buffa::types::decode_int64(buf)?);
6355                } else {
6356                    return ::core::result::Result::Err(
6357                        ::buffa::encoding::wire_type_mismatch(
6358                            tag,
6359                            ::buffa::encoding::WireType::LengthDelimited,
6360                        ),
6361                    );
6362                }
6363            }
6364            13u32 => {
6365                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
6366                    let len = ::buffa::encoding::decode_varint(buf)?;
6367                    let len = usize::try_from(len)
6368                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
6369                    if buf.remaining() < len {
6370                        return ::core::result::Result::Err(
6371                            ::buffa::DecodeError::UnexpectedEof,
6372                        );
6373                    }
6374                    self.reference_close.reserve(len);
6375                    let mut limited = buf.take(len);
6376                    while limited.has_remaining() {
6377                        self.reference_close
6378                            .push(::buffa::types::decode_int64(&mut limited)?);
6379                    }
6380                    let leftover = limited.remaining();
6381                    if leftover > 0 {
6382                        limited.advance(leftover);
6383                    }
6384                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
6385                    self.reference_close.push(::buffa::types::decode_int64(buf)?);
6386                } else {
6387                    return ::core::result::Result::Err(
6388                        ::buffa::encoding::wire_type_mismatch(
6389                            tag,
6390                            ::buffa::encoding::WireType::LengthDelimited,
6391                        ),
6392                    );
6393                }
6394            }
6395            14u32 => {
6396                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
6397                    let len = ::buffa::encoding::decode_varint(buf)?;
6398                    let len = usize::try_from(len)
6399                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
6400                    if buf.remaining() < len {
6401                        return ::core::result::Result::Err(
6402                            ::buffa::DecodeError::UnexpectedEof,
6403                        );
6404                    }
6405                    self.reference_volume.reserve(len);
6406                    let mut limited = buf.take(len);
6407                    while limited.has_remaining() {
6408                        self.reference_volume
6409                            .push(::buffa::types::decode_int64(&mut limited)?);
6410                    }
6411                    let leftover = limited.remaining();
6412                    if leftover > 0 {
6413                        limited.advance(leftover);
6414                    }
6415                } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
6416                    self.reference_volume.push(::buffa::types::decode_int64(buf)?);
6417                } else {
6418                    return ::core::result::Result::Err(
6419                        ::buffa::encoding::wire_type_mismatch(
6420                            tag,
6421                            ::buffa::encoding::WireType::LengthDelimited,
6422                        ),
6423                    );
6424                }
6425            }
6426            15u32 => {
6427                ::buffa::encoding::check_wire_type(
6428                    tag,
6429                    ::buffa::encoding::WireType::LengthDelimited,
6430                )?;
6431                ::buffa::types::merge_string(&mut self.next_page_token, buf)?;
6432            }
6433            _ => {
6434                self.__buffa_unknown_fields
6435                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
6436            }
6437        }
6438        ::core::result::Result::Ok(())
6439    }
6440    fn clear(&mut self) {
6441        self.symbol_id = 0u32;
6442        self.timeframe = ::buffa::EnumValue::from(0);
6443        self.ts_sec.clear();
6444        self.open.clear();
6445        self.high.clear();
6446        self.low.clear();
6447        self.close.clear();
6448        self.volume.clear();
6449        self.reference_ts_sec.clear();
6450        self.reference_open.clear();
6451        self.reference_high.clear();
6452        self.reference_low.clear();
6453        self.reference_close.clear();
6454        self.reference_volume.clear();
6455        self.next_page_token.clear();
6456        self.__buffa_unknown_fields.clear();
6457    }
6458}
6459impl ::buffa::ExtensionSet for GetCandlesColumnsResponse {
6460    const PROTO_FQN: &'static str = "marketdata.v1.GetCandlesColumnsResponse";
6461    fn unknown_fields(&self) -> &::buffa::UnknownFields {
6462        &self.__buffa_unknown_fields
6463    }
6464    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
6465        &mut self.__buffa_unknown_fields
6466    }
6467}
6468impl ::buffa::json_helpers::ProtoElemJson for GetCandlesColumnsResponse {
6469    fn serialize_proto_json<S: ::serde::Serializer>(
6470        v: &Self,
6471        s: S,
6472    ) -> ::core::result::Result<S::Ok, S::Error> {
6473        ::serde::Serialize::serialize(v, s)
6474    }
6475    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
6476        d: D,
6477    ) -> ::core::result::Result<Self, D::Error> {
6478        <Self as ::serde::Deserialize>::deserialize(d)
6479    }
6480}
6481#[doc(hidden)]
6482pub const __GET_CANDLES_COLUMNS_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
6483    type_url: "type.googleapis.com/marketdata.v1.GetCandlesColumnsResponse",
6484    to_json: ::buffa::type_registry::any_to_json::<GetCandlesColumnsResponse>,
6485    from_json: ::buffa::type_registry::any_from_json::<GetCandlesColumnsResponse>,
6486    is_wkt: false,
6487};
6488/// ---------------------------------------------------------------------------
6489/// Candle contains one public OHLCV bucket.
6490/// ---------------------------------------------------------------------------
6491///
6492/// Candle represents a single OHLCV bucket for a symbol and timeframe.
6493#[derive(Clone, PartialEq, Default)]
6494#[derive(::serde::Serialize, ::serde::Deserialize)]
6495#[serde(default)]
6496pub struct Candle {
6497    /// numeric spot market identifier
6498    ///
6499    /// Field 1: `symbol_id`
6500    #[serde(
6501        rename = "symbolId",
6502        alias = "symbol_id",
6503        with = "::buffa::json_helpers::uint32",
6504        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
6505    )]
6506    pub symbol_id: u32,
6507    /// timeframe of this candle
6508    ///
6509    /// Field 2: `timeframe`
6510    #[serde(
6511        rename = "timeframe",
6512        with = "::buffa::json_helpers::proto_enum",
6513        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
6514    )]
6515    pub timeframe: ::buffa::EnumValue<Timeframe>,
6516    /// bucket start timestamp (seconds since epoch, UTC)
6517    ///
6518    /// Field 3: `ts_sec`
6519    #[serde(
6520        rename = "tsSec",
6521        alias = "ts_sec",
6522        with = "::buffa::json_helpers::uint64",
6523        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
6524    )]
6525    pub ts_sec: u64,
6526    /// opening price in quote units scaled by 1e6
6527    ///
6528    /// Field 4: `open`
6529    #[serde(
6530        rename = "open",
6531        with = "::buffa::json_helpers::int64",
6532        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
6533    )]
6534    pub open: i64,
6535    /// highest traded price in quote units scaled by 1e6
6536    ///
6537    /// Field 5: `high`
6538    #[serde(
6539        rename = "high",
6540        with = "::buffa::json_helpers::int64",
6541        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
6542    )]
6543    pub high: i64,
6544    /// lowest traded price in quote units scaled by 1e6
6545    ///
6546    /// Field 6: `low`
6547    #[serde(
6548        rename = "low",
6549        with = "::buffa::json_helpers::int64",
6550        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
6551    )]
6552    pub low: i64,
6553    /// closing price in quote units scaled by 1e6
6554    ///
6555    /// Field 7: `close`
6556    #[serde(
6557        rename = "close",
6558        with = "::buffa::json_helpers::int64",
6559        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
6560    )]
6561    pub close: i64,
6562    /// Traded base-asset quantity scaled by the pair's base_quantity_scale from
6563    /// GetSpotConfig.
6564    ///
6565    /// Field 8: `volume`
6566    #[serde(
6567        rename = "volume",
6568        with = "::buffa::json_helpers::int64",
6569        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
6570    )]
6571    pub volume: i64,
6572    #[serde(skip)]
6573    #[doc(hidden)]
6574    pub __buffa_unknown_fields: ::buffa::UnknownFields,
6575}
6576impl ::core::fmt::Debug for Candle {
6577    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
6578        f.debug_struct("Candle")
6579            .field("symbol_id", &self.symbol_id)
6580            .field("timeframe", &self.timeframe)
6581            .field("ts_sec", &self.ts_sec)
6582            .field("open", &self.open)
6583            .field("high", &self.high)
6584            .field("low", &self.low)
6585            .field("close", &self.close)
6586            .field("volume", &self.volume)
6587            .finish()
6588    }
6589}
6590impl Candle {
6591    /// Protobuf type URL for this message, for use with `Any::pack` and
6592    /// `Any::unpack_if`.
6593    ///
6594    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
6595    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.Candle";
6596}
6597::buffa::impl_default_instance!(Candle);
6598impl ::buffa::MessageName for Candle {
6599    const PACKAGE: &'static str = "marketdata.v1";
6600    const NAME: &'static str = "Candle";
6601    const FULL_NAME: &'static str = "marketdata.v1.Candle";
6602    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.Candle";
6603}
6604impl ::buffa::Message for Candle {
6605    /// Returns the total encoded size in bytes.
6606    ///
6607    /// The result is a `u32`; the protobuf specification requires all
6608    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
6609    /// compliant message will never overflow this type.
6610    #[allow(clippy::let_and_return)]
6611    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
6612        #[allow(unused_imports)]
6613        use ::buffa::Enumeration as _;
6614        let mut size = 0u32;
6615        if self.symbol_id != 0u32 {
6616            size += 1u32 + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
6617        }
6618        {
6619            let val = self.timeframe.to_i32();
6620            if val != 0 {
6621                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
6622            }
6623        }
6624        if self.ts_sec != 0u64 {
6625            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_sec) as u32;
6626        }
6627        if self.open != 0i64 {
6628            size += 1u32 + ::buffa::types::int64_encoded_len(self.open) as u32;
6629        }
6630        if self.high != 0i64 {
6631            size += 1u32 + ::buffa::types::int64_encoded_len(self.high) as u32;
6632        }
6633        if self.low != 0i64 {
6634            size += 1u32 + ::buffa::types::int64_encoded_len(self.low) as u32;
6635        }
6636        if self.close != 0i64 {
6637            size += 1u32 + ::buffa::types::int64_encoded_len(self.close) as u32;
6638        }
6639        if self.volume != 0i64 {
6640            size += 1u32 + ::buffa::types::int64_encoded_len(self.volume) as u32;
6641        }
6642        size += self.__buffa_unknown_fields.encoded_len() as u32;
6643        size
6644    }
6645    fn write_to(
6646        &self,
6647        _cache: &mut ::buffa::SizeCache,
6648        buf: &mut impl ::buffa::bytes::BufMut,
6649    ) {
6650        #[allow(unused_imports)]
6651        use ::buffa::Enumeration as _;
6652        if self.symbol_id != 0u32 {
6653            ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
6654        }
6655        {
6656            let val = self.timeframe.to_i32();
6657            if val != 0 {
6658                ::buffa::types::put_int32_field(2u32, val, buf);
6659            }
6660        }
6661        if self.ts_sec != 0u64 {
6662            ::buffa::types::put_uint64_field(3u32, self.ts_sec, buf);
6663        }
6664        if self.open != 0i64 {
6665            ::buffa::types::put_int64_field(4u32, self.open, buf);
6666        }
6667        if self.high != 0i64 {
6668            ::buffa::types::put_int64_field(5u32, self.high, buf);
6669        }
6670        if self.low != 0i64 {
6671            ::buffa::types::put_int64_field(6u32, self.low, buf);
6672        }
6673        if self.close != 0i64 {
6674            ::buffa::types::put_int64_field(7u32, self.close, buf);
6675        }
6676        if self.volume != 0i64 {
6677            ::buffa::types::put_int64_field(8u32, self.volume, buf);
6678        }
6679        self.__buffa_unknown_fields.write_to(buf);
6680    }
6681    fn merge_field(
6682        &mut self,
6683        tag: ::buffa::encoding::Tag,
6684        buf: &mut impl ::buffa::bytes::Buf,
6685        ctx: ::buffa::DecodeContext<'_>,
6686    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
6687        #[allow(unused_imports)]
6688        use ::buffa::bytes::Buf as _;
6689        #[allow(unused_imports)]
6690        use ::buffa::Enumeration as _;
6691        match tag.field_number() {
6692            1u32 => {
6693                ::buffa::encoding::check_wire_type(
6694                    tag,
6695                    ::buffa::encoding::WireType::Varint,
6696                )?;
6697                self.symbol_id = ::buffa::types::decode_uint32(buf)?;
6698            }
6699            2u32 => {
6700                ::buffa::encoding::check_wire_type(
6701                    tag,
6702                    ::buffa::encoding::WireType::Varint,
6703                )?;
6704                self.timeframe = ::buffa::EnumValue::from(
6705                    ::buffa::types::decode_int32(buf)?,
6706                );
6707            }
6708            3u32 => {
6709                ::buffa::encoding::check_wire_type(
6710                    tag,
6711                    ::buffa::encoding::WireType::Varint,
6712                )?;
6713                self.ts_sec = ::buffa::types::decode_uint64(buf)?;
6714            }
6715            4u32 => {
6716                ::buffa::encoding::check_wire_type(
6717                    tag,
6718                    ::buffa::encoding::WireType::Varint,
6719                )?;
6720                self.open = ::buffa::types::decode_int64(buf)?;
6721            }
6722            5u32 => {
6723                ::buffa::encoding::check_wire_type(
6724                    tag,
6725                    ::buffa::encoding::WireType::Varint,
6726                )?;
6727                self.high = ::buffa::types::decode_int64(buf)?;
6728            }
6729            6u32 => {
6730                ::buffa::encoding::check_wire_type(
6731                    tag,
6732                    ::buffa::encoding::WireType::Varint,
6733                )?;
6734                self.low = ::buffa::types::decode_int64(buf)?;
6735            }
6736            7u32 => {
6737                ::buffa::encoding::check_wire_type(
6738                    tag,
6739                    ::buffa::encoding::WireType::Varint,
6740                )?;
6741                self.close = ::buffa::types::decode_int64(buf)?;
6742            }
6743            8u32 => {
6744                ::buffa::encoding::check_wire_type(
6745                    tag,
6746                    ::buffa::encoding::WireType::Varint,
6747                )?;
6748                self.volume = ::buffa::types::decode_int64(buf)?;
6749            }
6750            _ => {
6751                self.__buffa_unknown_fields
6752                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
6753            }
6754        }
6755        ::core::result::Result::Ok(())
6756    }
6757    fn clear(&mut self) {
6758        self.symbol_id = 0u32;
6759        self.timeframe = ::buffa::EnumValue::from(0);
6760        self.ts_sec = 0u64;
6761        self.open = 0i64;
6762        self.high = 0i64;
6763        self.low = 0i64;
6764        self.close = 0i64;
6765        self.volume = 0i64;
6766        self.__buffa_unknown_fields.clear();
6767    }
6768}
6769impl ::buffa::ExtensionSet for Candle {
6770    const PROTO_FQN: &'static str = "marketdata.v1.Candle";
6771    fn unknown_fields(&self) -> &::buffa::UnknownFields {
6772        &self.__buffa_unknown_fields
6773    }
6774    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
6775        &mut self.__buffa_unknown_fields
6776    }
6777}
6778impl ::buffa::json_helpers::ProtoElemJson for Candle {
6779    fn serialize_proto_json<S: ::serde::Serializer>(
6780        v: &Self,
6781        s: S,
6782    ) -> ::core::result::Result<S::Ok, S::Error> {
6783        ::serde::Serialize::serialize(v, s)
6784    }
6785    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
6786        d: D,
6787    ) -> ::core::result::Result<Self, D::Error> {
6788        <Self as ::serde::Deserialize>::deserialize(d)
6789    }
6790}
6791#[doc(hidden)]
6792pub const __CANDLE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
6793    type_url: "type.googleapis.com/marketdata.v1.Candle",
6794    to_json: ::buffa::type_registry::any_to_json::<Candle>,
6795    from_json: ::buffa::type_registry::any_from_json::<Candle>,
6796    is_wkt: false,
6797};
6798/// ---------------------------------------------------------------------------
6799/// GetSpotConfig: spot assets and pair reference data.
6800/// ---------------------------------------------------------------------------
6801///
6802/// AssetConfig describes one spot asset returned by GetSpotConfig.
6803#[derive(Clone, PartialEq, Default)]
6804#[derive(::serde::Serialize, ::serde::Deserialize)]
6805#[serde(default)]
6806pub struct AssetConfig {
6807    /// Asset code, e.g. "USDT" or "BTC".
6808    ///
6809    /// Field 1: `asset`
6810    #[serde(
6811        rename = "asset",
6812        with = "::buffa::json_helpers::proto_string",
6813        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
6814    )]
6815    pub asset: ::buffa::alloc::string::String,
6816    /// Stable numeric asset id used by account, balance, and order APIs.
6817    ///
6818    /// Field 2: `ledger_id`
6819    #[serde(
6820        rename = "ledgerId",
6821        alias = "ledger_id",
6822        with = "::buffa::json_helpers::uint32",
6823        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
6824    )]
6825    pub ledger_id: u32,
6826    /// Human-friendly display name, e.g. "Bitcoin".
6827    ///
6828    /// Field 3: `name`
6829    #[serde(
6830        rename = "name",
6831        with = "::buffa::json_helpers::proto_string",
6832        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
6833    )]
6834    pub name: ::buffa::alloc::string::String,
6835    /// Suggested decimal precision for displaying user-facing asset amounts.
6836    ///
6837    /// Field 4: `quantity_display_decimals`
6838    #[serde(
6839        rename = "quantityDisplayDecimals",
6840        alias = "quantity_display_decimals",
6841        with = "::buffa::json_helpers::uint32",
6842        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
6843    )]
6844    pub quantity_display_decimals: u32,
6845    /// Integer scale for quantities and balances in this asset (0..18).
6846    /// A scale of 8 means one whole asset is represented as 100000000 in scaled
6847    /// integer fields such as qty_scaled.
6848    ///
6849    /// Field 5: `quantity_scale`
6850    #[serde(
6851        rename = "quantityScale",
6852        alias = "quantity_scale",
6853        with = "::buffa::json_helpers::uint32",
6854        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
6855    )]
6856    pub quantity_scale: u32,
6857    #[serde(skip)]
6858    #[doc(hidden)]
6859    pub __buffa_unknown_fields: ::buffa::UnknownFields,
6860}
6861impl ::core::fmt::Debug for AssetConfig {
6862    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
6863        f.debug_struct("AssetConfig")
6864            .field("asset", &self.asset)
6865            .field("ledger_id", &self.ledger_id)
6866            .field("name", &self.name)
6867            .field("quantity_display_decimals", &self.quantity_display_decimals)
6868            .field("quantity_scale", &self.quantity_scale)
6869            .finish()
6870    }
6871}
6872impl AssetConfig {
6873    /// Protobuf type URL for this message, for use with `Any::pack` and
6874    /// `Any::unpack_if`.
6875    ///
6876    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
6877    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.AssetConfig";
6878}
6879::buffa::impl_default_instance!(AssetConfig);
6880impl ::buffa::MessageName for AssetConfig {
6881    const PACKAGE: &'static str = "marketdata.v1";
6882    const NAME: &'static str = "AssetConfig";
6883    const FULL_NAME: &'static str = "marketdata.v1.AssetConfig";
6884    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.AssetConfig";
6885}
6886impl ::buffa::Message for AssetConfig {
6887    /// Returns the total encoded size in bytes.
6888    ///
6889    /// The result is a `u32`; the protobuf specification requires all
6890    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
6891    /// compliant message will never overflow this type.
6892    #[allow(clippy::let_and_return)]
6893    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
6894        #[allow(unused_imports)]
6895        use ::buffa::Enumeration as _;
6896        let mut size = 0u32;
6897        if !self.asset.is_empty() {
6898            size += 1u32 + ::buffa::types::string_encoded_len(&self.asset) as u32;
6899        }
6900        if self.ledger_id != 0u32 {
6901            size += 1u32 + ::buffa::types::uint32_encoded_len(self.ledger_id) as u32;
6902        }
6903        if !self.name.is_empty() {
6904            size += 1u32 + ::buffa::types::string_encoded_len(&self.name) as u32;
6905        }
6906        if self.quantity_display_decimals != 0u32 {
6907            size
6908                += 1u32
6909                    + ::buffa::types::uint32_encoded_len(self.quantity_display_decimals)
6910                        as u32;
6911        }
6912        if self.quantity_scale != 0u32 {
6913            size
6914                += 1u32 + ::buffa::types::uint32_encoded_len(self.quantity_scale) as u32;
6915        }
6916        size += self.__buffa_unknown_fields.encoded_len() as u32;
6917        size
6918    }
6919    fn write_to(
6920        &self,
6921        _cache: &mut ::buffa::SizeCache,
6922        buf: &mut impl ::buffa::bytes::BufMut,
6923    ) {
6924        #[allow(unused_imports)]
6925        use ::buffa::Enumeration as _;
6926        if !self.asset.is_empty() {
6927            ::buffa::types::put_string_field(1u32, &self.asset, buf);
6928        }
6929        if self.ledger_id != 0u32 {
6930            ::buffa::types::put_uint32_field(2u32, self.ledger_id, buf);
6931        }
6932        if !self.name.is_empty() {
6933            ::buffa::types::put_string_field(3u32, &self.name, buf);
6934        }
6935        if self.quantity_display_decimals != 0u32 {
6936            ::buffa::types::put_uint32_field(4u32, self.quantity_display_decimals, buf);
6937        }
6938        if self.quantity_scale != 0u32 {
6939            ::buffa::types::put_uint32_field(5u32, self.quantity_scale, buf);
6940        }
6941        self.__buffa_unknown_fields.write_to(buf);
6942    }
6943    fn merge_field(
6944        &mut self,
6945        tag: ::buffa::encoding::Tag,
6946        buf: &mut impl ::buffa::bytes::Buf,
6947        ctx: ::buffa::DecodeContext<'_>,
6948    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
6949        #[allow(unused_imports)]
6950        use ::buffa::bytes::Buf as _;
6951        #[allow(unused_imports)]
6952        use ::buffa::Enumeration as _;
6953        match tag.field_number() {
6954            1u32 => {
6955                ::buffa::encoding::check_wire_type(
6956                    tag,
6957                    ::buffa::encoding::WireType::LengthDelimited,
6958                )?;
6959                ::buffa::types::merge_string(&mut self.asset, buf)?;
6960            }
6961            2u32 => {
6962                ::buffa::encoding::check_wire_type(
6963                    tag,
6964                    ::buffa::encoding::WireType::Varint,
6965                )?;
6966                self.ledger_id = ::buffa::types::decode_uint32(buf)?;
6967            }
6968            3u32 => {
6969                ::buffa::encoding::check_wire_type(
6970                    tag,
6971                    ::buffa::encoding::WireType::LengthDelimited,
6972                )?;
6973                ::buffa::types::merge_string(&mut self.name, buf)?;
6974            }
6975            4u32 => {
6976                ::buffa::encoding::check_wire_type(
6977                    tag,
6978                    ::buffa::encoding::WireType::Varint,
6979                )?;
6980                self.quantity_display_decimals = ::buffa::types::decode_uint32(buf)?;
6981            }
6982            5u32 => {
6983                ::buffa::encoding::check_wire_type(
6984                    tag,
6985                    ::buffa::encoding::WireType::Varint,
6986                )?;
6987                self.quantity_scale = ::buffa::types::decode_uint32(buf)?;
6988            }
6989            _ => {
6990                self.__buffa_unknown_fields
6991                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
6992            }
6993        }
6994        ::core::result::Result::Ok(())
6995    }
6996    fn clear(&mut self) {
6997        self.asset.clear();
6998        self.ledger_id = 0u32;
6999        self.name.clear();
7000        self.quantity_display_decimals = 0u32;
7001        self.quantity_scale = 0u32;
7002        self.__buffa_unknown_fields.clear();
7003    }
7004}
7005impl ::buffa::ExtensionSet for AssetConfig {
7006    const PROTO_FQN: &'static str = "marketdata.v1.AssetConfig";
7007    fn unknown_fields(&self) -> &::buffa::UnknownFields {
7008        &self.__buffa_unknown_fields
7009    }
7010    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
7011        &mut self.__buffa_unknown_fields
7012    }
7013}
7014impl ::buffa::json_helpers::ProtoElemJson for AssetConfig {
7015    fn serialize_proto_json<S: ::serde::Serializer>(
7016        v: &Self,
7017        s: S,
7018    ) -> ::core::result::Result<S::Ok, S::Error> {
7019        ::serde::Serialize::serialize(v, s)
7020    }
7021    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
7022        d: D,
7023    ) -> ::core::result::Result<Self, D::Error> {
7024        <Self as ::serde::Deserialize>::deserialize(d)
7025    }
7026}
7027#[doc(hidden)]
7028pub const __ASSET_CONFIG_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
7029    type_url: "type.googleapis.com/marketdata.v1.AssetConfig",
7030    to_json: ::buffa::type_registry::any_to_json::<AssetConfig>,
7031    from_json: ::buffa::type_registry::any_from_json::<AssetConfig>,
7032    is_wkt: false,
7033};
7034/// PairMarketdataConfig describes market-data display settings for a spot pair.
7035#[derive(Clone, PartialEq, Default)]
7036#[derive(::serde::Serialize, ::serde::Deserialize)]
7037#[serde(default)]
7038pub struct PairMarketdataConfig {
7039    /// Suggested order book aggregation bucket sizes in quote-asset price units,
7040    /// e.g. 0.01, 0.1, 1, or 10.
7041    ///
7042    /// Field 1: `orderbook_price_buckets`
7043    #[serde(
7044        rename = "orderbookPriceBuckets",
7045        alias = "orderbook_price_buckets",
7046        with = "::buffa::json_helpers::proto_seq",
7047        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
7048    )]
7049    pub orderbook_price_buckets: ::buffa::alloc::vec::Vec<f64>,
7050    #[serde(skip)]
7051    #[doc(hidden)]
7052    pub __buffa_unknown_fields: ::buffa::UnknownFields,
7053}
7054impl ::core::fmt::Debug for PairMarketdataConfig {
7055    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7056        f.debug_struct("PairMarketdataConfig")
7057            .field("orderbook_price_buckets", &self.orderbook_price_buckets)
7058            .finish()
7059    }
7060}
7061impl PairMarketdataConfig {
7062    /// Protobuf type URL for this message, for use with `Any::pack` and
7063    /// `Any::unpack_if`.
7064    ///
7065    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
7066    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.PairMarketdataConfig";
7067}
7068::buffa::impl_default_instance!(PairMarketdataConfig);
7069impl ::buffa::MessageName for PairMarketdataConfig {
7070    const PACKAGE: &'static str = "marketdata.v1";
7071    const NAME: &'static str = "PairMarketdataConfig";
7072    const FULL_NAME: &'static str = "marketdata.v1.PairMarketdataConfig";
7073    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.PairMarketdataConfig";
7074}
7075impl ::buffa::Message for PairMarketdataConfig {
7076    /// Returns the total encoded size in bytes.
7077    ///
7078    /// The result is a `u32`; the protobuf specification requires all
7079    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
7080    /// compliant message will never overflow this type.
7081    #[allow(clippy::let_and_return)]
7082    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
7083        #[allow(unused_imports)]
7084        use ::buffa::Enumeration as _;
7085        let mut size = 0u32;
7086        if !self.orderbook_price_buckets.is_empty() {
7087            let payload: u32 = self.orderbook_price_buckets.len() as u32
7088                * ::buffa::types::FIXED64_ENCODED_LEN as u32;
7089            size
7090                += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32 + payload;
7091        }
7092        size += self.__buffa_unknown_fields.encoded_len() as u32;
7093        size
7094    }
7095    fn write_to(
7096        &self,
7097        _cache: &mut ::buffa::SizeCache,
7098        buf: &mut impl ::buffa::bytes::BufMut,
7099    ) {
7100        #[allow(unused_imports)]
7101        use ::buffa::Enumeration as _;
7102        if !self.orderbook_price_buckets.is_empty() {
7103            let payload: u32 = self.orderbook_price_buckets.len() as u32
7104                * ::buffa::types::FIXED64_ENCODED_LEN as u32;
7105            ::buffa::types::put_len_delimited_header(1u32, payload, buf);
7106            for &v in &self.orderbook_price_buckets {
7107                ::buffa::types::encode_double(v, buf);
7108            }
7109        }
7110        self.__buffa_unknown_fields.write_to(buf);
7111    }
7112    fn merge_field(
7113        &mut self,
7114        tag: ::buffa::encoding::Tag,
7115        buf: &mut impl ::buffa::bytes::Buf,
7116        ctx: ::buffa::DecodeContext<'_>,
7117    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
7118        #[allow(unused_imports)]
7119        use ::buffa::bytes::Buf as _;
7120        #[allow(unused_imports)]
7121        use ::buffa::Enumeration as _;
7122        match tag.field_number() {
7123            1u32 => {
7124                if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
7125                    let len = ::buffa::encoding::decode_varint(buf)?;
7126                    let len = usize::try_from(len)
7127                        .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
7128                    if buf.remaining() < len {
7129                        return ::core::result::Result::Err(
7130                            ::buffa::DecodeError::UnexpectedEof,
7131                        );
7132                    }
7133                    self.orderbook_price_buckets.reserve(len / 8usize);
7134                    let mut limited = buf.take(len);
7135                    while limited.has_remaining() {
7136                        self.orderbook_price_buckets
7137                            .push(::buffa::types::decode_double(&mut limited)?);
7138                    }
7139                    let leftover = limited.remaining();
7140                    if leftover > 0 {
7141                        limited.advance(leftover);
7142                    }
7143                } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed64 {
7144                    self.orderbook_price_buckets
7145                        .push(::buffa::types::decode_double(buf)?);
7146                } else {
7147                    return ::core::result::Result::Err(
7148                        ::buffa::encoding::wire_type_mismatch(
7149                            tag,
7150                            ::buffa::encoding::WireType::LengthDelimited,
7151                        ),
7152                    );
7153                }
7154            }
7155            _ => {
7156                self.__buffa_unknown_fields
7157                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
7158            }
7159        }
7160        ::core::result::Result::Ok(())
7161    }
7162    fn clear(&mut self) {
7163        self.orderbook_price_buckets.clear();
7164        self.__buffa_unknown_fields.clear();
7165    }
7166}
7167impl ::buffa::ExtensionSet for PairMarketdataConfig {
7168    const PROTO_FQN: &'static str = "marketdata.v1.PairMarketdataConfig";
7169    fn unknown_fields(&self) -> &::buffa::UnknownFields {
7170        &self.__buffa_unknown_fields
7171    }
7172    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
7173        &mut self.__buffa_unknown_fields
7174    }
7175}
7176impl ::buffa::json_helpers::ProtoElemJson for PairMarketdataConfig {
7177    fn serialize_proto_json<S: ::serde::Serializer>(
7178        v: &Self,
7179        s: S,
7180    ) -> ::core::result::Result<S::Ok, S::Error> {
7181        ::serde::Serialize::serialize(v, s)
7182    }
7183    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
7184        d: D,
7185    ) -> ::core::result::Result<Self, D::Error> {
7186        <Self as ::serde::Deserialize>::deserialize(d)
7187    }
7188}
7189#[doc(hidden)]
7190pub const __PAIR_MARKETDATA_CONFIG_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
7191    type_url: "type.googleapis.com/marketdata.v1.PairMarketdataConfig",
7192    to_json: ::buffa::type_registry::any_to_json::<PairMarketdataConfig>,
7193    from_json: ::buffa::type_registry::any_from_json::<PairMarketdataConfig>,
7194    is_wkt: false,
7195};
7196/// PairConfig describes one spot trading pair and its trading constraints.
7197#[derive(Clone, PartialEq, Default)]
7198#[derive(::serde::Serialize, ::serde::Deserialize)]
7199#[serde(default)]
7200pub struct PairConfig {
7201    /// Stable numeric pair id used by low-latency ConnectRPC requests and streams.
7202    ///
7203    /// Field 1: `symbol_id`
7204    #[serde(
7205        rename = "symbolId",
7206        alias = "symbol_id",
7207        with = "::buffa::json_helpers::uint32",
7208        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
7209    )]
7210    pub symbol_id: u32,
7211    /// Trading pair symbol, e.g. "BTC-USDT".
7212    ///
7213    /// Field 2: `symbol`
7214    #[serde(
7215        rename = "symbol",
7216        with = "::buffa::json_helpers::proto_string",
7217        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
7218    )]
7219    pub symbol: ::buffa::alloc::string::String,
7220    /// Base asset code. For BTC-USDT, this is "BTC".
7221    ///
7222    /// Field 3: `base_asset`
7223    #[serde(
7224        rename = "baseAsset",
7225        alias = "base_asset",
7226        with = "::buffa::json_helpers::proto_string",
7227        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
7228    )]
7229    pub base_asset: ::buffa::alloc::string::String,
7230    /// Quote asset code. For BTC-USDT, this is "USDT".
7231    ///
7232    /// Field 4: `quote_asset`
7233    #[serde(
7234        rename = "quoteAsset",
7235        alias = "quote_asset",
7236        with = "::buffa::json_helpers::proto_string",
7237        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
7238    )]
7239    pub quote_asset: ::buffa::alloc::string::String,
7240    /// Minimum allowed price increment as a decimal string in quote-asset units.
7241    /// Prices use 6 decimal places in scaled integer fields; for example "0.01"
7242    /// means orders must be priced in 0.01 quote-asset increments.
7243    ///
7244    /// Field 5: `tick_size`
7245    #[serde(
7246        rename = "tickSize",
7247        alias = "tick_size",
7248        with = "::buffa::json_helpers::proto_string",
7249        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
7250    )]
7251    pub tick_size: ::buffa::alloc::string::String,
7252    /// Minimum allowed quantity increment as a decimal string in base-asset units.
7253    ///
7254    /// Field 6: `step_size`
7255    #[serde(
7256        rename = "stepSize",
7257        alias = "step_size",
7258        with = "::buffa::json_helpers::proto_string",
7259        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
7260    )]
7261    pub step_size: ::buffa::alloc::string::String,
7262    /// Minimum order notional as a decimal string in quote-asset units.
7263    ///
7264    /// Field 7: `min_notional_quote`
7265    #[serde(
7266        rename = "minNotionalQuote",
7267        alias = "min_notional_quote",
7268        with = "::buffa::json_helpers::proto_string",
7269        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
7270    )]
7271    pub min_notional_quote: ::buffa::alloc::string::String,
7272    /// Minimum order quantity as a decimal string in base-asset units.
7273    ///
7274    /// Field 8: `min_qty_base`
7275    #[serde(
7276        rename = "minQtyBase",
7277        alias = "min_qty_base",
7278        with = "::buffa::json_helpers::proto_string",
7279        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
7280    )]
7281    pub min_qty_base: ::buffa::alloc::string::String,
7282    /// Whether BUY order fees may be paid from the base asset instead of the
7283    /// spent quote asset when the order request selects the base fee asset.
7284    ///
7285    /// Field 9: `allow_buy_fee_from_base`
7286    #[serde(
7287        rename = "allowBuyFeeFromBase",
7288        alias = "allow_buy_fee_from_base",
7289        with = "::buffa::json_helpers::proto_bool",
7290        skip_serializing_if = "::buffa::json_helpers::skip_if::is_false"
7291    )]
7292    pub allow_buy_fee_from_base: bool,
7293    /// Quantity scale for base-asset amounts in this pair.
7294    ///
7295    /// Field 10: `base_quantity_scale`
7296    #[serde(
7297        rename = "baseQuantityScale",
7298        alias = "base_quantity_scale",
7299        with = "::buffa::json_helpers::uint32",
7300        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
7301    )]
7302    pub base_quantity_scale: u32,
7303    /// Quantity scale for quote-asset amounts in this pair.
7304    ///
7305    /// Field 11: `quote_quantity_scale`
7306    #[serde(
7307        rename = "quoteQuantityScale",
7308        alias = "quote_quantity_scale",
7309        with = "::buffa::json_helpers::uint32",
7310        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
7311    )]
7312    pub quote_quantity_scale: u32,
7313    /// Market-data display settings for this pair.
7314    ///
7315    /// Field 12: `marketdata`
7316    #[serde(
7317        rename = "marketdata",
7318        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
7319    )]
7320    pub marketdata: ::buffa::MessageField<PairMarketdataConfig>,
7321    /// Scheduled listing timestamp. When unset, the pair has no explicit future
7322    /// listing time.
7323    ///
7324    /// Field 13: `listing_at`
7325    #[serde(
7326        rename = "listingAt",
7327        alias = "listing_at",
7328        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
7329    )]
7330    pub listing_at: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
7331    /// Scheduled delisting timestamp. When unset, the pair has no explicit
7332    /// delisting time.
7333    ///
7334    /// Field 14: `delisting_at`
7335    #[serde(
7336        rename = "delistingAt",
7337        alias = "delisting_at",
7338        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
7339    )]
7340    pub delisting_at: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
7341    /// Current trading status.
7342    ///
7343    /// Field 15: `status`
7344    #[serde(
7345        rename = "status",
7346        with = "::buffa::json_helpers::proto_enum",
7347        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
7348    )]
7349    pub status: ::buffa::EnumValue<PairStatus>,
7350    /// Default MARKET order slippage cap for BUY orders, in basis points
7351    /// (1 bp = 0.01%). A request-level slippage setting can override this value.
7352    ///
7353    /// Field 16: `default_market_slippage_bps_buy`
7354    #[serde(
7355        rename = "defaultMarketSlippageBpsBuy",
7356        alias = "default_market_slippage_bps_buy",
7357        with = "::buffa::json_helpers::int32",
7358        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
7359    )]
7360    pub default_market_slippage_bps_buy: i32,
7361    /// Default MARKET order slippage cap for SELL orders, in basis points
7362    /// (1 bp = 0.01%). A request-level slippage setting can override this value.
7363    ///
7364    /// Field 17: `default_market_slippage_bps_sell`
7365    #[serde(
7366        rename = "defaultMarketSlippageBpsSell",
7367        alias = "default_market_slippage_bps_sell",
7368        with = "::buffa::json_helpers::int32",
7369        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
7370    )]
7371    pub default_market_slippage_bps_sell: i32,
7372    /// Maximum allowed drift between client reference price and server reference
7373    /// price for MARKET orders, in basis points (1 bp = 0.01%), when client
7374    /// reference pricing is used.
7375    ///
7376    /// Field 18: `max_client_ref_drift_bps`
7377    #[serde(
7378        rename = "maxClientRefDriftBps",
7379        alias = "max_client_ref_drift_bps",
7380        with = "::buffa::json_helpers::int32",
7381        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i32"
7382    )]
7383    pub max_client_ref_drift_bps: i32,
7384    #[serde(skip)]
7385    #[doc(hidden)]
7386    pub __buffa_unknown_fields: ::buffa::UnknownFields,
7387}
7388impl ::core::fmt::Debug for PairConfig {
7389    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7390        f.debug_struct("PairConfig")
7391            .field("symbol_id", &self.symbol_id)
7392            .field("symbol", &self.symbol)
7393            .field("base_asset", &self.base_asset)
7394            .field("quote_asset", &self.quote_asset)
7395            .field("tick_size", &self.tick_size)
7396            .field("step_size", &self.step_size)
7397            .field("min_notional_quote", &self.min_notional_quote)
7398            .field("min_qty_base", &self.min_qty_base)
7399            .field("allow_buy_fee_from_base", &self.allow_buy_fee_from_base)
7400            .field("base_quantity_scale", &self.base_quantity_scale)
7401            .field("quote_quantity_scale", &self.quote_quantity_scale)
7402            .field("marketdata", &self.marketdata)
7403            .field("listing_at", &self.listing_at)
7404            .field("delisting_at", &self.delisting_at)
7405            .field("status", &self.status)
7406            .field(
7407                "default_market_slippage_bps_buy",
7408                &self.default_market_slippage_bps_buy,
7409            )
7410            .field(
7411                "default_market_slippage_bps_sell",
7412                &self.default_market_slippage_bps_sell,
7413            )
7414            .field("max_client_ref_drift_bps", &self.max_client_ref_drift_bps)
7415            .finish()
7416    }
7417}
7418impl PairConfig {
7419    /// Protobuf type URL for this message, for use with `Any::pack` and
7420    /// `Any::unpack_if`.
7421    ///
7422    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
7423    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.PairConfig";
7424}
7425::buffa::impl_default_instance!(PairConfig);
7426impl ::buffa::MessageName for PairConfig {
7427    const PACKAGE: &'static str = "marketdata.v1";
7428    const NAME: &'static str = "PairConfig";
7429    const FULL_NAME: &'static str = "marketdata.v1.PairConfig";
7430    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.PairConfig";
7431}
7432impl ::buffa::Message for PairConfig {
7433    /// Returns the total encoded size in bytes.
7434    ///
7435    /// The result is a `u32`; the protobuf specification requires all
7436    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
7437    /// compliant message will never overflow this type.
7438    #[allow(clippy::let_and_return)]
7439    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
7440        #[allow(unused_imports)]
7441        use ::buffa::Enumeration as _;
7442        let mut size = 0u32;
7443        if self.symbol_id != 0u32 {
7444            size += 1u32 + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
7445        }
7446        if !self.symbol.is_empty() {
7447            size += 1u32 + ::buffa::types::string_encoded_len(&self.symbol) as u32;
7448        }
7449        if !self.base_asset.is_empty() {
7450            size += 1u32 + ::buffa::types::string_encoded_len(&self.base_asset) as u32;
7451        }
7452        if !self.quote_asset.is_empty() {
7453            size += 1u32 + ::buffa::types::string_encoded_len(&self.quote_asset) as u32;
7454        }
7455        if !self.tick_size.is_empty() {
7456            size += 1u32 + ::buffa::types::string_encoded_len(&self.tick_size) as u32;
7457        }
7458        if !self.step_size.is_empty() {
7459            size += 1u32 + ::buffa::types::string_encoded_len(&self.step_size) as u32;
7460        }
7461        if !self.min_notional_quote.is_empty() {
7462            size
7463                += 1u32
7464                    + ::buffa::types::string_encoded_len(&self.min_notional_quote)
7465                        as u32;
7466        }
7467        if !self.min_qty_base.is_empty() {
7468            size += 1u32 + ::buffa::types::string_encoded_len(&self.min_qty_base) as u32;
7469        }
7470        if self.allow_buy_fee_from_base {
7471            size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
7472        }
7473        if self.base_quantity_scale != 0u32 {
7474            size
7475                += 1u32
7476                    + ::buffa::types::uint32_encoded_len(self.base_quantity_scale)
7477                        as u32;
7478        }
7479        if self.quote_quantity_scale != 0u32 {
7480            size
7481                += 1u32
7482                    + ::buffa::types::uint32_encoded_len(self.quote_quantity_scale)
7483                        as u32;
7484        }
7485        if self.marketdata.is_set() {
7486            let __slot = __cache.reserve();
7487            let inner_size = self.marketdata.compute_size(__cache);
7488            __cache.set(__slot, inner_size);
7489            size
7490                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
7491                    + inner_size;
7492        }
7493        if self.listing_at.is_set() {
7494            let __slot = __cache.reserve();
7495            let inner_size = self.listing_at.compute_size(__cache);
7496            __cache.set(__slot, inner_size);
7497            size
7498                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
7499                    + inner_size;
7500        }
7501        if self.delisting_at.is_set() {
7502            let __slot = __cache.reserve();
7503            let inner_size = self.delisting_at.compute_size(__cache);
7504            __cache.set(__slot, inner_size);
7505            size
7506                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
7507                    + inner_size;
7508        }
7509        {
7510            let val = self.status.to_i32();
7511            if val != 0 {
7512                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
7513            }
7514        }
7515        if self.default_market_slippage_bps_buy != 0i32 {
7516            size
7517                += 2u32
7518                    + ::buffa::types::int32_encoded_len(
7519                        self.default_market_slippage_bps_buy,
7520                    ) as u32;
7521        }
7522        if self.default_market_slippage_bps_sell != 0i32 {
7523            size
7524                += 2u32
7525                    + ::buffa::types::int32_encoded_len(
7526                        self.default_market_slippage_bps_sell,
7527                    ) as u32;
7528        }
7529        if self.max_client_ref_drift_bps != 0i32 {
7530            size
7531                += 2u32
7532                    + ::buffa::types::int32_encoded_len(self.max_client_ref_drift_bps)
7533                        as u32;
7534        }
7535        size += self.__buffa_unknown_fields.encoded_len() as u32;
7536        size
7537    }
7538    fn write_to(
7539        &self,
7540        __cache: &mut ::buffa::SizeCache,
7541        buf: &mut impl ::buffa::bytes::BufMut,
7542    ) {
7543        #[allow(unused_imports)]
7544        use ::buffa::Enumeration as _;
7545        if self.symbol_id != 0u32 {
7546            ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
7547        }
7548        if !self.symbol.is_empty() {
7549            ::buffa::types::put_string_field(2u32, &self.symbol, buf);
7550        }
7551        if !self.base_asset.is_empty() {
7552            ::buffa::types::put_string_field(3u32, &self.base_asset, buf);
7553        }
7554        if !self.quote_asset.is_empty() {
7555            ::buffa::types::put_string_field(4u32, &self.quote_asset, buf);
7556        }
7557        if !self.tick_size.is_empty() {
7558            ::buffa::types::put_string_field(5u32, &self.tick_size, buf);
7559        }
7560        if !self.step_size.is_empty() {
7561            ::buffa::types::put_string_field(6u32, &self.step_size, buf);
7562        }
7563        if !self.min_notional_quote.is_empty() {
7564            ::buffa::types::put_string_field(7u32, &self.min_notional_quote, buf);
7565        }
7566        if !self.min_qty_base.is_empty() {
7567            ::buffa::types::put_string_field(8u32, &self.min_qty_base, buf);
7568        }
7569        if self.allow_buy_fee_from_base {
7570            ::buffa::types::put_bool_field(9u32, self.allow_buy_fee_from_base, buf);
7571        }
7572        if self.base_quantity_scale != 0u32 {
7573            ::buffa::types::put_uint32_field(10u32, self.base_quantity_scale, buf);
7574        }
7575        if self.quote_quantity_scale != 0u32 {
7576            ::buffa::types::put_uint32_field(11u32, self.quote_quantity_scale, buf);
7577        }
7578        if self.marketdata.is_set() {
7579            ::buffa::types::put_len_delimited_header(12u32, __cache.consume_next(), buf);
7580            self.marketdata.write_to(__cache, buf);
7581        }
7582        if self.listing_at.is_set() {
7583            ::buffa::types::put_len_delimited_header(13u32, __cache.consume_next(), buf);
7584            self.listing_at.write_to(__cache, buf);
7585        }
7586        if self.delisting_at.is_set() {
7587            ::buffa::types::put_len_delimited_header(14u32, __cache.consume_next(), buf);
7588            self.delisting_at.write_to(__cache, buf);
7589        }
7590        {
7591            let val = self.status.to_i32();
7592            if val != 0 {
7593                ::buffa::types::put_int32_field(15u32, val, buf);
7594            }
7595        }
7596        if self.default_market_slippage_bps_buy != 0i32 {
7597            ::buffa::types::put_int32_field(
7598                16u32,
7599                self.default_market_slippage_bps_buy,
7600                buf,
7601            );
7602        }
7603        if self.default_market_slippage_bps_sell != 0i32 {
7604            ::buffa::types::put_int32_field(
7605                17u32,
7606                self.default_market_slippage_bps_sell,
7607                buf,
7608            );
7609        }
7610        if self.max_client_ref_drift_bps != 0i32 {
7611            ::buffa::types::put_int32_field(18u32, self.max_client_ref_drift_bps, buf);
7612        }
7613        self.__buffa_unknown_fields.write_to(buf);
7614    }
7615    fn merge_field(
7616        &mut self,
7617        tag: ::buffa::encoding::Tag,
7618        buf: &mut impl ::buffa::bytes::Buf,
7619        ctx: ::buffa::DecodeContext<'_>,
7620    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
7621        #[allow(unused_imports)]
7622        use ::buffa::bytes::Buf as _;
7623        #[allow(unused_imports)]
7624        use ::buffa::Enumeration as _;
7625        match tag.field_number() {
7626            1u32 => {
7627                ::buffa::encoding::check_wire_type(
7628                    tag,
7629                    ::buffa::encoding::WireType::Varint,
7630                )?;
7631                self.symbol_id = ::buffa::types::decode_uint32(buf)?;
7632            }
7633            2u32 => {
7634                ::buffa::encoding::check_wire_type(
7635                    tag,
7636                    ::buffa::encoding::WireType::LengthDelimited,
7637                )?;
7638                ::buffa::types::merge_string(&mut self.symbol, buf)?;
7639            }
7640            3u32 => {
7641                ::buffa::encoding::check_wire_type(
7642                    tag,
7643                    ::buffa::encoding::WireType::LengthDelimited,
7644                )?;
7645                ::buffa::types::merge_string(&mut self.base_asset, buf)?;
7646            }
7647            4u32 => {
7648                ::buffa::encoding::check_wire_type(
7649                    tag,
7650                    ::buffa::encoding::WireType::LengthDelimited,
7651                )?;
7652                ::buffa::types::merge_string(&mut self.quote_asset, buf)?;
7653            }
7654            5u32 => {
7655                ::buffa::encoding::check_wire_type(
7656                    tag,
7657                    ::buffa::encoding::WireType::LengthDelimited,
7658                )?;
7659                ::buffa::types::merge_string(&mut self.tick_size, buf)?;
7660            }
7661            6u32 => {
7662                ::buffa::encoding::check_wire_type(
7663                    tag,
7664                    ::buffa::encoding::WireType::LengthDelimited,
7665                )?;
7666                ::buffa::types::merge_string(&mut self.step_size, buf)?;
7667            }
7668            7u32 => {
7669                ::buffa::encoding::check_wire_type(
7670                    tag,
7671                    ::buffa::encoding::WireType::LengthDelimited,
7672                )?;
7673                ::buffa::types::merge_string(&mut self.min_notional_quote, buf)?;
7674            }
7675            8u32 => {
7676                ::buffa::encoding::check_wire_type(
7677                    tag,
7678                    ::buffa::encoding::WireType::LengthDelimited,
7679                )?;
7680                ::buffa::types::merge_string(&mut self.min_qty_base, buf)?;
7681            }
7682            9u32 => {
7683                ::buffa::encoding::check_wire_type(
7684                    tag,
7685                    ::buffa::encoding::WireType::Varint,
7686                )?;
7687                self.allow_buy_fee_from_base = ::buffa::types::decode_bool(buf)?;
7688            }
7689            10u32 => {
7690                ::buffa::encoding::check_wire_type(
7691                    tag,
7692                    ::buffa::encoding::WireType::Varint,
7693                )?;
7694                self.base_quantity_scale = ::buffa::types::decode_uint32(buf)?;
7695            }
7696            11u32 => {
7697                ::buffa::encoding::check_wire_type(
7698                    tag,
7699                    ::buffa::encoding::WireType::Varint,
7700                )?;
7701                self.quote_quantity_scale = ::buffa::types::decode_uint32(buf)?;
7702            }
7703            12u32 => {
7704                ::buffa::encoding::check_wire_type(
7705                    tag,
7706                    ::buffa::encoding::WireType::LengthDelimited,
7707                )?;
7708                ::buffa::Message::merge_length_delimited(
7709                    self.marketdata.get_or_insert_default(),
7710                    buf,
7711                    ctx,
7712                )?;
7713            }
7714            13u32 => {
7715                ::buffa::encoding::check_wire_type(
7716                    tag,
7717                    ::buffa::encoding::WireType::LengthDelimited,
7718                )?;
7719                ::buffa::Message::merge_length_delimited(
7720                    self.listing_at.get_or_insert_default(),
7721                    buf,
7722                    ctx,
7723                )?;
7724            }
7725            14u32 => {
7726                ::buffa::encoding::check_wire_type(
7727                    tag,
7728                    ::buffa::encoding::WireType::LengthDelimited,
7729                )?;
7730                ::buffa::Message::merge_length_delimited(
7731                    self.delisting_at.get_or_insert_default(),
7732                    buf,
7733                    ctx,
7734                )?;
7735            }
7736            15u32 => {
7737                ::buffa::encoding::check_wire_type(
7738                    tag,
7739                    ::buffa::encoding::WireType::Varint,
7740                )?;
7741                self.status = ::buffa::EnumValue::from(
7742                    ::buffa::types::decode_int32(buf)?,
7743                );
7744            }
7745            16u32 => {
7746                ::buffa::encoding::check_wire_type(
7747                    tag,
7748                    ::buffa::encoding::WireType::Varint,
7749                )?;
7750                self.default_market_slippage_bps_buy = ::buffa::types::decode_int32(
7751                    buf,
7752                )?;
7753            }
7754            17u32 => {
7755                ::buffa::encoding::check_wire_type(
7756                    tag,
7757                    ::buffa::encoding::WireType::Varint,
7758                )?;
7759                self.default_market_slippage_bps_sell = ::buffa::types::decode_int32(
7760                    buf,
7761                )?;
7762            }
7763            18u32 => {
7764                ::buffa::encoding::check_wire_type(
7765                    tag,
7766                    ::buffa::encoding::WireType::Varint,
7767                )?;
7768                self.max_client_ref_drift_bps = ::buffa::types::decode_int32(buf)?;
7769            }
7770            _ => {
7771                self.__buffa_unknown_fields
7772                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
7773            }
7774        }
7775        ::core::result::Result::Ok(())
7776    }
7777    fn clear(&mut self) {
7778        self.symbol_id = 0u32;
7779        self.symbol.clear();
7780        self.base_asset.clear();
7781        self.quote_asset.clear();
7782        self.tick_size.clear();
7783        self.step_size.clear();
7784        self.min_notional_quote.clear();
7785        self.min_qty_base.clear();
7786        self.allow_buy_fee_from_base = false;
7787        self.base_quantity_scale = 0u32;
7788        self.quote_quantity_scale = 0u32;
7789        self.marketdata = ::buffa::MessageField::none();
7790        self.listing_at = ::buffa::MessageField::none();
7791        self.delisting_at = ::buffa::MessageField::none();
7792        self.status = ::buffa::EnumValue::from(0);
7793        self.default_market_slippage_bps_buy = 0i32;
7794        self.default_market_slippage_bps_sell = 0i32;
7795        self.max_client_ref_drift_bps = 0i32;
7796        self.__buffa_unknown_fields.clear();
7797    }
7798}
7799impl ::buffa::ExtensionSet for PairConfig {
7800    const PROTO_FQN: &'static str = "marketdata.v1.PairConfig";
7801    fn unknown_fields(&self) -> &::buffa::UnknownFields {
7802        &self.__buffa_unknown_fields
7803    }
7804    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
7805        &mut self.__buffa_unknown_fields
7806    }
7807}
7808impl ::buffa::json_helpers::ProtoElemJson for PairConfig {
7809    fn serialize_proto_json<S: ::serde::Serializer>(
7810        v: &Self,
7811        s: S,
7812    ) -> ::core::result::Result<S::Ok, S::Error> {
7813        ::serde::Serialize::serialize(v, s)
7814    }
7815    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
7816        d: D,
7817    ) -> ::core::result::Result<Self, D::Error> {
7818        <Self as ::serde::Deserialize>::deserialize(d)
7819    }
7820}
7821#[doc(hidden)]
7822pub const __PAIR_CONFIG_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
7823    type_url: "type.googleapis.com/marketdata.v1.PairConfig",
7824    to_json: ::buffa::type_registry::any_to_json::<PairConfig>,
7825    from_json: ::buffa::type_registry::any_from_json::<PairConfig>,
7826    is_wkt: false,
7827};
7828/// GetSpotConfigRequest has no parameters.
7829#[derive(Clone, PartialEq, Default)]
7830#[derive(::serde::Serialize, ::serde::Deserialize)]
7831#[serde(default)]
7832pub struct GetSpotConfigRequest {
7833    #[serde(skip)]
7834    #[doc(hidden)]
7835    pub __buffa_unknown_fields: ::buffa::UnknownFields,
7836}
7837impl ::core::fmt::Debug for GetSpotConfigRequest {
7838    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7839        f.debug_struct("GetSpotConfigRequest").finish()
7840    }
7841}
7842impl GetSpotConfigRequest {
7843    /// Protobuf type URL for this message, for use with `Any::pack` and
7844    /// `Any::unpack_if`.
7845    ///
7846    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
7847    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetSpotConfigRequest";
7848}
7849::buffa::impl_default_instance!(GetSpotConfigRequest);
7850impl ::buffa::MessageName for GetSpotConfigRequest {
7851    const PACKAGE: &'static str = "marketdata.v1";
7852    const NAME: &'static str = "GetSpotConfigRequest";
7853    const FULL_NAME: &'static str = "marketdata.v1.GetSpotConfigRequest";
7854    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetSpotConfigRequest";
7855}
7856impl ::buffa::Message for GetSpotConfigRequest {
7857    /// Returns the total encoded size in bytes.
7858    ///
7859    /// The result is a `u32`; the protobuf specification requires all
7860    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
7861    /// compliant message will never overflow this type.
7862    #[allow(clippy::let_and_return)]
7863    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
7864        #[allow(unused_imports)]
7865        use ::buffa::Enumeration as _;
7866        let mut size = 0u32;
7867        size += self.__buffa_unknown_fields.encoded_len() as u32;
7868        size
7869    }
7870    fn write_to(
7871        &self,
7872        _cache: &mut ::buffa::SizeCache,
7873        buf: &mut impl ::buffa::bytes::BufMut,
7874    ) {
7875        #[allow(unused_imports)]
7876        use ::buffa::Enumeration as _;
7877        self.__buffa_unknown_fields.write_to(buf);
7878    }
7879    fn merge_field(
7880        &mut self,
7881        tag: ::buffa::encoding::Tag,
7882        buf: &mut impl ::buffa::bytes::Buf,
7883        ctx: ::buffa::DecodeContext<'_>,
7884    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
7885        #[allow(unused_imports)]
7886        use ::buffa::bytes::Buf as _;
7887        #[allow(unused_imports)]
7888        use ::buffa::Enumeration as _;
7889        match tag.field_number() {
7890            _ => {
7891                self.__buffa_unknown_fields
7892                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
7893            }
7894        }
7895        ::core::result::Result::Ok(())
7896    }
7897    fn clear(&mut self) {
7898        self.__buffa_unknown_fields.clear();
7899    }
7900}
7901impl ::buffa::ExtensionSet for GetSpotConfigRequest {
7902    const PROTO_FQN: &'static str = "marketdata.v1.GetSpotConfigRequest";
7903    fn unknown_fields(&self) -> &::buffa::UnknownFields {
7904        &self.__buffa_unknown_fields
7905    }
7906    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
7907        &mut self.__buffa_unknown_fields
7908    }
7909}
7910impl ::buffa::json_helpers::ProtoElemJson for GetSpotConfigRequest {
7911    fn serialize_proto_json<S: ::serde::Serializer>(
7912        v: &Self,
7913        s: S,
7914    ) -> ::core::result::Result<S::Ok, S::Error> {
7915        ::serde::Serialize::serialize(v, s)
7916    }
7917    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
7918        d: D,
7919    ) -> ::core::result::Result<Self, D::Error> {
7920        <Self as ::serde::Deserialize>::deserialize(d)
7921    }
7922}
7923#[doc(hidden)]
7924pub const __GET_SPOT_CONFIG_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
7925    type_url: "type.googleapis.com/marketdata.v1.GetSpotConfigRequest",
7926    to_json: ::buffa::type_registry::any_to_json::<GetSpotConfigRequest>,
7927    from_json: ::buffa::type_registry::any_from_json::<GetSpotConfigRequest>,
7928    is_wkt: false,
7929};
7930/// GetSpotConfigResponse contains a cacheable spot reference-data snapshot.
7931#[derive(Clone, PartialEq, Default)]
7932#[derive(::serde::Serialize, ::serde::Deserialize)]
7933#[serde(default)]
7934pub struct GetSpotConfigResponse {
7935    /// Assets ordered by asset code in ascending alphabetical order.
7936    ///
7937    /// Field 1: `assets`
7938    #[serde(
7939        rename = "assets",
7940        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
7941        deserialize_with = "::buffa::json_helpers::null_as_default"
7942    )]
7943    pub assets: ::buffa::alloc::vec::Vec<AssetConfig>,
7944    /// Pairs ordered by symbol in ascending alphabetical order.
7945    ///
7946    /// Field 2: `pairs`
7947    #[serde(
7948        rename = "pairs",
7949        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
7950        deserialize_with = "::buffa::json_helpers::null_as_default"
7951    )]
7952    pub pairs: ::buffa::alloc::vec::Vec<PairConfig>,
7953    /// Snapshot generation timestamp, in seconds since the Unix epoch (UTC).
7954    ///
7955    /// Field 3: `ts_sec`
7956    #[serde(
7957        rename = "tsSec",
7958        alias = "ts_sec",
7959        with = "::buffa::json_helpers::uint64",
7960        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
7961    )]
7962    pub ts_sec: u64,
7963    #[serde(skip)]
7964    #[doc(hidden)]
7965    pub __buffa_unknown_fields: ::buffa::UnknownFields,
7966}
7967impl ::core::fmt::Debug for GetSpotConfigResponse {
7968    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7969        f.debug_struct("GetSpotConfigResponse")
7970            .field("assets", &self.assets)
7971            .field("pairs", &self.pairs)
7972            .field("ts_sec", &self.ts_sec)
7973            .finish()
7974    }
7975}
7976impl GetSpotConfigResponse {
7977    /// Protobuf type URL for this message, for use with `Any::pack` and
7978    /// `Any::unpack_if`.
7979    ///
7980    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
7981    pub const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetSpotConfigResponse";
7982}
7983::buffa::impl_default_instance!(GetSpotConfigResponse);
7984impl ::buffa::MessageName for GetSpotConfigResponse {
7985    const PACKAGE: &'static str = "marketdata.v1";
7986    const NAME: &'static str = "GetSpotConfigResponse";
7987    const FULL_NAME: &'static str = "marketdata.v1.GetSpotConfigResponse";
7988    const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetSpotConfigResponse";
7989}
7990impl ::buffa::Message for GetSpotConfigResponse {
7991    /// Returns the total encoded size in bytes.
7992    ///
7993    /// The result is a `u32`; the protobuf specification requires all
7994    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
7995    /// compliant message will never overflow this type.
7996    #[allow(clippy::let_and_return)]
7997    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
7998        #[allow(unused_imports)]
7999        use ::buffa::Enumeration as _;
8000        let mut size = 0u32;
8001        for v in &self.assets {
8002            let __slot = __cache.reserve();
8003            let inner_size = v.compute_size(__cache);
8004            __cache.set(__slot, inner_size);
8005            size
8006                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
8007                    + inner_size;
8008        }
8009        for v in &self.pairs {
8010            let __slot = __cache.reserve();
8011            let inner_size = v.compute_size(__cache);
8012            __cache.set(__slot, inner_size);
8013            size
8014                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
8015                    + inner_size;
8016        }
8017        if self.ts_sec != 0u64 {
8018            size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_sec) as u32;
8019        }
8020        size += self.__buffa_unknown_fields.encoded_len() as u32;
8021        size
8022    }
8023    fn write_to(
8024        &self,
8025        __cache: &mut ::buffa::SizeCache,
8026        buf: &mut impl ::buffa::bytes::BufMut,
8027    ) {
8028        #[allow(unused_imports)]
8029        use ::buffa::Enumeration as _;
8030        for v in &self.assets {
8031            ::buffa::types::put_len_delimited_header(1u32, __cache.consume_next(), buf);
8032            v.write_to(__cache, buf);
8033        }
8034        for v in &self.pairs {
8035            ::buffa::types::put_len_delimited_header(2u32, __cache.consume_next(), buf);
8036            v.write_to(__cache, buf);
8037        }
8038        if self.ts_sec != 0u64 {
8039            ::buffa::types::put_uint64_field(3u32, self.ts_sec, buf);
8040        }
8041        self.__buffa_unknown_fields.write_to(buf);
8042    }
8043    fn merge_field(
8044        &mut self,
8045        tag: ::buffa::encoding::Tag,
8046        buf: &mut impl ::buffa::bytes::Buf,
8047        ctx: ::buffa::DecodeContext<'_>,
8048    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
8049        #[allow(unused_imports)]
8050        use ::buffa::bytes::Buf as _;
8051        #[allow(unused_imports)]
8052        use ::buffa::Enumeration as _;
8053        match tag.field_number() {
8054            1u32 => {
8055                ::buffa::encoding::check_wire_type(
8056                    tag,
8057                    ::buffa::encoding::WireType::LengthDelimited,
8058                )?;
8059                let mut elem = ::core::default::Default::default();
8060                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
8061                self.assets.push(elem);
8062            }
8063            2u32 => {
8064                ::buffa::encoding::check_wire_type(
8065                    tag,
8066                    ::buffa::encoding::WireType::LengthDelimited,
8067                )?;
8068                let mut elem = ::core::default::Default::default();
8069                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
8070                self.pairs.push(elem);
8071            }
8072            3u32 => {
8073                ::buffa::encoding::check_wire_type(
8074                    tag,
8075                    ::buffa::encoding::WireType::Varint,
8076                )?;
8077                self.ts_sec = ::buffa::types::decode_uint64(buf)?;
8078            }
8079            _ => {
8080                self.__buffa_unknown_fields
8081                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
8082            }
8083        }
8084        ::core::result::Result::Ok(())
8085    }
8086    fn clear(&mut self) {
8087        self.assets.clear();
8088        self.pairs.clear();
8089        self.ts_sec = 0u64;
8090        self.__buffa_unknown_fields.clear();
8091    }
8092}
8093impl ::buffa::ExtensionSet for GetSpotConfigResponse {
8094    const PROTO_FQN: &'static str = "marketdata.v1.GetSpotConfigResponse";
8095    fn unknown_fields(&self) -> &::buffa::UnknownFields {
8096        &self.__buffa_unknown_fields
8097    }
8098    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
8099        &mut self.__buffa_unknown_fields
8100    }
8101}
8102impl ::buffa::json_helpers::ProtoElemJson for GetSpotConfigResponse {
8103    fn serialize_proto_json<S: ::serde::Serializer>(
8104        v: &Self,
8105        s: S,
8106    ) -> ::core::result::Result<S::Ok, S::Error> {
8107        ::serde::Serialize::serialize(v, s)
8108    }
8109    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
8110        d: D,
8111    ) -> ::core::result::Result<Self, D::Error> {
8112        <Self as ::serde::Deserialize>::deserialize(d)
8113    }
8114}
8115#[doc(hidden)]
8116pub const __GET_SPOT_CONFIG_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
8117    type_url: "type.googleapis.com/marketdata.v1.GetSpotConfigResponse",
8118    to_json: ::buffa::type_registry::any_to_json::<GetSpotConfigResponse>,
8119    from_json: ::buffa::type_registry::any_from_json::<GetSpotConfigResponse>,
8120    is_wkt: false,
8121};
8122#[allow(
8123    non_camel_case_types,
8124    dead_code,
8125    unused_imports,
8126    unused_qualifications,
8127    clippy::derivable_impls,
8128    clippy::match_single_binding,
8129    clippy::uninlined_format_args,
8130    clippy::doc_lazy_continuation,
8131    clippy::module_inception
8132)]
8133pub mod __buffa {
8134    #[allow(unused_imports)]
8135    use super::*;
8136    pub mod view {
8137        #[allow(unused_imports)]
8138        use super::*;
8139        /// HeatmapTimeRange selects historical buckets by \[start_time, end_time\] (UTC).
8140        /// At least one bound is required.
8141        #[derive(Clone, Debug, Default)]
8142        pub struct HeatmapTimeRangeView<'a> {
8143            /// Inclusive lower bound in UTC. Omit to leave the lower bound open.
8144            ///
8145            /// Field 1: `start_time`
8146            pub start_time: ::buffa::MessageFieldView<
8147                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
8148            >,
8149            /// Inclusive upper bound in UTC. Omit to leave the upper bound open.
8150            ///
8151            /// Field 2: `end_time`
8152            pub end_time: ::buffa::MessageFieldView<
8153                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
8154            >,
8155            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
8156        }
8157        impl<'a> ::buffa::MessageView<'a> for HeatmapTimeRangeView<'a> {
8158            type Owned = super::super::HeatmapTimeRange;
8159            fn decode_view(
8160                buf: &'a [u8],
8161            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8162                let __limit = ::core::cell::Cell::new(
8163                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
8164                );
8165                <Self as ::buffa::MessageView>::decode_view_ctx(
8166                    buf,
8167                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
8168                )
8169            }
8170            fn decode_view_with_ctx(
8171                buf: &'a [u8],
8172                ctx: ::buffa::DecodeContext<'_>,
8173            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8174                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
8175            }
8176            fn merge_view_field(
8177                &mut self,
8178                tag: ::buffa::encoding::Tag,
8179                cur: &'a [u8],
8180                before_tag: &'a [u8],
8181                ctx: ::buffa::DecodeContext<'_>,
8182            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
8183                let _ = ctx;
8184                #[allow(unused_variables)]
8185                let view = self;
8186                let mut cur = cur;
8187                match tag.field_number() {
8188                    1u32 => {
8189                        ::buffa::encoding::check_wire_type(
8190                            tag,
8191                            ::buffa::encoding::WireType::LengthDelimited,
8192                        )?;
8193                        let __sub_ctx = ctx.descend()?;
8194                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
8195                        match view.start_time.as_mut() {
8196                            Some(existing) => {
8197                                ::buffa::MessageView::merge_into_view(
8198                                    existing,
8199                                    sub,
8200                                    __sub_ctx,
8201                                )?
8202                            }
8203                            None => {
8204                                view.start_time = ::buffa::MessageFieldView::set(
8205                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
8206                                        sub,
8207                                        __sub_ctx,
8208                                    )?,
8209                                );
8210                            }
8211                        }
8212                    }
8213                    2u32 => {
8214                        ::buffa::encoding::check_wire_type(
8215                            tag,
8216                            ::buffa::encoding::WireType::LengthDelimited,
8217                        )?;
8218                        let __sub_ctx = ctx.descend()?;
8219                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
8220                        match view.end_time.as_mut() {
8221                            Some(existing) => {
8222                                ::buffa::MessageView::merge_into_view(
8223                                    existing,
8224                                    sub,
8225                                    __sub_ctx,
8226                                )?
8227                            }
8228                            None => {
8229                                view.end_time = ::buffa::MessageFieldView::set(
8230                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
8231                                        sub,
8232                                        __sub_ctx,
8233                                    )?,
8234                                );
8235                            }
8236                        }
8237                    }
8238                    _ => {
8239                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
8240                        let span_len = before_tag.len() - cur.len();
8241                        view.__buffa_unknown_fields
8242                            .push_record(before_tag, span_len, ctx)?;
8243                    }
8244                }
8245                ::core::result::Result::Ok(cur)
8246            }
8247            fn to_owned_message(
8248                &self,
8249            ) -> ::core::result::Result<
8250                super::super::HeatmapTimeRange,
8251                ::buffa::DecodeError,
8252            > {
8253                self.to_owned_from_source(None)
8254            }
8255            #[allow(clippy::useless_conversion, clippy::needless_update)]
8256            fn to_owned_from_source(
8257                &self,
8258                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
8259            ) -> ::core::result::Result<
8260                super::super::HeatmapTimeRange,
8261                ::buffa::DecodeError,
8262            > {
8263                #[allow(unused_imports)]
8264                use ::buffa::alloc::string::ToString as _;
8265                let _ = __buffa_src;
8266                ::core::result::Result::Ok(super::super::HeatmapTimeRange {
8267                    start_time: match self.start_time.as_option() {
8268                        Some(v) => {
8269                            ::buffa::MessageField::<
8270                                ::buffa_types::google::protobuf::Timestamp,
8271                            >::some(v.to_owned_from_source(__buffa_src)?)
8272                        }
8273                        None => ::buffa::MessageField::none(),
8274                    },
8275                    end_time: match self.end_time.as_option() {
8276                        Some(v) => {
8277                            ::buffa::MessageField::<
8278                                ::buffa_types::google::protobuf::Timestamp,
8279                            >::some(v.to_owned_from_source(__buffa_src)?)
8280                        }
8281                        None => ::buffa::MessageField::none(),
8282                    },
8283                    __buffa_unknown_fields: self
8284                        .__buffa_unknown_fields
8285                        .to_owned()?
8286                        .into(),
8287                    ..::core::default::Default::default()
8288                })
8289            }
8290        }
8291        impl<'a> ::buffa::ViewEncode<'a> for HeatmapTimeRangeView<'a> {
8292            #[allow(clippy::needless_borrow, clippy::let_and_return)]
8293            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
8294                #[allow(unused_imports)]
8295                use ::buffa::Enumeration as _;
8296                let mut size = 0u32;
8297                if self.start_time.is_set() {
8298                    let __slot = __cache.reserve();
8299                    let inner_size = self.start_time.compute_size(__cache);
8300                    __cache.set(__slot, inner_size);
8301                    size
8302                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
8303                            + inner_size;
8304                }
8305                if self.end_time.is_set() {
8306                    let __slot = __cache.reserve();
8307                    let inner_size = self.end_time.compute_size(__cache);
8308                    __cache.set(__slot, inner_size);
8309                    size
8310                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
8311                            + inner_size;
8312                }
8313                size += self.__buffa_unknown_fields.encoded_len() as u32;
8314                size
8315            }
8316            #[allow(clippy::needless_borrow)]
8317            fn write_to(
8318                &self,
8319                __cache: &mut ::buffa::SizeCache,
8320                buf: &mut impl ::buffa::bytes::BufMut,
8321            ) {
8322                #[allow(unused_imports)]
8323                use ::buffa::Enumeration as _;
8324                if self.start_time.is_set() {
8325                    ::buffa::types::put_len_delimited_header(
8326                        1u32,
8327                        __cache.consume_next(),
8328                        buf,
8329                    );
8330                    self.start_time.write_to(__cache, buf);
8331                }
8332                if self.end_time.is_set() {
8333                    ::buffa::types::put_len_delimited_header(
8334                        2u32,
8335                        __cache.consume_next(),
8336                        buf,
8337                    );
8338                    self.end_time.write_to(__cache, buf);
8339                }
8340                self.__buffa_unknown_fields.write_to(buf);
8341            }
8342        }
8343        /// Serializes this view as protobuf JSON.
8344        ///
8345        /// Implicit-presence fields with default values are omitted, `required`
8346        /// fields are always emitted, explicit-presence (`optional`) fields are
8347        /// emitted only when set, bytes fields are base64-encoded, and enum
8348        /// values are their proto name strings.
8349        ///
8350        /// This impl uses `serialize_map(None)` because the number of emitted
8351        /// fields depends on default-omission rules; serializers that require
8352        /// known map lengths (e.g. `bincode`) will return a runtime error.
8353        /// Use the owned message type for those formats.
8354        impl<'__a> ::serde::Serialize for HeatmapTimeRangeView<'__a> {
8355            fn serialize<__S: ::serde::Serializer>(
8356                &self,
8357                __s: __S,
8358            ) -> ::core::result::Result<__S::Ok, __S::Error> {
8359                use ::serde::ser::SerializeMap as _;
8360                let mut __map = __s.serialize_map(::core::option::Option::None)?;
8361                {
8362                    if let ::core::option::Option::Some(__v) = self
8363                        .start_time
8364                        .as_option()
8365                    {
8366                        __map.serialize_entry("startTime", __v)?;
8367                    }
8368                }
8369                {
8370                    if let ::core::option::Option::Some(__v) = self.end_time.as_option()
8371                    {
8372                        __map.serialize_entry("endTime", __v)?;
8373                    }
8374                }
8375                __map.end()
8376            }
8377        }
8378        impl<'a> ::buffa::MessageName for HeatmapTimeRangeView<'a> {
8379            const PACKAGE: &'static str = "marketdata.v1";
8380            const NAME: &'static str = "HeatmapTimeRange";
8381            const FULL_NAME: &'static str = "marketdata.v1.HeatmapTimeRange";
8382            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.HeatmapTimeRange";
8383        }
8384        ::buffa::impl_default_view_instance!(HeatmapTimeRangeView);
8385        ::buffa::impl_view_reborrow!(HeatmapTimeRangeView);
8386        /** Self-contained, `'static` owned view of a `HeatmapTimeRange` message.
8387
8388 Wraps [`::buffa::OwnedView`]`<`[`HeatmapTimeRangeView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
8389
8390 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`HeatmapTimeRangeView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
8391        #[derive(Clone, Debug)]
8392        pub struct HeatmapTimeRangeOwnedView(
8393            ::buffa::OwnedView<HeatmapTimeRangeView<'static>>,
8394        );
8395        impl HeatmapTimeRangeOwnedView {
8396            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
8397            ///
8398            /// The view borrows directly from the buffer's data; the buffer is
8399            /// retained inside the returned handle.
8400            ///
8401            /// # Errors
8402            ///
8403            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
8404            /// protobuf data.
8405            pub fn decode(
8406                bytes: ::buffa::bytes::Bytes,
8407            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8408                ::core::result::Result::Ok(
8409                    HeatmapTimeRangeOwnedView(::buffa::OwnedView::decode(bytes)?),
8410                )
8411            }
8412            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
8413            /// max message size).
8414            ///
8415            /// # Errors
8416            ///
8417            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
8418            /// exceeds the configured limits.
8419            pub fn decode_with_options(
8420                bytes: ::buffa::bytes::Bytes,
8421                opts: &::buffa::DecodeOptions,
8422            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8423                ::core::result::Result::Ok(
8424                    HeatmapTimeRangeOwnedView(
8425                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
8426                    ),
8427                )
8428            }
8429            /// Build from an owned message via an encode → decode round-trip.
8430            ///
8431            /// # Errors
8432            ///
8433            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
8434            /// somehow invalid (should not happen for well-formed messages).
8435            pub fn from_owned(
8436                msg: &super::super::HeatmapTimeRange,
8437            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8438                ::core::result::Result::Ok(
8439                    HeatmapTimeRangeOwnedView(::buffa::OwnedView::from_owned(msg)?),
8440                )
8441            }
8442            /// Borrow the full [`HeatmapTimeRangeView`] with its lifetime tied to `&self`.
8443            #[must_use]
8444            pub fn view(&self) -> &HeatmapTimeRangeView<'_> {
8445                self.0.reborrow()
8446            }
8447            /// Convert to the owned message type.
8448            ///
8449            /// # Errors
8450            ///
8451            /// Returns an error if re-materializing preserved unknown fields
8452            /// fails (e.g. the unknown-field limit is exceeded).
8453            pub fn to_owned_message(
8454                &self,
8455            ) -> ::core::result::Result<
8456                super::super::HeatmapTimeRange,
8457                ::buffa::DecodeError,
8458            > {
8459                self.0.to_owned_message()
8460            }
8461            /// The underlying bytes buffer.
8462            #[must_use]
8463            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
8464                self.0.bytes()
8465            }
8466            /// Consume the handle, returning the underlying bytes buffer.
8467            #[must_use]
8468            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
8469                self.0.into_bytes()
8470            }
8471            /// Inclusive lower bound in UTC. Omit to leave the lower bound open.
8472            ///
8473            /// Field 1: `start_time`
8474            #[must_use]
8475            pub fn start_time(
8476                &self,
8477            ) -> &::buffa::MessageFieldView<
8478                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
8479            > {
8480                &self.0.reborrow().start_time
8481            }
8482            /// Inclusive upper bound in UTC. Omit to leave the upper bound open.
8483            ///
8484            /// Field 2: `end_time`
8485            #[must_use]
8486            pub fn end_time(
8487                &self,
8488            ) -> &::buffa::MessageFieldView<
8489                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
8490            > {
8491                &self.0.reborrow().end_time
8492            }
8493        }
8494        impl ::core::convert::From<::buffa::OwnedView<HeatmapTimeRangeView<'static>>>
8495        for HeatmapTimeRangeOwnedView {
8496            fn from(inner: ::buffa::OwnedView<HeatmapTimeRangeView<'static>>) -> Self {
8497                HeatmapTimeRangeOwnedView(inner)
8498            }
8499        }
8500        impl ::core::convert::From<HeatmapTimeRangeOwnedView>
8501        for ::buffa::OwnedView<HeatmapTimeRangeView<'static>> {
8502            fn from(wrapper: HeatmapTimeRangeOwnedView) -> Self {
8503                wrapper.0
8504            }
8505        }
8506        impl ::core::convert::AsRef<::buffa::OwnedView<HeatmapTimeRangeView<'static>>>
8507        for HeatmapTimeRangeOwnedView {
8508            fn as_ref(&self) -> &::buffa::OwnedView<HeatmapTimeRangeView<'static>> {
8509                &self.0
8510            }
8511        }
8512        impl ::buffa::HasMessageView for super::super::HeatmapTimeRange {
8513            type View<'a> = HeatmapTimeRangeView<'a>;
8514            type ViewHandle = HeatmapTimeRangeOwnedView;
8515        }
8516        impl ::serde::Serialize for HeatmapTimeRangeOwnedView {
8517            fn serialize<__S: ::serde::Serializer>(
8518                &self,
8519                __s: __S,
8520            ) -> ::core::result::Result<__S::Ok, __S::Error> {
8521                ::serde::Serialize::serialize(&self.0, __s)
8522            }
8523        }
8524        /// GetOrderbookHeatmapRequest fetches historical heatmap buckets.
8525        #[derive(Clone, Debug, Default)]
8526        pub struct GetOrderbookHeatmapRequestView<'a> {
8527            /// Numeric spot market identifier.
8528            ///
8529            /// Field 1: `symbol_id`
8530            pub symbol_id: u32,
8531            /// Heatmap bucket interval.
8532            ///
8533            /// Field 2: `interval`
8534            pub interval: ::buffa::EnumValue<super::super::HeatmapInterval>,
8535            /// Top-N levels per side included in each bucket.
8536            ///
8537            /// Field 3: `depth`
8538            pub depth: ::buffa::EnumValue<super::super::HeatmapDepth>,
8539            /// Absolute time range for the first page. Reuse the same request filters and
8540            /// pass page_token from the prior response to continue older buckets.
8541            ///
8542            /// Field 4: `time_range`
8543            pub time_range: ::buffa::MessageFieldView<
8544                super::super::__buffa::view::HeatmapTimeRangeView<'a>,
8545            >,
8546            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
8547            /// bound to symbol, interval, depth, quantity mode, and the original time
8548            /// range.
8549            ///
8550            /// Field 5: `page_token`
8551            pub page_token: &'a str,
8552            /// Maximum number of delta buckets returned (min 1, max 20000).
8553            /// This limit counts only `chain.deltas`; `chain.base_keyframe` is not counted.
8554            ///
8555            /// Field 6: `limit`
8556            pub limit: u32,
8557            /// Quantity mode used for qty_scaled in snapshot/delta levels:
8558            /// - CLOSE: end-of-bucket quantity
8559            /// - PEAK: intra-bucket peak quantity
8560            ///
8561            /// Field 7: `quantity_mode`
8562            pub quantity_mode: ::buffa::EnumValue<super::super::HeatmapQuantityMode>,
8563            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
8564        }
8565        impl<'a> ::buffa::MessageView<'a> for GetOrderbookHeatmapRequestView<'a> {
8566            type Owned = super::super::GetOrderbookHeatmapRequest;
8567            fn decode_view(
8568                buf: &'a [u8],
8569            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8570                let __limit = ::core::cell::Cell::new(
8571                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
8572                );
8573                <Self as ::buffa::MessageView>::decode_view_ctx(
8574                    buf,
8575                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
8576                )
8577            }
8578            fn decode_view_with_ctx(
8579                buf: &'a [u8],
8580                ctx: ::buffa::DecodeContext<'_>,
8581            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8582                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
8583            }
8584            fn merge_view_field(
8585                &mut self,
8586                tag: ::buffa::encoding::Tag,
8587                cur: &'a [u8],
8588                before_tag: &'a [u8],
8589                ctx: ::buffa::DecodeContext<'_>,
8590            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
8591                let _ = ctx;
8592                #[allow(unused_variables)]
8593                let view = self;
8594                let mut cur = cur;
8595                match tag.field_number() {
8596                    1u32 => {
8597                        ::buffa::encoding::check_wire_type(
8598                            tag,
8599                            ::buffa::encoding::WireType::Varint,
8600                        )?;
8601                        view.symbol_id = ::buffa::types::decode_uint32(&mut cur)?;
8602                    }
8603                    2u32 => {
8604                        ::buffa::encoding::check_wire_type(
8605                            tag,
8606                            ::buffa::encoding::WireType::Varint,
8607                        )?;
8608                        view.interval = ::buffa::EnumValue::from(
8609                            ::buffa::types::decode_int32(&mut cur)?,
8610                        );
8611                    }
8612                    3u32 => {
8613                        ::buffa::encoding::check_wire_type(
8614                            tag,
8615                            ::buffa::encoding::WireType::Varint,
8616                        )?;
8617                        view.depth = ::buffa::EnumValue::from(
8618                            ::buffa::types::decode_int32(&mut cur)?,
8619                        );
8620                    }
8621                    4u32 => {
8622                        ::buffa::encoding::check_wire_type(
8623                            tag,
8624                            ::buffa::encoding::WireType::LengthDelimited,
8625                        )?;
8626                        let __sub_ctx = ctx.descend()?;
8627                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
8628                        match view.time_range.as_mut() {
8629                            Some(existing) => {
8630                                ::buffa::MessageView::merge_into_view(
8631                                    existing,
8632                                    sub,
8633                                    __sub_ctx,
8634                                )?
8635                            }
8636                            None => {
8637                                view.time_range = ::buffa::MessageFieldView::set(
8638                                    <super::super::__buffa::view::HeatmapTimeRangeView as ::buffa::MessageView>::decode_view_ctx(
8639                                        sub,
8640                                        __sub_ctx,
8641                                    )?,
8642                                );
8643                            }
8644                        }
8645                    }
8646                    5u32 => {
8647                        ::buffa::encoding::check_wire_type(
8648                            tag,
8649                            ::buffa::encoding::WireType::LengthDelimited,
8650                        )?;
8651                        view.page_token = ::buffa::types::borrow_str(&mut cur)?;
8652                    }
8653                    6u32 => {
8654                        ::buffa::encoding::check_wire_type(
8655                            tag,
8656                            ::buffa::encoding::WireType::Varint,
8657                        )?;
8658                        view.limit = ::buffa::types::decode_uint32(&mut cur)?;
8659                    }
8660                    7u32 => {
8661                        ::buffa::encoding::check_wire_type(
8662                            tag,
8663                            ::buffa::encoding::WireType::Varint,
8664                        )?;
8665                        view.quantity_mode = ::buffa::EnumValue::from(
8666                            ::buffa::types::decode_int32(&mut cur)?,
8667                        );
8668                    }
8669                    _ => {
8670                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
8671                        let span_len = before_tag.len() - cur.len();
8672                        view.__buffa_unknown_fields
8673                            .push_record(before_tag, span_len, ctx)?;
8674                    }
8675                }
8676                ::core::result::Result::Ok(cur)
8677            }
8678            fn to_owned_message(
8679                &self,
8680            ) -> ::core::result::Result<
8681                super::super::GetOrderbookHeatmapRequest,
8682                ::buffa::DecodeError,
8683            > {
8684                self.to_owned_from_source(None)
8685            }
8686            #[allow(clippy::useless_conversion, clippy::needless_update)]
8687            fn to_owned_from_source(
8688                &self,
8689                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
8690            ) -> ::core::result::Result<
8691                super::super::GetOrderbookHeatmapRequest,
8692                ::buffa::DecodeError,
8693            > {
8694                #[allow(unused_imports)]
8695                use ::buffa::alloc::string::ToString as _;
8696                let _ = __buffa_src;
8697                ::core::result::Result::Ok(super::super::GetOrderbookHeatmapRequest {
8698                    symbol_id: self.symbol_id,
8699                    interval: self.interval,
8700                    depth: self.depth,
8701                    time_range: match self.time_range.as_option() {
8702                        Some(v) => {
8703                            ::buffa::MessageField::<
8704                                super::super::HeatmapTimeRange,
8705                            >::some(v.to_owned_from_source(__buffa_src)?)
8706                        }
8707                        None => ::buffa::MessageField::none(),
8708                    },
8709                    page_token: self.page_token.to_string(),
8710                    limit: self.limit,
8711                    quantity_mode: self.quantity_mode,
8712                    __buffa_unknown_fields: self
8713                        .__buffa_unknown_fields
8714                        .to_owned()?
8715                        .into(),
8716                    ..::core::default::Default::default()
8717                })
8718            }
8719        }
8720        impl<'a> ::buffa::ViewEncode<'a> for GetOrderbookHeatmapRequestView<'a> {
8721            #[allow(clippy::needless_borrow, clippy::let_and_return)]
8722            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
8723                #[allow(unused_imports)]
8724                use ::buffa::Enumeration as _;
8725                let mut size = 0u32;
8726                if self.symbol_id != 0u32 {
8727                    size
8728                        += 1u32
8729                            + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
8730                }
8731                {
8732                    let val = self.interval.to_i32();
8733                    if val != 0 {
8734                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
8735                    }
8736                }
8737                {
8738                    let val = self.depth.to_i32();
8739                    if val != 0 {
8740                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
8741                    }
8742                }
8743                if self.time_range.is_set() {
8744                    let __slot = __cache.reserve();
8745                    let inner_size = self.time_range.compute_size(__cache);
8746                    __cache.set(__slot, inner_size);
8747                    size
8748                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
8749                            + inner_size;
8750                }
8751                if !self.page_token.is_empty() {
8752                    size
8753                        += 1u32
8754                            + ::buffa::types::string_encoded_len(&self.page_token)
8755                                as u32;
8756                }
8757                if self.limit != 0u32 {
8758                    size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
8759                }
8760                {
8761                    let val = self.quantity_mode.to_i32();
8762                    if val != 0 {
8763                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
8764                    }
8765                }
8766                size += self.__buffa_unknown_fields.encoded_len() as u32;
8767                size
8768            }
8769            #[allow(clippy::needless_borrow)]
8770            fn write_to(
8771                &self,
8772                __cache: &mut ::buffa::SizeCache,
8773                buf: &mut impl ::buffa::bytes::BufMut,
8774            ) {
8775                #[allow(unused_imports)]
8776                use ::buffa::Enumeration as _;
8777                if self.symbol_id != 0u32 {
8778                    ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
8779                }
8780                {
8781                    let val = self.interval.to_i32();
8782                    if val != 0 {
8783                        ::buffa::types::put_int32_field(2u32, val, buf);
8784                    }
8785                }
8786                {
8787                    let val = self.depth.to_i32();
8788                    if val != 0 {
8789                        ::buffa::types::put_int32_field(3u32, val, buf);
8790                    }
8791                }
8792                if self.time_range.is_set() {
8793                    ::buffa::types::put_len_delimited_header(
8794                        4u32,
8795                        __cache.consume_next(),
8796                        buf,
8797                    );
8798                    self.time_range.write_to(__cache, buf);
8799                }
8800                if !self.page_token.is_empty() {
8801                    ::buffa::types::put_string_field(5u32, &self.page_token, buf);
8802                }
8803                if self.limit != 0u32 {
8804                    ::buffa::types::put_uint32_field(6u32, self.limit, buf);
8805                }
8806                {
8807                    let val = self.quantity_mode.to_i32();
8808                    if val != 0 {
8809                        ::buffa::types::put_int32_field(7u32, val, buf);
8810                    }
8811                }
8812                self.__buffa_unknown_fields.write_to(buf);
8813            }
8814        }
8815        /// Serializes this view as protobuf JSON.
8816        ///
8817        /// Implicit-presence fields with default values are omitted, `required`
8818        /// fields are always emitted, explicit-presence (`optional`) fields are
8819        /// emitted only when set, bytes fields are base64-encoded, and enum
8820        /// values are their proto name strings.
8821        ///
8822        /// This impl uses `serialize_map(None)` because the number of emitted
8823        /// fields depends on default-omission rules; serializers that require
8824        /// known map lengths (e.g. `bincode`) will return a runtime error.
8825        /// Use the owned message type for those formats.
8826        impl<'__a> ::serde::Serialize for GetOrderbookHeatmapRequestView<'__a> {
8827            fn serialize<__S: ::serde::Serializer>(
8828                &self,
8829                __s: __S,
8830            ) -> ::core::result::Result<__S::Ok, __S::Error> {
8831                use ::serde::ser::SerializeMap as _;
8832                let mut __map = __s.serialize_map(::core::option::Option::None)?;
8833                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.symbol_id) {
8834                    __map
8835                        .serialize_entry(
8836                            "symbolId",
8837                            &::buffa::json_helpers::ProtoJson(&self.symbol_id),
8838                        )?;
8839                }
8840                if !::buffa::json_helpers::skip_if::is_default_enum_value(
8841                    &self.interval,
8842                ) {
8843                    __map.serialize_entry("interval", &self.interval)?;
8844                }
8845                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.depth) {
8846                    __map.serialize_entry("depth", &self.depth)?;
8847                }
8848                {
8849                    if let ::core::option::Option::Some(__v) = self
8850                        .time_range
8851                        .as_option()
8852                    {
8853                        __map.serialize_entry("timeRange", __v)?;
8854                    }
8855                }
8856                if !::buffa::json_helpers::skip_if::is_empty_str(self.page_token) {
8857                    __map.serialize_entry("pageToken", self.page_token)?;
8858                }
8859                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.limit) {
8860                    __map
8861                        .serialize_entry(
8862                            "limit",
8863                            &::buffa::json_helpers::ProtoJson(&self.limit),
8864                        )?;
8865                }
8866                if !::buffa::json_helpers::skip_if::is_default_enum_value(
8867                    &self.quantity_mode,
8868                ) {
8869                    __map.serialize_entry("quantityMode", &self.quantity_mode)?;
8870                }
8871                __map.end()
8872            }
8873        }
8874        impl<'a> ::buffa::MessageName for GetOrderbookHeatmapRequestView<'a> {
8875            const PACKAGE: &'static str = "marketdata.v1";
8876            const NAME: &'static str = "GetOrderbookHeatmapRequest";
8877            const FULL_NAME: &'static str = "marketdata.v1.GetOrderbookHeatmapRequest";
8878            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetOrderbookHeatmapRequest";
8879        }
8880        ::buffa::impl_default_view_instance!(GetOrderbookHeatmapRequestView);
8881        ::buffa::impl_view_reborrow!(GetOrderbookHeatmapRequestView);
8882        /** Self-contained, `'static` owned view of a `GetOrderbookHeatmapRequest` message.
8883
8884 Wraps [`::buffa::OwnedView`]`<`[`GetOrderbookHeatmapRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
8885
8886 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetOrderbookHeatmapRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
8887        #[derive(Clone, Debug)]
8888        pub struct GetOrderbookHeatmapRequestOwnedView(
8889            ::buffa::OwnedView<GetOrderbookHeatmapRequestView<'static>>,
8890        );
8891        impl GetOrderbookHeatmapRequestOwnedView {
8892            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
8893            ///
8894            /// The view borrows directly from the buffer's data; the buffer is
8895            /// retained inside the returned handle.
8896            ///
8897            /// # Errors
8898            ///
8899            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
8900            /// protobuf data.
8901            pub fn decode(
8902                bytes: ::buffa::bytes::Bytes,
8903            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8904                ::core::result::Result::Ok(
8905                    GetOrderbookHeatmapRequestOwnedView(
8906                        ::buffa::OwnedView::decode(bytes)?,
8907                    ),
8908                )
8909            }
8910            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
8911            /// max message size).
8912            ///
8913            /// # Errors
8914            ///
8915            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
8916            /// exceeds the configured limits.
8917            pub fn decode_with_options(
8918                bytes: ::buffa::bytes::Bytes,
8919                opts: &::buffa::DecodeOptions,
8920            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8921                ::core::result::Result::Ok(
8922                    GetOrderbookHeatmapRequestOwnedView(
8923                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
8924                    ),
8925                )
8926            }
8927            /// Build from an owned message via an encode → decode round-trip.
8928            ///
8929            /// # Errors
8930            ///
8931            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
8932            /// somehow invalid (should not happen for well-formed messages).
8933            pub fn from_owned(
8934                msg: &super::super::GetOrderbookHeatmapRequest,
8935            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
8936                ::core::result::Result::Ok(
8937                    GetOrderbookHeatmapRequestOwnedView(
8938                        ::buffa::OwnedView::from_owned(msg)?,
8939                    ),
8940                )
8941            }
8942            /// Borrow the full [`GetOrderbookHeatmapRequestView`] with its lifetime tied to `&self`.
8943            #[must_use]
8944            pub fn view(&self) -> &GetOrderbookHeatmapRequestView<'_> {
8945                self.0.reborrow()
8946            }
8947            /// Convert to the owned message type.
8948            ///
8949            /// # Errors
8950            ///
8951            /// Returns an error if re-materializing preserved unknown fields
8952            /// fails (e.g. the unknown-field limit is exceeded).
8953            pub fn to_owned_message(
8954                &self,
8955            ) -> ::core::result::Result<
8956                super::super::GetOrderbookHeatmapRequest,
8957                ::buffa::DecodeError,
8958            > {
8959                self.0.to_owned_message()
8960            }
8961            /// The underlying bytes buffer.
8962            #[must_use]
8963            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
8964                self.0.bytes()
8965            }
8966            /// Consume the handle, returning the underlying bytes buffer.
8967            #[must_use]
8968            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
8969                self.0.into_bytes()
8970            }
8971            /// Numeric spot market identifier.
8972            ///
8973            /// Field 1: `symbol_id`
8974            #[must_use]
8975            pub fn symbol_id(&self) -> u32 {
8976                self.0.reborrow().symbol_id
8977            }
8978            /// Heatmap bucket interval.
8979            ///
8980            /// Field 2: `interval`
8981            #[must_use]
8982            pub fn interval(&self) -> ::buffa::EnumValue<super::super::HeatmapInterval> {
8983                self.0.reborrow().interval
8984            }
8985            /// Top-N levels per side included in each bucket.
8986            ///
8987            /// Field 3: `depth`
8988            #[must_use]
8989            pub fn depth(&self) -> ::buffa::EnumValue<super::super::HeatmapDepth> {
8990                self.0.reborrow().depth
8991            }
8992            /// Absolute time range for the first page. Reuse the same request filters and
8993            /// pass page_token from the prior response to continue older buckets.
8994            ///
8995            /// Field 4: `time_range`
8996            #[must_use]
8997            pub fn time_range(
8998                &self,
8999            ) -> &::buffa::MessageFieldView<
9000                super::super::__buffa::view::HeatmapTimeRangeView<'_>,
9001            > {
9002                &self.0.reborrow().time_range
9003            }
9004            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
9005            /// bound to symbol, interval, depth, quantity mode, and the original time
9006            /// range.
9007            ///
9008            /// Field 5: `page_token`
9009            #[must_use]
9010            pub fn page_token(&self) -> &'_ str {
9011                self.0.reborrow().page_token
9012            }
9013            /// Maximum number of delta buckets returned (min 1, max 20000).
9014            /// This limit counts only `chain.deltas`; `chain.base_keyframe` is not counted.
9015            ///
9016            /// Field 6: `limit`
9017            #[must_use]
9018            pub fn limit(&self) -> u32 {
9019                self.0.reborrow().limit
9020            }
9021            /// Quantity mode used for qty_scaled in snapshot/delta levels:
9022            /// - CLOSE: end-of-bucket quantity
9023            /// - PEAK: intra-bucket peak quantity
9024            ///
9025            /// Field 7: `quantity_mode`
9026            #[must_use]
9027            pub fn quantity_mode(
9028                &self,
9029            ) -> ::buffa::EnumValue<super::super::HeatmapQuantityMode> {
9030                self.0.reborrow().quantity_mode
9031            }
9032        }
9033        impl ::core::convert::From<
9034            ::buffa::OwnedView<GetOrderbookHeatmapRequestView<'static>>,
9035        > for GetOrderbookHeatmapRequestOwnedView {
9036            fn from(
9037                inner: ::buffa::OwnedView<GetOrderbookHeatmapRequestView<'static>>,
9038            ) -> Self {
9039                GetOrderbookHeatmapRequestOwnedView(inner)
9040            }
9041        }
9042        impl ::core::convert::From<GetOrderbookHeatmapRequestOwnedView>
9043        for ::buffa::OwnedView<GetOrderbookHeatmapRequestView<'static>> {
9044            fn from(wrapper: GetOrderbookHeatmapRequestOwnedView) -> Self {
9045                wrapper.0
9046            }
9047        }
9048        impl ::core::convert::AsRef<
9049            ::buffa::OwnedView<GetOrderbookHeatmapRequestView<'static>>,
9050        > for GetOrderbookHeatmapRequestOwnedView {
9051            fn as_ref(
9052                &self,
9053            ) -> &::buffa::OwnedView<GetOrderbookHeatmapRequestView<'static>> {
9054                &self.0
9055            }
9056        }
9057        impl ::buffa::HasMessageView for super::super::GetOrderbookHeatmapRequest {
9058            type View<'a> = GetOrderbookHeatmapRequestView<'a>;
9059            type ViewHandle = GetOrderbookHeatmapRequestOwnedView;
9060        }
9061        impl ::serde::Serialize for GetOrderbookHeatmapRequestOwnedView {
9062            fn serialize<__S: ::serde::Serializer>(
9063                &self,
9064                __s: __S,
9065            ) -> ::core::result::Result<__S::Ok, __S::Error> {
9066                ::serde::Serialize::serialize(&self.0, __s)
9067            }
9068        }
9069        /// HeatmapLevels represents one side of the orderbook for snapshots.
9070        /// Arrays are aligned by index and prices are sorted ascending for both sides:
9071        /// - price_ticks\[i\] \<-\> qty_scaled\[i\]
9072        #[derive(Clone, Debug, Default)]
9073        pub struct HeatmapLevelsView<'a> {
9074            /// Price levels in quote units scaled by 1e6.
9075            ///
9076            /// Field 1: `price_ticks`
9077            pub price_ticks: ::buffa::RepeatedView<'a, i64>,
9078            /// Quantity at each price level according to quantity_mode, scaled by the
9079            /// pair's base_quantity_scale from GetSpotConfig.
9080            ///
9081            /// Field 2: `qty_scaled`
9082            pub qty_scaled: ::buffa::RepeatedView<'a, i64>,
9083            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
9084        }
9085        impl<'a> ::buffa::MessageView<'a> for HeatmapLevelsView<'a> {
9086            type Owned = super::super::HeatmapLevels;
9087            fn decode_view(
9088                buf: &'a [u8],
9089            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
9090                let __limit = ::core::cell::Cell::new(
9091                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
9092                );
9093                <Self as ::buffa::MessageView>::decode_view_ctx(
9094                    buf,
9095                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
9096                )
9097            }
9098            fn decode_view_with_ctx(
9099                buf: &'a [u8],
9100                ctx: ::buffa::DecodeContext<'_>,
9101            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
9102                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
9103            }
9104            fn merge_view_field(
9105                &mut self,
9106                tag: ::buffa::encoding::Tag,
9107                cur: &'a [u8],
9108                before_tag: &'a [u8],
9109                ctx: ::buffa::DecodeContext<'_>,
9110            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
9111                let _ = ctx;
9112                #[allow(unused_variables)]
9113                let view = self;
9114                let mut cur = cur;
9115                match tag.field_number() {
9116                    1u32 => {
9117                        if tag.wire_type()
9118                            == ::buffa::encoding::WireType::LengthDelimited
9119                        {
9120                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
9121                            view.price_ticks
9122                                .reserve(::buffa::encoding::count_varints(payload));
9123                            let mut pcur: &[u8] = payload;
9124                            while !pcur.is_empty() {
9125                                view.price_ticks
9126                                    .push(::buffa::types::decode_int64(&mut pcur)?);
9127                            }
9128                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
9129                        {
9130                            view.price_ticks
9131                                .push(::buffa::types::decode_int64(&mut cur)?);
9132                        } else {
9133                            return Err(
9134                                ::buffa::encoding::wire_type_mismatch(
9135                                    tag,
9136                                    ::buffa::encoding::WireType::LengthDelimited,
9137                                ),
9138                            );
9139                        }
9140                    }
9141                    2u32 => {
9142                        if tag.wire_type()
9143                            == ::buffa::encoding::WireType::LengthDelimited
9144                        {
9145                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
9146                            view.qty_scaled
9147                                .reserve(::buffa::encoding::count_varints(payload));
9148                            let mut pcur: &[u8] = payload;
9149                            while !pcur.is_empty() {
9150                                view.qty_scaled
9151                                    .push(::buffa::types::decode_int64(&mut pcur)?);
9152                            }
9153                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
9154                        {
9155                            view.qty_scaled
9156                                .push(::buffa::types::decode_int64(&mut cur)?);
9157                        } else {
9158                            return Err(
9159                                ::buffa::encoding::wire_type_mismatch(
9160                                    tag,
9161                                    ::buffa::encoding::WireType::LengthDelimited,
9162                                ),
9163                            );
9164                        }
9165                    }
9166                    _ => {
9167                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
9168                        let span_len = before_tag.len() - cur.len();
9169                        view.__buffa_unknown_fields
9170                            .push_record(before_tag, span_len, ctx)?;
9171                    }
9172                }
9173                ::core::result::Result::Ok(cur)
9174            }
9175            fn to_owned_message(
9176                &self,
9177            ) -> ::core::result::Result<
9178                super::super::HeatmapLevels,
9179                ::buffa::DecodeError,
9180            > {
9181                self.to_owned_from_source(None)
9182            }
9183            #[allow(clippy::useless_conversion, clippy::needless_update)]
9184            fn to_owned_from_source(
9185                &self,
9186                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
9187            ) -> ::core::result::Result<
9188                super::super::HeatmapLevels,
9189                ::buffa::DecodeError,
9190            > {
9191                #[allow(unused_imports)]
9192                use ::buffa::alloc::string::ToString as _;
9193                let _ = __buffa_src;
9194                ::core::result::Result::Ok(super::super::HeatmapLevels {
9195                    price_ticks: self.price_ticks.to_vec(),
9196                    qty_scaled: self.qty_scaled.to_vec(),
9197                    __buffa_unknown_fields: self
9198                        .__buffa_unknown_fields
9199                        .to_owned()?
9200                        .into(),
9201                    ..::core::default::Default::default()
9202                })
9203            }
9204        }
9205        impl<'a> ::buffa::ViewEncode<'a> for HeatmapLevelsView<'a> {
9206            #[allow(clippy::needless_borrow, clippy::let_and_return)]
9207            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
9208                #[allow(unused_imports)]
9209                use ::buffa::Enumeration as _;
9210                let mut size = 0u32;
9211                if !self.price_ticks.is_empty() {
9212                    let payload: u32 = self
9213                        .price_ticks
9214                        .iter()
9215                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
9216                        .sum::<u32>();
9217                    size
9218                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
9219                            + payload;
9220                }
9221                if !self.qty_scaled.is_empty() {
9222                    let payload: u32 = self
9223                        .qty_scaled
9224                        .iter()
9225                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
9226                        .sum::<u32>();
9227                    size
9228                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
9229                            + payload;
9230                }
9231                size += self.__buffa_unknown_fields.encoded_len() as u32;
9232                size
9233            }
9234            #[allow(clippy::needless_borrow)]
9235            fn write_to(
9236                &self,
9237                _cache: &mut ::buffa::SizeCache,
9238                buf: &mut impl ::buffa::bytes::BufMut,
9239            ) {
9240                #[allow(unused_imports)]
9241                use ::buffa::Enumeration as _;
9242                if !self.price_ticks.is_empty() {
9243                    let payload: u32 = self
9244                        .price_ticks
9245                        .iter()
9246                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
9247                        .sum::<u32>();
9248                    ::buffa::types::put_len_delimited_header(1u32, payload, buf);
9249                    for &v in &self.price_ticks {
9250                        ::buffa::types::encode_int64(v, buf);
9251                    }
9252                }
9253                if !self.qty_scaled.is_empty() {
9254                    let payload: u32 = self
9255                        .qty_scaled
9256                        .iter()
9257                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
9258                        .sum::<u32>();
9259                    ::buffa::types::put_len_delimited_header(2u32, payload, buf);
9260                    for &v in &self.qty_scaled {
9261                        ::buffa::types::encode_int64(v, buf);
9262                    }
9263                }
9264                self.__buffa_unknown_fields.write_to(buf);
9265            }
9266        }
9267        /// Serializes this view as protobuf JSON.
9268        ///
9269        /// Implicit-presence fields with default values are omitted, `required`
9270        /// fields are always emitted, explicit-presence (`optional`) fields are
9271        /// emitted only when set, bytes fields are base64-encoded, and enum
9272        /// values are their proto name strings.
9273        ///
9274        /// This impl uses `serialize_map(None)` because the number of emitted
9275        /// fields depends on default-omission rules; serializers that require
9276        /// known map lengths (e.g. `bincode`) will return a runtime error.
9277        /// Use the owned message type for those formats.
9278        impl<'__a> ::serde::Serialize for HeatmapLevelsView<'__a> {
9279            fn serialize<__S: ::serde::Serializer>(
9280                &self,
9281                __s: __S,
9282            ) -> ::core::result::Result<__S::Ok, __S::Error> {
9283                use ::serde::ser::SerializeMap as _;
9284                let mut __map = __s.serialize_map(::core::option::Option::None)?;
9285                if !self.price_ticks.is_empty() {
9286                    __map
9287                        .serialize_entry(
9288                            "priceTicks",
9289                            &::buffa::json_helpers::RepeatedJson(&self.price_ticks),
9290                        )?;
9291                }
9292                if !self.qty_scaled.is_empty() {
9293                    __map
9294                        .serialize_entry(
9295                            "qtyScaled",
9296                            &::buffa::json_helpers::RepeatedJson(&self.qty_scaled),
9297                        )?;
9298                }
9299                __map.end()
9300            }
9301        }
9302        impl<'a> ::buffa::MessageName for HeatmapLevelsView<'a> {
9303            const PACKAGE: &'static str = "marketdata.v1";
9304            const NAME: &'static str = "HeatmapLevels";
9305            const FULL_NAME: &'static str = "marketdata.v1.HeatmapLevels";
9306            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.HeatmapLevels";
9307        }
9308        ::buffa::impl_default_view_instance!(HeatmapLevelsView);
9309        ::buffa::impl_view_reborrow!(HeatmapLevelsView);
9310        /** Self-contained, `'static` owned view of a `HeatmapLevels` message.
9311
9312 Wraps [`::buffa::OwnedView`]`<`[`HeatmapLevelsView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
9313
9314 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`HeatmapLevelsView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
9315        #[derive(Clone, Debug)]
9316        pub struct HeatmapLevelsOwnedView(
9317            ::buffa::OwnedView<HeatmapLevelsView<'static>>,
9318        );
9319        impl HeatmapLevelsOwnedView {
9320            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
9321            ///
9322            /// The view borrows directly from the buffer's data; the buffer is
9323            /// retained inside the returned handle.
9324            ///
9325            /// # Errors
9326            ///
9327            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
9328            /// protobuf data.
9329            pub fn decode(
9330                bytes: ::buffa::bytes::Bytes,
9331            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
9332                ::core::result::Result::Ok(
9333                    HeatmapLevelsOwnedView(::buffa::OwnedView::decode(bytes)?),
9334                )
9335            }
9336            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
9337            /// max message size).
9338            ///
9339            /// # Errors
9340            ///
9341            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
9342            /// exceeds the configured limits.
9343            pub fn decode_with_options(
9344                bytes: ::buffa::bytes::Bytes,
9345                opts: &::buffa::DecodeOptions,
9346            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
9347                ::core::result::Result::Ok(
9348                    HeatmapLevelsOwnedView(
9349                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
9350                    ),
9351                )
9352            }
9353            /// Build from an owned message via an encode → decode round-trip.
9354            ///
9355            /// # Errors
9356            ///
9357            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
9358            /// somehow invalid (should not happen for well-formed messages).
9359            pub fn from_owned(
9360                msg: &super::super::HeatmapLevels,
9361            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
9362                ::core::result::Result::Ok(
9363                    HeatmapLevelsOwnedView(::buffa::OwnedView::from_owned(msg)?),
9364                )
9365            }
9366            /// Borrow the full [`HeatmapLevelsView`] with its lifetime tied to `&self`.
9367            #[must_use]
9368            pub fn view(&self) -> &HeatmapLevelsView<'_> {
9369                self.0.reborrow()
9370            }
9371            /// Convert to the owned message type.
9372            ///
9373            /// # Errors
9374            ///
9375            /// Returns an error if re-materializing preserved unknown fields
9376            /// fails (e.g. the unknown-field limit is exceeded).
9377            pub fn to_owned_message(
9378                &self,
9379            ) -> ::core::result::Result<
9380                super::super::HeatmapLevels,
9381                ::buffa::DecodeError,
9382            > {
9383                self.0.to_owned_message()
9384            }
9385            /// The underlying bytes buffer.
9386            #[must_use]
9387            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
9388                self.0.bytes()
9389            }
9390            /// Consume the handle, returning the underlying bytes buffer.
9391            #[must_use]
9392            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
9393                self.0.into_bytes()
9394            }
9395            /// Price levels in quote units scaled by 1e6.
9396            ///
9397            /// Field 1: `price_ticks`
9398            #[must_use]
9399            pub fn price_ticks(&self) -> &::buffa::RepeatedView<'_, i64> {
9400                &self.0.reborrow().price_ticks
9401            }
9402            /// Quantity at each price level according to quantity_mode, scaled by the
9403            /// pair's base_quantity_scale from GetSpotConfig.
9404            ///
9405            /// Field 2: `qty_scaled`
9406            #[must_use]
9407            pub fn qty_scaled(&self) -> &::buffa::RepeatedView<'_, i64> {
9408                &self.0.reborrow().qty_scaled
9409            }
9410        }
9411        impl ::core::convert::From<::buffa::OwnedView<HeatmapLevelsView<'static>>>
9412        for HeatmapLevelsOwnedView {
9413            fn from(inner: ::buffa::OwnedView<HeatmapLevelsView<'static>>) -> Self {
9414                HeatmapLevelsOwnedView(inner)
9415            }
9416        }
9417        impl ::core::convert::From<HeatmapLevelsOwnedView>
9418        for ::buffa::OwnedView<HeatmapLevelsView<'static>> {
9419            fn from(wrapper: HeatmapLevelsOwnedView) -> Self {
9420                wrapper.0
9421            }
9422        }
9423        impl ::core::convert::AsRef<::buffa::OwnedView<HeatmapLevelsView<'static>>>
9424        for HeatmapLevelsOwnedView {
9425            fn as_ref(&self) -> &::buffa::OwnedView<HeatmapLevelsView<'static>> {
9426                &self.0
9427            }
9428        }
9429        impl ::buffa::HasMessageView for super::super::HeatmapLevels {
9430            type View<'a> = HeatmapLevelsView<'a>;
9431            type ViewHandle = HeatmapLevelsOwnedView;
9432        }
9433        impl ::serde::Serialize for HeatmapLevelsOwnedView {
9434            fn serialize<__S: ::serde::Serializer>(
9435                &self,
9436                __s: __S,
9437            ) -> ::core::result::Result<__S::Ok, __S::Error> {
9438                ::serde::Serialize::serialize(&self.0, __s)
9439            }
9440        }
9441        /// HeatmapDeltaLevels represents sparse per-bucket level changes for one side.
9442        /// Arrays are aligned by index and prices are sorted ascending for both sides:
9443        /// - price_ticks\[i\] \<-\> qty_scaled\[i\]
9444        /// Delete semantics: qty_scaled\[i\] = 0 means delete level at price_ticks\[i\].
9445        #[derive(Clone, Debug, Default)]
9446        pub struct HeatmapDeltaLevelsView<'a> {
9447            /// Price levels in quote units scaled by 1e6.
9448            ///
9449            /// Field 1: `price_ticks`
9450            pub price_ticks: ::buffa::RepeatedView<'a, i64>,
9451            /// Quantity at each price level, scaled by the pair's base_quantity_scale from
9452            /// GetSpotConfig. A zero value deletes the level at the matching price_ticks
9453            /// index.
9454            ///
9455            /// Field 2: `qty_scaled`
9456            pub qty_scaled: ::buffa::RepeatedView<'a, i64>,
9457            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
9458        }
9459        impl<'a> ::buffa::MessageView<'a> for HeatmapDeltaLevelsView<'a> {
9460            type Owned = super::super::HeatmapDeltaLevels;
9461            fn decode_view(
9462                buf: &'a [u8],
9463            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
9464                let __limit = ::core::cell::Cell::new(
9465                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
9466                );
9467                <Self as ::buffa::MessageView>::decode_view_ctx(
9468                    buf,
9469                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
9470                )
9471            }
9472            fn decode_view_with_ctx(
9473                buf: &'a [u8],
9474                ctx: ::buffa::DecodeContext<'_>,
9475            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
9476                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
9477            }
9478            fn merge_view_field(
9479                &mut self,
9480                tag: ::buffa::encoding::Tag,
9481                cur: &'a [u8],
9482                before_tag: &'a [u8],
9483                ctx: ::buffa::DecodeContext<'_>,
9484            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
9485                let _ = ctx;
9486                #[allow(unused_variables)]
9487                let view = self;
9488                let mut cur = cur;
9489                match tag.field_number() {
9490                    1u32 => {
9491                        if tag.wire_type()
9492                            == ::buffa::encoding::WireType::LengthDelimited
9493                        {
9494                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
9495                            view.price_ticks
9496                                .reserve(::buffa::encoding::count_varints(payload));
9497                            let mut pcur: &[u8] = payload;
9498                            while !pcur.is_empty() {
9499                                view.price_ticks
9500                                    .push(::buffa::types::decode_int64(&mut pcur)?);
9501                            }
9502                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
9503                        {
9504                            view.price_ticks
9505                                .push(::buffa::types::decode_int64(&mut cur)?);
9506                        } else {
9507                            return Err(
9508                                ::buffa::encoding::wire_type_mismatch(
9509                                    tag,
9510                                    ::buffa::encoding::WireType::LengthDelimited,
9511                                ),
9512                            );
9513                        }
9514                    }
9515                    2u32 => {
9516                        if tag.wire_type()
9517                            == ::buffa::encoding::WireType::LengthDelimited
9518                        {
9519                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
9520                            view.qty_scaled
9521                                .reserve(::buffa::encoding::count_varints(payload));
9522                            let mut pcur: &[u8] = payload;
9523                            while !pcur.is_empty() {
9524                                view.qty_scaled
9525                                    .push(::buffa::types::decode_int64(&mut pcur)?);
9526                            }
9527                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
9528                        {
9529                            view.qty_scaled
9530                                .push(::buffa::types::decode_int64(&mut cur)?);
9531                        } else {
9532                            return Err(
9533                                ::buffa::encoding::wire_type_mismatch(
9534                                    tag,
9535                                    ::buffa::encoding::WireType::LengthDelimited,
9536                                ),
9537                            );
9538                        }
9539                    }
9540                    _ => {
9541                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
9542                        let span_len = before_tag.len() - cur.len();
9543                        view.__buffa_unknown_fields
9544                            .push_record(before_tag, span_len, ctx)?;
9545                    }
9546                }
9547                ::core::result::Result::Ok(cur)
9548            }
9549            fn to_owned_message(
9550                &self,
9551            ) -> ::core::result::Result<
9552                super::super::HeatmapDeltaLevels,
9553                ::buffa::DecodeError,
9554            > {
9555                self.to_owned_from_source(None)
9556            }
9557            #[allow(clippy::useless_conversion, clippy::needless_update)]
9558            fn to_owned_from_source(
9559                &self,
9560                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
9561            ) -> ::core::result::Result<
9562                super::super::HeatmapDeltaLevels,
9563                ::buffa::DecodeError,
9564            > {
9565                #[allow(unused_imports)]
9566                use ::buffa::alloc::string::ToString as _;
9567                let _ = __buffa_src;
9568                ::core::result::Result::Ok(super::super::HeatmapDeltaLevels {
9569                    price_ticks: self.price_ticks.to_vec(),
9570                    qty_scaled: self.qty_scaled.to_vec(),
9571                    __buffa_unknown_fields: self
9572                        .__buffa_unknown_fields
9573                        .to_owned()?
9574                        .into(),
9575                    ..::core::default::Default::default()
9576                })
9577            }
9578        }
9579        impl<'a> ::buffa::ViewEncode<'a> for HeatmapDeltaLevelsView<'a> {
9580            #[allow(clippy::needless_borrow, clippy::let_and_return)]
9581            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
9582                #[allow(unused_imports)]
9583                use ::buffa::Enumeration as _;
9584                let mut size = 0u32;
9585                if !self.price_ticks.is_empty() {
9586                    let payload: u32 = self
9587                        .price_ticks
9588                        .iter()
9589                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
9590                        .sum::<u32>();
9591                    size
9592                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
9593                            + payload;
9594                }
9595                if !self.qty_scaled.is_empty() {
9596                    let payload: u32 = self
9597                        .qty_scaled
9598                        .iter()
9599                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
9600                        .sum::<u32>();
9601                    size
9602                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
9603                            + payload;
9604                }
9605                size += self.__buffa_unknown_fields.encoded_len() as u32;
9606                size
9607            }
9608            #[allow(clippy::needless_borrow)]
9609            fn write_to(
9610                &self,
9611                _cache: &mut ::buffa::SizeCache,
9612                buf: &mut impl ::buffa::bytes::BufMut,
9613            ) {
9614                #[allow(unused_imports)]
9615                use ::buffa::Enumeration as _;
9616                if !self.price_ticks.is_empty() {
9617                    let payload: u32 = self
9618                        .price_ticks
9619                        .iter()
9620                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
9621                        .sum::<u32>();
9622                    ::buffa::types::put_len_delimited_header(1u32, payload, buf);
9623                    for &v in &self.price_ticks {
9624                        ::buffa::types::encode_int64(v, buf);
9625                    }
9626                }
9627                if !self.qty_scaled.is_empty() {
9628                    let payload: u32 = self
9629                        .qty_scaled
9630                        .iter()
9631                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
9632                        .sum::<u32>();
9633                    ::buffa::types::put_len_delimited_header(2u32, payload, buf);
9634                    for &v in &self.qty_scaled {
9635                        ::buffa::types::encode_int64(v, buf);
9636                    }
9637                }
9638                self.__buffa_unknown_fields.write_to(buf);
9639            }
9640        }
9641        /// Serializes this view as protobuf JSON.
9642        ///
9643        /// Implicit-presence fields with default values are omitted, `required`
9644        /// fields are always emitted, explicit-presence (`optional`) fields are
9645        /// emitted only when set, bytes fields are base64-encoded, and enum
9646        /// values are their proto name strings.
9647        ///
9648        /// This impl uses `serialize_map(None)` because the number of emitted
9649        /// fields depends on default-omission rules; serializers that require
9650        /// known map lengths (e.g. `bincode`) will return a runtime error.
9651        /// Use the owned message type for those formats.
9652        impl<'__a> ::serde::Serialize for HeatmapDeltaLevelsView<'__a> {
9653            fn serialize<__S: ::serde::Serializer>(
9654                &self,
9655                __s: __S,
9656            ) -> ::core::result::Result<__S::Ok, __S::Error> {
9657                use ::serde::ser::SerializeMap as _;
9658                let mut __map = __s.serialize_map(::core::option::Option::None)?;
9659                if !self.price_ticks.is_empty() {
9660                    __map
9661                        .serialize_entry(
9662                            "priceTicks",
9663                            &::buffa::json_helpers::RepeatedJson(&self.price_ticks),
9664                        )?;
9665                }
9666                if !self.qty_scaled.is_empty() {
9667                    __map
9668                        .serialize_entry(
9669                            "qtyScaled",
9670                            &::buffa::json_helpers::RepeatedJson(&self.qty_scaled),
9671                        )?;
9672                }
9673                __map.end()
9674            }
9675        }
9676        impl<'a> ::buffa::MessageName for HeatmapDeltaLevelsView<'a> {
9677            const PACKAGE: &'static str = "marketdata.v1";
9678            const NAME: &'static str = "HeatmapDeltaLevels";
9679            const FULL_NAME: &'static str = "marketdata.v1.HeatmapDeltaLevels";
9680            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.HeatmapDeltaLevels";
9681        }
9682        ::buffa::impl_default_view_instance!(HeatmapDeltaLevelsView);
9683        ::buffa::impl_view_reborrow!(HeatmapDeltaLevelsView);
9684        /** Self-contained, `'static` owned view of a `HeatmapDeltaLevels` message.
9685
9686 Wraps [`::buffa::OwnedView`]`<`[`HeatmapDeltaLevelsView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
9687
9688 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`HeatmapDeltaLevelsView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
9689        #[derive(Clone, Debug)]
9690        pub struct HeatmapDeltaLevelsOwnedView(
9691            ::buffa::OwnedView<HeatmapDeltaLevelsView<'static>>,
9692        );
9693        impl HeatmapDeltaLevelsOwnedView {
9694            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
9695            ///
9696            /// The view borrows directly from the buffer's data; the buffer is
9697            /// retained inside the returned handle.
9698            ///
9699            /// # Errors
9700            ///
9701            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
9702            /// protobuf data.
9703            pub fn decode(
9704                bytes: ::buffa::bytes::Bytes,
9705            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
9706                ::core::result::Result::Ok(
9707                    HeatmapDeltaLevelsOwnedView(::buffa::OwnedView::decode(bytes)?),
9708                )
9709            }
9710            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
9711            /// max message size).
9712            ///
9713            /// # Errors
9714            ///
9715            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
9716            /// exceeds the configured limits.
9717            pub fn decode_with_options(
9718                bytes: ::buffa::bytes::Bytes,
9719                opts: &::buffa::DecodeOptions,
9720            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
9721                ::core::result::Result::Ok(
9722                    HeatmapDeltaLevelsOwnedView(
9723                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
9724                    ),
9725                )
9726            }
9727            /// Build from an owned message via an encode → decode round-trip.
9728            ///
9729            /// # Errors
9730            ///
9731            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
9732            /// somehow invalid (should not happen for well-formed messages).
9733            pub fn from_owned(
9734                msg: &super::super::HeatmapDeltaLevels,
9735            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
9736                ::core::result::Result::Ok(
9737                    HeatmapDeltaLevelsOwnedView(::buffa::OwnedView::from_owned(msg)?),
9738                )
9739            }
9740            /// Borrow the full [`HeatmapDeltaLevelsView`] with its lifetime tied to `&self`.
9741            #[must_use]
9742            pub fn view(&self) -> &HeatmapDeltaLevelsView<'_> {
9743                self.0.reborrow()
9744            }
9745            /// Convert to the owned message type.
9746            ///
9747            /// # Errors
9748            ///
9749            /// Returns an error if re-materializing preserved unknown fields
9750            /// fails (e.g. the unknown-field limit is exceeded).
9751            pub fn to_owned_message(
9752                &self,
9753            ) -> ::core::result::Result<
9754                super::super::HeatmapDeltaLevels,
9755                ::buffa::DecodeError,
9756            > {
9757                self.0.to_owned_message()
9758            }
9759            /// The underlying bytes buffer.
9760            #[must_use]
9761            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
9762                self.0.bytes()
9763            }
9764            /// Consume the handle, returning the underlying bytes buffer.
9765            #[must_use]
9766            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
9767                self.0.into_bytes()
9768            }
9769            /// Price levels in quote units scaled by 1e6.
9770            ///
9771            /// Field 1: `price_ticks`
9772            #[must_use]
9773            pub fn price_ticks(&self) -> &::buffa::RepeatedView<'_, i64> {
9774                &self.0.reborrow().price_ticks
9775            }
9776            /// Quantity at each price level, scaled by the pair's base_quantity_scale from
9777            /// GetSpotConfig. A zero value deletes the level at the matching price_ticks
9778            /// index.
9779            ///
9780            /// Field 2: `qty_scaled`
9781            #[must_use]
9782            pub fn qty_scaled(&self) -> &::buffa::RepeatedView<'_, i64> {
9783                &self.0.reborrow().qty_scaled
9784            }
9785        }
9786        impl ::core::convert::From<::buffa::OwnedView<HeatmapDeltaLevelsView<'static>>>
9787        for HeatmapDeltaLevelsOwnedView {
9788            fn from(inner: ::buffa::OwnedView<HeatmapDeltaLevelsView<'static>>) -> Self {
9789                HeatmapDeltaLevelsOwnedView(inner)
9790            }
9791        }
9792        impl ::core::convert::From<HeatmapDeltaLevelsOwnedView>
9793        for ::buffa::OwnedView<HeatmapDeltaLevelsView<'static>> {
9794            fn from(wrapper: HeatmapDeltaLevelsOwnedView) -> Self {
9795                wrapper.0
9796            }
9797        }
9798        impl ::core::convert::AsRef<::buffa::OwnedView<HeatmapDeltaLevelsView<'static>>>
9799        for HeatmapDeltaLevelsOwnedView {
9800            fn as_ref(&self) -> &::buffa::OwnedView<HeatmapDeltaLevelsView<'static>> {
9801                &self.0
9802            }
9803        }
9804        impl ::buffa::HasMessageView for super::super::HeatmapDeltaLevels {
9805            type View<'a> = HeatmapDeltaLevelsView<'a>;
9806            type ViewHandle = HeatmapDeltaLevelsOwnedView;
9807        }
9808        impl ::serde::Serialize for HeatmapDeltaLevelsOwnedView {
9809            fn serialize<__S: ::serde::Serializer>(
9810                &self,
9811                __s: __S,
9812            ) -> ::core::result::Result<__S::Ok, __S::Error> {
9813                ::serde::Serialize::serialize(&self.0, __s)
9814            }
9815        }
9816        /// HeatmapKeyframe is a full-book snapshot anchor.
9817        #[derive(Clone, Debug, Default)]
9818        pub struct HeatmapKeyframeView<'a> {
9819            /// Snapshot timestamp (seconds since epoch, UTC).
9820            ///
9821            /// Field 1: `ts_sec`
9822            pub ts_sec: u64,
9823            /// Best bid price in quote units scaled by 1e6.
9824            ///
9825            /// Field 2: `best_bid_ticks`
9826            pub best_bid_ticks: i64,
9827            /// Best ask price in quote units scaled by 1e6.
9828            ///
9829            /// Field 3: `best_ask_ticks`
9830            pub best_ask_ticks: i64,
9831            /// Mid price in quote units scaled by 1e6.
9832            ///
9833            /// Field 4: `mid_ticks`
9834            pub mid_ticks: i64,
9835            /// Complete bid-side levels at the snapshot.
9836            ///
9837            /// Field 5: `bids`
9838            pub bids: ::buffa::MessageFieldView<
9839                super::super::__buffa::view::HeatmapLevelsView<'a>,
9840            >,
9841            /// Complete ask-side levels at the snapshot.
9842            ///
9843            /// Field 6: `asks`
9844            pub asks: ::buffa::MessageFieldView<
9845                super::super::__buffa::view::HeatmapLevelsView<'a>,
9846            >,
9847            /// Monotonic order book sequence at the snapshot.
9848            ///
9849            /// Field 7: `book_seq`
9850            pub book_seq: u64,
9851            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
9852        }
9853        impl<'a> ::buffa::MessageView<'a> for HeatmapKeyframeView<'a> {
9854            type Owned = super::super::HeatmapKeyframe;
9855            fn decode_view(
9856                buf: &'a [u8],
9857            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
9858                let __limit = ::core::cell::Cell::new(
9859                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
9860                );
9861                <Self as ::buffa::MessageView>::decode_view_ctx(
9862                    buf,
9863                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
9864                )
9865            }
9866            fn decode_view_with_ctx(
9867                buf: &'a [u8],
9868                ctx: ::buffa::DecodeContext<'_>,
9869            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
9870                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
9871            }
9872            fn merge_view_field(
9873                &mut self,
9874                tag: ::buffa::encoding::Tag,
9875                cur: &'a [u8],
9876                before_tag: &'a [u8],
9877                ctx: ::buffa::DecodeContext<'_>,
9878            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
9879                let _ = ctx;
9880                #[allow(unused_variables)]
9881                let view = self;
9882                let mut cur = cur;
9883                match tag.field_number() {
9884                    1u32 => {
9885                        ::buffa::encoding::check_wire_type(
9886                            tag,
9887                            ::buffa::encoding::WireType::Varint,
9888                        )?;
9889                        view.ts_sec = ::buffa::types::decode_uint64(&mut cur)?;
9890                    }
9891                    2u32 => {
9892                        ::buffa::encoding::check_wire_type(
9893                            tag,
9894                            ::buffa::encoding::WireType::Varint,
9895                        )?;
9896                        view.best_bid_ticks = ::buffa::types::decode_int64(&mut cur)?;
9897                    }
9898                    3u32 => {
9899                        ::buffa::encoding::check_wire_type(
9900                            tag,
9901                            ::buffa::encoding::WireType::Varint,
9902                        )?;
9903                        view.best_ask_ticks = ::buffa::types::decode_int64(&mut cur)?;
9904                    }
9905                    4u32 => {
9906                        ::buffa::encoding::check_wire_type(
9907                            tag,
9908                            ::buffa::encoding::WireType::Varint,
9909                        )?;
9910                        view.mid_ticks = ::buffa::types::decode_int64(&mut cur)?;
9911                    }
9912                    5u32 => {
9913                        ::buffa::encoding::check_wire_type(
9914                            tag,
9915                            ::buffa::encoding::WireType::LengthDelimited,
9916                        )?;
9917                        let __sub_ctx = ctx.descend()?;
9918                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
9919                        match view.bids.as_mut() {
9920                            Some(existing) => {
9921                                ::buffa::MessageView::merge_into_view(
9922                                    existing,
9923                                    sub,
9924                                    __sub_ctx,
9925                                )?
9926                            }
9927                            None => {
9928                                view.bids = ::buffa::MessageFieldView::set(
9929                                    <super::super::__buffa::view::HeatmapLevelsView as ::buffa::MessageView>::decode_view_ctx(
9930                                        sub,
9931                                        __sub_ctx,
9932                                    )?,
9933                                );
9934                            }
9935                        }
9936                    }
9937                    6u32 => {
9938                        ::buffa::encoding::check_wire_type(
9939                            tag,
9940                            ::buffa::encoding::WireType::LengthDelimited,
9941                        )?;
9942                        let __sub_ctx = ctx.descend()?;
9943                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
9944                        match view.asks.as_mut() {
9945                            Some(existing) => {
9946                                ::buffa::MessageView::merge_into_view(
9947                                    existing,
9948                                    sub,
9949                                    __sub_ctx,
9950                                )?
9951                            }
9952                            None => {
9953                                view.asks = ::buffa::MessageFieldView::set(
9954                                    <super::super::__buffa::view::HeatmapLevelsView as ::buffa::MessageView>::decode_view_ctx(
9955                                        sub,
9956                                        __sub_ctx,
9957                                    )?,
9958                                );
9959                            }
9960                        }
9961                    }
9962                    7u32 => {
9963                        ::buffa::encoding::check_wire_type(
9964                            tag,
9965                            ::buffa::encoding::WireType::Varint,
9966                        )?;
9967                        view.book_seq = ::buffa::types::decode_uint64(&mut cur)?;
9968                    }
9969                    _ => {
9970                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
9971                        let span_len = before_tag.len() - cur.len();
9972                        view.__buffa_unknown_fields
9973                            .push_record(before_tag, span_len, ctx)?;
9974                    }
9975                }
9976                ::core::result::Result::Ok(cur)
9977            }
9978            fn to_owned_message(
9979                &self,
9980            ) -> ::core::result::Result<
9981                super::super::HeatmapKeyframe,
9982                ::buffa::DecodeError,
9983            > {
9984                self.to_owned_from_source(None)
9985            }
9986            #[allow(clippy::useless_conversion, clippy::needless_update)]
9987            fn to_owned_from_source(
9988                &self,
9989                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
9990            ) -> ::core::result::Result<
9991                super::super::HeatmapKeyframe,
9992                ::buffa::DecodeError,
9993            > {
9994                #[allow(unused_imports)]
9995                use ::buffa::alloc::string::ToString as _;
9996                let _ = __buffa_src;
9997                ::core::result::Result::Ok(super::super::HeatmapKeyframe {
9998                    ts_sec: self.ts_sec,
9999                    best_bid_ticks: self.best_bid_ticks,
10000                    best_ask_ticks: self.best_ask_ticks,
10001                    mid_ticks: self.mid_ticks,
10002                    bids: match self.bids.as_option() {
10003                        Some(v) => {
10004                            ::buffa::MessageField::<
10005                                super::super::HeatmapLevels,
10006                            >::some(v.to_owned_from_source(__buffa_src)?)
10007                        }
10008                        None => ::buffa::MessageField::none(),
10009                    },
10010                    asks: match self.asks.as_option() {
10011                        Some(v) => {
10012                            ::buffa::MessageField::<
10013                                super::super::HeatmapLevels,
10014                            >::some(v.to_owned_from_source(__buffa_src)?)
10015                        }
10016                        None => ::buffa::MessageField::none(),
10017                    },
10018                    book_seq: self.book_seq,
10019                    __buffa_unknown_fields: self
10020                        .__buffa_unknown_fields
10021                        .to_owned()?
10022                        .into(),
10023                    ..::core::default::Default::default()
10024                })
10025            }
10026        }
10027        impl<'a> ::buffa::ViewEncode<'a> for HeatmapKeyframeView<'a> {
10028            #[allow(clippy::needless_borrow, clippy::let_and_return)]
10029            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
10030                #[allow(unused_imports)]
10031                use ::buffa::Enumeration as _;
10032                let mut size = 0u32;
10033                if self.ts_sec != 0u64 {
10034                    size
10035                        += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_sec) as u32;
10036                }
10037                if self.best_bid_ticks != 0i64 {
10038                    size
10039                        += 1u32
10040                            + ::buffa::types::int64_encoded_len(self.best_bid_ticks)
10041                                as u32;
10042                }
10043                if self.best_ask_ticks != 0i64 {
10044                    size
10045                        += 1u32
10046                            + ::buffa::types::int64_encoded_len(self.best_ask_ticks)
10047                                as u32;
10048                }
10049                if self.mid_ticks != 0i64 {
10050                    size
10051                        += 1u32
10052                            + ::buffa::types::int64_encoded_len(self.mid_ticks) as u32;
10053                }
10054                if self.bids.is_set() {
10055                    let __slot = __cache.reserve();
10056                    let inner_size = self.bids.compute_size(__cache);
10057                    __cache.set(__slot, inner_size);
10058                    size
10059                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
10060                            + inner_size;
10061                }
10062                if self.asks.is_set() {
10063                    let __slot = __cache.reserve();
10064                    let inner_size = self.asks.compute_size(__cache);
10065                    __cache.set(__slot, inner_size);
10066                    size
10067                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
10068                            + inner_size;
10069                }
10070                if self.book_seq != 0u64 {
10071                    size
10072                        += 1u32
10073                            + ::buffa::types::uint64_encoded_len(self.book_seq) as u32;
10074                }
10075                size += self.__buffa_unknown_fields.encoded_len() as u32;
10076                size
10077            }
10078            #[allow(clippy::needless_borrow)]
10079            fn write_to(
10080                &self,
10081                __cache: &mut ::buffa::SizeCache,
10082                buf: &mut impl ::buffa::bytes::BufMut,
10083            ) {
10084                #[allow(unused_imports)]
10085                use ::buffa::Enumeration as _;
10086                if self.ts_sec != 0u64 {
10087                    ::buffa::types::put_uint64_field(1u32, self.ts_sec, buf);
10088                }
10089                if self.best_bid_ticks != 0i64 {
10090                    ::buffa::types::put_int64_field(2u32, self.best_bid_ticks, buf);
10091                }
10092                if self.best_ask_ticks != 0i64 {
10093                    ::buffa::types::put_int64_field(3u32, self.best_ask_ticks, buf);
10094                }
10095                if self.mid_ticks != 0i64 {
10096                    ::buffa::types::put_int64_field(4u32, self.mid_ticks, buf);
10097                }
10098                if self.bids.is_set() {
10099                    ::buffa::types::put_len_delimited_header(
10100                        5u32,
10101                        __cache.consume_next(),
10102                        buf,
10103                    );
10104                    self.bids.write_to(__cache, buf);
10105                }
10106                if self.asks.is_set() {
10107                    ::buffa::types::put_len_delimited_header(
10108                        6u32,
10109                        __cache.consume_next(),
10110                        buf,
10111                    );
10112                    self.asks.write_to(__cache, buf);
10113                }
10114                if self.book_seq != 0u64 {
10115                    ::buffa::types::put_uint64_field(7u32, self.book_seq, buf);
10116                }
10117                self.__buffa_unknown_fields.write_to(buf);
10118            }
10119        }
10120        /// Serializes this view as protobuf JSON.
10121        ///
10122        /// Implicit-presence fields with default values are omitted, `required`
10123        /// fields are always emitted, explicit-presence (`optional`) fields are
10124        /// emitted only when set, bytes fields are base64-encoded, and enum
10125        /// values are their proto name strings.
10126        ///
10127        /// This impl uses `serialize_map(None)` because the number of emitted
10128        /// fields depends on default-omission rules; serializers that require
10129        /// known map lengths (e.g. `bincode`) will return a runtime error.
10130        /// Use the owned message type for those formats.
10131        impl<'__a> ::serde::Serialize for HeatmapKeyframeView<'__a> {
10132            fn serialize<__S: ::serde::Serializer>(
10133                &self,
10134                __s: __S,
10135            ) -> ::core::result::Result<__S::Ok, __S::Error> {
10136                use ::serde::ser::SerializeMap as _;
10137                let mut __map = __s.serialize_map(::core::option::Option::None)?;
10138                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_sec) {
10139                    __map
10140                        .serialize_entry(
10141                            "tsSec",
10142                            &::buffa::json_helpers::ProtoJson(&self.ts_sec),
10143                        )?;
10144                }
10145                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.best_bid_ticks) {
10146                    __map
10147                        .serialize_entry(
10148                            "bestBidTicks",
10149                            &::buffa::json_helpers::ProtoJson(&self.best_bid_ticks),
10150                        )?;
10151                }
10152                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.best_ask_ticks) {
10153                    __map
10154                        .serialize_entry(
10155                            "bestAskTicks",
10156                            &::buffa::json_helpers::ProtoJson(&self.best_ask_ticks),
10157                        )?;
10158                }
10159                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.mid_ticks) {
10160                    __map
10161                        .serialize_entry(
10162                            "midTicks",
10163                            &::buffa::json_helpers::ProtoJson(&self.mid_ticks),
10164                        )?;
10165                }
10166                {
10167                    if let ::core::option::Option::Some(__v) = self.bids.as_option() {
10168                        __map.serialize_entry("bids", __v)?;
10169                    }
10170                }
10171                {
10172                    if let ::core::option::Option::Some(__v) = self.asks.as_option() {
10173                        __map.serialize_entry("asks", __v)?;
10174                    }
10175                }
10176                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.book_seq) {
10177                    __map
10178                        .serialize_entry(
10179                            "bookSeq",
10180                            &::buffa::json_helpers::ProtoJson(&self.book_seq),
10181                        )?;
10182                }
10183                __map.end()
10184            }
10185        }
10186        impl<'a> ::buffa::MessageName for HeatmapKeyframeView<'a> {
10187            const PACKAGE: &'static str = "marketdata.v1";
10188            const NAME: &'static str = "HeatmapKeyframe";
10189            const FULL_NAME: &'static str = "marketdata.v1.HeatmapKeyframe";
10190            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.HeatmapKeyframe";
10191        }
10192        ::buffa::impl_default_view_instance!(HeatmapKeyframeView);
10193        ::buffa::impl_view_reborrow!(HeatmapKeyframeView);
10194        /** Self-contained, `'static` owned view of a `HeatmapKeyframe` message.
10195
10196 Wraps [`::buffa::OwnedView`]`<`[`HeatmapKeyframeView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
10197
10198 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`HeatmapKeyframeView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
10199        #[derive(Clone, Debug)]
10200        pub struct HeatmapKeyframeOwnedView(
10201            ::buffa::OwnedView<HeatmapKeyframeView<'static>>,
10202        );
10203        impl HeatmapKeyframeOwnedView {
10204            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
10205            ///
10206            /// The view borrows directly from the buffer's data; the buffer is
10207            /// retained inside the returned handle.
10208            ///
10209            /// # Errors
10210            ///
10211            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
10212            /// protobuf data.
10213            pub fn decode(
10214                bytes: ::buffa::bytes::Bytes,
10215            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10216                ::core::result::Result::Ok(
10217                    HeatmapKeyframeOwnedView(::buffa::OwnedView::decode(bytes)?),
10218                )
10219            }
10220            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
10221            /// max message size).
10222            ///
10223            /// # Errors
10224            ///
10225            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
10226            /// exceeds the configured limits.
10227            pub fn decode_with_options(
10228                bytes: ::buffa::bytes::Bytes,
10229                opts: &::buffa::DecodeOptions,
10230            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10231                ::core::result::Result::Ok(
10232                    HeatmapKeyframeOwnedView(
10233                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
10234                    ),
10235                )
10236            }
10237            /// Build from an owned message via an encode → decode round-trip.
10238            ///
10239            /// # Errors
10240            ///
10241            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
10242            /// somehow invalid (should not happen for well-formed messages).
10243            pub fn from_owned(
10244                msg: &super::super::HeatmapKeyframe,
10245            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10246                ::core::result::Result::Ok(
10247                    HeatmapKeyframeOwnedView(::buffa::OwnedView::from_owned(msg)?),
10248                )
10249            }
10250            /// Borrow the full [`HeatmapKeyframeView`] with its lifetime tied to `&self`.
10251            #[must_use]
10252            pub fn view(&self) -> &HeatmapKeyframeView<'_> {
10253                self.0.reborrow()
10254            }
10255            /// Convert to the owned message type.
10256            ///
10257            /// # Errors
10258            ///
10259            /// Returns an error if re-materializing preserved unknown fields
10260            /// fails (e.g. the unknown-field limit is exceeded).
10261            pub fn to_owned_message(
10262                &self,
10263            ) -> ::core::result::Result<
10264                super::super::HeatmapKeyframe,
10265                ::buffa::DecodeError,
10266            > {
10267                self.0.to_owned_message()
10268            }
10269            /// The underlying bytes buffer.
10270            #[must_use]
10271            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
10272                self.0.bytes()
10273            }
10274            /// Consume the handle, returning the underlying bytes buffer.
10275            #[must_use]
10276            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
10277                self.0.into_bytes()
10278            }
10279            /// Snapshot timestamp (seconds since epoch, UTC).
10280            ///
10281            /// Field 1: `ts_sec`
10282            #[must_use]
10283            pub fn ts_sec(&self) -> u64 {
10284                self.0.reborrow().ts_sec
10285            }
10286            /// Best bid price in quote units scaled by 1e6.
10287            ///
10288            /// Field 2: `best_bid_ticks`
10289            #[must_use]
10290            pub fn best_bid_ticks(&self) -> i64 {
10291                self.0.reborrow().best_bid_ticks
10292            }
10293            /// Best ask price in quote units scaled by 1e6.
10294            ///
10295            /// Field 3: `best_ask_ticks`
10296            #[must_use]
10297            pub fn best_ask_ticks(&self) -> i64 {
10298                self.0.reborrow().best_ask_ticks
10299            }
10300            /// Mid price in quote units scaled by 1e6.
10301            ///
10302            /// Field 4: `mid_ticks`
10303            #[must_use]
10304            pub fn mid_ticks(&self) -> i64 {
10305                self.0.reborrow().mid_ticks
10306            }
10307            /// Complete bid-side levels at the snapshot.
10308            ///
10309            /// Field 5: `bids`
10310            #[must_use]
10311            pub fn bids(
10312                &self,
10313            ) -> &::buffa::MessageFieldView<
10314                super::super::__buffa::view::HeatmapLevelsView<'_>,
10315            > {
10316                &self.0.reborrow().bids
10317            }
10318            /// Complete ask-side levels at the snapshot.
10319            ///
10320            /// Field 6: `asks`
10321            #[must_use]
10322            pub fn asks(
10323                &self,
10324            ) -> &::buffa::MessageFieldView<
10325                super::super::__buffa::view::HeatmapLevelsView<'_>,
10326            > {
10327                &self.0.reborrow().asks
10328            }
10329            /// Monotonic order book sequence at the snapshot.
10330            ///
10331            /// Field 7: `book_seq`
10332            #[must_use]
10333            pub fn book_seq(&self) -> u64 {
10334                self.0.reborrow().book_seq
10335            }
10336        }
10337        impl ::core::convert::From<::buffa::OwnedView<HeatmapKeyframeView<'static>>>
10338        for HeatmapKeyframeOwnedView {
10339            fn from(inner: ::buffa::OwnedView<HeatmapKeyframeView<'static>>) -> Self {
10340                HeatmapKeyframeOwnedView(inner)
10341            }
10342        }
10343        impl ::core::convert::From<HeatmapKeyframeOwnedView>
10344        for ::buffa::OwnedView<HeatmapKeyframeView<'static>> {
10345            fn from(wrapper: HeatmapKeyframeOwnedView) -> Self {
10346                wrapper.0
10347            }
10348        }
10349        impl ::core::convert::AsRef<::buffa::OwnedView<HeatmapKeyframeView<'static>>>
10350        for HeatmapKeyframeOwnedView {
10351            fn as_ref(&self) -> &::buffa::OwnedView<HeatmapKeyframeView<'static>> {
10352                &self.0
10353            }
10354        }
10355        impl ::buffa::HasMessageView for super::super::HeatmapKeyframe {
10356            type View<'a> = HeatmapKeyframeView<'a>;
10357            type ViewHandle = HeatmapKeyframeOwnedView;
10358        }
10359        impl ::serde::Serialize for HeatmapKeyframeOwnedView {
10360            fn serialize<__S: ::serde::Serializer>(
10361                &self,
10362                __s: __S,
10363            ) -> ::core::result::Result<__S::Ok, __S::Error> {
10364                ::serde::Serialize::serialize(&self.0, __s)
10365            }
10366        }
10367        /// HeatmapDeltaBucket is one sparse update bucket containing both sides.
10368        #[derive(Clone, Debug, Default)]
10369        pub struct HeatmapDeltaBucketView<'a> {
10370            /// Bucket start timestamp (seconds since epoch, UTC), aligned to `interval`.
10371            ///
10372            /// Field 1: `ts_sec`
10373            pub ts_sec: u64,
10374            /// Sparse bid-side level changes in this bucket.
10375            ///
10376            /// Field 2: `bids`
10377            pub bids: ::buffa::MessageFieldView<
10378                super::super::__buffa::view::HeatmapDeltaLevelsView<'a>,
10379            >,
10380            /// Sparse ask-side level changes in this bucket.
10381            ///
10382            /// Field 3: `asks`
10383            pub asks: ::buffa::MessageFieldView<
10384                super::super::__buffa::view::HeatmapDeltaLevelsView<'a>,
10385            >,
10386            /// Number of upstream L2 updates aggregated into this interval bucket.
10387            ///
10388            /// Field 4: `updates_in_bucket`
10389            pub updates_in_bucket: u32,
10390            /// Earliest monotonic order book sequence represented by this bucket.
10391            ///
10392            /// Field 5: `book_seq_start`
10393            pub book_seq_start: u64,
10394            /// Latest monotonic order book sequence represented by this bucket.
10395            ///
10396            /// Field 6: `book_seq_end`
10397            pub book_seq_end: u64,
10398            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
10399        }
10400        impl<'a> ::buffa::MessageView<'a> for HeatmapDeltaBucketView<'a> {
10401            type Owned = super::super::HeatmapDeltaBucket;
10402            fn decode_view(
10403                buf: &'a [u8],
10404            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10405                let __limit = ::core::cell::Cell::new(
10406                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
10407                );
10408                <Self as ::buffa::MessageView>::decode_view_ctx(
10409                    buf,
10410                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
10411                )
10412            }
10413            fn decode_view_with_ctx(
10414                buf: &'a [u8],
10415                ctx: ::buffa::DecodeContext<'_>,
10416            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10417                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
10418            }
10419            fn merge_view_field(
10420                &mut self,
10421                tag: ::buffa::encoding::Tag,
10422                cur: &'a [u8],
10423                before_tag: &'a [u8],
10424                ctx: ::buffa::DecodeContext<'_>,
10425            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
10426                let _ = ctx;
10427                #[allow(unused_variables)]
10428                let view = self;
10429                let mut cur = cur;
10430                match tag.field_number() {
10431                    1u32 => {
10432                        ::buffa::encoding::check_wire_type(
10433                            tag,
10434                            ::buffa::encoding::WireType::Varint,
10435                        )?;
10436                        view.ts_sec = ::buffa::types::decode_uint64(&mut cur)?;
10437                    }
10438                    2u32 => {
10439                        ::buffa::encoding::check_wire_type(
10440                            tag,
10441                            ::buffa::encoding::WireType::LengthDelimited,
10442                        )?;
10443                        let __sub_ctx = ctx.descend()?;
10444                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
10445                        match view.bids.as_mut() {
10446                            Some(existing) => {
10447                                ::buffa::MessageView::merge_into_view(
10448                                    existing,
10449                                    sub,
10450                                    __sub_ctx,
10451                                )?
10452                            }
10453                            None => {
10454                                view.bids = ::buffa::MessageFieldView::set(
10455                                    <super::super::__buffa::view::HeatmapDeltaLevelsView as ::buffa::MessageView>::decode_view_ctx(
10456                                        sub,
10457                                        __sub_ctx,
10458                                    )?,
10459                                );
10460                            }
10461                        }
10462                    }
10463                    3u32 => {
10464                        ::buffa::encoding::check_wire_type(
10465                            tag,
10466                            ::buffa::encoding::WireType::LengthDelimited,
10467                        )?;
10468                        let __sub_ctx = ctx.descend()?;
10469                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
10470                        match view.asks.as_mut() {
10471                            Some(existing) => {
10472                                ::buffa::MessageView::merge_into_view(
10473                                    existing,
10474                                    sub,
10475                                    __sub_ctx,
10476                                )?
10477                            }
10478                            None => {
10479                                view.asks = ::buffa::MessageFieldView::set(
10480                                    <super::super::__buffa::view::HeatmapDeltaLevelsView as ::buffa::MessageView>::decode_view_ctx(
10481                                        sub,
10482                                        __sub_ctx,
10483                                    )?,
10484                                );
10485                            }
10486                        }
10487                    }
10488                    4u32 => {
10489                        ::buffa::encoding::check_wire_type(
10490                            tag,
10491                            ::buffa::encoding::WireType::Varint,
10492                        )?;
10493                        view.updates_in_bucket = ::buffa::types::decode_uint32(
10494                            &mut cur,
10495                        )?;
10496                    }
10497                    5u32 => {
10498                        ::buffa::encoding::check_wire_type(
10499                            tag,
10500                            ::buffa::encoding::WireType::Varint,
10501                        )?;
10502                        view.book_seq_start = ::buffa::types::decode_uint64(&mut cur)?;
10503                    }
10504                    6u32 => {
10505                        ::buffa::encoding::check_wire_type(
10506                            tag,
10507                            ::buffa::encoding::WireType::Varint,
10508                        )?;
10509                        view.book_seq_end = ::buffa::types::decode_uint64(&mut cur)?;
10510                    }
10511                    _ => {
10512                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
10513                        let span_len = before_tag.len() - cur.len();
10514                        view.__buffa_unknown_fields
10515                            .push_record(before_tag, span_len, ctx)?;
10516                    }
10517                }
10518                ::core::result::Result::Ok(cur)
10519            }
10520            fn to_owned_message(
10521                &self,
10522            ) -> ::core::result::Result<
10523                super::super::HeatmapDeltaBucket,
10524                ::buffa::DecodeError,
10525            > {
10526                self.to_owned_from_source(None)
10527            }
10528            #[allow(clippy::useless_conversion, clippy::needless_update)]
10529            fn to_owned_from_source(
10530                &self,
10531                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
10532            ) -> ::core::result::Result<
10533                super::super::HeatmapDeltaBucket,
10534                ::buffa::DecodeError,
10535            > {
10536                #[allow(unused_imports)]
10537                use ::buffa::alloc::string::ToString as _;
10538                let _ = __buffa_src;
10539                ::core::result::Result::Ok(super::super::HeatmapDeltaBucket {
10540                    ts_sec: self.ts_sec,
10541                    bids: match self.bids.as_option() {
10542                        Some(v) => {
10543                            ::buffa::MessageField::<
10544                                super::super::HeatmapDeltaLevels,
10545                            >::some(v.to_owned_from_source(__buffa_src)?)
10546                        }
10547                        None => ::buffa::MessageField::none(),
10548                    },
10549                    asks: match self.asks.as_option() {
10550                        Some(v) => {
10551                            ::buffa::MessageField::<
10552                                super::super::HeatmapDeltaLevels,
10553                            >::some(v.to_owned_from_source(__buffa_src)?)
10554                        }
10555                        None => ::buffa::MessageField::none(),
10556                    },
10557                    updates_in_bucket: self.updates_in_bucket,
10558                    book_seq_start: self.book_seq_start,
10559                    book_seq_end: self.book_seq_end,
10560                    __buffa_unknown_fields: self
10561                        .__buffa_unknown_fields
10562                        .to_owned()?
10563                        .into(),
10564                    ..::core::default::Default::default()
10565                })
10566            }
10567        }
10568        impl<'a> ::buffa::ViewEncode<'a> for HeatmapDeltaBucketView<'a> {
10569            #[allow(clippy::needless_borrow, clippy::let_and_return)]
10570            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
10571                #[allow(unused_imports)]
10572                use ::buffa::Enumeration as _;
10573                let mut size = 0u32;
10574                if self.ts_sec != 0u64 {
10575                    size
10576                        += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_sec) as u32;
10577                }
10578                if self.bids.is_set() {
10579                    let __slot = __cache.reserve();
10580                    let inner_size = self.bids.compute_size(__cache);
10581                    __cache.set(__slot, inner_size);
10582                    size
10583                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
10584                            + inner_size;
10585                }
10586                if self.asks.is_set() {
10587                    let __slot = __cache.reserve();
10588                    let inner_size = self.asks.compute_size(__cache);
10589                    __cache.set(__slot, inner_size);
10590                    size
10591                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
10592                            + inner_size;
10593                }
10594                if self.updates_in_bucket != 0u32 {
10595                    size
10596                        += 1u32
10597                            + ::buffa::types::uint32_encoded_len(self.updates_in_bucket)
10598                                as u32;
10599                }
10600                if self.book_seq_start != 0u64 {
10601                    size
10602                        += 1u32
10603                            + ::buffa::types::uint64_encoded_len(self.book_seq_start)
10604                                as u32;
10605                }
10606                if self.book_seq_end != 0u64 {
10607                    size
10608                        += 1u32
10609                            + ::buffa::types::uint64_encoded_len(self.book_seq_end)
10610                                as u32;
10611                }
10612                size += self.__buffa_unknown_fields.encoded_len() as u32;
10613                size
10614            }
10615            #[allow(clippy::needless_borrow)]
10616            fn write_to(
10617                &self,
10618                __cache: &mut ::buffa::SizeCache,
10619                buf: &mut impl ::buffa::bytes::BufMut,
10620            ) {
10621                #[allow(unused_imports)]
10622                use ::buffa::Enumeration as _;
10623                if self.ts_sec != 0u64 {
10624                    ::buffa::types::put_uint64_field(1u32, self.ts_sec, buf);
10625                }
10626                if self.bids.is_set() {
10627                    ::buffa::types::put_len_delimited_header(
10628                        2u32,
10629                        __cache.consume_next(),
10630                        buf,
10631                    );
10632                    self.bids.write_to(__cache, buf);
10633                }
10634                if self.asks.is_set() {
10635                    ::buffa::types::put_len_delimited_header(
10636                        3u32,
10637                        __cache.consume_next(),
10638                        buf,
10639                    );
10640                    self.asks.write_to(__cache, buf);
10641                }
10642                if self.updates_in_bucket != 0u32 {
10643                    ::buffa::types::put_uint32_field(4u32, self.updates_in_bucket, buf);
10644                }
10645                if self.book_seq_start != 0u64 {
10646                    ::buffa::types::put_uint64_field(5u32, self.book_seq_start, buf);
10647                }
10648                if self.book_seq_end != 0u64 {
10649                    ::buffa::types::put_uint64_field(6u32, self.book_seq_end, buf);
10650                }
10651                self.__buffa_unknown_fields.write_to(buf);
10652            }
10653        }
10654        /// Serializes this view as protobuf JSON.
10655        ///
10656        /// Implicit-presence fields with default values are omitted, `required`
10657        /// fields are always emitted, explicit-presence (`optional`) fields are
10658        /// emitted only when set, bytes fields are base64-encoded, and enum
10659        /// values are their proto name strings.
10660        ///
10661        /// This impl uses `serialize_map(None)` because the number of emitted
10662        /// fields depends on default-omission rules; serializers that require
10663        /// known map lengths (e.g. `bincode`) will return a runtime error.
10664        /// Use the owned message type for those formats.
10665        impl<'__a> ::serde::Serialize for HeatmapDeltaBucketView<'__a> {
10666            fn serialize<__S: ::serde::Serializer>(
10667                &self,
10668                __s: __S,
10669            ) -> ::core::result::Result<__S::Ok, __S::Error> {
10670                use ::serde::ser::SerializeMap as _;
10671                let mut __map = __s.serialize_map(::core::option::Option::None)?;
10672                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_sec) {
10673                    __map
10674                        .serialize_entry(
10675                            "tsSec",
10676                            &::buffa::json_helpers::ProtoJson(&self.ts_sec),
10677                        )?;
10678                }
10679                {
10680                    if let ::core::option::Option::Some(__v) = self.bids.as_option() {
10681                        __map.serialize_entry("bids", __v)?;
10682                    }
10683                }
10684                {
10685                    if let ::core::option::Option::Some(__v) = self.asks.as_option() {
10686                        __map.serialize_entry("asks", __v)?;
10687                    }
10688                }
10689                if !::buffa::json_helpers::skip_if::is_zero_u32(
10690                    &self.updates_in_bucket,
10691                ) {
10692                    __map
10693                        .serialize_entry(
10694                            "updatesInBucket",
10695                            &::buffa::json_helpers::ProtoJson(&self.updates_in_bucket),
10696                        )?;
10697                }
10698                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.book_seq_start) {
10699                    __map
10700                        .serialize_entry(
10701                            "bookSeqStart",
10702                            &::buffa::json_helpers::ProtoJson(&self.book_seq_start),
10703                        )?;
10704                }
10705                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.book_seq_end) {
10706                    __map
10707                        .serialize_entry(
10708                            "bookSeqEnd",
10709                            &::buffa::json_helpers::ProtoJson(&self.book_seq_end),
10710                        )?;
10711                }
10712                __map.end()
10713            }
10714        }
10715        impl<'a> ::buffa::MessageName for HeatmapDeltaBucketView<'a> {
10716            const PACKAGE: &'static str = "marketdata.v1";
10717            const NAME: &'static str = "HeatmapDeltaBucket";
10718            const FULL_NAME: &'static str = "marketdata.v1.HeatmapDeltaBucket";
10719            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.HeatmapDeltaBucket";
10720        }
10721        ::buffa::impl_default_view_instance!(HeatmapDeltaBucketView);
10722        ::buffa::impl_view_reborrow!(HeatmapDeltaBucketView);
10723        /** Self-contained, `'static` owned view of a `HeatmapDeltaBucket` message.
10724
10725 Wraps [`::buffa::OwnedView`]`<`[`HeatmapDeltaBucketView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
10726
10727 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`HeatmapDeltaBucketView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
10728        #[derive(Clone, Debug)]
10729        pub struct HeatmapDeltaBucketOwnedView(
10730            ::buffa::OwnedView<HeatmapDeltaBucketView<'static>>,
10731        );
10732        impl HeatmapDeltaBucketOwnedView {
10733            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
10734            ///
10735            /// The view borrows directly from the buffer's data; the buffer is
10736            /// retained inside the returned handle.
10737            ///
10738            /// # Errors
10739            ///
10740            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
10741            /// protobuf data.
10742            pub fn decode(
10743                bytes: ::buffa::bytes::Bytes,
10744            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10745                ::core::result::Result::Ok(
10746                    HeatmapDeltaBucketOwnedView(::buffa::OwnedView::decode(bytes)?),
10747                )
10748            }
10749            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
10750            /// max message size).
10751            ///
10752            /// # Errors
10753            ///
10754            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
10755            /// exceeds the configured limits.
10756            pub fn decode_with_options(
10757                bytes: ::buffa::bytes::Bytes,
10758                opts: &::buffa::DecodeOptions,
10759            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10760                ::core::result::Result::Ok(
10761                    HeatmapDeltaBucketOwnedView(
10762                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
10763                    ),
10764                )
10765            }
10766            /// Build from an owned message via an encode → decode round-trip.
10767            ///
10768            /// # Errors
10769            ///
10770            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
10771            /// somehow invalid (should not happen for well-formed messages).
10772            pub fn from_owned(
10773                msg: &super::super::HeatmapDeltaBucket,
10774            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10775                ::core::result::Result::Ok(
10776                    HeatmapDeltaBucketOwnedView(::buffa::OwnedView::from_owned(msg)?),
10777                )
10778            }
10779            /// Borrow the full [`HeatmapDeltaBucketView`] with its lifetime tied to `&self`.
10780            #[must_use]
10781            pub fn view(&self) -> &HeatmapDeltaBucketView<'_> {
10782                self.0.reborrow()
10783            }
10784            /// Convert to the owned message type.
10785            ///
10786            /// # Errors
10787            ///
10788            /// Returns an error if re-materializing preserved unknown fields
10789            /// fails (e.g. the unknown-field limit is exceeded).
10790            pub fn to_owned_message(
10791                &self,
10792            ) -> ::core::result::Result<
10793                super::super::HeatmapDeltaBucket,
10794                ::buffa::DecodeError,
10795            > {
10796                self.0.to_owned_message()
10797            }
10798            /// The underlying bytes buffer.
10799            #[must_use]
10800            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
10801                self.0.bytes()
10802            }
10803            /// Consume the handle, returning the underlying bytes buffer.
10804            #[must_use]
10805            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
10806                self.0.into_bytes()
10807            }
10808            /// Bucket start timestamp (seconds since epoch, UTC), aligned to `interval`.
10809            ///
10810            /// Field 1: `ts_sec`
10811            #[must_use]
10812            pub fn ts_sec(&self) -> u64 {
10813                self.0.reborrow().ts_sec
10814            }
10815            /// Sparse bid-side level changes in this bucket.
10816            ///
10817            /// Field 2: `bids`
10818            #[must_use]
10819            pub fn bids(
10820                &self,
10821            ) -> &::buffa::MessageFieldView<
10822                super::super::__buffa::view::HeatmapDeltaLevelsView<'_>,
10823            > {
10824                &self.0.reborrow().bids
10825            }
10826            /// Sparse ask-side level changes in this bucket.
10827            ///
10828            /// Field 3: `asks`
10829            #[must_use]
10830            pub fn asks(
10831                &self,
10832            ) -> &::buffa::MessageFieldView<
10833                super::super::__buffa::view::HeatmapDeltaLevelsView<'_>,
10834            > {
10835                &self.0.reborrow().asks
10836            }
10837            /// Number of upstream L2 updates aggregated into this interval bucket.
10838            ///
10839            /// Field 4: `updates_in_bucket`
10840            #[must_use]
10841            pub fn updates_in_bucket(&self) -> u32 {
10842                self.0.reborrow().updates_in_bucket
10843            }
10844            /// Earliest monotonic order book sequence represented by this bucket.
10845            ///
10846            /// Field 5: `book_seq_start`
10847            #[must_use]
10848            pub fn book_seq_start(&self) -> u64 {
10849                self.0.reborrow().book_seq_start
10850            }
10851            /// Latest monotonic order book sequence represented by this bucket.
10852            ///
10853            /// Field 6: `book_seq_end`
10854            #[must_use]
10855            pub fn book_seq_end(&self) -> u64 {
10856                self.0.reborrow().book_seq_end
10857            }
10858        }
10859        impl ::core::convert::From<::buffa::OwnedView<HeatmapDeltaBucketView<'static>>>
10860        for HeatmapDeltaBucketOwnedView {
10861            fn from(inner: ::buffa::OwnedView<HeatmapDeltaBucketView<'static>>) -> Self {
10862                HeatmapDeltaBucketOwnedView(inner)
10863            }
10864        }
10865        impl ::core::convert::From<HeatmapDeltaBucketOwnedView>
10866        for ::buffa::OwnedView<HeatmapDeltaBucketView<'static>> {
10867            fn from(wrapper: HeatmapDeltaBucketOwnedView) -> Self {
10868                wrapper.0
10869            }
10870        }
10871        impl ::core::convert::AsRef<::buffa::OwnedView<HeatmapDeltaBucketView<'static>>>
10872        for HeatmapDeltaBucketOwnedView {
10873            fn as_ref(&self) -> &::buffa::OwnedView<HeatmapDeltaBucketView<'static>> {
10874                &self.0
10875            }
10876        }
10877        impl ::buffa::HasMessageView for super::super::HeatmapDeltaBucket {
10878            type View<'a> = HeatmapDeltaBucketView<'a>;
10879            type ViewHandle = HeatmapDeltaBucketOwnedView;
10880        }
10881        impl ::serde::Serialize for HeatmapDeltaBucketOwnedView {
10882            fn serialize<__S: ::serde::Serializer>(
10883                &self,
10884                __s: __S,
10885            ) -> ::core::result::Result<__S::Ok, __S::Error> {
10886                ::serde::Serialize::serialize(&self.0, __s)
10887            }
10888        }
10889        /// HeatmapLiveBucket is the canonical live payload for real-time heatmap updates.
10890        /// It represents the latest state of one bucket (open or finalized).
10891        #[derive(Clone, Debug, Default)]
10892        pub struct HeatmapLiveBucketView<'a> {
10893            /// Numeric spot market identifier.
10894            ///
10895            /// Field 1: `symbol_id`
10896            pub symbol_id: u32,
10897            /// Bucket interval for this payload.
10898            ///
10899            /// Field 2: `interval`
10900            pub interval: ::buffa::EnumValue<super::super::HeatmapInterval>,
10901            /// Bucket start timestamp (seconds since epoch, UTC), aligned to `interval`.
10902            ///
10903            /// Field 3: `ts_sec`
10904            pub ts_sec: u64,
10905            /// True when this bucket is finalized; false for provisional updates to an
10906            /// open bucket.
10907            ///
10908            /// Field 4: `is_final`
10909            pub is_final: bool,
10910            /// Sparse bid-side level changes represented by this bucket.
10911            ///
10912            /// Field 5: `bids`
10913            pub bids: ::buffa::MessageFieldView<
10914                super::super::__buffa::view::HeatmapDeltaLevelsView<'a>,
10915            >,
10916            /// Sparse ask-side level changes represented by this bucket.
10917            ///
10918            /// Field 6: `asks`
10919            pub asks: ::buffa::MessageFieldView<
10920                super::super::__buffa::view::HeatmapDeltaLevelsView<'a>,
10921            >,
10922            /// Number of upstream L2 updates aggregated into this interval bucket.
10923            ///
10924            /// Field 7: `updates_in_bucket`
10925            pub updates_in_bucket: u32,
10926            /// Earliest monotonic order book sequence represented by this bucket.
10927            ///
10928            /// Field 8: `book_seq_start`
10929            pub book_seq_start: u64,
10930            /// Latest monotonic order book sequence represented by this bucket.
10931            ///
10932            /// Field 9: `book_seq_end`
10933            pub book_seq_end: u64,
10934            /// Quantity semantics for qty_scaled in bids and asks.
10935            ///
10936            /// Field 10: `quantity_mode`
10937            pub quantity_mode: ::buffa::EnumValue<super::super::HeatmapQuantityMode>,
10938            /// Effective bin stride for this symbol as a price delta in 1e-6 quote-unit
10939            /// ticks.
10940            ///
10941            /// Field 11: `effective_bin_ticks`
10942            pub effective_bin_ticks: u64,
10943            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
10944        }
10945        impl<'a> ::buffa::MessageView<'a> for HeatmapLiveBucketView<'a> {
10946            type Owned = super::super::HeatmapLiveBucket;
10947            fn decode_view(
10948                buf: &'a [u8],
10949            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10950                let __limit = ::core::cell::Cell::new(
10951                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
10952                );
10953                <Self as ::buffa::MessageView>::decode_view_ctx(
10954                    buf,
10955                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
10956                )
10957            }
10958            fn decode_view_with_ctx(
10959                buf: &'a [u8],
10960                ctx: ::buffa::DecodeContext<'_>,
10961            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
10962                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
10963            }
10964            fn merge_view_field(
10965                &mut self,
10966                tag: ::buffa::encoding::Tag,
10967                cur: &'a [u8],
10968                before_tag: &'a [u8],
10969                ctx: ::buffa::DecodeContext<'_>,
10970            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
10971                let _ = ctx;
10972                #[allow(unused_variables)]
10973                let view = self;
10974                let mut cur = cur;
10975                match tag.field_number() {
10976                    1u32 => {
10977                        ::buffa::encoding::check_wire_type(
10978                            tag,
10979                            ::buffa::encoding::WireType::Varint,
10980                        )?;
10981                        view.symbol_id = ::buffa::types::decode_uint32(&mut cur)?;
10982                    }
10983                    2u32 => {
10984                        ::buffa::encoding::check_wire_type(
10985                            tag,
10986                            ::buffa::encoding::WireType::Varint,
10987                        )?;
10988                        view.interval = ::buffa::EnumValue::from(
10989                            ::buffa::types::decode_int32(&mut cur)?,
10990                        );
10991                    }
10992                    3u32 => {
10993                        ::buffa::encoding::check_wire_type(
10994                            tag,
10995                            ::buffa::encoding::WireType::Varint,
10996                        )?;
10997                        view.ts_sec = ::buffa::types::decode_uint64(&mut cur)?;
10998                    }
10999                    4u32 => {
11000                        ::buffa::encoding::check_wire_type(
11001                            tag,
11002                            ::buffa::encoding::WireType::Varint,
11003                        )?;
11004                        view.is_final = ::buffa::types::decode_bool(&mut cur)?;
11005                    }
11006                    5u32 => {
11007                        ::buffa::encoding::check_wire_type(
11008                            tag,
11009                            ::buffa::encoding::WireType::LengthDelimited,
11010                        )?;
11011                        let __sub_ctx = ctx.descend()?;
11012                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
11013                        match view.bids.as_mut() {
11014                            Some(existing) => {
11015                                ::buffa::MessageView::merge_into_view(
11016                                    existing,
11017                                    sub,
11018                                    __sub_ctx,
11019                                )?
11020                            }
11021                            None => {
11022                                view.bids = ::buffa::MessageFieldView::set(
11023                                    <super::super::__buffa::view::HeatmapDeltaLevelsView as ::buffa::MessageView>::decode_view_ctx(
11024                                        sub,
11025                                        __sub_ctx,
11026                                    )?,
11027                                );
11028                            }
11029                        }
11030                    }
11031                    6u32 => {
11032                        ::buffa::encoding::check_wire_type(
11033                            tag,
11034                            ::buffa::encoding::WireType::LengthDelimited,
11035                        )?;
11036                        let __sub_ctx = ctx.descend()?;
11037                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
11038                        match view.asks.as_mut() {
11039                            Some(existing) => {
11040                                ::buffa::MessageView::merge_into_view(
11041                                    existing,
11042                                    sub,
11043                                    __sub_ctx,
11044                                )?
11045                            }
11046                            None => {
11047                                view.asks = ::buffa::MessageFieldView::set(
11048                                    <super::super::__buffa::view::HeatmapDeltaLevelsView as ::buffa::MessageView>::decode_view_ctx(
11049                                        sub,
11050                                        __sub_ctx,
11051                                    )?,
11052                                );
11053                            }
11054                        }
11055                    }
11056                    7u32 => {
11057                        ::buffa::encoding::check_wire_type(
11058                            tag,
11059                            ::buffa::encoding::WireType::Varint,
11060                        )?;
11061                        view.updates_in_bucket = ::buffa::types::decode_uint32(
11062                            &mut cur,
11063                        )?;
11064                    }
11065                    8u32 => {
11066                        ::buffa::encoding::check_wire_type(
11067                            tag,
11068                            ::buffa::encoding::WireType::Varint,
11069                        )?;
11070                        view.book_seq_start = ::buffa::types::decode_uint64(&mut cur)?;
11071                    }
11072                    9u32 => {
11073                        ::buffa::encoding::check_wire_type(
11074                            tag,
11075                            ::buffa::encoding::WireType::Varint,
11076                        )?;
11077                        view.book_seq_end = ::buffa::types::decode_uint64(&mut cur)?;
11078                    }
11079                    10u32 => {
11080                        ::buffa::encoding::check_wire_type(
11081                            tag,
11082                            ::buffa::encoding::WireType::Varint,
11083                        )?;
11084                        view.quantity_mode = ::buffa::EnumValue::from(
11085                            ::buffa::types::decode_int32(&mut cur)?,
11086                        );
11087                    }
11088                    11u32 => {
11089                        ::buffa::encoding::check_wire_type(
11090                            tag,
11091                            ::buffa::encoding::WireType::Varint,
11092                        )?;
11093                        view.effective_bin_ticks = ::buffa::types::decode_uint64(
11094                            &mut cur,
11095                        )?;
11096                    }
11097                    _ => {
11098                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
11099                        let span_len = before_tag.len() - cur.len();
11100                        view.__buffa_unknown_fields
11101                            .push_record(before_tag, span_len, ctx)?;
11102                    }
11103                }
11104                ::core::result::Result::Ok(cur)
11105            }
11106            fn to_owned_message(
11107                &self,
11108            ) -> ::core::result::Result<
11109                super::super::HeatmapLiveBucket,
11110                ::buffa::DecodeError,
11111            > {
11112                self.to_owned_from_source(None)
11113            }
11114            #[allow(clippy::useless_conversion, clippy::needless_update)]
11115            fn to_owned_from_source(
11116                &self,
11117                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
11118            ) -> ::core::result::Result<
11119                super::super::HeatmapLiveBucket,
11120                ::buffa::DecodeError,
11121            > {
11122                #[allow(unused_imports)]
11123                use ::buffa::alloc::string::ToString as _;
11124                let _ = __buffa_src;
11125                ::core::result::Result::Ok(super::super::HeatmapLiveBucket {
11126                    symbol_id: self.symbol_id,
11127                    interval: self.interval,
11128                    ts_sec: self.ts_sec,
11129                    is_final: self.is_final,
11130                    bids: match self.bids.as_option() {
11131                        Some(v) => {
11132                            ::buffa::MessageField::<
11133                                super::super::HeatmapDeltaLevels,
11134                            >::some(v.to_owned_from_source(__buffa_src)?)
11135                        }
11136                        None => ::buffa::MessageField::none(),
11137                    },
11138                    asks: match self.asks.as_option() {
11139                        Some(v) => {
11140                            ::buffa::MessageField::<
11141                                super::super::HeatmapDeltaLevels,
11142                            >::some(v.to_owned_from_source(__buffa_src)?)
11143                        }
11144                        None => ::buffa::MessageField::none(),
11145                    },
11146                    updates_in_bucket: self.updates_in_bucket,
11147                    book_seq_start: self.book_seq_start,
11148                    book_seq_end: self.book_seq_end,
11149                    quantity_mode: self.quantity_mode,
11150                    effective_bin_ticks: self.effective_bin_ticks,
11151                    __buffa_unknown_fields: self
11152                        .__buffa_unknown_fields
11153                        .to_owned()?
11154                        .into(),
11155                    ..::core::default::Default::default()
11156                })
11157            }
11158        }
11159        impl<'a> ::buffa::ViewEncode<'a> for HeatmapLiveBucketView<'a> {
11160            #[allow(clippy::needless_borrow, clippy::let_and_return)]
11161            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
11162                #[allow(unused_imports)]
11163                use ::buffa::Enumeration as _;
11164                let mut size = 0u32;
11165                if self.symbol_id != 0u32 {
11166                    size
11167                        += 1u32
11168                            + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
11169                }
11170                {
11171                    let val = self.interval.to_i32();
11172                    if val != 0 {
11173                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
11174                    }
11175                }
11176                if self.ts_sec != 0u64 {
11177                    size
11178                        += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_sec) as u32;
11179                }
11180                if self.is_final {
11181                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
11182                }
11183                if self.bids.is_set() {
11184                    let __slot = __cache.reserve();
11185                    let inner_size = self.bids.compute_size(__cache);
11186                    __cache.set(__slot, inner_size);
11187                    size
11188                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
11189                            + inner_size;
11190                }
11191                if self.asks.is_set() {
11192                    let __slot = __cache.reserve();
11193                    let inner_size = self.asks.compute_size(__cache);
11194                    __cache.set(__slot, inner_size);
11195                    size
11196                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
11197                            + inner_size;
11198                }
11199                if self.updates_in_bucket != 0u32 {
11200                    size
11201                        += 1u32
11202                            + ::buffa::types::uint32_encoded_len(self.updates_in_bucket)
11203                                as u32;
11204                }
11205                if self.book_seq_start != 0u64 {
11206                    size
11207                        += 1u32
11208                            + ::buffa::types::uint64_encoded_len(self.book_seq_start)
11209                                as u32;
11210                }
11211                if self.book_seq_end != 0u64 {
11212                    size
11213                        += 1u32
11214                            + ::buffa::types::uint64_encoded_len(self.book_seq_end)
11215                                as u32;
11216                }
11217                {
11218                    let val = self.quantity_mode.to_i32();
11219                    if val != 0 {
11220                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
11221                    }
11222                }
11223                if self.effective_bin_ticks != 0u64 {
11224                    size
11225                        += 1u32
11226                            + ::buffa::types::uint64_encoded_len(
11227                                self.effective_bin_ticks,
11228                            ) as u32;
11229                }
11230                size += self.__buffa_unknown_fields.encoded_len() as u32;
11231                size
11232            }
11233            #[allow(clippy::needless_borrow)]
11234            fn write_to(
11235                &self,
11236                __cache: &mut ::buffa::SizeCache,
11237                buf: &mut impl ::buffa::bytes::BufMut,
11238            ) {
11239                #[allow(unused_imports)]
11240                use ::buffa::Enumeration as _;
11241                if self.symbol_id != 0u32 {
11242                    ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
11243                }
11244                {
11245                    let val = self.interval.to_i32();
11246                    if val != 0 {
11247                        ::buffa::types::put_int32_field(2u32, val, buf);
11248                    }
11249                }
11250                if self.ts_sec != 0u64 {
11251                    ::buffa::types::put_uint64_field(3u32, self.ts_sec, buf);
11252                }
11253                if self.is_final {
11254                    ::buffa::types::put_bool_field(4u32, self.is_final, buf);
11255                }
11256                if self.bids.is_set() {
11257                    ::buffa::types::put_len_delimited_header(
11258                        5u32,
11259                        __cache.consume_next(),
11260                        buf,
11261                    );
11262                    self.bids.write_to(__cache, buf);
11263                }
11264                if self.asks.is_set() {
11265                    ::buffa::types::put_len_delimited_header(
11266                        6u32,
11267                        __cache.consume_next(),
11268                        buf,
11269                    );
11270                    self.asks.write_to(__cache, buf);
11271                }
11272                if self.updates_in_bucket != 0u32 {
11273                    ::buffa::types::put_uint32_field(7u32, self.updates_in_bucket, buf);
11274                }
11275                if self.book_seq_start != 0u64 {
11276                    ::buffa::types::put_uint64_field(8u32, self.book_seq_start, buf);
11277                }
11278                if self.book_seq_end != 0u64 {
11279                    ::buffa::types::put_uint64_field(9u32, self.book_seq_end, buf);
11280                }
11281                {
11282                    let val = self.quantity_mode.to_i32();
11283                    if val != 0 {
11284                        ::buffa::types::put_int32_field(10u32, val, buf);
11285                    }
11286                }
11287                if self.effective_bin_ticks != 0u64 {
11288                    ::buffa::types::put_uint64_field(
11289                        11u32,
11290                        self.effective_bin_ticks,
11291                        buf,
11292                    );
11293                }
11294                self.__buffa_unknown_fields.write_to(buf);
11295            }
11296        }
11297        /// Serializes this view as protobuf JSON.
11298        ///
11299        /// Implicit-presence fields with default values are omitted, `required`
11300        /// fields are always emitted, explicit-presence (`optional`) fields are
11301        /// emitted only when set, bytes fields are base64-encoded, and enum
11302        /// values are their proto name strings.
11303        ///
11304        /// This impl uses `serialize_map(None)` because the number of emitted
11305        /// fields depends on default-omission rules; serializers that require
11306        /// known map lengths (e.g. `bincode`) will return a runtime error.
11307        /// Use the owned message type for those formats.
11308        impl<'__a> ::serde::Serialize for HeatmapLiveBucketView<'__a> {
11309            fn serialize<__S: ::serde::Serializer>(
11310                &self,
11311                __s: __S,
11312            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11313                use ::serde::ser::SerializeMap as _;
11314                let mut __map = __s.serialize_map(::core::option::Option::None)?;
11315                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.symbol_id) {
11316                    __map
11317                        .serialize_entry(
11318                            "symbolId",
11319                            &::buffa::json_helpers::ProtoJson(&self.symbol_id),
11320                        )?;
11321                }
11322                if !::buffa::json_helpers::skip_if::is_default_enum_value(
11323                    &self.interval,
11324                ) {
11325                    __map.serialize_entry("interval", &self.interval)?;
11326                }
11327                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_sec) {
11328                    __map
11329                        .serialize_entry(
11330                            "tsSec",
11331                            &::buffa::json_helpers::ProtoJson(&self.ts_sec),
11332                        )?;
11333                }
11334                if self.is_final {
11335                    __map.serialize_entry("isFinal", &self.is_final)?;
11336                }
11337                {
11338                    if let ::core::option::Option::Some(__v) = self.bids.as_option() {
11339                        __map.serialize_entry("bids", __v)?;
11340                    }
11341                }
11342                {
11343                    if let ::core::option::Option::Some(__v) = self.asks.as_option() {
11344                        __map.serialize_entry("asks", __v)?;
11345                    }
11346                }
11347                if !::buffa::json_helpers::skip_if::is_zero_u32(
11348                    &self.updates_in_bucket,
11349                ) {
11350                    __map
11351                        .serialize_entry(
11352                            "updatesInBucket",
11353                            &::buffa::json_helpers::ProtoJson(&self.updates_in_bucket),
11354                        )?;
11355                }
11356                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.book_seq_start) {
11357                    __map
11358                        .serialize_entry(
11359                            "bookSeqStart",
11360                            &::buffa::json_helpers::ProtoJson(&self.book_seq_start),
11361                        )?;
11362                }
11363                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.book_seq_end) {
11364                    __map
11365                        .serialize_entry(
11366                            "bookSeqEnd",
11367                            &::buffa::json_helpers::ProtoJson(&self.book_seq_end),
11368                        )?;
11369                }
11370                if !::buffa::json_helpers::skip_if::is_default_enum_value(
11371                    &self.quantity_mode,
11372                ) {
11373                    __map.serialize_entry("quantityMode", &self.quantity_mode)?;
11374                }
11375                if !::buffa::json_helpers::skip_if::is_zero_u64(
11376                    &self.effective_bin_ticks,
11377                ) {
11378                    __map
11379                        .serialize_entry(
11380                            "effectiveBinTicks",
11381                            &::buffa::json_helpers::ProtoJson(&self.effective_bin_ticks),
11382                        )?;
11383                }
11384                __map.end()
11385            }
11386        }
11387        impl<'a> ::buffa::MessageName for HeatmapLiveBucketView<'a> {
11388            const PACKAGE: &'static str = "marketdata.v1";
11389            const NAME: &'static str = "HeatmapLiveBucket";
11390            const FULL_NAME: &'static str = "marketdata.v1.HeatmapLiveBucket";
11391            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.HeatmapLiveBucket";
11392        }
11393        ::buffa::impl_default_view_instance!(HeatmapLiveBucketView);
11394        ::buffa::impl_view_reborrow!(HeatmapLiveBucketView);
11395        /** Self-contained, `'static` owned view of a `HeatmapLiveBucket` message.
11396
11397 Wraps [`::buffa::OwnedView`]`<`[`HeatmapLiveBucketView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
11398
11399 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`HeatmapLiveBucketView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
11400        #[derive(Clone, Debug)]
11401        pub struct HeatmapLiveBucketOwnedView(
11402            ::buffa::OwnedView<HeatmapLiveBucketView<'static>>,
11403        );
11404        impl HeatmapLiveBucketOwnedView {
11405            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
11406            ///
11407            /// The view borrows directly from the buffer's data; the buffer is
11408            /// retained inside the returned handle.
11409            ///
11410            /// # Errors
11411            ///
11412            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
11413            /// protobuf data.
11414            pub fn decode(
11415                bytes: ::buffa::bytes::Bytes,
11416            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11417                ::core::result::Result::Ok(
11418                    HeatmapLiveBucketOwnedView(::buffa::OwnedView::decode(bytes)?),
11419                )
11420            }
11421            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
11422            /// max message size).
11423            ///
11424            /// # Errors
11425            ///
11426            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
11427            /// exceeds the configured limits.
11428            pub fn decode_with_options(
11429                bytes: ::buffa::bytes::Bytes,
11430                opts: &::buffa::DecodeOptions,
11431            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11432                ::core::result::Result::Ok(
11433                    HeatmapLiveBucketOwnedView(
11434                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
11435                    ),
11436                )
11437            }
11438            /// Build from an owned message via an encode → decode round-trip.
11439            ///
11440            /// # Errors
11441            ///
11442            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
11443            /// somehow invalid (should not happen for well-formed messages).
11444            pub fn from_owned(
11445                msg: &super::super::HeatmapLiveBucket,
11446            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11447                ::core::result::Result::Ok(
11448                    HeatmapLiveBucketOwnedView(::buffa::OwnedView::from_owned(msg)?),
11449                )
11450            }
11451            /// Borrow the full [`HeatmapLiveBucketView`] with its lifetime tied to `&self`.
11452            #[must_use]
11453            pub fn view(&self) -> &HeatmapLiveBucketView<'_> {
11454                self.0.reborrow()
11455            }
11456            /// Convert to the owned message type.
11457            ///
11458            /// # Errors
11459            ///
11460            /// Returns an error if re-materializing preserved unknown fields
11461            /// fails (e.g. the unknown-field limit is exceeded).
11462            pub fn to_owned_message(
11463                &self,
11464            ) -> ::core::result::Result<
11465                super::super::HeatmapLiveBucket,
11466                ::buffa::DecodeError,
11467            > {
11468                self.0.to_owned_message()
11469            }
11470            /// The underlying bytes buffer.
11471            #[must_use]
11472            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
11473                self.0.bytes()
11474            }
11475            /// Consume the handle, returning the underlying bytes buffer.
11476            #[must_use]
11477            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
11478                self.0.into_bytes()
11479            }
11480            /// Numeric spot market identifier.
11481            ///
11482            /// Field 1: `symbol_id`
11483            #[must_use]
11484            pub fn symbol_id(&self) -> u32 {
11485                self.0.reborrow().symbol_id
11486            }
11487            /// Bucket interval for this payload.
11488            ///
11489            /// Field 2: `interval`
11490            #[must_use]
11491            pub fn interval(&self) -> ::buffa::EnumValue<super::super::HeatmapInterval> {
11492                self.0.reborrow().interval
11493            }
11494            /// Bucket start timestamp (seconds since epoch, UTC), aligned to `interval`.
11495            ///
11496            /// Field 3: `ts_sec`
11497            #[must_use]
11498            pub fn ts_sec(&self) -> u64 {
11499                self.0.reborrow().ts_sec
11500            }
11501            /// True when this bucket is finalized; false for provisional updates to an
11502            /// open bucket.
11503            ///
11504            /// Field 4: `is_final`
11505            #[must_use]
11506            pub fn is_final(&self) -> bool {
11507                self.0.reborrow().is_final
11508            }
11509            /// Sparse bid-side level changes represented by this bucket.
11510            ///
11511            /// Field 5: `bids`
11512            #[must_use]
11513            pub fn bids(
11514                &self,
11515            ) -> &::buffa::MessageFieldView<
11516                super::super::__buffa::view::HeatmapDeltaLevelsView<'_>,
11517            > {
11518                &self.0.reborrow().bids
11519            }
11520            /// Sparse ask-side level changes represented by this bucket.
11521            ///
11522            /// Field 6: `asks`
11523            #[must_use]
11524            pub fn asks(
11525                &self,
11526            ) -> &::buffa::MessageFieldView<
11527                super::super::__buffa::view::HeatmapDeltaLevelsView<'_>,
11528            > {
11529                &self.0.reborrow().asks
11530            }
11531            /// Number of upstream L2 updates aggregated into this interval bucket.
11532            ///
11533            /// Field 7: `updates_in_bucket`
11534            #[must_use]
11535            pub fn updates_in_bucket(&self) -> u32 {
11536                self.0.reborrow().updates_in_bucket
11537            }
11538            /// Earliest monotonic order book sequence represented by this bucket.
11539            ///
11540            /// Field 8: `book_seq_start`
11541            #[must_use]
11542            pub fn book_seq_start(&self) -> u64 {
11543                self.0.reborrow().book_seq_start
11544            }
11545            /// Latest monotonic order book sequence represented by this bucket.
11546            ///
11547            /// Field 9: `book_seq_end`
11548            #[must_use]
11549            pub fn book_seq_end(&self) -> u64 {
11550                self.0.reborrow().book_seq_end
11551            }
11552            /// Quantity semantics for qty_scaled in bids and asks.
11553            ///
11554            /// Field 10: `quantity_mode`
11555            #[must_use]
11556            pub fn quantity_mode(
11557                &self,
11558            ) -> ::buffa::EnumValue<super::super::HeatmapQuantityMode> {
11559                self.0.reborrow().quantity_mode
11560            }
11561            /// Effective bin stride for this symbol as a price delta in 1e-6 quote-unit
11562            /// ticks.
11563            ///
11564            /// Field 11: `effective_bin_ticks`
11565            #[must_use]
11566            pub fn effective_bin_ticks(&self) -> u64 {
11567                self.0.reborrow().effective_bin_ticks
11568            }
11569        }
11570        impl ::core::convert::From<::buffa::OwnedView<HeatmapLiveBucketView<'static>>>
11571        for HeatmapLiveBucketOwnedView {
11572            fn from(inner: ::buffa::OwnedView<HeatmapLiveBucketView<'static>>) -> Self {
11573                HeatmapLiveBucketOwnedView(inner)
11574            }
11575        }
11576        impl ::core::convert::From<HeatmapLiveBucketOwnedView>
11577        for ::buffa::OwnedView<HeatmapLiveBucketView<'static>> {
11578            fn from(wrapper: HeatmapLiveBucketOwnedView) -> Self {
11579                wrapper.0
11580            }
11581        }
11582        impl ::core::convert::AsRef<::buffa::OwnedView<HeatmapLiveBucketView<'static>>>
11583        for HeatmapLiveBucketOwnedView {
11584            fn as_ref(&self) -> &::buffa::OwnedView<HeatmapLiveBucketView<'static>> {
11585                &self.0
11586            }
11587        }
11588        impl ::buffa::HasMessageView for super::super::HeatmapLiveBucket {
11589            type View<'a> = HeatmapLiveBucketView<'a>;
11590            type ViewHandle = HeatmapLiveBucketOwnedView;
11591        }
11592        impl ::serde::Serialize for HeatmapLiveBucketOwnedView {
11593            fn serialize<__S: ::serde::Serializer>(
11594                &self,
11595                __s: __S,
11596            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11597                ::serde::Serialize::serialize(&self.0, __s)
11598            }
11599        }
11600        /// HeatmapDeltaChain is the historical payload for all intervals.
11601        /// Reconstruct by applying deltas over base_keyframe.
11602        /// Deltas are ordered oldest-first by ts_sec.
11603        #[derive(Clone, Debug, Default)]
11604        pub struct HeatmapDeltaChainView<'a> {
11605            /// Full-book snapshot from which to apply the returned deltas.
11606            ///
11607            /// Field 1: `base_keyframe`
11608            pub base_keyframe: ::buffa::MessageFieldView<
11609                super::super::__buffa::view::HeatmapKeyframeView<'a>,
11610            >,
11611            /// Sparse update buckets ordered oldest-first by timestamp.
11612            ///
11613            /// Field 2: `deltas`
11614            pub deltas: ::buffa::RepeatedView<
11615                'a,
11616                super::super::__buffa::view::HeatmapDeltaBucketView<'a>,
11617            >,
11618            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
11619        }
11620        impl<'a> ::buffa::MessageView<'a> for HeatmapDeltaChainView<'a> {
11621            type Owned = super::super::HeatmapDeltaChain;
11622            fn decode_view(
11623                buf: &'a [u8],
11624            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11625                let __limit = ::core::cell::Cell::new(
11626                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
11627                );
11628                <Self as ::buffa::MessageView>::decode_view_ctx(
11629                    buf,
11630                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
11631                )
11632            }
11633            fn decode_view_with_ctx(
11634                buf: &'a [u8],
11635                ctx: ::buffa::DecodeContext<'_>,
11636            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11637                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
11638            }
11639            fn merge_view_field(
11640                &mut self,
11641                tag: ::buffa::encoding::Tag,
11642                cur: &'a [u8],
11643                before_tag: &'a [u8],
11644                ctx: ::buffa::DecodeContext<'_>,
11645            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
11646                let _ = ctx;
11647                #[allow(unused_variables)]
11648                let view = self;
11649                let mut cur = cur;
11650                match tag.field_number() {
11651                    1u32 => {
11652                        ::buffa::encoding::check_wire_type(
11653                            tag,
11654                            ::buffa::encoding::WireType::LengthDelimited,
11655                        )?;
11656                        let __sub_ctx = ctx.descend()?;
11657                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
11658                        match view.base_keyframe.as_mut() {
11659                            Some(existing) => {
11660                                ::buffa::MessageView::merge_into_view(
11661                                    existing,
11662                                    sub,
11663                                    __sub_ctx,
11664                                )?
11665                            }
11666                            None => {
11667                                view.base_keyframe = ::buffa::MessageFieldView::set(
11668                                    <super::super::__buffa::view::HeatmapKeyframeView as ::buffa::MessageView>::decode_view_ctx(
11669                                        sub,
11670                                        __sub_ctx,
11671                                    )?,
11672                                );
11673                            }
11674                        }
11675                    }
11676                    2u32 => {
11677                        ::buffa::encoding::check_wire_type(
11678                            tag,
11679                            ::buffa::encoding::WireType::LengthDelimited,
11680                        )?;
11681                        let __sub_ctx = ctx.descend()?;
11682                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
11683                        view.deltas
11684                            .push(
11685                                <super::super::__buffa::view::HeatmapDeltaBucketView as ::buffa::MessageView>::decode_view_ctx(
11686                                    sub,
11687                                    __sub_ctx,
11688                                )?,
11689                            );
11690                    }
11691                    _ => {
11692                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
11693                        let span_len = before_tag.len() - cur.len();
11694                        view.__buffa_unknown_fields
11695                            .push_record(before_tag, span_len, ctx)?;
11696                    }
11697                }
11698                ::core::result::Result::Ok(cur)
11699            }
11700            fn to_owned_message(
11701                &self,
11702            ) -> ::core::result::Result<
11703                super::super::HeatmapDeltaChain,
11704                ::buffa::DecodeError,
11705            > {
11706                self.to_owned_from_source(None)
11707            }
11708            #[allow(clippy::useless_conversion, clippy::needless_update)]
11709            fn to_owned_from_source(
11710                &self,
11711                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
11712            ) -> ::core::result::Result<
11713                super::super::HeatmapDeltaChain,
11714                ::buffa::DecodeError,
11715            > {
11716                #[allow(unused_imports)]
11717                use ::buffa::alloc::string::ToString as _;
11718                let _ = __buffa_src;
11719                ::core::result::Result::Ok(super::super::HeatmapDeltaChain {
11720                    base_keyframe: match self.base_keyframe.as_option() {
11721                        Some(v) => {
11722                            ::buffa::MessageField::<
11723                                super::super::HeatmapKeyframe,
11724                            >::some(v.to_owned_from_source(__buffa_src)?)
11725                        }
11726                        None => ::buffa::MessageField::none(),
11727                    },
11728                    deltas: self
11729                        .deltas
11730                        .iter()
11731                        .map(|v| v.to_owned_from_source(__buffa_src))
11732                        .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
11733                    __buffa_unknown_fields: self
11734                        .__buffa_unknown_fields
11735                        .to_owned()?
11736                        .into(),
11737                    ..::core::default::Default::default()
11738                })
11739            }
11740        }
11741        impl<'a> ::buffa::ViewEncode<'a> for HeatmapDeltaChainView<'a> {
11742            #[allow(clippy::needless_borrow, clippy::let_and_return)]
11743            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
11744                #[allow(unused_imports)]
11745                use ::buffa::Enumeration as _;
11746                let mut size = 0u32;
11747                if self.base_keyframe.is_set() {
11748                    let __slot = __cache.reserve();
11749                    let inner_size = self.base_keyframe.compute_size(__cache);
11750                    __cache.set(__slot, inner_size);
11751                    size
11752                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
11753                            + inner_size;
11754                }
11755                for v in &self.deltas {
11756                    let __slot = __cache.reserve();
11757                    let inner_size = v.compute_size(__cache);
11758                    __cache.set(__slot, inner_size);
11759                    size
11760                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
11761                            + inner_size;
11762                }
11763                size += self.__buffa_unknown_fields.encoded_len() as u32;
11764                size
11765            }
11766            #[allow(clippy::needless_borrow)]
11767            fn write_to(
11768                &self,
11769                __cache: &mut ::buffa::SizeCache,
11770                buf: &mut impl ::buffa::bytes::BufMut,
11771            ) {
11772                #[allow(unused_imports)]
11773                use ::buffa::Enumeration as _;
11774                if self.base_keyframe.is_set() {
11775                    ::buffa::types::put_len_delimited_header(
11776                        1u32,
11777                        __cache.consume_next(),
11778                        buf,
11779                    );
11780                    self.base_keyframe.write_to(__cache, buf);
11781                }
11782                for v in &self.deltas {
11783                    ::buffa::types::put_len_delimited_header(
11784                        2u32,
11785                        __cache.consume_next(),
11786                        buf,
11787                    );
11788                    v.write_to(__cache, buf);
11789                }
11790                self.__buffa_unknown_fields.write_to(buf);
11791            }
11792        }
11793        /// Serializes this view as protobuf JSON.
11794        ///
11795        /// Implicit-presence fields with default values are omitted, `required`
11796        /// fields are always emitted, explicit-presence (`optional`) fields are
11797        /// emitted only when set, bytes fields are base64-encoded, and enum
11798        /// values are their proto name strings.
11799        ///
11800        /// This impl uses `serialize_map(None)` because the number of emitted
11801        /// fields depends on default-omission rules; serializers that require
11802        /// known map lengths (e.g. `bincode`) will return a runtime error.
11803        /// Use the owned message type for those formats.
11804        impl<'__a> ::serde::Serialize for HeatmapDeltaChainView<'__a> {
11805            fn serialize<__S: ::serde::Serializer>(
11806                &self,
11807                __s: __S,
11808            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11809                use ::serde::ser::SerializeMap as _;
11810                let mut __map = __s.serialize_map(::core::option::Option::None)?;
11811                {
11812                    if let ::core::option::Option::Some(__v) = self
11813                        .base_keyframe
11814                        .as_option()
11815                    {
11816                        __map.serialize_entry("baseKeyframe", __v)?;
11817                    }
11818                }
11819                if !self.deltas.is_empty() {
11820                    __map.serialize_entry("deltas", &*self.deltas)?;
11821                }
11822                __map.end()
11823            }
11824        }
11825        impl<'a> ::buffa::MessageName for HeatmapDeltaChainView<'a> {
11826            const PACKAGE: &'static str = "marketdata.v1";
11827            const NAME: &'static str = "HeatmapDeltaChain";
11828            const FULL_NAME: &'static str = "marketdata.v1.HeatmapDeltaChain";
11829            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.HeatmapDeltaChain";
11830        }
11831        ::buffa::impl_default_view_instance!(HeatmapDeltaChainView);
11832        ::buffa::impl_view_reborrow!(HeatmapDeltaChainView);
11833        /** Self-contained, `'static` owned view of a `HeatmapDeltaChain` message.
11834
11835 Wraps [`::buffa::OwnedView`]`<`[`HeatmapDeltaChainView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
11836
11837 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`HeatmapDeltaChainView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
11838        #[derive(Clone, Debug)]
11839        pub struct HeatmapDeltaChainOwnedView(
11840            ::buffa::OwnedView<HeatmapDeltaChainView<'static>>,
11841        );
11842        impl HeatmapDeltaChainOwnedView {
11843            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
11844            ///
11845            /// The view borrows directly from the buffer's data; the buffer is
11846            /// retained inside the returned handle.
11847            ///
11848            /// # Errors
11849            ///
11850            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
11851            /// protobuf data.
11852            pub fn decode(
11853                bytes: ::buffa::bytes::Bytes,
11854            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11855                ::core::result::Result::Ok(
11856                    HeatmapDeltaChainOwnedView(::buffa::OwnedView::decode(bytes)?),
11857                )
11858            }
11859            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
11860            /// max message size).
11861            ///
11862            /// # Errors
11863            ///
11864            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
11865            /// exceeds the configured limits.
11866            pub fn decode_with_options(
11867                bytes: ::buffa::bytes::Bytes,
11868                opts: &::buffa::DecodeOptions,
11869            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11870                ::core::result::Result::Ok(
11871                    HeatmapDeltaChainOwnedView(
11872                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
11873                    ),
11874                )
11875            }
11876            /// Build from an owned message via an encode → decode round-trip.
11877            ///
11878            /// # Errors
11879            ///
11880            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
11881            /// somehow invalid (should not happen for well-formed messages).
11882            pub fn from_owned(
11883                msg: &super::super::HeatmapDeltaChain,
11884            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
11885                ::core::result::Result::Ok(
11886                    HeatmapDeltaChainOwnedView(::buffa::OwnedView::from_owned(msg)?),
11887                )
11888            }
11889            /// Borrow the full [`HeatmapDeltaChainView`] with its lifetime tied to `&self`.
11890            #[must_use]
11891            pub fn view(&self) -> &HeatmapDeltaChainView<'_> {
11892                self.0.reborrow()
11893            }
11894            /// Convert to the owned message type.
11895            ///
11896            /// # Errors
11897            ///
11898            /// Returns an error if re-materializing preserved unknown fields
11899            /// fails (e.g. the unknown-field limit is exceeded).
11900            pub fn to_owned_message(
11901                &self,
11902            ) -> ::core::result::Result<
11903                super::super::HeatmapDeltaChain,
11904                ::buffa::DecodeError,
11905            > {
11906                self.0.to_owned_message()
11907            }
11908            /// The underlying bytes buffer.
11909            #[must_use]
11910            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
11911                self.0.bytes()
11912            }
11913            /// Consume the handle, returning the underlying bytes buffer.
11914            #[must_use]
11915            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
11916                self.0.into_bytes()
11917            }
11918            /// Full-book snapshot from which to apply the returned deltas.
11919            ///
11920            /// Field 1: `base_keyframe`
11921            #[must_use]
11922            pub fn base_keyframe(
11923                &self,
11924            ) -> &::buffa::MessageFieldView<
11925                super::super::__buffa::view::HeatmapKeyframeView<'_>,
11926            > {
11927                &self.0.reborrow().base_keyframe
11928            }
11929            /// Sparse update buckets ordered oldest-first by timestamp.
11930            ///
11931            /// Field 2: `deltas`
11932            #[must_use]
11933            pub fn deltas(
11934                &self,
11935            ) -> &::buffa::RepeatedView<
11936                '_,
11937                super::super::__buffa::view::HeatmapDeltaBucketView<'_>,
11938            > {
11939                &self.0.reborrow().deltas
11940            }
11941        }
11942        impl ::core::convert::From<::buffa::OwnedView<HeatmapDeltaChainView<'static>>>
11943        for HeatmapDeltaChainOwnedView {
11944            fn from(inner: ::buffa::OwnedView<HeatmapDeltaChainView<'static>>) -> Self {
11945                HeatmapDeltaChainOwnedView(inner)
11946            }
11947        }
11948        impl ::core::convert::From<HeatmapDeltaChainOwnedView>
11949        for ::buffa::OwnedView<HeatmapDeltaChainView<'static>> {
11950            fn from(wrapper: HeatmapDeltaChainOwnedView) -> Self {
11951                wrapper.0
11952            }
11953        }
11954        impl ::core::convert::AsRef<::buffa::OwnedView<HeatmapDeltaChainView<'static>>>
11955        for HeatmapDeltaChainOwnedView {
11956            fn as_ref(&self) -> &::buffa::OwnedView<HeatmapDeltaChainView<'static>> {
11957                &self.0
11958            }
11959        }
11960        impl ::buffa::HasMessageView for super::super::HeatmapDeltaChain {
11961            type View<'a> = HeatmapDeltaChainView<'a>;
11962            type ViewHandle = HeatmapDeltaChainOwnedView;
11963        }
11964        impl ::serde::Serialize for HeatmapDeltaChainOwnedView {
11965            fn serialize<__S: ::serde::Serializer>(
11966                &self,
11967                __s: __S,
11968            ) -> ::core::result::Result<__S::Ok, __S::Error> {
11969                ::serde::Serialize::serialize(&self.0, __s)
11970            }
11971        }
11972        /// GetOrderbookHeatmapResponse returns a historical replay chain plus optional
11973        /// live bucket state for explicit realtime stitching.
11974        #[derive(Clone, Debug, Default)]
11975        pub struct GetOrderbookHeatmapResponseView<'a> {
11976            /// Numeric spot market identifier returned for the requested market.
11977            ///
11978            /// Field 1: `symbol_id`
11979            pub symbol_id: u32,
11980            /// Bucket interval used for the returned chain.
11981            ///
11982            /// Field 2: `interval`
11983            pub interval: ::buffa::EnumValue<super::super::HeatmapInterval>,
11984            /// Top-N depth requested per side.
11985            ///
11986            /// Field 3: `depth`
11987            pub depth: ::buffa::EnumValue<super::super::HeatmapDepth>,
11988            /// Always returned as snapshot + sparse deltas for the requested interval.
11989            ///
11990            /// Field 4: `chain`
11991            pub chain: ::buffa::MessageFieldView<
11992                super::super::__buffa::view::HeatmapDeltaChainView<'a>,
11993            >,
11994            /// Latest finalized historical bucket timestamp in seconds since epoch (UTC).
11995            ///
11996            /// Field 5: `last_persisted_ts_sec`
11997            pub last_persisted_ts_sec: u64,
11998            /// Book sequence anchor for realtime continuation; apply live updates where book_seq_end is greater than this value.
11999            ///
12000            /// Field 6: `live_from_book_seq_end`
12001            pub live_from_book_seq_end: u64,
12002            /// True when live_from_book_seq_end is available and can be used as a realtime continuation anchor.
12003            ///
12004            /// Field 7: `has_live_anchor`
12005            pub has_live_anchor: bool,
12006            /// Opaque cursor for the next page. Empty when no more results exist.
12007            ///
12008            /// Field 8: `next_page_token`
12009            pub next_page_token: &'a str,
12010            /// Server response time in seconds since epoch (UTC).
12011            ///
12012            /// Field 10: `server_time_sec`
12013            pub server_time_sec: u64,
12014            /// Quantity mode used for all qty_scaled values in the response.
12015            ///
12016            /// Field 11: `quantity_mode`
12017            pub quantity_mode: ::buffa::EnumValue<super::super::HeatmapQuantityMode>,
12018            /// Optional latest live bucket for the requested interval and depth.
12019            /// Present only when it is newer than the historical anchor and its quantity semantics match quantity_mode.
12020            ///
12021            /// Field 12: `live_bucket`
12022            pub live_bucket: ::buffa::MessageFieldView<
12023                super::super::__buffa::view::HeatmapLiveBucketView<'a>,
12024            >,
12025            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
12026        }
12027        impl<'a> ::buffa::MessageView<'a> for GetOrderbookHeatmapResponseView<'a> {
12028            type Owned = super::super::GetOrderbookHeatmapResponse;
12029            fn decode_view(
12030                buf: &'a [u8],
12031            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12032                let __limit = ::core::cell::Cell::new(
12033                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
12034                );
12035                <Self as ::buffa::MessageView>::decode_view_ctx(
12036                    buf,
12037                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
12038                )
12039            }
12040            fn decode_view_with_ctx(
12041                buf: &'a [u8],
12042                ctx: ::buffa::DecodeContext<'_>,
12043            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12044                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
12045            }
12046            fn merge_view_field(
12047                &mut self,
12048                tag: ::buffa::encoding::Tag,
12049                cur: &'a [u8],
12050                before_tag: &'a [u8],
12051                ctx: ::buffa::DecodeContext<'_>,
12052            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
12053                let _ = ctx;
12054                #[allow(unused_variables)]
12055                let view = self;
12056                let mut cur = cur;
12057                match tag.field_number() {
12058                    1u32 => {
12059                        ::buffa::encoding::check_wire_type(
12060                            tag,
12061                            ::buffa::encoding::WireType::Varint,
12062                        )?;
12063                        view.symbol_id = ::buffa::types::decode_uint32(&mut cur)?;
12064                    }
12065                    2u32 => {
12066                        ::buffa::encoding::check_wire_type(
12067                            tag,
12068                            ::buffa::encoding::WireType::Varint,
12069                        )?;
12070                        view.interval = ::buffa::EnumValue::from(
12071                            ::buffa::types::decode_int32(&mut cur)?,
12072                        );
12073                    }
12074                    3u32 => {
12075                        ::buffa::encoding::check_wire_type(
12076                            tag,
12077                            ::buffa::encoding::WireType::Varint,
12078                        )?;
12079                        view.depth = ::buffa::EnumValue::from(
12080                            ::buffa::types::decode_int32(&mut cur)?,
12081                        );
12082                    }
12083                    4u32 => {
12084                        ::buffa::encoding::check_wire_type(
12085                            tag,
12086                            ::buffa::encoding::WireType::LengthDelimited,
12087                        )?;
12088                        let __sub_ctx = ctx.descend()?;
12089                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
12090                        match view.chain.as_mut() {
12091                            Some(existing) => {
12092                                ::buffa::MessageView::merge_into_view(
12093                                    existing,
12094                                    sub,
12095                                    __sub_ctx,
12096                                )?
12097                            }
12098                            None => {
12099                                view.chain = ::buffa::MessageFieldView::set(
12100                                    <super::super::__buffa::view::HeatmapDeltaChainView as ::buffa::MessageView>::decode_view_ctx(
12101                                        sub,
12102                                        __sub_ctx,
12103                                    )?,
12104                                );
12105                            }
12106                        }
12107                    }
12108                    5u32 => {
12109                        ::buffa::encoding::check_wire_type(
12110                            tag,
12111                            ::buffa::encoding::WireType::Varint,
12112                        )?;
12113                        view.last_persisted_ts_sec = ::buffa::types::decode_uint64(
12114                            &mut cur,
12115                        )?;
12116                    }
12117                    6u32 => {
12118                        ::buffa::encoding::check_wire_type(
12119                            tag,
12120                            ::buffa::encoding::WireType::Varint,
12121                        )?;
12122                        view.live_from_book_seq_end = ::buffa::types::decode_uint64(
12123                            &mut cur,
12124                        )?;
12125                    }
12126                    7u32 => {
12127                        ::buffa::encoding::check_wire_type(
12128                            tag,
12129                            ::buffa::encoding::WireType::Varint,
12130                        )?;
12131                        view.has_live_anchor = ::buffa::types::decode_bool(&mut cur)?;
12132                    }
12133                    8u32 => {
12134                        ::buffa::encoding::check_wire_type(
12135                            tag,
12136                            ::buffa::encoding::WireType::LengthDelimited,
12137                        )?;
12138                        view.next_page_token = ::buffa::types::borrow_str(&mut cur)?;
12139                    }
12140                    10u32 => {
12141                        ::buffa::encoding::check_wire_type(
12142                            tag,
12143                            ::buffa::encoding::WireType::Varint,
12144                        )?;
12145                        view.server_time_sec = ::buffa::types::decode_uint64(&mut cur)?;
12146                    }
12147                    11u32 => {
12148                        ::buffa::encoding::check_wire_type(
12149                            tag,
12150                            ::buffa::encoding::WireType::Varint,
12151                        )?;
12152                        view.quantity_mode = ::buffa::EnumValue::from(
12153                            ::buffa::types::decode_int32(&mut cur)?,
12154                        );
12155                    }
12156                    12u32 => {
12157                        ::buffa::encoding::check_wire_type(
12158                            tag,
12159                            ::buffa::encoding::WireType::LengthDelimited,
12160                        )?;
12161                        let __sub_ctx = ctx.descend()?;
12162                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
12163                        match view.live_bucket.as_mut() {
12164                            Some(existing) => {
12165                                ::buffa::MessageView::merge_into_view(
12166                                    existing,
12167                                    sub,
12168                                    __sub_ctx,
12169                                )?
12170                            }
12171                            None => {
12172                                view.live_bucket = ::buffa::MessageFieldView::set(
12173                                    <super::super::__buffa::view::HeatmapLiveBucketView as ::buffa::MessageView>::decode_view_ctx(
12174                                        sub,
12175                                        __sub_ctx,
12176                                    )?,
12177                                );
12178                            }
12179                        }
12180                    }
12181                    _ => {
12182                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
12183                        let span_len = before_tag.len() - cur.len();
12184                        view.__buffa_unknown_fields
12185                            .push_record(before_tag, span_len, ctx)?;
12186                    }
12187                }
12188                ::core::result::Result::Ok(cur)
12189            }
12190            fn to_owned_message(
12191                &self,
12192            ) -> ::core::result::Result<
12193                super::super::GetOrderbookHeatmapResponse,
12194                ::buffa::DecodeError,
12195            > {
12196                self.to_owned_from_source(None)
12197            }
12198            #[allow(clippy::useless_conversion, clippy::needless_update)]
12199            fn to_owned_from_source(
12200                &self,
12201                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
12202            ) -> ::core::result::Result<
12203                super::super::GetOrderbookHeatmapResponse,
12204                ::buffa::DecodeError,
12205            > {
12206                #[allow(unused_imports)]
12207                use ::buffa::alloc::string::ToString as _;
12208                let _ = __buffa_src;
12209                ::core::result::Result::Ok(super::super::GetOrderbookHeatmapResponse {
12210                    symbol_id: self.symbol_id,
12211                    interval: self.interval,
12212                    depth: self.depth,
12213                    chain: match self.chain.as_option() {
12214                        Some(v) => {
12215                            ::buffa::MessageField::<
12216                                super::super::HeatmapDeltaChain,
12217                            >::some(v.to_owned_from_source(__buffa_src)?)
12218                        }
12219                        None => ::buffa::MessageField::none(),
12220                    },
12221                    last_persisted_ts_sec: self.last_persisted_ts_sec,
12222                    live_from_book_seq_end: self.live_from_book_seq_end,
12223                    has_live_anchor: self.has_live_anchor,
12224                    next_page_token: self.next_page_token.to_string(),
12225                    server_time_sec: self.server_time_sec,
12226                    quantity_mode: self.quantity_mode,
12227                    live_bucket: match self.live_bucket.as_option() {
12228                        Some(v) => {
12229                            ::buffa::MessageField::<
12230                                super::super::HeatmapLiveBucket,
12231                            >::some(v.to_owned_from_source(__buffa_src)?)
12232                        }
12233                        None => ::buffa::MessageField::none(),
12234                    },
12235                    __buffa_unknown_fields: self
12236                        .__buffa_unknown_fields
12237                        .to_owned()?
12238                        .into(),
12239                    ..::core::default::Default::default()
12240                })
12241            }
12242        }
12243        impl<'a> ::buffa::ViewEncode<'a> for GetOrderbookHeatmapResponseView<'a> {
12244            #[allow(clippy::needless_borrow, clippy::let_and_return)]
12245            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
12246                #[allow(unused_imports)]
12247                use ::buffa::Enumeration as _;
12248                let mut size = 0u32;
12249                if self.symbol_id != 0u32 {
12250                    size
12251                        += 1u32
12252                            + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
12253                }
12254                {
12255                    let val = self.interval.to_i32();
12256                    if val != 0 {
12257                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
12258                    }
12259                }
12260                {
12261                    let val = self.depth.to_i32();
12262                    if val != 0 {
12263                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
12264                    }
12265                }
12266                if self.chain.is_set() {
12267                    let __slot = __cache.reserve();
12268                    let inner_size = self.chain.compute_size(__cache);
12269                    __cache.set(__slot, inner_size);
12270                    size
12271                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
12272                            + inner_size;
12273                }
12274                if self.last_persisted_ts_sec != 0u64 {
12275                    size
12276                        += 1u32
12277                            + ::buffa::types::uint64_encoded_len(
12278                                self.last_persisted_ts_sec,
12279                            ) as u32;
12280                }
12281                if self.live_from_book_seq_end != 0u64 {
12282                    size
12283                        += 1u32
12284                            + ::buffa::types::uint64_encoded_len(
12285                                self.live_from_book_seq_end,
12286                            ) as u32;
12287                }
12288                if self.has_live_anchor {
12289                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
12290                }
12291                if !self.next_page_token.is_empty() {
12292                    size
12293                        += 1u32
12294                            + ::buffa::types::string_encoded_len(&self.next_page_token)
12295                                as u32;
12296                }
12297                if self.server_time_sec != 0u64 {
12298                    size
12299                        += 1u32
12300                            + ::buffa::types::uint64_encoded_len(self.server_time_sec)
12301                                as u32;
12302                }
12303                {
12304                    let val = self.quantity_mode.to_i32();
12305                    if val != 0 {
12306                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
12307                    }
12308                }
12309                if self.live_bucket.is_set() {
12310                    let __slot = __cache.reserve();
12311                    let inner_size = self.live_bucket.compute_size(__cache);
12312                    __cache.set(__slot, inner_size);
12313                    size
12314                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
12315                            + inner_size;
12316                }
12317                size += self.__buffa_unknown_fields.encoded_len() as u32;
12318                size
12319            }
12320            #[allow(clippy::needless_borrow)]
12321            fn write_to(
12322                &self,
12323                __cache: &mut ::buffa::SizeCache,
12324                buf: &mut impl ::buffa::bytes::BufMut,
12325            ) {
12326                #[allow(unused_imports)]
12327                use ::buffa::Enumeration as _;
12328                if self.symbol_id != 0u32 {
12329                    ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
12330                }
12331                {
12332                    let val = self.interval.to_i32();
12333                    if val != 0 {
12334                        ::buffa::types::put_int32_field(2u32, val, buf);
12335                    }
12336                }
12337                {
12338                    let val = self.depth.to_i32();
12339                    if val != 0 {
12340                        ::buffa::types::put_int32_field(3u32, val, buf);
12341                    }
12342                }
12343                if self.chain.is_set() {
12344                    ::buffa::types::put_len_delimited_header(
12345                        4u32,
12346                        __cache.consume_next(),
12347                        buf,
12348                    );
12349                    self.chain.write_to(__cache, buf);
12350                }
12351                if self.last_persisted_ts_sec != 0u64 {
12352                    ::buffa::types::put_uint64_field(
12353                        5u32,
12354                        self.last_persisted_ts_sec,
12355                        buf,
12356                    );
12357                }
12358                if self.live_from_book_seq_end != 0u64 {
12359                    ::buffa::types::put_uint64_field(
12360                        6u32,
12361                        self.live_from_book_seq_end,
12362                        buf,
12363                    );
12364                }
12365                if self.has_live_anchor {
12366                    ::buffa::types::put_bool_field(7u32, self.has_live_anchor, buf);
12367                }
12368                if !self.next_page_token.is_empty() {
12369                    ::buffa::types::put_string_field(8u32, &self.next_page_token, buf);
12370                }
12371                if self.server_time_sec != 0u64 {
12372                    ::buffa::types::put_uint64_field(10u32, self.server_time_sec, buf);
12373                }
12374                {
12375                    let val = self.quantity_mode.to_i32();
12376                    if val != 0 {
12377                        ::buffa::types::put_int32_field(11u32, val, buf);
12378                    }
12379                }
12380                if self.live_bucket.is_set() {
12381                    ::buffa::types::put_len_delimited_header(
12382                        12u32,
12383                        __cache.consume_next(),
12384                        buf,
12385                    );
12386                    self.live_bucket.write_to(__cache, buf);
12387                }
12388                self.__buffa_unknown_fields.write_to(buf);
12389            }
12390        }
12391        /// Serializes this view as protobuf JSON.
12392        ///
12393        /// Implicit-presence fields with default values are omitted, `required`
12394        /// fields are always emitted, explicit-presence (`optional`) fields are
12395        /// emitted only when set, bytes fields are base64-encoded, and enum
12396        /// values are their proto name strings.
12397        ///
12398        /// This impl uses `serialize_map(None)` because the number of emitted
12399        /// fields depends on default-omission rules; serializers that require
12400        /// known map lengths (e.g. `bincode`) will return a runtime error.
12401        /// Use the owned message type for those formats.
12402        impl<'__a> ::serde::Serialize for GetOrderbookHeatmapResponseView<'__a> {
12403            fn serialize<__S: ::serde::Serializer>(
12404                &self,
12405                __s: __S,
12406            ) -> ::core::result::Result<__S::Ok, __S::Error> {
12407                use ::serde::ser::SerializeMap as _;
12408                let mut __map = __s.serialize_map(::core::option::Option::None)?;
12409                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.symbol_id) {
12410                    __map
12411                        .serialize_entry(
12412                            "symbolId",
12413                            &::buffa::json_helpers::ProtoJson(&self.symbol_id),
12414                        )?;
12415                }
12416                if !::buffa::json_helpers::skip_if::is_default_enum_value(
12417                    &self.interval,
12418                ) {
12419                    __map.serialize_entry("interval", &self.interval)?;
12420                }
12421                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.depth) {
12422                    __map.serialize_entry("depth", &self.depth)?;
12423                }
12424                {
12425                    if let ::core::option::Option::Some(__v) = self.chain.as_option() {
12426                        __map.serialize_entry("chain", __v)?;
12427                    }
12428                }
12429                if !::buffa::json_helpers::skip_if::is_zero_u64(
12430                    &self.last_persisted_ts_sec,
12431                ) {
12432                    __map
12433                        .serialize_entry(
12434                            "lastPersistedTsSec",
12435                            &::buffa::json_helpers::ProtoJson(
12436                                &self.last_persisted_ts_sec,
12437                            ),
12438                        )?;
12439                }
12440                if !::buffa::json_helpers::skip_if::is_zero_u64(
12441                    &self.live_from_book_seq_end,
12442                ) {
12443                    __map
12444                        .serialize_entry(
12445                            "liveFromBookSeqEnd",
12446                            &::buffa::json_helpers::ProtoJson(
12447                                &self.live_from_book_seq_end,
12448                            ),
12449                        )?;
12450                }
12451                if self.has_live_anchor {
12452                    __map.serialize_entry("hasLiveAnchor", &self.has_live_anchor)?;
12453                }
12454                if !::buffa::json_helpers::skip_if::is_empty_str(self.next_page_token) {
12455                    __map.serialize_entry("nextPageToken", self.next_page_token)?;
12456                }
12457                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.server_time_sec) {
12458                    __map
12459                        .serialize_entry(
12460                            "serverTimeSec",
12461                            &::buffa::json_helpers::ProtoJson(&self.server_time_sec),
12462                        )?;
12463                }
12464                if !::buffa::json_helpers::skip_if::is_default_enum_value(
12465                    &self.quantity_mode,
12466                ) {
12467                    __map.serialize_entry("quantityMode", &self.quantity_mode)?;
12468                }
12469                {
12470                    if let ::core::option::Option::Some(__v) = self
12471                        .live_bucket
12472                        .as_option()
12473                    {
12474                        __map.serialize_entry("liveBucket", __v)?;
12475                    }
12476                }
12477                __map.end()
12478            }
12479        }
12480        impl<'a> ::buffa::MessageName for GetOrderbookHeatmapResponseView<'a> {
12481            const PACKAGE: &'static str = "marketdata.v1";
12482            const NAME: &'static str = "GetOrderbookHeatmapResponse";
12483            const FULL_NAME: &'static str = "marketdata.v1.GetOrderbookHeatmapResponse";
12484            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetOrderbookHeatmapResponse";
12485        }
12486        ::buffa::impl_default_view_instance!(GetOrderbookHeatmapResponseView);
12487        ::buffa::impl_view_reborrow!(GetOrderbookHeatmapResponseView);
12488        /** Self-contained, `'static` owned view of a `GetOrderbookHeatmapResponse` message.
12489
12490 Wraps [`::buffa::OwnedView`]`<`[`GetOrderbookHeatmapResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
12491
12492 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetOrderbookHeatmapResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
12493        #[derive(Clone, Debug)]
12494        pub struct GetOrderbookHeatmapResponseOwnedView(
12495            ::buffa::OwnedView<GetOrderbookHeatmapResponseView<'static>>,
12496        );
12497        impl GetOrderbookHeatmapResponseOwnedView {
12498            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
12499            ///
12500            /// The view borrows directly from the buffer's data; the buffer is
12501            /// retained inside the returned handle.
12502            ///
12503            /// # Errors
12504            ///
12505            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
12506            /// protobuf data.
12507            pub fn decode(
12508                bytes: ::buffa::bytes::Bytes,
12509            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12510                ::core::result::Result::Ok(
12511                    GetOrderbookHeatmapResponseOwnedView(
12512                        ::buffa::OwnedView::decode(bytes)?,
12513                    ),
12514                )
12515            }
12516            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
12517            /// max message size).
12518            ///
12519            /// # Errors
12520            ///
12521            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
12522            /// exceeds the configured limits.
12523            pub fn decode_with_options(
12524                bytes: ::buffa::bytes::Bytes,
12525                opts: &::buffa::DecodeOptions,
12526            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12527                ::core::result::Result::Ok(
12528                    GetOrderbookHeatmapResponseOwnedView(
12529                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
12530                    ),
12531                )
12532            }
12533            /// Build from an owned message via an encode → decode round-trip.
12534            ///
12535            /// # Errors
12536            ///
12537            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
12538            /// somehow invalid (should not happen for well-formed messages).
12539            pub fn from_owned(
12540                msg: &super::super::GetOrderbookHeatmapResponse,
12541            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12542                ::core::result::Result::Ok(
12543                    GetOrderbookHeatmapResponseOwnedView(
12544                        ::buffa::OwnedView::from_owned(msg)?,
12545                    ),
12546                )
12547            }
12548            /// Borrow the full [`GetOrderbookHeatmapResponseView`] with its lifetime tied to `&self`.
12549            #[must_use]
12550            pub fn view(&self) -> &GetOrderbookHeatmapResponseView<'_> {
12551                self.0.reborrow()
12552            }
12553            /// Convert to the owned message type.
12554            ///
12555            /// # Errors
12556            ///
12557            /// Returns an error if re-materializing preserved unknown fields
12558            /// fails (e.g. the unknown-field limit is exceeded).
12559            pub fn to_owned_message(
12560                &self,
12561            ) -> ::core::result::Result<
12562                super::super::GetOrderbookHeatmapResponse,
12563                ::buffa::DecodeError,
12564            > {
12565                self.0.to_owned_message()
12566            }
12567            /// The underlying bytes buffer.
12568            #[must_use]
12569            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
12570                self.0.bytes()
12571            }
12572            /// Consume the handle, returning the underlying bytes buffer.
12573            #[must_use]
12574            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
12575                self.0.into_bytes()
12576            }
12577            /// Numeric spot market identifier returned for the requested market.
12578            ///
12579            /// Field 1: `symbol_id`
12580            #[must_use]
12581            pub fn symbol_id(&self) -> u32 {
12582                self.0.reborrow().symbol_id
12583            }
12584            /// Bucket interval used for the returned chain.
12585            ///
12586            /// Field 2: `interval`
12587            #[must_use]
12588            pub fn interval(&self) -> ::buffa::EnumValue<super::super::HeatmapInterval> {
12589                self.0.reborrow().interval
12590            }
12591            /// Top-N depth requested per side.
12592            ///
12593            /// Field 3: `depth`
12594            #[must_use]
12595            pub fn depth(&self) -> ::buffa::EnumValue<super::super::HeatmapDepth> {
12596                self.0.reborrow().depth
12597            }
12598            /// Always returned as snapshot + sparse deltas for the requested interval.
12599            ///
12600            /// Field 4: `chain`
12601            #[must_use]
12602            pub fn chain(
12603                &self,
12604            ) -> &::buffa::MessageFieldView<
12605                super::super::__buffa::view::HeatmapDeltaChainView<'_>,
12606            > {
12607                &self.0.reborrow().chain
12608            }
12609            /// Latest finalized historical bucket timestamp in seconds since epoch (UTC).
12610            ///
12611            /// Field 5: `last_persisted_ts_sec`
12612            #[must_use]
12613            pub fn last_persisted_ts_sec(&self) -> u64 {
12614                self.0.reborrow().last_persisted_ts_sec
12615            }
12616            /// Book sequence anchor for realtime continuation; apply live updates where book_seq_end is greater than this value.
12617            ///
12618            /// Field 6: `live_from_book_seq_end`
12619            #[must_use]
12620            pub fn live_from_book_seq_end(&self) -> u64 {
12621                self.0.reborrow().live_from_book_seq_end
12622            }
12623            /// True when live_from_book_seq_end is available and can be used as a realtime continuation anchor.
12624            ///
12625            /// Field 7: `has_live_anchor`
12626            #[must_use]
12627            pub fn has_live_anchor(&self) -> bool {
12628                self.0.reborrow().has_live_anchor
12629            }
12630            /// Opaque cursor for the next page. Empty when no more results exist.
12631            ///
12632            /// Field 8: `next_page_token`
12633            #[must_use]
12634            pub fn next_page_token(&self) -> &'_ str {
12635                self.0.reborrow().next_page_token
12636            }
12637            /// Server response time in seconds since epoch (UTC).
12638            ///
12639            /// Field 10: `server_time_sec`
12640            #[must_use]
12641            pub fn server_time_sec(&self) -> u64 {
12642                self.0.reborrow().server_time_sec
12643            }
12644            /// Quantity mode used for all qty_scaled values in the response.
12645            ///
12646            /// Field 11: `quantity_mode`
12647            #[must_use]
12648            pub fn quantity_mode(
12649                &self,
12650            ) -> ::buffa::EnumValue<super::super::HeatmapQuantityMode> {
12651                self.0.reborrow().quantity_mode
12652            }
12653            /// Optional latest live bucket for the requested interval and depth.
12654            /// Present only when it is newer than the historical anchor and its quantity semantics match quantity_mode.
12655            ///
12656            /// Field 12: `live_bucket`
12657            #[must_use]
12658            pub fn live_bucket(
12659                &self,
12660            ) -> &::buffa::MessageFieldView<
12661                super::super::__buffa::view::HeatmapLiveBucketView<'_>,
12662            > {
12663                &self.0.reborrow().live_bucket
12664            }
12665        }
12666        impl ::core::convert::From<
12667            ::buffa::OwnedView<GetOrderbookHeatmapResponseView<'static>>,
12668        > for GetOrderbookHeatmapResponseOwnedView {
12669            fn from(
12670                inner: ::buffa::OwnedView<GetOrderbookHeatmapResponseView<'static>>,
12671            ) -> Self {
12672                GetOrderbookHeatmapResponseOwnedView(inner)
12673            }
12674        }
12675        impl ::core::convert::From<GetOrderbookHeatmapResponseOwnedView>
12676        for ::buffa::OwnedView<GetOrderbookHeatmapResponseView<'static>> {
12677            fn from(wrapper: GetOrderbookHeatmapResponseOwnedView) -> Self {
12678                wrapper.0
12679            }
12680        }
12681        impl ::core::convert::AsRef<
12682            ::buffa::OwnedView<GetOrderbookHeatmapResponseView<'static>>,
12683        > for GetOrderbookHeatmapResponseOwnedView {
12684            fn as_ref(
12685                &self,
12686            ) -> &::buffa::OwnedView<GetOrderbookHeatmapResponseView<'static>> {
12687                &self.0
12688            }
12689        }
12690        impl ::buffa::HasMessageView for super::super::GetOrderbookHeatmapResponse {
12691            type View<'a> = GetOrderbookHeatmapResponseView<'a>;
12692            type ViewHandle = GetOrderbookHeatmapResponseOwnedView;
12693        }
12694        impl ::serde::Serialize for GetOrderbookHeatmapResponseOwnedView {
12695            fn serialize<__S: ::serde::Serializer>(
12696                &self,
12697                __s: __S,
12698            ) -> ::core::result::Result<__S::Ok, __S::Error> {
12699                ::serde::Serialize::serialize(&self.0, __s)
12700            }
12701        }
12702        /// ---------------------------------------------------------------------------
12703        /// GetTrades: Binary (protobuf) request/response with scaled integers.
12704        /// REST responses expose decimal strings.
12705        /// ---------------------------------------------------------------------------
12706        ///
12707        /// GetTradesRequest selects recent public trades for one spot market.
12708        ///
12709        /// Results are ordered newest-first by execution timestamp, with match_id as a
12710        /// tie-breaker. When both start_time and end_time are set, both bounds are
12711        /// inclusive.
12712        #[derive(Clone, Debug, Default)]
12713        pub struct GetTradesRequestView<'a> {
12714            /// Stable numeric pair id from GetSpotConfig.
12715            ///
12716            /// Field 1: `symbol_id`
12717            pub symbol_id: u32,
12718            /// Maximum number of trades to return. Defaults to 100 when unset; max 1000.
12719            ///
12720            /// Field 2: `limit`
12721            pub limit: u32,
12722            /// Inclusive lower bound for trade execution time. Must not be more than
12723            /// 5 minutes in the future.
12724            ///
12725            /// Field 3: `start_time`
12726            pub start_time: ::buffa::MessageFieldView<
12727                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
12728            >,
12729            /// Inclusive upper bound for trade execution time. Must be greater than or
12730            /// equal to start_time when both are set, and must not be more than 5 minutes
12731            /// in the future.
12732            ///
12733            /// Field 4: `end_time`
12734            pub end_time: ::buffa::MessageFieldView<
12735                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
12736            >,
12737            /// Optional filter by trade aggressor side. Unspecified returns both sides.
12738            ///
12739            /// Field 5: `side`
12740            pub side: ::buffa::EnumValue<super::super::SideFilter>,
12741            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
12742            /// bound to symbol, time bounds, side filter, and newest-first sort order.
12743            ///
12744            /// Field 6: `page_token`
12745            pub page_token: &'a str,
12746            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
12747        }
12748        impl<'a> ::buffa::MessageView<'a> for GetTradesRequestView<'a> {
12749            type Owned = super::super::GetTradesRequest;
12750            fn decode_view(
12751                buf: &'a [u8],
12752            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12753                let __limit = ::core::cell::Cell::new(
12754                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
12755                );
12756                <Self as ::buffa::MessageView>::decode_view_ctx(
12757                    buf,
12758                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
12759                )
12760            }
12761            fn decode_view_with_ctx(
12762                buf: &'a [u8],
12763                ctx: ::buffa::DecodeContext<'_>,
12764            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
12765                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
12766            }
12767            fn merge_view_field(
12768                &mut self,
12769                tag: ::buffa::encoding::Tag,
12770                cur: &'a [u8],
12771                before_tag: &'a [u8],
12772                ctx: ::buffa::DecodeContext<'_>,
12773            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
12774                let _ = ctx;
12775                #[allow(unused_variables)]
12776                let view = self;
12777                let mut cur = cur;
12778                match tag.field_number() {
12779                    1u32 => {
12780                        ::buffa::encoding::check_wire_type(
12781                            tag,
12782                            ::buffa::encoding::WireType::Varint,
12783                        )?;
12784                        view.symbol_id = ::buffa::types::decode_uint32(&mut cur)?;
12785                    }
12786                    2u32 => {
12787                        ::buffa::encoding::check_wire_type(
12788                            tag,
12789                            ::buffa::encoding::WireType::Varint,
12790                        )?;
12791                        view.limit = ::buffa::types::decode_uint32(&mut cur)?;
12792                    }
12793                    3u32 => {
12794                        ::buffa::encoding::check_wire_type(
12795                            tag,
12796                            ::buffa::encoding::WireType::LengthDelimited,
12797                        )?;
12798                        let __sub_ctx = ctx.descend()?;
12799                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
12800                        match view.start_time.as_mut() {
12801                            Some(existing) => {
12802                                ::buffa::MessageView::merge_into_view(
12803                                    existing,
12804                                    sub,
12805                                    __sub_ctx,
12806                                )?
12807                            }
12808                            None => {
12809                                view.start_time = ::buffa::MessageFieldView::set(
12810                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
12811                                        sub,
12812                                        __sub_ctx,
12813                                    )?,
12814                                );
12815                            }
12816                        }
12817                    }
12818                    4u32 => {
12819                        ::buffa::encoding::check_wire_type(
12820                            tag,
12821                            ::buffa::encoding::WireType::LengthDelimited,
12822                        )?;
12823                        let __sub_ctx = ctx.descend()?;
12824                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
12825                        match view.end_time.as_mut() {
12826                            Some(existing) => {
12827                                ::buffa::MessageView::merge_into_view(
12828                                    existing,
12829                                    sub,
12830                                    __sub_ctx,
12831                                )?
12832                            }
12833                            None => {
12834                                view.end_time = ::buffa::MessageFieldView::set(
12835                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
12836                                        sub,
12837                                        __sub_ctx,
12838                                    )?,
12839                                );
12840                            }
12841                        }
12842                    }
12843                    5u32 => {
12844                        ::buffa::encoding::check_wire_type(
12845                            tag,
12846                            ::buffa::encoding::WireType::Varint,
12847                        )?;
12848                        view.side = ::buffa::EnumValue::from(
12849                            ::buffa::types::decode_int32(&mut cur)?,
12850                        );
12851                    }
12852                    6u32 => {
12853                        ::buffa::encoding::check_wire_type(
12854                            tag,
12855                            ::buffa::encoding::WireType::LengthDelimited,
12856                        )?;
12857                        view.page_token = ::buffa::types::borrow_str(&mut cur)?;
12858                    }
12859                    _ => {
12860                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
12861                        let span_len = before_tag.len() - cur.len();
12862                        view.__buffa_unknown_fields
12863                            .push_record(before_tag, span_len, ctx)?;
12864                    }
12865                }
12866                ::core::result::Result::Ok(cur)
12867            }
12868            fn to_owned_message(
12869                &self,
12870            ) -> ::core::result::Result<
12871                super::super::GetTradesRequest,
12872                ::buffa::DecodeError,
12873            > {
12874                self.to_owned_from_source(None)
12875            }
12876            #[allow(clippy::useless_conversion, clippy::needless_update)]
12877            fn to_owned_from_source(
12878                &self,
12879                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
12880            ) -> ::core::result::Result<
12881                super::super::GetTradesRequest,
12882                ::buffa::DecodeError,
12883            > {
12884                #[allow(unused_imports)]
12885                use ::buffa::alloc::string::ToString as _;
12886                let _ = __buffa_src;
12887                ::core::result::Result::Ok(super::super::GetTradesRequest {
12888                    symbol_id: self.symbol_id,
12889                    limit: self.limit,
12890                    start_time: match self.start_time.as_option() {
12891                        Some(v) => {
12892                            ::buffa::MessageField::<
12893                                ::buffa_types::google::protobuf::Timestamp,
12894                            >::some(v.to_owned_from_source(__buffa_src)?)
12895                        }
12896                        None => ::buffa::MessageField::none(),
12897                    },
12898                    end_time: match self.end_time.as_option() {
12899                        Some(v) => {
12900                            ::buffa::MessageField::<
12901                                ::buffa_types::google::protobuf::Timestamp,
12902                            >::some(v.to_owned_from_source(__buffa_src)?)
12903                        }
12904                        None => ::buffa::MessageField::none(),
12905                    },
12906                    side: self.side,
12907                    page_token: self.page_token.to_string(),
12908                    __buffa_unknown_fields: self
12909                        .__buffa_unknown_fields
12910                        .to_owned()?
12911                        .into(),
12912                    ..::core::default::Default::default()
12913                })
12914            }
12915        }
12916        impl<'a> ::buffa::ViewEncode<'a> for GetTradesRequestView<'a> {
12917            #[allow(clippy::needless_borrow, clippy::let_and_return)]
12918            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
12919                #[allow(unused_imports)]
12920                use ::buffa::Enumeration as _;
12921                let mut size = 0u32;
12922                if self.symbol_id != 0u32 {
12923                    size
12924                        += 1u32
12925                            + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
12926                }
12927                if self.limit != 0u32 {
12928                    size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
12929                }
12930                if self.start_time.is_set() {
12931                    let __slot = __cache.reserve();
12932                    let inner_size = self.start_time.compute_size(__cache);
12933                    __cache.set(__slot, inner_size);
12934                    size
12935                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
12936                            + inner_size;
12937                }
12938                if self.end_time.is_set() {
12939                    let __slot = __cache.reserve();
12940                    let inner_size = self.end_time.compute_size(__cache);
12941                    __cache.set(__slot, inner_size);
12942                    size
12943                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
12944                            + inner_size;
12945                }
12946                {
12947                    let val = self.side.to_i32();
12948                    if val != 0 {
12949                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
12950                    }
12951                }
12952                if !self.page_token.is_empty() {
12953                    size
12954                        += 1u32
12955                            + ::buffa::types::string_encoded_len(&self.page_token)
12956                                as u32;
12957                }
12958                size += self.__buffa_unknown_fields.encoded_len() as u32;
12959                size
12960            }
12961            #[allow(clippy::needless_borrow)]
12962            fn write_to(
12963                &self,
12964                __cache: &mut ::buffa::SizeCache,
12965                buf: &mut impl ::buffa::bytes::BufMut,
12966            ) {
12967                #[allow(unused_imports)]
12968                use ::buffa::Enumeration as _;
12969                if self.symbol_id != 0u32 {
12970                    ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
12971                }
12972                if self.limit != 0u32 {
12973                    ::buffa::types::put_uint32_field(2u32, self.limit, buf);
12974                }
12975                if self.start_time.is_set() {
12976                    ::buffa::types::put_len_delimited_header(
12977                        3u32,
12978                        __cache.consume_next(),
12979                        buf,
12980                    );
12981                    self.start_time.write_to(__cache, buf);
12982                }
12983                if self.end_time.is_set() {
12984                    ::buffa::types::put_len_delimited_header(
12985                        4u32,
12986                        __cache.consume_next(),
12987                        buf,
12988                    );
12989                    self.end_time.write_to(__cache, buf);
12990                }
12991                {
12992                    let val = self.side.to_i32();
12993                    if val != 0 {
12994                        ::buffa::types::put_int32_field(5u32, val, buf);
12995                    }
12996                }
12997                if !self.page_token.is_empty() {
12998                    ::buffa::types::put_string_field(6u32, &self.page_token, buf);
12999                }
13000                self.__buffa_unknown_fields.write_to(buf);
13001            }
13002        }
13003        /// Serializes this view as protobuf JSON.
13004        ///
13005        /// Implicit-presence fields with default values are omitted, `required`
13006        /// fields are always emitted, explicit-presence (`optional`) fields are
13007        /// emitted only when set, bytes fields are base64-encoded, and enum
13008        /// values are their proto name strings.
13009        ///
13010        /// This impl uses `serialize_map(None)` because the number of emitted
13011        /// fields depends on default-omission rules; serializers that require
13012        /// known map lengths (e.g. `bincode`) will return a runtime error.
13013        /// Use the owned message type for those formats.
13014        impl<'__a> ::serde::Serialize for GetTradesRequestView<'__a> {
13015            fn serialize<__S: ::serde::Serializer>(
13016                &self,
13017                __s: __S,
13018            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13019                use ::serde::ser::SerializeMap as _;
13020                let mut __map = __s.serialize_map(::core::option::Option::None)?;
13021                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.symbol_id) {
13022                    __map
13023                        .serialize_entry(
13024                            "symbolId",
13025                            &::buffa::json_helpers::ProtoJson(&self.symbol_id),
13026                        )?;
13027                }
13028                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.limit) {
13029                    __map
13030                        .serialize_entry(
13031                            "limit",
13032                            &::buffa::json_helpers::ProtoJson(&self.limit),
13033                        )?;
13034                }
13035                {
13036                    if let ::core::option::Option::Some(__v) = self
13037                        .start_time
13038                        .as_option()
13039                    {
13040                        __map.serialize_entry("startTime", __v)?;
13041                    }
13042                }
13043                {
13044                    if let ::core::option::Option::Some(__v) = self.end_time.as_option()
13045                    {
13046                        __map.serialize_entry("endTime", __v)?;
13047                    }
13048                }
13049                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.side) {
13050                    __map.serialize_entry("side", &self.side)?;
13051                }
13052                if !::buffa::json_helpers::skip_if::is_empty_str(self.page_token) {
13053                    __map.serialize_entry("pageToken", self.page_token)?;
13054                }
13055                __map.end()
13056            }
13057        }
13058        impl<'a> ::buffa::MessageName for GetTradesRequestView<'a> {
13059            const PACKAGE: &'static str = "marketdata.v1";
13060            const NAME: &'static str = "GetTradesRequest";
13061            const FULL_NAME: &'static str = "marketdata.v1.GetTradesRequest";
13062            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetTradesRequest";
13063        }
13064        ::buffa::impl_default_view_instance!(GetTradesRequestView);
13065        ::buffa::impl_view_reborrow!(GetTradesRequestView);
13066        /** Self-contained, `'static` owned view of a `GetTradesRequest` message.
13067
13068 Wraps [`::buffa::OwnedView`]`<`[`GetTradesRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
13069
13070 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetTradesRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
13071        #[derive(Clone, Debug)]
13072        pub struct GetTradesRequestOwnedView(
13073            ::buffa::OwnedView<GetTradesRequestView<'static>>,
13074        );
13075        impl GetTradesRequestOwnedView {
13076            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
13077            ///
13078            /// The view borrows directly from the buffer's data; the buffer is
13079            /// retained inside the returned handle.
13080            ///
13081            /// # Errors
13082            ///
13083            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
13084            /// protobuf data.
13085            pub fn decode(
13086                bytes: ::buffa::bytes::Bytes,
13087            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13088                ::core::result::Result::Ok(
13089                    GetTradesRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
13090                )
13091            }
13092            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
13093            /// max message size).
13094            ///
13095            /// # Errors
13096            ///
13097            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
13098            /// exceeds the configured limits.
13099            pub fn decode_with_options(
13100                bytes: ::buffa::bytes::Bytes,
13101                opts: &::buffa::DecodeOptions,
13102            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13103                ::core::result::Result::Ok(
13104                    GetTradesRequestOwnedView(
13105                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
13106                    ),
13107                )
13108            }
13109            /// Build from an owned message via an encode → decode round-trip.
13110            ///
13111            /// # Errors
13112            ///
13113            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
13114            /// somehow invalid (should not happen for well-formed messages).
13115            pub fn from_owned(
13116                msg: &super::super::GetTradesRequest,
13117            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13118                ::core::result::Result::Ok(
13119                    GetTradesRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
13120                )
13121            }
13122            /// Borrow the full [`GetTradesRequestView`] with its lifetime tied to `&self`.
13123            #[must_use]
13124            pub fn view(&self) -> &GetTradesRequestView<'_> {
13125                self.0.reborrow()
13126            }
13127            /// Convert to the owned message type.
13128            ///
13129            /// # Errors
13130            ///
13131            /// Returns an error if re-materializing preserved unknown fields
13132            /// fails (e.g. the unknown-field limit is exceeded).
13133            pub fn to_owned_message(
13134                &self,
13135            ) -> ::core::result::Result<
13136                super::super::GetTradesRequest,
13137                ::buffa::DecodeError,
13138            > {
13139                self.0.to_owned_message()
13140            }
13141            /// The underlying bytes buffer.
13142            #[must_use]
13143            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
13144                self.0.bytes()
13145            }
13146            /// Consume the handle, returning the underlying bytes buffer.
13147            #[must_use]
13148            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
13149                self.0.into_bytes()
13150            }
13151            /// Stable numeric pair id from GetSpotConfig.
13152            ///
13153            /// Field 1: `symbol_id`
13154            #[must_use]
13155            pub fn symbol_id(&self) -> u32 {
13156                self.0.reborrow().symbol_id
13157            }
13158            /// Maximum number of trades to return. Defaults to 100 when unset; max 1000.
13159            ///
13160            /// Field 2: `limit`
13161            #[must_use]
13162            pub fn limit(&self) -> u32 {
13163                self.0.reborrow().limit
13164            }
13165            /// Inclusive lower bound for trade execution time. Must not be more than
13166            /// 5 minutes in the future.
13167            ///
13168            /// Field 3: `start_time`
13169            #[must_use]
13170            pub fn start_time(
13171                &self,
13172            ) -> &::buffa::MessageFieldView<
13173                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
13174            > {
13175                &self.0.reborrow().start_time
13176            }
13177            /// Inclusive upper bound for trade execution time. Must be greater than or
13178            /// equal to start_time when both are set, and must not be more than 5 minutes
13179            /// in the future.
13180            ///
13181            /// Field 4: `end_time`
13182            #[must_use]
13183            pub fn end_time(
13184                &self,
13185            ) -> &::buffa::MessageFieldView<
13186                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
13187            > {
13188                &self.0.reborrow().end_time
13189            }
13190            /// Optional filter by trade aggressor side. Unspecified returns both sides.
13191            ///
13192            /// Field 5: `side`
13193            #[must_use]
13194            pub fn side(&self) -> ::buffa::EnumValue<super::super::SideFilter> {
13195                self.0.reborrow().side
13196            }
13197            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
13198            /// bound to symbol, time bounds, side filter, and newest-first sort order.
13199            ///
13200            /// Field 6: `page_token`
13201            #[must_use]
13202            pub fn page_token(&self) -> &'_ str {
13203                self.0.reborrow().page_token
13204            }
13205        }
13206        impl ::core::convert::From<::buffa::OwnedView<GetTradesRequestView<'static>>>
13207        for GetTradesRequestOwnedView {
13208            fn from(inner: ::buffa::OwnedView<GetTradesRequestView<'static>>) -> Self {
13209                GetTradesRequestOwnedView(inner)
13210            }
13211        }
13212        impl ::core::convert::From<GetTradesRequestOwnedView>
13213        for ::buffa::OwnedView<GetTradesRequestView<'static>> {
13214            fn from(wrapper: GetTradesRequestOwnedView) -> Self {
13215                wrapper.0
13216            }
13217        }
13218        impl ::core::convert::AsRef<::buffa::OwnedView<GetTradesRequestView<'static>>>
13219        for GetTradesRequestOwnedView {
13220            fn as_ref(&self) -> &::buffa::OwnedView<GetTradesRequestView<'static>> {
13221                &self.0
13222            }
13223        }
13224        impl ::buffa::HasMessageView for super::super::GetTradesRequest {
13225            type View<'a> = GetTradesRequestView<'a>;
13226            type ViewHandle = GetTradesRequestOwnedView;
13227        }
13228        impl ::serde::Serialize for GetTradesRequestOwnedView {
13229            fn serialize<__S: ::serde::Serializer>(
13230                &self,
13231                __s: __S,
13232            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13233                ::serde::Serialize::serialize(&self.0, __s)
13234            }
13235        }
13236        /// MarketTrade is one public trade print represented with scaled integers.
13237        ///
13238        /// REST responses render price and quantity as decimal strings.
13239        #[derive(Clone, Debug, Default)]
13240        pub struct MarketTradeView<'a> {
13241            /// Stable numeric pair id from GetSpotConfig.
13242            ///
13243            /// Field 1: `symbol_id`
13244            pub symbol_id: u32,
13245            /// Stable trade id within the symbol, suitable for pagination and de-duplication.
13246            ///
13247            /// Field 2: `match_id`
13248            pub match_id: u64,
13249            /// True when the taker/aggressor bought the base asset; false when the
13250            /// taker/aggressor sold the base asset.
13251            ///
13252            /// Field 3: `is_buy`
13253            pub is_buy: bool,
13254            /// Trade price in quote-asset units scaled by 1e6.
13255            ///
13256            /// Field 4: `price_ticks`
13257            pub price_ticks: i64,
13258            /// Traded base-asset quantity scaled by the pair's base_quantity_scale from
13259            /// GetSpotConfig.
13260            ///
13261            /// Field 5: `qty_scaled`
13262            pub qty_scaled: i64,
13263            /// Trade execution timestamp, in nanoseconds since the Unix epoch (UTC).
13264            ///
13265            /// Field 6: `ts_ns`
13266            pub ts_ns: u64,
13267            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
13268        }
13269        impl<'a> ::buffa::MessageView<'a> for MarketTradeView<'a> {
13270            type Owned = super::super::MarketTrade;
13271            fn decode_view(
13272                buf: &'a [u8],
13273            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13274                let __limit = ::core::cell::Cell::new(
13275                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
13276                );
13277                <Self as ::buffa::MessageView>::decode_view_ctx(
13278                    buf,
13279                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
13280                )
13281            }
13282            fn decode_view_with_ctx(
13283                buf: &'a [u8],
13284                ctx: ::buffa::DecodeContext<'_>,
13285            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13286                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
13287            }
13288            fn merge_view_field(
13289                &mut self,
13290                tag: ::buffa::encoding::Tag,
13291                cur: &'a [u8],
13292                before_tag: &'a [u8],
13293                ctx: ::buffa::DecodeContext<'_>,
13294            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
13295                let _ = ctx;
13296                #[allow(unused_variables)]
13297                let view = self;
13298                let mut cur = cur;
13299                match tag.field_number() {
13300                    1u32 => {
13301                        ::buffa::encoding::check_wire_type(
13302                            tag,
13303                            ::buffa::encoding::WireType::Varint,
13304                        )?;
13305                        view.symbol_id = ::buffa::types::decode_uint32(&mut cur)?;
13306                    }
13307                    2u32 => {
13308                        ::buffa::encoding::check_wire_type(
13309                            tag,
13310                            ::buffa::encoding::WireType::Varint,
13311                        )?;
13312                        view.match_id = ::buffa::types::decode_uint64(&mut cur)?;
13313                    }
13314                    3u32 => {
13315                        ::buffa::encoding::check_wire_type(
13316                            tag,
13317                            ::buffa::encoding::WireType::Varint,
13318                        )?;
13319                        view.is_buy = ::buffa::types::decode_bool(&mut cur)?;
13320                    }
13321                    4u32 => {
13322                        ::buffa::encoding::check_wire_type(
13323                            tag,
13324                            ::buffa::encoding::WireType::Varint,
13325                        )?;
13326                        view.price_ticks = ::buffa::types::decode_int64(&mut cur)?;
13327                    }
13328                    5u32 => {
13329                        ::buffa::encoding::check_wire_type(
13330                            tag,
13331                            ::buffa::encoding::WireType::Varint,
13332                        )?;
13333                        view.qty_scaled = ::buffa::types::decode_int64(&mut cur)?;
13334                    }
13335                    6u32 => {
13336                        ::buffa::encoding::check_wire_type(
13337                            tag,
13338                            ::buffa::encoding::WireType::Varint,
13339                        )?;
13340                        view.ts_ns = ::buffa::types::decode_uint64(&mut cur)?;
13341                    }
13342                    _ => {
13343                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
13344                        let span_len = before_tag.len() - cur.len();
13345                        view.__buffa_unknown_fields
13346                            .push_record(before_tag, span_len, ctx)?;
13347                    }
13348                }
13349                ::core::result::Result::Ok(cur)
13350            }
13351            fn to_owned_message(
13352                &self,
13353            ) -> ::core::result::Result<
13354                super::super::MarketTrade,
13355                ::buffa::DecodeError,
13356            > {
13357                self.to_owned_from_source(None)
13358            }
13359            #[allow(clippy::useless_conversion, clippy::needless_update)]
13360            fn to_owned_from_source(
13361                &self,
13362                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
13363            ) -> ::core::result::Result<
13364                super::super::MarketTrade,
13365                ::buffa::DecodeError,
13366            > {
13367                #[allow(unused_imports)]
13368                use ::buffa::alloc::string::ToString as _;
13369                let _ = __buffa_src;
13370                ::core::result::Result::Ok(super::super::MarketTrade {
13371                    symbol_id: self.symbol_id,
13372                    match_id: self.match_id,
13373                    is_buy: self.is_buy,
13374                    price_ticks: self.price_ticks,
13375                    qty_scaled: self.qty_scaled,
13376                    ts_ns: self.ts_ns,
13377                    __buffa_unknown_fields: self
13378                        .__buffa_unknown_fields
13379                        .to_owned()?
13380                        .into(),
13381                    ..::core::default::Default::default()
13382                })
13383            }
13384        }
13385        impl<'a> ::buffa::ViewEncode<'a> for MarketTradeView<'a> {
13386            #[allow(clippy::needless_borrow, clippy::let_and_return)]
13387            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
13388                #[allow(unused_imports)]
13389                use ::buffa::Enumeration as _;
13390                let mut size = 0u32;
13391                if self.symbol_id != 0u32 {
13392                    size
13393                        += 1u32
13394                            + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
13395                }
13396                if self.match_id != 0u64 {
13397                    size
13398                        += 1u32
13399                            + ::buffa::types::uint64_encoded_len(self.match_id) as u32;
13400                }
13401                if self.is_buy {
13402                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
13403                }
13404                if self.price_ticks != 0i64 {
13405                    size
13406                        += 1u32
13407                            + ::buffa::types::int64_encoded_len(self.price_ticks) as u32;
13408                }
13409                if self.qty_scaled != 0i64 {
13410                    size
13411                        += 1u32
13412                            + ::buffa::types::int64_encoded_len(self.qty_scaled) as u32;
13413                }
13414                if self.ts_ns != 0u64 {
13415                    size += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_ns) as u32;
13416                }
13417                size += self.__buffa_unknown_fields.encoded_len() as u32;
13418                size
13419            }
13420            #[allow(clippy::needless_borrow)]
13421            fn write_to(
13422                &self,
13423                _cache: &mut ::buffa::SizeCache,
13424                buf: &mut impl ::buffa::bytes::BufMut,
13425            ) {
13426                #[allow(unused_imports)]
13427                use ::buffa::Enumeration as _;
13428                if self.symbol_id != 0u32 {
13429                    ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
13430                }
13431                if self.match_id != 0u64 {
13432                    ::buffa::types::put_uint64_field(2u32, self.match_id, buf);
13433                }
13434                if self.is_buy {
13435                    ::buffa::types::put_bool_field(3u32, self.is_buy, buf);
13436                }
13437                if self.price_ticks != 0i64 {
13438                    ::buffa::types::put_int64_field(4u32, self.price_ticks, buf);
13439                }
13440                if self.qty_scaled != 0i64 {
13441                    ::buffa::types::put_int64_field(5u32, self.qty_scaled, buf);
13442                }
13443                if self.ts_ns != 0u64 {
13444                    ::buffa::types::put_uint64_field(6u32, self.ts_ns, buf);
13445                }
13446                self.__buffa_unknown_fields.write_to(buf);
13447            }
13448        }
13449        /// Serializes this view as protobuf JSON.
13450        ///
13451        /// Implicit-presence fields with default values are omitted, `required`
13452        /// fields are always emitted, explicit-presence (`optional`) fields are
13453        /// emitted only when set, bytes fields are base64-encoded, and enum
13454        /// values are their proto name strings.
13455        ///
13456        /// This impl uses `serialize_map(None)` because the number of emitted
13457        /// fields depends on default-omission rules; serializers that require
13458        /// known map lengths (e.g. `bincode`) will return a runtime error.
13459        /// Use the owned message type for those formats.
13460        impl<'__a> ::serde::Serialize for MarketTradeView<'__a> {
13461            fn serialize<__S: ::serde::Serializer>(
13462                &self,
13463                __s: __S,
13464            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13465                use ::serde::ser::SerializeMap as _;
13466                let mut __map = __s.serialize_map(::core::option::Option::None)?;
13467                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.symbol_id) {
13468                    __map
13469                        .serialize_entry(
13470                            "symbolId",
13471                            &::buffa::json_helpers::ProtoJson(&self.symbol_id),
13472                        )?;
13473                }
13474                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.match_id) {
13475                    __map
13476                        .serialize_entry(
13477                            "matchId",
13478                            &::buffa::json_helpers::ProtoJson(&self.match_id),
13479                        )?;
13480                }
13481                if self.is_buy {
13482                    __map.serialize_entry("isBuy", &self.is_buy)?;
13483                }
13484                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.price_ticks) {
13485                    __map
13486                        .serialize_entry(
13487                            "priceTicks",
13488                            &::buffa::json_helpers::ProtoJson(&self.price_ticks),
13489                        )?;
13490                }
13491                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.qty_scaled) {
13492                    __map
13493                        .serialize_entry(
13494                            "qtyScaled",
13495                            &::buffa::json_helpers::ProtoJson(&self.qty_scaled),
13496                        )?;
13497                }
13498                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_ns) {
13499                    __map
13500                        .serialize_entry(
13501                            "tsNs",
13502                            &::buffa::json_helpers::ProtoJson(&self.ts_ns),
13503                        )?;
13504                }
13505                __map.end()
13506            }
13507        }
13508        impl<'a> ::buffa::MessageName for MarketTradeView<'a> {
13509            const PACKAGE: &'static str = "marketdata.v1";
13510            const NAME: &'static str = "MarketTrade";
13511            const FULL_NAME: &'static str = "marketdata.v1.MarketTrade";
13512            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.MarketTrade";
13513        }
13514        ::buffa::impl_default_view_instance!(MarketTradeView);
13515        ::buffa::impl_view_reborrow!(MarketTradeView);
13516        /** Self-contained, `'static` owned view of a `MarketTrade` message.
13517
13518 Wraps [`::buffa::OwnedView`]`<`[`MarketTradeView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
13519
13520 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`MarketTradeView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
13521        #[derive(Clone, Debug)]
13522        pub struct MarketTradeOwnedView(::buffa::OwnedView<MarketTradeView<'static>>);
13523        impl MarketTradeOwnedView {
13524            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
13525            ///
13526            /// The view borrows directly from the buffer's data; the buffer is
13527            /// retained inside the returned handle.
13528            ///
13529            /// # Errors
13530            ///
13531            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
13532            /// protobuf data.
13533            pub fn decode(
13534                bytes: ::buffa::bytes::Bytes,
13535            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13536                ::core::result::Result::Ok(
13537                    MarketTradeOwnedView(::buffa::OwnedView::decode(bytes)?),
13538                )
13539            }
13540            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
13541            /// max message size).
13542            ///
13543            /// # Errors
13544            ///
13545            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
13546            /// exceeds the configured limits.
13547            pub fn decode_with_options(
13548                bytes: ::buffa::bytes::Bytes,
13549                opts: &::buffa::DecodeOptions,
13550            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13551                ::core::result::Result::Ok(
13552                    MarketTradeOwnedView(
13553                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
13554                    ),
13555                )
13556            }
13557            /// Build from an owned message via an encode → decode round-trip.
13558            ///
13559            /// # Errors
13560            ///
13561            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
13562            /// somehow invalid (should not happen for well-formed messages).
13563            pub fn from_owned(
13564                msg: &super::super::MarketTrade,
13565            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13566                ::core::result::Result::Ok(
13567                    MarketTradeOwnedView(::buffa::OwnedView::from_owned(msg)?),
13568                )
13569            }
13570            /// Borrow the full [`MarketTradeView`] with its lifetime tied to `&self`.
13571            #[must_use]
13572            pub fn view(&self) -> &MarketTradeView<'_> {
13573                self.0.reborrow()
13574            }
13575            /// Convert to the owned message type.
13576            ///
13577            /// # Errors
13578            ///
13579            /// Returns an error if re-materializing preserved unknown fields
13580            /// fails (e.g. the unknown-field limit is exceeded).
13581            pub fn to_owned_message(
13582                &self,
13583            ) -> ::core::result::Result<
13584                super::super::MarketTrade,
13585                ::buffa::DecodeError,
13586            > {
13587                self.0.to_owned_message()
13588            }
13589            /// The underlying bytes buffer.
13590            #[must_use]
13591            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
13592                self.0.bytes()
13593            }
13594            /// Consume the handle, returning the underlying bytes buffer.
13595            #[must_use]
13596            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
13597                self.0.into_bytes()
13598            }
13599            /// Stable numeric pair id from GetSpotConfig.
13600            ///
13601            /// Field 1: `symbol_id`
13602            #[must_use]
13603            pub fn symbol_id(&self) -> u32 {
13604                self.0.reborrow().symbol_id
13605            }
13606            /// Stable trade id within the symbol, suitable for pagination and de-duplication.
13607            ///
13608            /// Field 2: `match_id`
13609            #[must_use]
13610            pub fn match_id(&self) -> u64 {
13611                self.0.reborrow().match_id
13612            }
13613            /// True when the taker/aggressor bought the base asset; false when the
13614            /// taker/aggressor sold the base asset.
13615            ///
13616            /// Field 3: `is_buy`
13617            #[must_use]
13618            pub fn is_buy(&self) -> bool {
13619                self.0.reborrow().is_buy
13620            }
13621            /// Trade price in quote-asset units scaled by 1e6.
13622            ///
13623            /// Field 4: `price_ticks`
13624            #[must_use]
13625            pub fn price_ticks(&self) -> i64 {
13626                self.0.reborrow().price_ticks
13627            }
13628            /// Traded base-asset quantity scaled by the pair's base_quantity_scale from
13629            /// GetSpotConfig.
13630            ///
13631            /// Field 5: `qty_scaled`
13632            #[must_use]
13633            pub fn qty_scaled(&self) -> i64 {
13634                self.0.reborrow().qty_scaled
13635            }
13636            /// Trade execution timestamp, in nanoseconds since the Unix epoch (UTC).
13637            ///
13638            /// Field 6: `ts_ns`
13639            #[must_use]
13640            pub fn ts_ns(&self) -> u64 {
13641                self.0.reborrow().ts_ns
13642            }
13643        }
13644        impl ::core::convert::From<::buffa::OwnedView<MarketTradeView<'static>>>
13645        for MarketTradeOwnedView {
13646            fn from(inner: ::buffa::OwnedView<MarketTradeView<'static>>) -> Self {
13647                MarketTradeOwnedView(inner)
13648            }
13649        }
13650        impl ::core::convert::From<MarketTradeOwnedView>
13651        for ::buffa::OwnedView<MarketTradeView<'static>> {
13652            fn from(wrapper: MarketTradeOwnedView) -> Self {
13653                wrapper.0
13654            }
13655        }
13656        impl ::core::convert::AsRef<::buffa::OwnedView<MarketTradeView<'static>>>
13657        for MarketTradeOwnedView {
13658            fn as_ref(&self) -> &::buffa::OwnedView<MarketTradeView<'static>> {
13659                &self.0
13660            }
13661        }
13662        impl ::buffa::HasMessageView for super::super::MarketTrade {
13663            type View<'a> = MarketTradeView<'a>;
13664            type ViewHandle = MarketTradeOwnedView;
13665        }
13666        impl ::serde::Serialize for MarketTradeOwnedView {
13667            fn serialize<__S: ::serde::Serializer>(
13668                &self,
13669                __s: __S,
13670            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13671                ::serde::Serialize::serialize(&self.0, __s)
13672            }
13673        }
13674        /// GetTradesResponse contains public trades for one spot market.
13675        #[derive(Clone, Debug, Default)]
13676        pub struct GetTradesResponseView<'a> {
13677            /// Trades ordered newest-first by execution timestamp, with match_id as a
13678            /// tie-breaker.
13679            ///
13680            /// Field 1: `trades`
13681            pub trades: ::buffa::RepeatedView<
13682                'a,
13683                super::super::__buffa::view::MarketTradeView<'a>,
13684            >,
13685            /// Opaque cursor for the next page. Empty when no more results exist.
13686            ///
13687            /// Field 2: `next_page_token`
13688            pub next_page_token: &'a str,
13689            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
13690        }
13691        impl<'a> ::buffa::MessageView<'a> for GetTradesResponseView<'a> {
13692            type Owned = super::super::GetTradesResponse;
13693            fn decode_view(
13694                buf: &'a [u8],
13695            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13696                let __limit = ::core::cell::Cell::new(
13697                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
13698                );
13699                <Self as ::buffa::MessageView>::decode_view_ctx(
13700                    buf,
13701                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
13702                )
13703            }
13704            fn decode_view_with_ctx(
13705                buf: &'a [u8],
13706                ctx: ::buffa::DecodeContext<'_>,
13707            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13708                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
13709            }
13710            fn merge_view_field(
13711                &mut self,
13712                tag: ::buffa::encoding::Tag,
13713                cur: &'a [u8],
13714                before_tag: &'a [u8],
13715                ctx: ::buffa::DecodeContext<'_>,
13716            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
13717                let _ = ctx;
13718                #[allow(unused_variables)]
13719                let view = self;
13720                let mut cur = cur;
13721                match tag.field_number() {
13722                    2u32 => {
13723                        ::buffa::encoding::check_wire_type(
13724                            tag,
13725                            ::buffa::encoding::WireType::LengthDelimited,
13726                        )?;
13727                        view.next_page_token = ::buffa::types::borrow_str(&mut cur)?;
13728                    }
13729                    1u32 => {
13730                        ::buffa::encoding::check_wire_type(
13731                            tag,
13732                            ::buffa::encoding::WireType::LengthDelimited,
13733                        )?;
13734                        let __sub_ctx = ctx.descend()?;
13735                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
13736                        view.trades
13737                            .push(
13738                                <super::super::__buffa::view::MarketTradeView as ::buffa::MessageView>::decode_view_ctx(
13739                                    sub,
13740                                    __sub_ctx,
13741                                )?,
13742                            );
13743                    }
13744                    _ => {
13745                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
13746                        let span_len = before_tag.len() - cur.len();
13747                        view.__buffa_unknown_fields
13748                            .push_record(before_tag, span_len, ctx)?;
13749                    }
13750                }
13751                ::core::result::Result::Ok(cur)
13752            }
13753            fn to_owned_message(
13754                &self,
13755            ) -> ::core::result::Result<
13756                super::super::GetTradesResponse,
13757                ::buffa::DecodeError,
13758            > {
13759                self.to_owned_from_source(None)
13760            }
13761            #[allow(clippy::useless_conversion, clippy::needless_update)]
13762            fn to_owned_from_source(
13763                &self,
13764                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
13765            ) -> ::core::result::Result<
13766                super::super::GetTradesResponse,
13767                ::buffa::DecodeError,
13768            > {
13769                #[allow(unused_imports)]
13770                use ::buffa::alloc::string::ToString as _;
13771                let _ = __buffa_src;
13772                ::core::result::Result::Ok(super::super::GetTradesResponse {
13773                    trades: self
13774                        .trades
13775                        .iter()
13776                        .map(|v| v.to_owned_from_source(__buffa_src))
13777                        .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
13778                    next_page_token: self.next_page_token.to_string(),
13779                    __buffa_unknown_fields: self
13780                        .__buffa_unknown_fields
13781                        .to_owned()?
13782                        .into(),
13783                    ..::core::default::Default::default()
13784                })
13785            }
13786        }
13787        impl<'a> ::buffa::ViewEncode<'a> for GetTradesResponseView<'a> {
13788            #[allow(clippy::needless_borrow, clippy::let_and_return)]
13789            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
13790                #[allow(unused_imports)]
13791                use ::buffa::Enumeration as _;
13792                let mut size = 0u32;
13793                for v in &self.trades {
13794                    let __slot = __cache.reserve();
13795                    let inner_size = v.compute_size(__cache);
13796                    __cache.set(__slot, inner_size);
13797                    size
13798                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
13799                            + inner_size;
13800                }
13801                if !self.next_page_token.is_empty() {
13802                    size
13803                        += 1u32
13804                            + ::buffa::types::string_encoded_len(&self.next_page_token)
13805                                as u32;
13806                }
13807                size += self.__buffa_unknown_fields.encoded_len() as u32;
13808                size
13809            }
13810            #[allow(clippy::needless_borrow)]
13811            fn write_to(
13812                &self,
13813                __cache: &mut ::buffa::SizeCache,
13814                buf: &mut impl ::buffa::bytes::BufMut,
13815            ) {
13816                #[allow(unused_imports)]
13817                use ::buffa::Enumeration as _;
13818                for v in &self.trades {
13819                    ::buffa::types::put_len_delimited_header(
13820                        1u32,
13821                        __cache.consume_next(),
13822                        buf,
13823                    );
13824                    v.write_to(__cache, buf);
13825                }
13826                if !self.next_page_token.is_empty() {
13827                    ::buffa::types::put_string_field(2u32, &self.next_page_token, buf);
13828                }
13829                self.__buffa_unknown_fields.write_to(buf);
13830            }
13831        }
13832        /// Serializes this view as protobuf JSON.
13833        ///
13834        /// Implicit-presence fields with default values are omitted, `required`
13835        /// fields are always emitted, explicit-presence (`optional`) fields are
13836        /// emitted only when set, bytes fields are base64-encoded, and enum
13837        /// values are their proto name strings.
13838        ///
13839        /// This impl uses `serialize_map(None)` because the number of emitted
13840        /// fields depends on default-omission rules; serializers that require
13841        /// known map lengths (e.g. `bincode`) will return a runtime error.
13842        /// Use the owned message type for those formats.
13843        impl<'__a> ::serde::Serialize for GetTradesResponseView<'__a> {
13844            fn serialize<__S: ::serde::Serializer>(
13845                &self,
13846                __s: __S,
13847            ) -> ::core::result::Result<__S::Ok, __S::Error> {
13848                use ::serde::ser::SerializeMap as _;
13849                let mut __map = __s.serialize_map(::core::option::Option::None)?;
13850                if !self.trades.is_empty() {
13851                    __map.serialize_entry("trades", &*self.trades)?;
13852                }
13853                if !::buffa::json_helpers::skip_if::is_empty_str(self.next_page_token) {
13854                    __map.serialize_entry("nextPageToken", self.next_page_token)?;
13855                }
13856                __map.end()
13857            }
13858        }
13859        impl<'a> ::buffa::MessageName for GetTradesResponseView<'a> {
13860            const PACKAGE: &'static str = "marketdata.v1";
13861            const NAME: &'static str = "GetTradesResponse";
13862            const FULL_NAME: &'static str = "marketdata.v1.GetTradesResponse";
13863            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetTradesResponse";
13864        }
13865        ::buffa::impl_default_view_instance!(GetTradesResponseView);
13866        ::buffa::impl_view_reborrow!(GetTradesResponseView);
13867        /** Self-contained, `'static` owned view of a `GetTradesResponse` message.
13868
13869 Wraps [`::buffa::OwnedView`]`<`[`GetTradesResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
13870
13871 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetTradesResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
13872        #[derive(Clone, Debug)]
13873        pub struct GetTradesResponseOwnedView(
13874            ::buffa::OwnedView<GetTradesResponseView<'static>>,
13875        );
13876        impl GetTradesResponseOwnedView {
13877            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
13878            ///
13879            /// The view borrows directly from the buffer's data; the buffer is
13880            /// retained inside the returned handle.
13881            ///
13882            /// # Errors
13883            ///
13884            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
13885            /// protobuf data.
13886            pub fn decode(
13887                bytes: ::buffa::bytes::Bytes,
13888            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13889                ::core::result::Result::Ok(
13890                    GetTradesResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
13891                )
13892            }
13893            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
13894            /// max message size).
13895            ///
13896            /// # Errors
13897            ///
13898            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
13899            /// exceeds the configured limits.
13900            pub fn decode_with_options(
13901                bytes: ::buffa::bytes::Bytes,
13902                opts: &::buffa::DecodeOptions,
13903            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13904                ::core::result::Result::Ok(
13905                    GetTradesResponseOwnedView(
13906                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
13907                    ),
13908                )
13909            }
13910            /// Build from an owned message via an encode → decode round-trip.
13911            ///
13912            /// # Errors
13913            ///
13914            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
13915            /// somehow invalid (should not happen for well-formed messages).
13916            pub fn from_owned(
13917                msg: &super::super::GetTradesResponse,
13918            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
13919                ::core::result::Result::Ok(
13920                    GetTradesResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
13921                )
13922            }
13923            /// Borrow the full [`GetTradesResponseView`] with its lifetime tied to `&self`.
13924            #[must_use]
13925            pub fn view(&self) -> &GetTradesResponseView<'_> {
13926                self.0.reborrow()
13927            }
13928            /// Convert to the owned message type.
13929            ///
13930            /// # Errors
13931            ///
13932            /// Returns an error if re-materializing preserved unknown fields
13933            /// fails (e.g. the unknown-field limit is exceeded).
13934            pub fn to_owned_message(
13935                &self,
13936            ) -> ::core::result::Result<
13937                super::super::GetTradesResponse,
13938                ::buffa::DecodeError,
13939            > {
13940                self.0.to_owned_message()
13941            }
13942            /// The underlying bytes buffer.
13943            #[must_use]
13944            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
13945                self.0.bytes()
13946            }
13947            /// Consume the handle, returning the underlying bytes buffer.
13948            #[must_use]
13949            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
13950                self.0.into_bytes()
13951            }
13952            /// Trades ordered newest-first by execution timestamp, with match_id as a
13953            /// tie-breaker.
13954            ///
13955            /// Field 1: `trades`
13956            #[must_use]
13957            pub fn trades(
13958                &self,
13959            ) -> &::buffa::RepeatedView<
13960                '_,
13961                super::super::__buffa::view::MarketTradeView<'_>,
13962            > {
13963                &self.0.reborrow().trades
13964            }
13965            /// Opaque cursor for the next page. Empty when no more results exist.
13966            ///
13967            /// Field 2: `next_page_token`
13968            #[must_use]
13969            pub fn next_page_token(&self) -> &'_ str {
13970                self.0.reborrow().next_page_token
13971            }
13972        }
13973        impl ::core::convert::From<::buffa::OwnedView<GetTradesResponseView<'static>>>
13974        for GetTradesResponseOwnedView {
13975            fn from(inner: ::buffa::OwnedView<GetTradesResponseView<'static>>) -> Self {
13976                GetTradesResponseOwnedView(inner)
13977            }
13978        }
13979        impl ::core::convert::From<GetTradesResponseOwnedView>
13980        for ::buffa::OwnedView<GetTradesResponseView<'static>> {
13981            fn from(wrapper: GetTradesResponseOwnedView) -> Self {
13982                wrapper.0
13983            }
13984        }
13985        impl ::core::convert::AsRef<::buffa::OwnedView<GetTradesResponseView<'static>>>
13986        for GetTradesResponseOwnedView {
13987            fn as_ref(&self) -> &::buffa::OwnedView<GetTradesResponseView<'static>> {
13988                &self.0
13989            }
13990        }
13991        impl ::buffa::HasMessageView for super::super::GetTradesResponse {
13992            type View<'a> = GetTradesResponseView<'a>;
13993            type ViewHandle = GetTradesResponseOwnedView;
13994        }
13995        impl ::serde::Serialize for GetTradesResponseOwnedView {
13996            fn serialize<__S: ::serde::Serializer>(
13997                &self,
13998                __s: __S,
13999            ) -> ::core::result::Result<__S::Ok, __S::Error> {
14000                ::serde::Serialize::serialize(&self.0, __s)
14001            }
14002        }
14003        /// ---------------------------------------------------------------------------
14004        /// GetCandles: Binary (protobuf) request/response with scaled integers.
14005        /// REST responses expose decimal strings.
14006        /// ---------------------------------------------------------------------------
14007        ///
14008        /// GetCandlesRequest selects a spot market candle series.
14009        ///
14010        /// The response is ordered newest-first by candle bucket start time. When both
14011        /// start_time and end_time are set, both bounds are inclusive.
14012        #[derive(Clone, Debug, Default)]
14013        pub struct GetCandlesRequestView<'a> {
14014            /// Numeric spot market identifier.
14015            ///
14016            /// Field 1: `symbol_id`
14017            pub symbol_id: u32,
14018            /// Candle bucket size. Required for ConnectRPC clients.
14019            ///
14020            /// Field 2: `timeframe`
14021            pub timeframe: ::buffa::EnumValue<super::super::Timeframe>,
14022            /// Maximum number of closed candles to return. Defaults to 500 when unset;
14023            /// max 10000.
14024            ///
14025            /// Field 3: `limit`
14026            pub limit: u32,
14027            /// Inclusive lower bound for candle bucket start time, as a UTC timestamp.
14028            /// Must not be more than 5 minutes in the future.
14029            ///
14030            /// Field 4: `start_time`
14031            pub start_time: ::buffa::MessageFieldView<
14032                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
14033            >,
14034            /// Inclusive upper bound for candle bucket start time, as a UTC timestamp.
14035            /// Must be greater than or equal to start_time when both are set, and must not
14036            /// be more than 5 minutes in the future.
14037            ///
14038            /// Field 5: `end_time`
14039            pub end_time: ::buffa::MessageFieldView<
14040                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
14041            >,
14042            /// Include the current open candle when it is available and inside the
14043            /// requested range.
14044            /// The open candle is prepended to the newest-first candle list and does not
14045            /// count toward the closed-candle limit.
14046            ///
14047            /// Field 6: `include_incomplete`
14048            pub include_incomplete: bool,
14049            /// Include the composite reference market candle series for the same market,
14050            /// timeframe, and time range.
14051            /// The reference series can be empty when no reference series is available for
14052            /// the requested timeframe.
14053            ///
14054            /// Field 7: `include_reference`
14055            pub include_reference: bool,
14056            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
14057            /// bound to symbol, timeframe, time bounds, and newest-first candle ordering.
14058            /// Inclusion flags affect response enrichment and may change between pages.
14059            ///
14060            /// Field 8: `page_token`
14061            pub page_token: &'a str,
14062            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
14063        }
14064        impl<'a> ::buffa::MessageView<'a> for GetCandlesRequestView<'a> {
14065            type Owned = super::super::GetCandlesRequest;
14066            fn decode_view(
14067                buf: &'a [u8],
14068            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14069                let __limit = ::core::cell::Cell::new(
14070                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
14071                );
14072                <Self as ::buffa::MessageView>::decode_view_ctx(
14073                    buf,
14074                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
14075                )
14076            }
14077            fn decode_view_with_ctx(
14078                buf: &'a [u8],
14079                ctx: ::buffa::DecodeContext<'_>,
14080            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14081                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
14082            }
14083            fn merge_view_field(
14084                &mut self,
14085                tag: ::buffa::encoding::Tag,
14086                cur: &'a [u8],
14087                before_tag: &'a [u8],
14088                ctx: ::buffa::DecodeContext<'_>,
14089            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
14090                let _ = ctx;
14091                #[allow(unused_variables)]
14092                let view = self;
14093                let mut cur = cur;
14094                match tag.field_number() {
14095                    1u32 => {
14096                        ::buffa::encoding::check_wire_type(
14097                            tag,
14098                            ::buffa::encoding::WireType::Varint,
14099                        )?;
14100                        view.symbol_id = ::buffa::types::decode_uint32(&mut cur)?;
14101                    }
14102                    2u32 => {
14103                        ::buffa::encoding::check_wire_type(
14104                            tag,
14105                            ::buffa::encoding::WireType::Varint,
14106                        )?;
14107                        view.timeframe = ::buffa::EnumValue::from(
14108                            ::buffa::types::decode_int32(&mut cur)?,
14109                        );
14110                    }
14111                    3u32 => {
14112                        ::buffa::encoding::check_wire_type(
14113                            tag,
14114                            ::buffa::encoding::WireType::Varint,
14115                        )?;
14116                        view.limit = ::buffa::types::decode_uint32(&mut cur)?;
14117                    }
14118                    4u32 => {
14119                        ::buffa::encoding::check_wire_type(
14120                            tag,
14121                            ::buffa::encoding::WireType::LengthDelimited,
14122                        )?;
14123                        let __sub_ctx = ctx.descend()?;
14124                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
14125                        match view.start_time.as_mut() {
14126                            Some(existing) => {
14127                                ::buffa::MessageView::merge_into_view(
14128                                    existing,
14129                                    sub,
14130                                    __sub_ctx,
14131                                )?
14132                            }
14133                            None => {
14134                                view.start_time = ::buffa::MessageFieldView::set(
14135                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
14136                                        sub,
14137                                        __sub_ctx,
14138                                    )?,
14139                                );
14140                            }
14141                        }
14142                    }
14143                    5u32 => {
14144                        ::buffa::encoding::check_wire_type(
14145                            tag,
14146                            ::buffa::encoding::WireType::LengthDelimited,
14147                        )?;
14148                        let __sub_ctx = ctx.descend()?;
14149                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
14150                        match view.end_time.as_mut() {
14151                            Some(existing) => {
14152                                ::buffa::MessageView::merge_into_view(
14153                                    existing,
14154                                    sub,
14155                                    __sub_ctx,
14156                                )?
14157                            }
14158                            None => {
14159                                view.end_time = ::buffa::MessageFieldView::set(
14160                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
14161                                        sub,
14162                                        __sub_ctx,
14163                                    )?,
14164                                );
14165                            }
14166                        }
14167                    }
14168                    6u32 => {
14169                        ::buffa::encoding::check_wire_type(
14170                            tag,
14171                            ::buffa::encoding::WireType::Varint,
14172                        )?;
14173                        view.include_incomplete = ::buffa::types::decode_bool(&mut cur)?;
14174                    }
14175                    7u32 => {
14176                        ::buffa::encoding::check_wire_type(
14177                            tag,
14178                            ::buffa::encoding::WireType::Varint,
14179                        )?;
14180                        view.include_reference = ::buffa::types::decode_bool(&mut cur)?;
14181                    }
14182                    8u32 => {
14183                        ::buffa::encoding::check_wire_type(
14184                            tag,
14185                            ::buffa::encoding::WireType::LengthDelimited,
14186                        )?;
14187                        view.page_token = ::buffa::types::borrow_str(&mut cur)?;
14188                    }
14189                    _ => {
14190                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
14191                        let span_len = before_tag.len() - cur.len();
14192                        view.__buffa_unknown_fields
14193                            .push_record(before_tag, span_len, ctx)?;
14194                    }
14195                }
14196                ::core::result::Result::Ok(cur)
14197            }
14198            fn to_owned_message(
14199                &self,
14200            ) -> ::core::result::Result<
14201                super::super::GetCandlesRequest,
14202                ::buffa::DecodeError,
14203            > {
14204                self.to_owned_from_source(None)
14205            }
14206            #[allow(clippy::useless_conversion, clippy::needless_update)]
14207            fn to_owned_from_source(
14208                &self,
14209                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
14210            ) -> ::core::result::Result<
14211                super::super::GetCandlesRequest,
14212                ::buffa::DecodeError,
14213            > {
14214                #[allow(unused_imports)]
14215                use ::buffa::alloc::string::ToString as _;
14216                let _ = __buffa_src;
14217                ::core::result::Result::Ok(super::super::GetCandlesRequest {
14218                    symbol_id: self.symbol_id,
14219                    timeframe: self.timeframe,
14220                    limit: self.limit,
14221                    start_time: match self.start_time.as_option() {
14222                        Some(v) => {
14223                            ::buffa::MessageField::<
14224                                ::buffa_types::google::protobuf::Timestamp,
14225                            >::some(v.to_owned_from_source(__buffa_src)?)
14226                        }
14227                        None => ::buffa::MessageField::none(),
14228                    },
14229                    end_time: match self.end_time.as_option() {
14230                        Some(v) => {
14231                            ::buffa::MessageField::<
14232                                ::buffa_types::google::protobuf::Timestamp,
14233                            >::some(v.to_owned_from_source(__buffa_src)?)
14234                        }
14235                        None => ::buffa::MessageField::none(),
14236                    },
14237                    include_incomplete: self.include_incomplete,
14238                    include_reference: self.include_reference,
14239                    page_token: self.page_token.to_string(),
14240                    __buffa_unknown_fields: self
14241                        .__buffa_unknown_fields
14242                        .to_owned()?
14243                        .into(),
14244                    ..::core::default::Default::default()
14245                })
14246            }
14247        }
14248        impl<'a> ::buffa::ViewEncode<'a> for GetCandlesRequestView<'a> {
14249            #[allow(clippy::needless_borrow, clippy::let_and_return)]
14250            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
14251                #[allow(unused_imports)]
14252                use ::buffa::Enumeration as _;
14253                let mut size = 0u32;
14254                if self.symbol_id != 0u32 {
14255                    size
14256                        += 1u32
14257                            + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
14258                }
14259                {
14260                    let val = self.timeframe.to_i32();
14261                    if val != 0 {
14262                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
14263                    }
14264                }
14265                if self.limit != 0u32 {
14266                    size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
14267                }
14268                if self.start_time.is_set() {
14269                    let __slot = __cache.reserve();
14270                    let inner_size = self.start_time.compute_size(__cache);
14271                    __cache.set(__slot, inner_size);
14272                    size
14273                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
14274                            + inner_size;
14275                }
14276                if self.end_time.is_set() {
14277                    let __slot = __cache.reserve();
14278                    let inner_size = self.end_time.compute_size(__cache);
14279                    __cache.set(__slot, inner_size);
14280                    size
14281                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
14282                            + inner_size;
14283                }
14284                if self.include_incomplete {
14285                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
14286                }
14287                if self.include_reference {
14288                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
14289                }
14290                if !self.page_token.is_empty() {
14291                    size
14292                        += 1u32
14293                            + ::buffa::types::string_encoded_len(&self.page_token)
14294                                as u32;
14295                }
14296                size += self.__buffa_unknown_fields.encoded_len() as u32;
14297                size
14298            }
14299            #[allow(clippy::needless_borrow)]
14300            fn write_to(
14301                &self,
14302                __cache: &mut ::buffa::SizeCache,
14303                buf: &mut impl ::buffa::bytes::BufMut,
14304            ) {
14305                #[allow(unused_imports)]
14306                use ::buffa::Enumeration as _;
14307                if self.symbol_id != 0u32 {
14308                    ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
14309                }
14310                {
14311                    let val = self.timeframe.to_i32();
14312                    if val != 0 {
14313                        ::buffa::types::put_int32_field(2u32, val, buf);
14314                    }
14315                }
14316                if self.limit != 0u32 {
14317                    ::buffa::types::put_uint32_field(3u32, self.limit, buf);
14318                }
14319                if self.start_time.is_set() {
14320                    ::buffa::types::put_len_delimited_header(
14321                        4u32,
14322                        __cache.consume_next(),
14323                        buf,
14324                    );
14325                    self.start_time.write_to(__cache, buf);
14326                }
14327                if self.end_time.is_set() {
14328                    ::buffa::types::put_len_delimited_header(
14329                        5u32,
14330                        __cache.consume_next(),
14331                        buf,
14332                    );
14333                    self.end_time.write_to(__cache, buf);
14334                }
14335                if self.include_incomplete {
14336                    ::buffa::types::put_bool_field(6u32, self.include_incomplete, buf);
14337                }
14338                if self.include_reference {
14339                    ::buffa::types::put_bool_field(7u32, self.include_reference, buf);
14340                }
14341                if !self.page_token.is_empty() {
14342                    ::buffa::types::put_string_field(8u32, &self.page_token, buf);
14343                }
14344                self.__buffa_unknown_fields.write_to(buf);
14345            }
14346        }
14347        /// Serializes this view as protobuf JSON.
14348        ///
14349        /// Implicit-presence fields with default values are omitted, `required`
14350        /// fields are always emitted, explicit-presence (`optional`) fields are
14351        /// emitted only when set, bytes fields are base64-encoded, and enum
14352        /// values are their proto name strings.
14353        ///
14354        /// This impl uses `serialize_map(None)` because the number of emitted
14355        /// fields depends on default-omission rules; serializers that require
14356        /// known map lengths (e.g. `bincode`) will return a runtime error.
14357        /// Use the owned message type for those formats.
14358        impl<'__a> ::serde::Serialize for GetCandlesRequestView<'__a> {
14359            fn serialize<__S: ::serde::Serializer>(
14360                &self,
14361                __s: __S,
14362            ) -> ::core::result::Result<__S::Ok, __S::Error> {
14363                use ::serde::ser::SerializeMap as _;
14364                let mut __map = __s.serialize_map(::core::option::Option::None)?;
14365                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.symbol_id) {
14366                    __map
14367                        .serialize_entry(
14368                            "symbolId",
14369                            &::buffa::json_helpers::ProtoJson(&self.symbol_id),
14370                        )?;
14371                }
14372                if !::buffa::json_helpers::skip_if::is_default_enum_value(
14373                    &self.timeframe,
14374                ) {
14375                    __map.serialize_entry("timeframe", &self.timeframe)?;
14376                }
14377                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.limit) {
14378                    __map
14379                        .serialize_entry(
14380                            "limit",
14381                            &::buffa::json_helpers::ProtoJson(&self.limit),
14382                        )?;
14383                }
14384                {
14385                    if let ::core::option::Option::Some(__v) = self
14386                        .start_time
14387                        .as_option()
14388                    {
14389                        __map.serialize_entry("startTime", __v)?;
14390                    }
14391                }
14392                {
14393                    if let ::core::option::Option::Some(__v) = self.end_time.as_option()
14394                    {
14395                        __map.serialize_entry("endTime", __v)?;
14396                    }
14397                }
14398                if self.include_incomplete {
14399                    __map
14400                        .serialize_entry("includeIncomplete", &self.include_incomplete)?;
14401                }
14402                if self.include_reference {
14403                    __map.serialize_entry("includeReference", &self.include_reference)?;
14404                }
14405                if !::buffa::json_helpers::skip_if::is_empty_str(self.page_token) {
14406                    __map.serialize_entry("pageToken", self.page_token)?;
14407                }
14408                __map.end()
14409            }
14410        }
14411        impl<'a> ::buffa::MessageName for GetCandlesRequestView<'a> {
14412            const PACKAGE: &'static str = "marketdata.v1";
14413            const NAME: &'static str = "GetCandlesRequest";
14414            const FULL_NAME: &'static str = "marketdata.v1.GetCandlesRequest";
14415            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetCandlesRequest";
14416        }
14417        ::buffa::impl_default_view_instance!(GetCandlesRequestView);
14418        ::buffa::impl_view_reborrow!(GetCandlesRequestView);
14419        /** Self-contained, `'static` owned view of a `GetCandlesRequest` message.
14420
14421 Wraps [`::buffa::OwnedView`]`<`[`GetCandlesRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
14422
14423 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetCandlesRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
14424        #[derive(Clone, Debug)]
14425        pub struct GetCandlesRequestOwnedView(
14426            ::buffa::OwnedView<GetCandlesRequestView<'static>>,
14427        );
14428        impl GetCandlesRequestOwnedView {
14429            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
14430            ///
14431            /// The view borrows directly from the buffer's data; the buffer is
14432            /// retained inside the returned handle.
14433            ///
14434            /// # Errors
14435            ///
14436            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
14437            /// protobuf data.
14438            pub fn decode(
14439                bytes: ::buffa::bytes::Bytes,
14440            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14441                ::core::result::Result::Ok(
14442                    GetCandlesRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
14443                )
14444            }
14445            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
14446            /// max message size).
14447            ///
14448            /// # Errors
14449            ///
14450            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
14451            /// exceeds the configured limits.
14452            pub fn decode_with_options(
14453                bytes: ::buffa::bytes::Bytes,
14454                opts: &::buffa::DecodeOptions,
14455            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14456                ::core::result::Result::Ok(
14457                    GetCandlesRequestOwnedView(
14458                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
14459                    ),
14460                )
14461            }
14462            /// Build from an owned message via an encode → decode round-trip.
14463            ///
14464            /// # Errors
14465            ///
14466            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
14467            /// somehow invalid (should not happen for well-formed messages).
14468            pub fn from_owned(
14469                msg: &super::super::GetCandlesRequest,
14470            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14471                ::core::result::Result::Ok(
14472                    GetCandlesRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
14473                )
14474            }
14475            /// Borrow the full [`GetCandlesRequestView`] with its lifetime tied to `&self`.
14476            #[must_use]
14477            pub fn view(&self) -> &GetCandlesRequestView<'_> {
14478                self.0.reborrow()
14479            }
14480            /// Convert to the owned message type.
14481            ///
14482            /// # Errors
14483            ///
14484            /// Returns an error if re-materializing preserved unknown fields
14485            /// fails (e.g. the unknown-field limit is exceeded).
14486            pub fn to_owned_message(
14487                &self,
14488            ) -> ::core::result::Result<
14489                super::super::GetCandlesRequest,
14490                ::buffa::DecodeError,
14491            > {
14492                self.0.to_owned_message()
14493            }
14494            /// The underlying bytes buffer.
14495            #[must_use]
14496            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
14497                self.0.bytes()
14498            }
14499            /// Consume the handle, returning the underlying bytes buffer.
14500            #[must_use]
14501            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
14502                self.0.into_bytes()
14503            }
14504            /// Numeric spot market identifier.
14505            ///
14506            /// Field 1: `symbol_id`
14507            #[must_use]
14508            pub fn symbol_id(&self) -> u32 {
14509                self.0.reborrow().symbol_id
14510            }
14511            /// Candle bucket size. Required for ConnectRPC clients.
14512            ///
14513            /// Field 2: `timeframe`
14514            #[must_use]
14515            pub fn timeframe(&self) -> ::buffa::EnumValue<super::super::Timeframe> {
14516                self.0.reborrow().timeframe
14517            }
14518            /// Maximum number of closed candles to return. Defaults to 500 when unset;
14519            /// max 10000.
14520            ///
14521            /// Field 3: `limit`
14522            #[must_use]
14523            pub fn limit(&self) -> u32 {
14524                self.0.reborrow().limit
14525            }
14526            /// Inclusive lower bound for candle bucket start time, as a UTC timestamp.
14527            /// Must not be more than 5 minutes in the future.
14528            ///
14529            /// Field 4: `start_time`
14530            #[must_use]
14531            pub fn start_time(
14532                &self,
14533            ) -> &::buffa::MessageFieldView<
14534                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
14535            > {
14536                &self.0.reborrow().start_time
14537            }
14538            /// Inclusive upper bound for candle bucket start time, as a UTC timestamp.
14539            /// Must be greater than or equal to start_time when both are set, and must not
14540            /// be more than 5 minutes in the future.
14541            ///
14542            /// Field 5: `end_time`
14543            #[must_use]
14544            pub fn end_time(
14545                &self,
14546            ) -> &::buffa::MessageFieldView<
14547                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
14548            > {
14549                &self.0.reborrow().end_time
14550            }
14551            /// Include the current open candle when it is available and inside the
14552            /// requested range.
14553            /// The open candle is prepended to the newest-first candle list and does not
14554            /// count toward the closed-candle limit.
14555            ///
14556            /// Field 6: `include_incomplete`
14557            #[must_use]
14558            pub fn include_incomplete(&self) -> bool {
14559                self.0.reborrow().include_incomplete
14560            }
14561            /// Include the composite reference market candle series for the same market,
14562            /// timeframe, and time range.
14563            /// The reference series can be empty when no reference series is available for
14564            /// the requested timeframe.
14565            ///
14566            /// Field 7: `include_reference`
14567            #[must_use]
14568            pub fn include_reference(&self) -> bool {
14569                self.0.reborrow().include_reference
14570            }
14571            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
14572            /// bound to symbol, timeframe, time bounds, and newest-first candle ordering.
14573            /// Inclusion flags affect response enrichment and may change between pages.
14574            ///
14575            /// Field 8: `page_token`
14576            #[must_use]
14577            pub fn page_token(&self) -> &'_ str {
14578                self.0.reborrow().page_token
14579            }
14580        }
14581        impl ::core::convert::From<::buffa::OwnedView<GetCandlesRequestView<'static>>>
14582        for GetCandlesRequestOwnedView {
14583            fn from(inner: ::buffa::OwnedView<GetCandlesRequestView<'static>>) -> Self {
14584                GetCandlesRequestOwnedView(inner)
14585            }
14586        }
14587        impl ::core::convert::From<GetCandlesRequestOwnedView>
14588        for ::buffa::OwnedView<GetCandlesRequestView<'static>> {
14589            fn from(wrapper: GetCandlesRequestOwnedView) -> Self {
14590                wrapper.0
14591            }
14592        }
14593        impl ::core::convert::AsRef<::buffa::OwnedView<GetCandlesRequestView<'static>>>
14594        for GetCandlesRequestOwnedView {
14595            fn as_ref(&self) -> &::buffa::OwnedView<GetCandlesRequestView<'static>> {
14596                &self.0
14597            }
14598        }
14599        impl ::buffa::HasMessageView for super::super::GetCandlesRequest {
14600            type View<'a> = GetCandlesRequestView<'a>;
14601            type ViewHandle = GetCandlesRequestOwnedView;
14602        }
14603        impl ::serde::Serialize for GetCandlesRequestOwnedView {
14604            fn serialize<__S: ::serde::Serializer>(
14605                &self,
14606                __s: __S,
14607            ) -> ::core::result::Result<__S::Ok, __S::Error> {
14608                ::serde::Serialize::serialize(&self.0, __s)
14609            }
14610        }
14611        /// GetCandlesColumnsRequest selects a spot market candle series for columnar output.
14612        ///
14613        /// The response is ordered oldest-first for efficient chart ingestion. When both
14614        /// start_time and end_time are set, both bounds are inclusive.
14615        #[derive(Clone, Debug, Default)]
14616        pub struct GetCandlesColumnsRequestView<'a> {
14617            /// Numeric spot market identifier.
14618            ///
14619            /// Field 1: `symbol_id`
14620            pub symbol_id: u32,
14621            /// Candle bucket size. Required for ConnectRPC clients.
14622            ///
14623            /// Field 2: `timeframe`
14624            pub timeframe: ::buffa::EnumValue<super::super::Timeframe>,
14625            /// Maximum number of closed candles to return. Defaults to 500 when unset;
14626            /// max 10000.
14627            ///
14628            /// Field 3: `limit`
14629            pub limit: u32,
14630            /// Inclusive lower bound for candle bucket start time, as a UTC timestamp.
14631            /// Must not be more than 5 minutes in the future.
14632            ///
14633            /// Field 4: `start_time`
14634            pub start_time: ::buffa::MessageFieldView<
14635                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
14636            >,
14637            /// Inclusive upper bound for candle bucket start time, as a UTC timestamp.
14638            /// Must be greater than or equal to start_time when both are set, and must not
14639            /// be more than 5 minutes in the future.
14640            ///
14641            /// Field 5: `end_time`
14642            pub end_time: ::buffa::MessageFieldView<
14643                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
14644            >,
14645            /// Include the current open candle when it is available and inside the
14646            /// requested range.
14647            /// The open candle is prepended to the newest-first candle list and does not
14648            /// count toward the closed-candle limit.
14649            ///
14650            /// Field 6: `include_incomplete`
14651            pub include_incomplete: bool,
14652            /// Include the composite reference market candle series for the same market,
14653            /// timeframe, and time range.
14654            /// The reference series can be empty when no reference series is available for
14655            /// the requested timeframe.
14656            ///
14657            /// Field 7: `include_reference`
14658            pub include_reference: bool,
14659            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
14660            /// bound to symbol, timeframe, time bounds, and oldest-first candle ordering.
14661            /// Inclusion flags and columnar response shape may change between pages.
14662            ///
14663            /// Field 8: `page_token`
14664            pub page_token: &'a str,
14665            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
14666        }
14667        impl<'a> ::buffa::MessageView<'a> for GetCandlesColumnsRequestView<'a> {
14668            type Owned = super::super::GetCandlesColumnsRequest;
14669            fn decode_view(
14670                buf: &'a [u8],
14671            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14672                let __limit = ::core::cell::Cell::new(
14673                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
14674                );
14675                <Self as ::buffa::MessageView>::decode_view_ctx(
14676                    buf,
14677                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
14678                )
14679            }
14680            fn decode_view_with_ctx(
14681                buf: &'a [u8],
14682                ctx: ::buffa::DecodeContext<'_>,
14683            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
14684                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
14685            }
14686            fn merge_view_field(
14687                &mut self,
14688                tag: ::buffa::encoding::Tag,
14689                cur: &'a [u8],
14690                before_tag: &'a [u8],
14691                ctx: ::buffa::DecodeContext<'_>,
14692            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
14693                let _ = ctx;
14694                #[allow(unused_variables)]
14695                let view = self;
14696                let mut cur = cur;
14697                match tag.field_number() {
14698                    1u32 => {
14699                        ::buffa::encoding::check_wire_type(
14700                            tag,
14701                            ::buffa::encoding::WireType::Varint,
14702                        )?;
14703                        view.symbol_id = ::buffa::types::decode_uint32(&mut cur)?;
14704                    }
14705                    2u32 => {
14706                        ::buffa::encoding::check_wire_type(
14707                            tag,
14708                            ::buffa::encoding::WireType::Varint,
14709                        )?;
14710                        view.timeframe = ::buffa::EnumValue::from(
14711                            ::buffa::types::decode_int32(&mut cur)?,
14712                        );
14713                    }
14714                    3u32 => {
14715                        ::buffa::encoding::check_wire_type(
14716                            tag,
14717                            ::buffa::encoding::WireType::Varint,
14718                        )?;
14719                        view.limit = ::buffa::types::decode_uint32(&mut cur)?;
14720                    }
14721                    4u32 => {
14722                        ::buffa::encoding::check_wire_type(
14723                            tag,
14724                            ::buffa::encoding::WireType::LengthDelimited,
14725                        )?;
14726                        let __sub_ctx = ctx.descend()?;
14727                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
14728                        match view.start_time.as_mut() {
14729                            Some(existing) => {
14730                                ::buffa::MessageView::merge_into_view(
14731                                    existing,
14732                                    sub,
14733                                    __sub_ctx,
14734                                )?
14735                            }
14736                            None => {
14737                                view.start_time = ::buffa::MessageFieldView::set(
14738                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
14739                                        sub,
14740                                        __sub_ctx,
14741                                    )?,
14742                                );
14743                            }
14744                        }
14745                    }
14746                    5u32 => {
14747                        ::buffa::encoding::check_wire_type(
14748                            tag,
14749                            ::buffa::encoding::WireType::LengthDelimited,
14750                        )?;
14751                        let __sub_ctx = ctx.descend()?;
14752                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
14753                        match view.end_time.as_mut() {
14754                            Some(existing) => {
14755                                ::buffa::MessageView::merge_into_view(
14756                                    existing,
14757                                    sub,
14758                                    __sub_ctx,
14759                                )?
14760                            }
14761                            None => {
14762                                view.end_time = ::buffa::MessageFieldView::set(
14763                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
14764                                        sub,
14765                                        __sub_ctx,
14766                                    )?,
14767                                );
14768                            }
14769                        }
14770                    }
14771                    6u32 => {
14772                        ::buffa::encoding::check_wire_type(
14773                            tag,
14774                            ::buffa::encoding::WireType::Varint,
14775                        )?;
14776                        view.include_incomplete = ::buffa::types::decode_bool(&mut cur)?;
14777                    }
14778                    7u32 => {
14779                        ::buffa::encoding::check_wire_type(
14780                            tag,
14781                            ::buffa::encoding::WireType::Varint,
14782                        )?;
14783                        view.include_reference = ::buffa::types::decode_bool(&mut cur)?;
14784                    }
14785                    8u32 => {
14786                        ::buffa::encoding::check_wire_type(
14787                            tag,
14788                            ::buffa::encoding::WireType::LengthDelimited,
14789                        )?;
14790                        view.page_token = ::buffa::types::borrow_str(&mut cur)?;
14791                    }
14792                    _ => {
14793                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
14794                        let span_len = before_tag.len() - cur.len();
14795                        view.__buffa_unknown_fields
14796                            .push_record(before_tag, span_len, ctx)?;
14797                    }
14798                }
14799                ::core::result::Result::Ok(cur)
14800            }
14801            fn to_owned_message(
14802                &self,
14803            ) -> ::core::result::Result<
14804                super::super::GetCandlesColumnsRequest,
14805                ::buffa::DecodeError,
14806            > {
14807                self.to_owned_from_source(None)
14808            }
14809            #[allow(clippy::useless_conversion, clippy::needless_update)]
14810            fn to_owned_from_source(
14811                &self,
14812                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
14813            ) -> ::core::result::Result<
14814                super::super::GetCandlesColumnsRequest,
14815                ::buffa::DecodeError,
14816            > {
14817                #[allow(unused_imports)]
14818                use ::buffa::alloc::string::ToString as _;
14819                let _ = __buffa_src;
14820                ::core::result::Result::Ok(super::super::GetCandlesColumnsRequest {
14821                    symbol_id: self.symbol_id,
14822                    timeframe: self.timeframe,
14823                    limit: self.limit,
14824                    start_time: match self.start_time.as_option() {
14825                        Some(v) => {
14826                            ::buffa::MessageField::<
14827                                ::buffa_types::google::protobuf::Timestamp,
14828                            >::some(v.to_owned_from_source(__buffa_src)?)
14829                        }
14830                        None => ::buffa::MessageField::none(),
14831                    },
14832                    end_time: match self.end_time.as_option() {
14833                        Some(v) => {
14834                            ::buffa::MessageField::<
14835                                ::buffa_types::google::protobuf::Timestamp,
14836                            >::some(v.to_owned_from_source(__buffa_src)?)
14837                        }
14838                        None => ::buffa::MessageField::none(),
14839                    },
14840                    include_incomplete: self.include_incomplete,
14841                    include_reference: self.include_reference,
14842                    page_token: self.page_token.to_string(),
14843                    __buffa_unknown_fields: self
14844                        .__buffa_unknown_fields
14845                        .to_owned()?
14846                        .into(),
14847                    ..::core::default::Default::default()
14848                })
14849            }
14850        }
14851        impl<'a> ::buffa::ViewEncode<'a> for GetCandlesColumnsRequestView<'a> {
14852            #[allow(clippy::needless_borrow, clippy::let_and_return)]
14853            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
14854                #[allow(unused_imports)]
14855                use ::buffa::Enumeration as _;
14856                let mut size = 0u32;
14857                if self.symbol_id != 0u32 {
14858                    size
14859                        += 1u32
14860                            + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
14861                }
14862                {
14863                    let val = self.timeframe.to_i32();
14864                    if val != 0 {
14865                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
14866                    }
14867                }
14868                if self.limit != 0u32 {
14869                    size += 1u32 + ::buffa::types::uint32_encoded_len(self.limit) as u32;
14870                }
14871                if self.start_time.is_set() {
14872                    let __slot = __cache.reserve();
14873                    let inner_size = self.start_time.compute_size(__cache);
14874                    __cache.set(__slot, inner_size);
14875                    size
14876                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
14877                            + inner_size;
14878                }
14879                if self.end_time.is_set() {
14880                    let __slot = __cache.reserve();
14881                    let inner_size = self.end_time.compute_size(__cache);
14882                    __cache.set(__slot, inner_size);
14883                    size
14884                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
14885                            + inner_size;
14886                }
14887                if self.include_incomplete {
14888                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
14889                }
14890                if self.include_reference {
14891                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
14892                }
14893                if !self.page_token.is_empty() {
14894                    size
14895                        += 1u32
14896                            + ::buffa::types::string_encoded_len(&self.page_token)
14897                                as u32;
14898                }
14899                size += self.__buffa_unknown_fields.encoded_len() as u32;
14900                size
14901            }
14902            #[allow(clippy::needless_borrow)]
14903            fn write_to(
14904                &self,
14905                __cache: &mut ::buffa::SizeCache,
14906                buf: &mut impl ::buffa::bytes::BufMut,
14907            ) {
14908                #[allow(unused_imports)]
14909                use ::buffa::Enumeration as _;
14910                if self.symbol_id != 0u32 {
14911                    ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
14912                }
14913                {
14914                    let val = self.timeframe.to_i32();
14915                    if val != 0 {
14916                        ::buffa::types::put_int32_field(2u32, val, buf);
14917                    }
14918                }
14919                if self.limit != 0u32 {
14920                    ::buffa::types::put_uint32_field(3u32, self.limit, buf);
14921                }
14922                if self.start_time.is_set() {
14923                    ::buffa::types::put_len_delimited_header(
14924                        4u32,
14925                        __cache.consume_next(),
14926                        buf,
14927                    );
14928                    self.start_time.write_to(__cache, buf);
14929                }
14930                if self.end_time.is_set() {
14931                    ::buffa::types::put_len_delimited_header(
14932                        5u32,
14933                        __cache.consume_next(),
14934                        buf,
14935                    );
14936                    self.end_time.write_to(__cache, buf);
14937                }
14938                if self.include_incomplete {
14939                    ::buffa::types::put_bool_field(6u32, self.include_incomplete, buf);
14940                }
14941                if self.include_reference {
14942                    ::buffa::types::put_bool_field(7u32, self.include_reference, buf);
14943                }
14944                if !self.page_token.is_empty() {
14945                    ::buffa::types::put_string_field(8u32, &self.page_token, buf);
14946                }
14947                self.__buffa_unknown_fields.write_to(buf);
14948            }
14949        }
14950        /// Serializes this view as protobuf JSON.
14951        ///
14952        /// Implicit-presence fields with default values are omitted, `required`
14953        /// fields are always emitted, explicit-presence (`optional`) fields are
14954        /// emitted only when set, bytes fields are base64-encoded, and enum
14955        /// values are their proto name strings.
14956        ///
14957        /// This impl uses `serialize_map(None)` because the number of emitted
14958        /// fields depends on default-omission rules; serializers that require
14959        /// known map lengths (e.g. `bincode`) will return a runtime error.
14960        /// Use the owned message type for those formats.
14961        impl<'__a> ::serde::Serialize for GetCandlesColumnsRequestView<'__a> {
14962            fn serialize<__S: ::serde::Serializer>(
14963                &self,
14964                __s: __S,
14965            ) -> ::core::result::Result<__S::Ok, __S::Error> {
14966                use ::serde::ser::SerializeMap as _;
14967                let mut __map = __s.serialize_map(::core::option::Option::None)?;
14968                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.symbol_id) {
14969                    __map
14970                        .serialize_entry(
14971                            "symbolId",
14972                            &::buffa::json_helpers::ProtoJson(&self.symbol_id),
14973                        )?;
14974                }
14975                if !::buffa::json_helpers::skip_if::is_default_enum_value(
14976                    &self.timeframe,
14977                ) {
14978                    __map.serialize_entry("timeframe", &self.timeframe)?;
14979                }
14980                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.limit) {
14981                    __map
14982                        .serialize_entry(
14983                            "limit",
14984                            &::buffa::json_helpers::ProtoJson(&self.limit),
14985                        )?;
14986                }
14987                {
14988                    if let ::core::option::Option::Some(__v) = self
14989                        .start_time
14990                        .as_option()
14991                    {
14992                        __map.serialize_entry("startTime", __v)?;
14993                    }
14994                }
14995                {
14996                    if let ::core::option::Option::Some(__v) = self.end_time.as_option()
14997                    {
14998                        __map.serialize_entry("endTime", __v)?;
14999                    }
15000                }
15001                if self.include_incomplete {
15002                    __map
15003                        .serialize_entry("includeIncomplete", &self.include_incomplete)?;
15004                }
15005                if self.include_reference {
15006                    __map.serialize_entry("includeReference", &self.include_reference)?;
15007                }
15008                if !::buffa::json_helpers::skip_if::is_empty_str(self.page_token) {
15009                    __map.serialize_entry("pageToken", self.page_token)?;
15010                }
15011                __map.end()
15012            }
15013        }
15014        impl<'a> ::buffa::MessageName for GetCandlesColumnsRequestView<'a> {
15015            const PACKAGE: &'static str = "marketdata.v1";
15016            const NAME: &'static str = "GetCandlesColumnsRequest";
15017            const FULL_NAME: &'static str = "marketdata.v1.GetCandlesColumnsRequest";
15018            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetCandlesColumnsRequest";
15019        }
15020        ::buffa::impl_default_view_instance!(GetCandlesColumnsRequestView);
15021        ::buffa::impl_view_reborrow!(GetCandlesColumnsRequestView);
15022        /** Self-contained, `'static` owned view of a `GetCandlesColumnsRequest` message.
15023
15024 Wraps [`::buffa::OwnedView`]`<`[`GetCandlesColumnsRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
15025
15026 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetCandlesColumnsRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
15027        #[derive(Clone, Debug)]
15028        pub struct GetCandlesColumnsRequestOwnedView(
15029            ::buffa::OwnedView<GetCandlesColumnsRequestView<'static>>,
15030        );
15031        impl GetCandlesColumnsRequestOwnedView {
15032            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
15033            ///
15034            /// The view borrows directly from the buffer's data; the buffer is
15035            /// retained inside the returned handle.
15036            ///
15037            /// # Errors
15038            ///
15039            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
15040            /// protobuf data.
15041            pub fn decode(
15042                bytes: ::buffa::bytes::Bytes,
15043            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15044                ::core::result::Result::Ok(
15045                    GetCandlesColumnsRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
15046                )
15047            }
15048            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
15049            /// max message size).
15050            ///
15051            /// # Errors
15052            ///
15053            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
15054            /// exceeds the configured limits.
15055            pub fn decode_with_options(
15056                bytes: ::buffa::bytes::Bytes,
15057                opts: &::buffa::DecodeOptions,
15058            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15059                ::core::result::Result::Ok(
15060                    GetCandlesColumnsRequestOwnedView(
15061                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
15062                    ),
15063                )
15064            }
15065            /// Build from an owned message via an encode → decode round-trip.
15066            ///
15067            /// # Errors
15068            ///
15069            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
15070            /// somehow invalid (should not happen for well-formed messages).
15071            pub fn from_owned(
15072                msg: &super::super::GetCandlesColumnsRequest,
15073            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15074                ::core::result::Result::Ok(
15075                    GetCandlesColumnsRequestOwnedView(
15076                        ::buffa::OwnedView::from_owned(msg)?,
15077                    ),
15078                )
15079            }
15080            /// Borrow the full [`GetCandlesColumnsRequestView`] with its lifetime tied to `&self`.
15081            #[must_use]
15082            pub fn view(&self) -> &GetCandlesColumnsRequestView<'_> {
15083                self.0.reborrow()
15084            }
15085            /// Convert to the owned message type.
15086            ///
15087            /// # Errors
15088            ///
15089            /// Returns an error if re-materializing preserved unknown fields
15090            /// fails (e.g. the unknown-field limit is exceeded).
15091            pub fn to_owned_message(
15092                &self,
15093            ) -> ::core::result::Result<
15094                super::super::GetCandlesColumnsRequest,
15095                ::buffa::DecodeError,
15096            > {
15097                self.0.to_owned_message()
15098            }
15099            /// The underlying bytes buffer.
15100            #[must_use]
15101            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
15102                self.0.bytes()
15103            }
15104            /// Consume the handle, returning the underlying bytes buffer.
15105            #[must_use]
15106            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
15107                self.0.into_bytes()
15108            }
15109            /// Numeric spot market identifier.
15110            ///
15111            /// Field 1: `symbol_id`
15112            #[must_use]
15113            pub fn symbol_id(&self) -> u32 {
15114                self.0.reborrow().symbol_id
15115            }
15116            /// Candle bucket size. Required for ConnectRPC clients.
15117            ///
15118            /// Field 2: `timeframe`
15119            #[must_use]
15120            pub fn timeframe(&self) -> ::buffa::EnumValue<super::super::Timeframe> {
15121                self.0.reborrow().timeframe
15122            }
15123            /// Maximum number of closed candles to return. Defaults to 500 when unset;
15124            /// max 10000.
15125            ///
15126            /// Field 3: `limit`
15127            #[must_use]
15128            pub fn limit(&self) -> u32 {
15129                self.0.reborrow().limit
15130            }
15131            /// Inclusive lower bound for candle bucket start time, as a UTC timestamp.
15132            /// Must not be more than 5 minutes in the future.
15133            ///
15134            /// Field 4: `start_time`
15135            #[must_use]
15136            pub fn start_time(
15137                &self,
15138            ) -> &::buffa::MessageFieldView<
15139                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
15140            > {
15141                &self.0.reborrow().start_time
15142            }
15143            /// Inclusive upper bound for candle bucket start time, as a UTC timestamp.
15144            /// Must be greater than or equal to start_time when both are set, and must not
15145            /// be more than 5 minutes in the future.
15146            ///
15147            /// Field 5: `end_time`
15148            #[must_use]
15149            pub fn end_time(
15150                &self,
15151            ) -> &::buffa::MessageFieldView<
15152                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
15153            > {
15154                &self.0.reborrow().end_time
15155            }
15156            /// Include the current open candle when it is available and inside the
15157            /// requested range.
15158            /// The open candle is prepended to the newest-first candle list and does not
15159            /// count toward the closed-candle limit.
15160            ///
15161            /// Field 6: `include_incomplete`
15162            #[must_use]
15163            pub fn include_incomplete(&self) -> bool {
15164                self.0.reborrow().include_incomplete
15165            }
15166            /// Include the composite reference market candle series for the same market,
15167            /// timeframe, and time range.
15168            /// The reference series can be empty when no reference series is available for
15169            /// the requested timeframe.
15170            ///
15171            /// Field 7: `include_reference`
15172            #[must_use]
15173            pub fn include_reference(&self) -> bool {
15174                self.0.reborrow().include_reference
15175            }
15176            /// Opaque keyset cursor from a previous response. The cursor is exclusive and
15177            /// bound to symbol, timeframe, time bounds, and oldest-first candle ordering.
15178            /// Inclusion flags and columnar response shape may change between pages.
15179            ///
15180            /// Field 8: `page_token`
15181            #[must_use]
15182            pub fn page_token(&self) -> &'_ str {
15183                self.0.reborrow().page_token
15184            }
15185        }
15186        impl ::core::convert::From<
15187            ::buffa::OwnedView<GetCandlesColumnsRequestView<'static>>,
15188        > for GetCandlesColumnsRequestOwnedView {
15189            fn from(
15190                inner: ::buffa::OwnedView<GetCandlesColumnsRequestView<'static>>,
15191            ) -> Self {
15192                GetCandlesColumnsRequestOwnedView(inner)
15193            }
15194        }
15195        impl ::core::convert::From<GetCandlesColumnsRequestOwnedView>
15196        for ::buffa::OwnedView<GetCandlesColumnsRequestView<'static>> {
15197            fn from(wrapper: GetCandlesColumnsRequestOwnedView) -> Self {
15198                wrapper.0
15199            }
15200        }
15201        impl ::core::convert::AsRef<
15202            ::buffa::OwnedView<GetCandlesColumnsRequestView<'static>>,
15203        > for GetCandlesColumnsRequestOwnedView {
15204            fn as_ref(
15205                &self,
15206            ) -> &::buffa::OwnedView<GetCandlesColumnsRequestView<'static>> {
15207                &self.0
15208            }
15209        }
15210        impl ::buffa::HasMessageView for super::super::GetCandlesColumnsRequest {
15211            type View<'a> = GetCandlesColumnsRequestView<'a>;
15212            type ViewHandle = GetCandlesColumnsRequestOwnedView;
15213        }
15214        impl ::serde::Serialize for GetCandlesColumnsRequestOwnedView {
15215            fn serialize<__S: ::serde::Serializer>(
15216                &self,
15217                __s: __S,
15218            ) -> ::core::result::Result<__S::Ok, __S::Error> {
15219                ::serde::Serialize::serialize(&self.0, __s)
15220            }
15221        }
15222        /// CandlePoint is one OHLCV bucket represented with scaled integers.
15223        ///
15224        /// REST responses render these values as decimal strings in tuple order:
15225        /// \[ts_sec, open, high, low, close, volume\].
15226        #[derive(Clone, Debug, Default)]
15227        pub struct CandlePointView<'a> {
15228            /// Candle bucket start timestamp, in seconds since epoch (UTC).
15229            ///
15230            /// Field 1: `ts_sec`
15231            pub ts_sec: u64,
15232            /// Opening price in quote units scaled by 1e6.
15233            ///
15234            /// Field 2: `open`
15235            pub open: i64,
15236            /// Highest traded price in quote units scaled by 1e6.
15237            ///
15238            /// Field 3: `high`
15239            pub high: i64,
15240            /// Lowest traded price in quote units scaled by 1e6.
15241            ///
15242            /// Field 4: `low`
15243            pub low: i64,
15244            /// Closing price in quote units scaled by 1e6.
15245            ///
15246            /// Field 5: `close`
15247            pub close: i64,
15248            /// Traded base-asset quantity scaled by the market's base asset quantity_scale
15249            /// from GetSpotConfig.
15250            ///
15251            /// Field 6: `volume`
15252            pub volume: i64,
15253            /// True only for WebSocket terminal updates of a closed bucket.
15254            /// Historical API rows and current open-candle rows set this to false.
15255            ///
15256            /// Field 7: `is_closed`
15257            pub is_closed: bool,
15258            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
15259        }
15260        impl<'a> ::buffa::MessageView<'a> for CandlePointView<'a> {
15261            type Owned = super::super::CandlePoint;
15262            fn decode_view(
15263                buf: &'a [u8],
15264            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15265                let __limit = ::core::cell::Cell::new(
15266                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
15267                );
15268                <Self as ::buffa::MessageView>::decode_view_ctx(
15269                    buf,
15270                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
15271                )
15272            }
15273            fn decode_view_with_ctx(
15274                buf: &'a [u8],
15275                ctx: ::buffa::DecodeContext<'_>,
15276            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15277                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
15278            }
15279            fn merge_view_field(
15280                &mut self,
15281                tag: ::buffa::encoding::Tag,
15282                cur: &'a [u8],
15283                before_tag: &'a [u8],
15284                ctx: ::buffa::DecodeContext<'_>,
15285            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
15286                let _ = ctx;
15287                #[allow(unused_variables)]
15288                let view = self;
15289                let mut cur = cur;
15290                match tag.field_number() {
15291                    1u32 => {
15292                        ::buffa::encoding::check_wire_type(
15293                            tag,
15294                            ::buffa::encoding::WireType::Varint,
15295                        )?;
15296                        view.ts_sec = ::buffa::types::decode_uint64(&mut cur)?;
15297                    }
15298                    2u32 => {
15299                        ::buffa::encoding::check_wire_type(
15300                            tag,
15301                            ::buffa::encoding::WireType::Varint,
15302                        )?;
15303                        view.open = ::buffa::types::decode_int64(&mut cur)?;
15304                    }
15305                    3u32 => {
15306                        ::buffa::encoding::check_wire_type(
15307                            tag,
15308                            ::buffa::encoding::WireType::Varint,
15309                        )?;
15310                        view.high = ::buffa::types::decode_int64(&mut cur)?;
15311                    }
15312                    4u32 => {
15313                        ::buffa::encoding::check_wire_type(
15314                            tag,
15315                            ::buffa::encoding::WireType::Varint,
15316                        )?;
15317                        view.low = ::buffa::types::decode_int64(&mut cur)?;
15318                    }
15319                    5u32 => {
15320                        ::buffa::encoding::check_wire_type(
15321                            tag,
15322                            ::buffa::encoding::WireType::Varint,
15323                        )?;
15324                        view.close = ::buffa::types::decode_int64(&mut cur)?;
15325                    }
15326                    6u32 => {
15327                        ::buffa::encoding::check_wire_type(
15328                            tag,
15329                            ::buffa::encoding::WireType::Varint,
15330                        )?;
15331                        view.volume = ::buffa::types::decode_int64(&mut cur)?;
15332                    }
15333                    7u32 => {
15334                        ::buffa::encoding::check_wire_type(
15335                            tag,
15336                            ::buffa::encoding::WireType::Varint,
15337                        )?;
15338                        view.is_closed = ::buffa::types::decode_bool(&mut cur)?;
15339                    }
15340                    _ => {
15341                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
15342                        let span_len = before_tag.len() - cur.len();
15343                        view.__buffa_unknown_fields
15344                            .push_record(before_tag, span_len, ctx)?;
15345                    }
15346                }
15347                ::core::result::Result::Ok(cur)
15348            }
15349            fn to_owned_message(
15350                &self,
15351            ) -> ::core::result::Result<
15352                super::super::CandlePoint,
15353                ::buffa::DecodeError,
15354            > {
15355                self.to_owned_from_source(None)
15356            }
15357            #[allow(clippy::useless_conversion, clippy::needless_update)]
15358            fn to_owned_from_source(
15359                &self,
15360                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
15361            ) -> ::core::result::Result<
15362                super::super::CandlePoint,
15363                ::buffa::DecodeError,
15364            > {
15365                #[allow(unused_imports)]
15366                use ::buffa::alloc::string::ToString as _;
15367                let _ = __buffa_src;
15368                ::core::result::Result::Ok(super::super::CandlePoint {
15369                    ts_sec: self.ts_sec,
15370                    open: self.open,
15371                    high: self.high,
15372                    low: self.low,
15373                    close: self.close,
15374                    volume: self.volume,
15375                    is_closed: self.is_closed,
15376                    __buffa_unknown_fields: self
15377                        .__buffa_unknown_fields
15378                        .to_owned()?
15379                        .into(),
15380                    ..::core::default::Default::default()
15381                })
15382            }
15383        }
15384        impl<'a> ::buffa::ViewEncode<'a> for CandlePointView<'a> {
15385            #[allow(clippy::needless_borrow, clippy::let_and_return)]
15386            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
15387                #[allow(unused_imports)]
15388                use ::buffa::Enumeration as _;
15389                let mut size = 0u32;
15390                if self.ts_sec != 0u64 {
15391                    size
15392                        += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_sec) as u32;
15393                }
15394                if self.open != 0i64 {
15395                    size += 1u32 + ::buffa::types::int64_encoded_len(self.open) as u32;
15396                }
15397                if self.high != 0i64 {
15398                    size += 1u32 + ::buffa::types::int64_encoded_len(self.high) as u32;
15399                }
15400                if self.low != 0i64 {
15401                    size += 1u32 + ::buffa::types::int64_encoded_len(self.low) as u32;
15402                }
15403                if self.close != 0i64 {
15404                    size += 1u32 + ::buffa::types::int64_encoded_len(self.close) as u32;
15405                }
15406                if self.volume != 0i64 {
15407                    size += 1u32 + ::buffa::types::int64_encoded_len(self.volume) as u32;
15408                }
15409                if self.is_closed {
15410                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
15411                }
15412                size += self.__buffa_unknown_fields.encoded_len() as u32;
15413                size
15414            }
15415            #[allow(clippy::needless_borrow)]
15416            fn write_to(
15417                &self,
15418                _cache: &mut ::buffa::SizeCache,
15419                buf: &mut impl ::buffa::bytes::BufMut,
15420            ) {
15421                #[allow(unused_imports)]
15422                use ::buffa::Enumeration as _;
15423                if self.ts_sec != 0u64 {
15424                    ::buffa::types::put_uint64_field(1u32, self.ts_sec, buf);
15425                }
15426                if self.open != 0i64 {
15427                    ::buffa::types::put_int64_field(2u32, self.open, buf);
15428                }
15429                if self.high != 0i64 {
15430                    ::buffa::types::put_int64_field(3u32, self.high, buf);
15431                }
15432                if self.low != 0i64 {
15433                    ::buffa::types::put_int64_field(4u32, self.low, buf);
15434                }
15435                if self.close != 0i64 {
15436                    ::buffa::types::put_int64_field(5u32, self.close, buf);
15437                }
15438                if self.volume != 0i64 {
15439                    ::buffa::types::put_int64_field(6u32, self.volume, buf);
15440                }
15441                if self.is_closed {
15442                    ::buffa::types::put_bool_field(7u32, self.is_closed, buf);
15443                }
15444                self.__buffa_unknown_fields.write_to(buf);
15445            }
15446        }
15447        /// Serializes this view as protobuf JSON.
15448        ///
15449        /// Implicit-presence fields with default values are omitted, `required`
15450        /// fields are always emitted, explicit-presence (`optional`) fields are
15451        /// emitted only when set, bytes fields are base64-encoded, and enum
15452        /// values are their proto name strings.
15453        ///
15454        /// This impl uses `serialize_map(None)` because the number of emitted
15455        /// fields depends on default-omission rules; serializers that require
15456        /// known map lengths (e.g. `bincode`) will return a runtime error.
15457        /// Use the owned message type for those formats.
15458        impl<'__a> ::serde::Serialize for CandlePointView<'__a> {
15459            fn serialize<__S: ::serde::Serializer>(
15460                &self,
15461                __s: __S,
15462            ) -> ::core::result::Result<__S::Ok, __S::Error> {
15463                use ::serde::ser::SerializeMap as _;
15464                let mut __map = __s.serialize_map(::core::option::Option::None)?;
15465                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_sec) {
15466                    __map
15467                        .serialize_entry(
15468                            "tsSec",
15469                            &::buffa::json_helpers::ProtoJson(&self.ts_sec),
15470                        )?;
15471                }
15472                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.open) {
15473                    __map
15474                        .serialize_entry(
15475                            "open",
15476                            &::buffa::json_helpers::ProtoJson(&self.open),
15477                        )?;
15478                }
15479                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.high) {
15480                    __map
15481                        .serialize_entry(
15482                            "high",
15483                            &::buffa::json_helpers::ProtoJson(&self.high),
15484                        )?;
15485                }
15486                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.low) {
15487                    __map
15488                        .serialize_entry(
15489                            "low",
15490                            &::buffa::json_helpers::ProtoJson(&self.low),
15491                        )?;
15492                }
15493                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.close) {
15494                    __map
15495                        .serialize_entry(
15496                            "close",
15497                            &::buffa::json_helpers::ProtoJson(&self.close),
15498                        )?;
15499                }
15500                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.volume) {
15501                    __map
15502                        .serialize_entry(
15503                            "volume",
15504                            &::buffa::json_helpers::ProtoJson(&self.volume),
15505                        )?;
15506                }
15507                if self.is_closed {
15508                    __map.serialize_entry("isClosed", &self.is_closed)?;
15509                }
15510                __map.end()
15511            }
15512        }
15513        impl<'a> ::buffa::MessageName for CandlePointView<'a> {
15514            const PACKAGE: &'static str = "marketdata.v1";
15515            const NAME: &'static str = "CandlePoint";
15516            const FULL_NAME: &'static str = "marketdata.v1.CandlePoint";
15517            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.CandlePoint";
15518        }
15519        ::buffa::impl_default_view_instance!(CandlePointView);
15520        ::buffa::impl_view_reborrow!(CandlePointView);
15521        /** Self-contained, `'static` owned view of a `CandlePoint` message.
15522
15523 Wraps [`::buffa::OwnedView`]`<`[`CandlePointView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
15524
15525 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CandlePointView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
15526        #[derive(Clone, Debug)]
15527        pub struct CandlePointOwnedView(::buffa::OwnedView<CandlePointView<'static>>);
15528        impl CandlePointOwnedView {
15529            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
15530            ///
15531            /// The view borrows directly from the buffer's data; the buffer is
15532            /// retained inside the returned handle.
15533            ///
15534            /// # Errors
15535            ///
15536            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
15537            /// protobuf data.
15538            pub fn decode(
15539                bytes: ::buffa::bytes::Bytes,
15540            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15541                ::core::result::Result::Ok(
15542                    CandlePointOwnedView(::buffa::OwnedView::decode(bytes)?),
15543                )
15544            }
15545            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
15546            /// max message size).
15547            ///
15548            /// # Errors
15549            ///
15550            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
15551            /// exceeds the configured limits.
15552            pub fn decode_with_options(
15553                bytes: ::buffa::bytes::Bytes,
15554                opts: &::buffa::DecodeOptions,
15555            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15556                ::core::result::Result::Ok(
15557                    CandlePointOwnedView(
15558                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
15559                    ),
15560                )
15561            }
15562            /// Build from an owned message via an encode → decode round-trip.
15563            ///
15564            /// # Errors
15565            ///
15566            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
15567            /// somehow invalid (should not happen for well-formed messages).
15568            pub fn from_owned(
15569                msg: &super::super::CandlePoint,
15570            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15571                ::core::result::Result::Ok(
15572                    CandlePointOwnedView(::buffa::OwnedView::from_owned(msg)?),
15573                )
15574            }
15575            /// Borrow the full [`CandlePointView`] with its lifetime tied to `&self`.
15576            #[must_use]
15577            pub fn view(&self) -> &CandlePointView<'_> {
15578                self.0.reborrow()
15579            }
15580            /// Convert to the owned message type.
15581            ///
15582            /// # Errors
15583            ///
15584            /// Returns an error if re-materializing preserved unknown fields
15585            /// fails (e.g. the unknown-field limit is exceeded).
15586            pub fn to_owned_message(
15587                &self,
15588            ) -> ::core::result::Result<
15589                super::super::CandlePoint,
15590                ::buffa::DecodeError,
15591            > {
15592                self.0.to_owned_message()
15593            }
15594            /// The underlying bytes buffer.
15595            #[must_use]
15596            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
15597                self.0.bytes()
15598            }
15599            /// Consume the handle, returning the underlying bytes buffer.
15600            #[must_use]
15601            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
15602                self.0.into_bytes()
15603            }
15604            /// Candle bucket start timestamp, in seconds since epoch (UTC).
15605            ///
15606            /// Field 1: `ts_sec`
15607            #[must_use]
15608            pub fn ts_sec(&self) -> u64 {
15609                self.0.reborrow().ts_sec
15610            }
15611            /// Opening price in quote units scaled by 1e6.
15612            ///
15613            /// Field 2: `open`
15614            #[must_use]
15615            pub fn open(&self) -> i64 {
15616                self.0.reborrow().open
15617            }
15618            /// Highest traded price in quote units scaled by 1e6.
15619            ///
15620            /// Field 3: `high`
15621            #[must_use]
15622            pub fn high(&self) -> i64 {
15623                self.0.reborrow().high
15624            }
15625            /// Lowest traded price in quote units scaled by 1e6.
15626            ///
15627            /// Field 4: `low`
15628            #[must_use]
15629            pub fn low(&self) -> i64 {
15630                self.0.reborrow().low
15631            }
15632            /// Closing price in quote units scaled by 1e6.
15633            ///
15634            /// Field 5: `close`
15635            #[must_use]
15636            pub fn close(&self) -> i64 {
15637                self.0.reborrow().close
15638            }
15639            /// Traded base-asset quantity scaled by the market's base asset quantity_scale
15640            /// from GetSpotConfig.
15641            ///
15642            /// Field 6: `volume`
15643            #[must_use]
15644            pub fn volume(&self) -> i64 {
15645                self.0.reborrow().volume
15646            }
15647            /// True only for WebSocket terminal updates of a closed bucket.
15648            /// Historical API rows and current open-candle rows set this to false.
15649            ///
15650            /// Field 7: `is_closed`
15651            #[must_use]
15652            pub fn is_closed(&self) -> bool {
15653                self.0.reborrow().is_closed
15654            }
15655        }
15656        impl ::core::convert::From<::buffa::OwnedView<CandlePointView<'static>>>
15657        for CandlePointOwnedView {
15658            fn from(inner: ::buffa::OwnedView<CandlePointView<'static>>) -> Self {
15659                CandlePointOwnedView(inner)
15660            }
15661        }
15662        impl ::core::convert::From<CandlePointOwnedView>
15663        for ::buffa::OwnedView<CandlePointView<'static>> {
15664            fn from(wrapper: CandlePointOwnedView) -> Self {
15665                wrapper.0
15666            }
15667        }
15668        impl ::core::convert::AsRef<::buffa::OwnedView<CandlePointView<'static>>>
15669        for CandlePointOwnedView {
15670            fn as_ref(&self) -> &::buffa::OwnedView<CandlePointView<'static>> {
15671                &self.0
15672            }
15673        }
15674        impl ::buffa::HasMessageView for super::super::CandlePoint {
15675            type View<'a> = CandlePointView<'a>;
15676            type ViewHandle = CandlePointOwnedView;
15677        }
15678        impl ::serde::Serialize for CandlePointOwnedView {
15679            fn serialize<__S: ::serde::Serializer>(
15680                &self,
15681                __s: __S,
15682            ) -> ::core::result::Result<__S::Ok, __S::Error> {
15683                ::serde::Serialize::serialize(&self.0, __s)
15684            }
15685        }
15686        /// GetCandlesResponse contains OHLCV candles for one spot market and timeframe.
15687        ///
15688        /// Candles and reference_candles are ordered newest-first by ts_sec. REST
15689        /// responses render price and volume values as decimal strings.
15690        #[derive(Clone, Debug, Default)]
15691        pub struct GetCandlesResponseView<'a> {
15692            /// Numeric spot market identifier echoed from the request.
15693            ///
15694            /// Field 1: `symbol_id`
15695            pub symbol_id: u32,
15696            /// Candle bucket size used for the returned series.
15697            ///
15698            /// Field 2: `timeframe`
15699            pub timeframe: ::buffa::EnumValue<super::super::Timeframe>,
15700            /// Primary market candle series, ordered newest-first by ts_sec.
15701            ///
15702            /// Field 3: `candles`
15703            pub candles: ::buffa::RepeatedView<
15704                'a,
15705                super::super::__buffa::view::CandlePointView<'a>,
15706            >,
15707            /// Composite reference market candle series, ordered newest-first by ts_sec.
15708            /// Populated only when include_reference is true and reference data is
15709            /// available.
15710            ///
15711            /// Field 4: `reference_candles`
15712            pub reference_candles: ::buffa::RepeatedView<
15713                'a,
15714                super::super::__buffa::view::CandlePointView<'a>,
15715            >,
15716            /// Opaque cursor for the next page. Empty when no more results exist.
15717            ///
15718            /// Field 5: `next_page_token`
15719            pub next_page_token: &'a str,
15720            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
15721        }
15722        impl<'a> ::buffa::MessageView<'a> for GetCandlesResponseView<'a> {
15723            type Owned = super::super::GetCandlesResponse;
15724            fn decode_view(
15725                buf: &'a [u8],
15726            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15727                let __limit = ::core::cell::Cell::new(
15728                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
15729                );
15730                <Self as ::buffa::MessageView>::decode_view_ctx(
15731                    buf,
15732                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
15733                )
15734            }
15735            fn decode_view_with_ctx(
15736                buf: &'a [u8],
15737                ctx: ::buffa::DecodeContext<'_>,
15738            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15739                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
15740            }
15741            fn merge_view_field(
15742                &mut self,
15743                tag: ::buffa::encoding::Tag,
15744                cur: &'a [u8],
15745                before_tag: &'a [u8],
15746                ctx: ::buffa::DecodeContext<'_>,
15747            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
15748                let _ = ctx;
15749                #[allow(unused_variables)]
15750                let view = self;
15751                let mut cur = cur;
15752                match tag.field_number() {
15753                    1u32 => {
15754                        ::buffa::encoding::check_wire_type(
15755                            tag,
15756                            ::buffa::encoding::WireType::Varint,
15757                        )?;
15758                        view.symbol_id = ::buffa::types::decode_uint32(&mut cur)?;
15759                    }
15760                    2u32 => {
15761                        ::buffa::encoding::check_wire_type(
15762                            tag,
15763                            ::buffa::encoding::WireType::Varint,
15764                        )?;
15765                        view.timeframe = ::buffa::EnumValue::from(
15766                            ::buffa::types::decode_int32(&mut cur)?,
15767                        );
15768                    }
15769                    5u32 => {
15770                        ::buffa::encoding::check_wire_type(
15771                            tag,
15772                            ::buffa::encoding::WireType::LengthDelimited,
15773                        )?;
15774                        view.next_page_token = ::buffa::types::borrow_str(&mut cur)?;
15775                    }
15776                    3u32 => {
15777                        ::buffa::encoding::check_wire_type(
15778                            tag,
15779                            ::buffa::encoding::WireType::LengthDelimited,
15780                        )?;
15781                        let __sub_ctx = ctx.descend()?;
15782                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
15783                        view.candles
15784                            .push(
15785                                <super::super::__buffa::view::CandlePointView as ::buffa::MessageView>::decode_view_ctx(
15786                                    sub,
15787                                    __sub_ctx,
15788                                )?,
15789                            );
15790                    }
15791                    4u32 => {
15792                        ::buffa::encoding::check_wire_type(
15793                            tag,
15794                            ::buffa::encoding::WireType::LengthDelimited,
15795                        )?;
15796                        let __sub_ctx = ctx.descend()?;
15797                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
15798                        view.reference_candles
15799                            .push(
15800                                <super::super::__buffa::view::CandlePointView as ::buffa::MessageView>::decode_view_ctx(
15801                                    sub,
15802                                    __sub_ctx,
15803                                )?,
15804                            );
15805                    }
15806                    _ => {
15807                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
15808                        let span_len = before_tag.len() - cur.len();
15809                        view.__buffa_unknown_fields
15810                            .push_record(before_tag, span_len, ctx)?;
15811                    }
15812                }
15813                ::core::result::Result::Ok(cur)
15814            }
15815            fn to_owned_message(
15816                &self,
15817            ) -> ::core::result::Result<
15818                super::super::GetCandlesResponse,
15819                ::buffa::DecodeError,
15820            > {
15821                self.to_owned_from_source(None)
15822            }
15823            #[allow(clippy::useless_conversion, clippy::needless_update)]
15824            fn to_owned_from_source(
15825                &self,
15826                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
15827            ) -> ::core::result::Result<
15828                super::super::GetCandlesResponse,
15829                ::buffa::DecodeError,
15830            > {
15831                #[allow(unused_imports)]
15832                use ::buffa::alloc::string::ToString as _;
15833                let _ = __buffa_src;
15834                ::core::result::Result::Ok(super::super::GetCandlesResponse {
15835                    symbol_id: self.symbol_id,
15836                    timeframe: self.timeframe,
15837                    candles: self
15838                        .candles
15839                        .iter()
15840                        .map(|v| v.to_owned_from_source(__buffa_src))
15841                        .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
15842                    reference_candles: self
15843                        .reference_candles
15844                        .iter()
15845                        .map(|v| v.to_owned_from_source(__buffa_src))
15846                        .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
15847                    next_page_token: self.next_page_token.to_string(),
15848                    __buffa_unknown_fields: self
15849                        .__buffa_unknown_fields
15850                        .to_owned()?
15851                        .into(),
15852                    ..::core::default::Default::default()
15853                })
15854            }
15855        }
15856        impl<'a> ::buffa::ViewEncode<'a> for GetCandlesResponseView<'a> {
15857            #[allow(clippy::needless_borrow, clippy::let_and_return)]
15858            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
15859                #[allow(unused_imports)]
15860                use ::buffa::Enumeration as _;
15861                let mut size = 0u32;
15862                if self.symbol_id != 0u32 {
15863                    size
15864                        += 1u32
15865                            + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
15866                }
15867                {
15868                    let val = self.timeframe.to_i32();
15869                    if val != 0 {
15870                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
15871                    }
15872                }
15873                for v in &self.candles {
15874                    let __slot = __cache.reserve();
15875                    let inner_size = v.compute_size(__cache);
15876                    __cache.set(__slot, inner_size);
15877                    size
15878                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
15879                            + inner_size;
15880                }
15881                for v in &self.reference_candles {
15882                    let __slot = __cache.reserve();
15883                    let inner_size = v.compute_size(__cache);
15884                    __cache.set(__slot, inner_size);
15885                    size
15886                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
15887                            + inner_size;
15888                }
15889                if !self.next_page_token.is_empty() {
15890                    size
15891                        += 1u32
15892                            + ::buffa::types::string_encoded_len(&self.next_page_token)
15893                                as u32;
15894                }
15895                size += self.__buffa_unknown_fields.encoded_len() as u32;
15896                size
15897            }
15898            #[allow(clippy::needless_borrow)]
15899            fn write_to(
15900                &self,
15901                __cache: &mut ::buffa::SizeCache,
15902                buf: &mut impl ::buffa::bytes::BufMut,
15903            ) {
15904                #[allow(unused_imports)]
15905                use ::buffa::Enumeration as _;
15906                if self.symbol_id != 0u32 {
15907                    ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
15908                }
15909                {
15910                    let val = self.timeframe.to_i32();
15911                    if val != 0 {
15912                        ::buffa::types::put_int32_field(2u32, val, buf);
15913                    }
15914                }
15915                for v in &self.candles {
15916                    ::buffa::types::put_len_delimited_header(
15917                        3u32,
15918                        __cache.consume_next(),
15919                        buf,
15920                    );
15921                    v.write_to(__cache, buf);
15922                }
15923                for v in &self.reference_candles {
15924                    ::buffa::types::put_len_delimited_header(
15925                        4u32,
15926                        __cache.consume_next(),
15927                        buf,
15928                    );
15929                    v.write_to(__cache, buf);
15930                }
15931                if !self.next_page_token.is_empty() {
15932                    ::buffa::types::put_string_field(5u32, &self.next_page_token, buf);
15933                }
15934                self.__buffa_unknown_fields.write_to(buf);
15935            }
15936        }
15937        /// Serializes this view as protobuf JSON.
15938        ///
15939        /// Implicit-presence fields with default values are omitted, `required`
15940        /// fields are always emitted, explicit-presence (`optional`) fields are
15941        /// emitted only when set, bytes fields are base64-encoded, and enum
15942        /// values are their proto name strings.
15943        ///
15944        /// This impl uses `serialize_map(None)` because the number of emitted
15945        /// fields depends on default-omission rules; serializers that require
15946        /// known map lengths (e.g. `bincode`) will return a runtime error.
15947        /// Use the owned message type for those formats.
15948        impl<'__a> ::serde::Serialize for GetCandlesResponseView<'__a> {
15949            fn serialize<__S: ::serde::Serializer>(
15950                &self,
15951                __s: __S,
15952            ) -> ::core::result::Result<__S::Ok, __S::Error> {
15953                use ::serde::ser::SerializeMap as _;
15954                let mut __map = __s.serialize_map(::core::option::Option::None)?;
15955                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.symbol_id) {
15956                    __map
15957                        .serialize_entry(
15958                            "symbolId",
15959                            &::buffa::json_helpers::ProtoJson(&self.symbol_id),
15960                        )?;
15961                }
15962                if !::buffa::json_helpers::skip_if::is_default_enum_value(
15963                    &self.timeframe,
15964                ) {
15965                    __map.serialize_entry("timeframe", &self.timeframe)?;
15966                }
15967                if !self.candles.is_empty() {
15968                    __map.serialize_entry("candles", &*self.candles)?;
15969                }
15970                if !self.reference_candles.is_empty() {
15971                    __map.serialize_entry("referenceCandles", &*self.reference_candles)?;
15972                }
15973                if !::buffa::json_helpers::skip_if::is_empty_str(self.next_page_token) {
15974                    __map.serialize_entry("nextPageToken", self.next_page_token)?;
15975                }
15976                __map.end()
15977            }
15978        }
15979        impl<'a> ::buffa::MessageName for GetCandlesResponseView<'a> {
15980            const PACKAGE: &'static str = "marketdata.v1";
15981            const NAME: &'static str = "GetCandlesResponse";
15982            const FULL_NAME: &'static str = "marketdata.v1.GetCandlesResponse";
15983            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetCandlesResponse";
15984        }
15985        ::buffa::impl_default_view_instance!(GetCandlesResponseView);
15986        ::buffa::impl_view_reborrow!(GetCandlesResponseView);
15987        /** Self-contained, `'static` owned view of a `GetCandlesResponse` message.
15988
15989 Wraps [`::buffa::OwnedView`]`<`[`GetCandlesResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
15990
15991 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetCandlesResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
15992        #[derive(Clone, Debug)]
15993        pub struct GetCandlesResponseOwnedView(
15994            ::buffa::OwnedView<GetCandlesResponseView<'static>>,
15995        );
15996        impl GetCandlesResponseOwnedView {
15997            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
15998            ///
15999            /// The view borrows directly from the buffer's data; the buffer is
16000            /// retained inside the returned handle.
16001            ///
16002            /// # Errors
16003            ///
16004            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
16005            /// protobuf data.
16006            pub fn decode(
16007                bytes: ::buffa::bytes::Bytes,
16008            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16009                ::core::result::Result::Ok(
16010                    GetCandlesResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
16011                )
16012            }
16013            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
16014            /// max message size).
16015            ///
16016            /// # Errors
16017            ///
16018            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
16019            /// exceeds the configured limits.
16020            pub fn decode_with_options(
16021                bytes: ::buffa::bytes::Bytes,
16022                opts: &::buffa::DecodeOptions,
16023            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16024                ::core::result::Result::Ok(
16025                    GetCandlesResponseOwnedView(
16026                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
16027                    ),
16028                )
16029            }
16030            /// Build from an owned message via an encode → decode round-trip.
16031            ///
16032            /// # Errors
16033            ///
16034            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
16035            /// somehow invalid (should not happen for well-formed messages).
16036            pub fn from_owned(
16037                msg: &super::super::GetCandlesResponse,
16038            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16039                ::core::result::Result::Ok(
16040                    GetCandlesResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
16041                )
16042            }
16043            /// Borrow the full [`GetCandlesResponseView`] with its lifetime tied to `&self`.
16044            #[must_use]
16045            pub fn view(&self) -> &GetCandlesResponseView<'_> {
16046                self.0.reborrow()
16047            }
16048            /// Convert to the owned message type.
16049            ///
16050            /// # Errors
16051            ///
16052            /// Returns an error if re-materializing preserved unknown fields
16053            /// fails (e.g. the unknown-field limit is exceeded).
16054            pub fn to_owned_message(
16055                &self,
16056            ) -> ::core::result::Result<
16057                super::super::GetCandlesResponse,
16058                ::buffa::DecodeError,
16059            > {
16060                self.0.to_owned_message()
16061            }
16062            /// The underlying bytes buffer.
16063            #[must_use]
16064            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
16065                self.0.bytes()
16066            }
16067            /// Consume the handle, returning the underlying bytes buffer.
16068            #[must_use]
16069            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
16070                self.0.into_bytes()
16071            }
16072            /// Numeric spot market identifier echoed from the request.
16073            ///
16074            /// Field 1: `symbol_id`
16075            #[must_use]
16076            pub fn symbol_id(&self) -> u32 {
16077                self.0.reborrow().symbol_id
16078            }
16079            /// Candle bucket size used for the returned series.
16080            ///
16081            /// Field 2: `timeframe`
16082            #[must_use]
16083            pub fn timeframe(&self) -> ::buffa::EnumValue<super::super::Timeframe> {
16084                self.0.reborrow().timeframe
16085            }
16086            /// Primary market candle series, ordered newest-first by ts_sec.
16087            ///
16088            /// Field 3: `candles`
16089            #[must_use]
16090            pub fn candles(
16091                &self,
16092            ) -> &::buffa::RepeatedView<
16093                '_,
16094                super::super::__buffa::view::CandlePointView<'_>,
16095            > {
16096                &self.0.reborrow().candles
16097            }
16098            /// Composite reference market candle series, ordered newest-first by ts_sec.
16099            /// Populated only when include_reference is true and reference data is
16100            /// available.
16101            ///
16102            /// Field 4: `reference_candles`
16103            #[must_use]
16104            pub fn reference_candles(
16105                &self,
16106            ) -> &::buffa::RepeatedView<
16107                '_,
16108                super::super::__buffa::view::CandlePointView<'_>,
16109            > {
16110                &self.0.reborrow().reference_candles
16111            }
16112            /// Opaque cursor for the next page. Empty when no more results exist.
16113            ///
16114            /// Field 5: `next_page_token`
16115            #[must_use]
16116            pub fn next_page_token(&self) -> &'_ str {
16117                self.0.reborrow().next_page_token
16118            }
16119        }
16120        impl ::core::convert::From<::buffa::OwnedView<GetCandlesResponseView<'static>>>
16121        for GetCandlesResponseOwnedView {
16122            fn from(inner: ::buffa::OwnedView<GetCandlesResponseView<'static>>) -> Self {
16123                GetCandlesResponseOwnedView(inner)
16124            }
16125        }
16126        impl ::core::convert::From<GetCandlesResponseOwnedView>
16127        for ::buffa::OwnedView<GetCandlesResponseView<'static>> {
16128            fn from(wrapper: GetCandlesResponseOwnedView) -> Self {
16129                wrapper.0
16130            }
16131        }
16132        impl ::core::convert::AsRef<::buffa::OwnedView<GetCandlesResponseView<'static>>>
16133        for GetCandlesResponseOwnedView {
16134            fn as_ref(&self) -> &::buffa::OwnedView<GetCandlesResponseView<'static>> {
16135                &self.0
16136            }
16137        }
16138        impl ::buffa::HasMessageView for super::super::GetCandlesResponse {
16139            type View<'a> = GetCandlesResponseView<'a>;
16140            type ViewHandle = GetCandlesResponseOwnedView;
16141        }
16142        impl ::serde::Serialize for GetCandlesResponseOwnedView {
16143            fn serialize<__S: ::serde::Serializer>(
16144                &self,
16145                __s: __S,
16146            ) -> ::core::result::Result<__S::Ok, __S::Error> {
16147                ::serde::Serialize::serialize(&self.0, __s)
16148            }
16149        }
16150        /// GetCandlesColumnsResponse returns the same candle series as GetCandles but in columnar form.
16151        /// This is optimized for charting clients that ingest arrays of each field (binary only).
16152        ///
16153        /// Ordering: values are returned oldest-first (ascending ts_sec).
16154        #[derive(Clone, Debug, Default)]
16155        pub struct GetCandlesColumnsResponseView<'a> {
16156            /// Numeric spot market identifier.
16157            ///
16158            /// Field 1: `symbol_id`
16159            pub symbol_id: u32,
16160            /// Timeframe of this series.
16161            ///
16162            /// Field 2: `timeframe`
16163            pub timeframe: ::buffa::EnumValue<super::super::Timeframe>,
16164            /// Candle bucket start timestamps (seconds since epoch, UTC).
16165            ///
16166            /// Field 3: `ts_sec`
16167            pub ts_sec: ::buffa::RepeatedView<'a, u64>,
16168            /// Opening prices in quote units scaled by 1e6.
16169            ///
16170            /// Field 4: `open`
16171            pub open: ::buffa::RepeatedView<'a, i64>,
16172            /// Highest traded prices in quote units scaled by 1e6.
16173            ///
16174            /// Field 5: `high`
16175            pub high: ::buffa::RepeatedView<'a, i64>,
16176            /// Lowest traded prices in quote units scaled by 1e6.
16177            ///
16178            /// Field 6: `low`
16179            pub low: ::buffa::RepeatedView<'a, i64>,
16180            /// Closing prices in quote units scaled by 1e6.
16181            ///
16182            /// Field 7: `close`
16183            pub close: ::buffa::RepeatedView<'a, i64>,
16184            /// Traded base-asset quantities scaled by the pair's base_quantity_scale from
16185            /// GetSpotConfig.
16186            ///
16187            /// Field 8: `volume`
16188            pub volume: ::buffa::RepeatedView<'a, i64>,
16189            /// Reference candle series in columnar form (same ordering as ts_sec: oldest-first).
16190            /// Only populated when request.include_reference=true.
16191            ///
16192            /// Field 9: `reference_ts_sec`
16193            pub reference_ts_sec: ::buffa::RepeatedView<'a, u64>,
16194            /// Reference opening prices in quote units scaled by 1e6.
16195            ///
16196            /// Field 10: `reference_open`
16197            pub reference_open: ::buffa::RepeatedView<'a, i64>,
16198            /// Reference high prices in quote units scaled by 1e6.
16199            ///
16200            /// Field 11: `reference_high`
16201            pub reference_high: ::buffa::RepeatedView<'a, i64>,
16202            /// Reference low prices in quote units scaled by 1e6.
16203            ///
16204            /// Field 12: `reference_low`
16205            pub reference_low: ::buffa::RepeatedView<'a, i64>,
16206            /// Reference closing prices in quote units scaled by 1e6.
16207            ///
16208            /// Field 13: `reference_close`
16209            pub reference_close: ::buffa::RepeatedView<'a, i64>,
16210            /// Reference traded base-asset quantities scaled by the pair's
16211            /// base_quantity_scale from GetSpotConfig.
16212            ///
16213            /// Field 14: `reference_volume`
16214            pub reference_volume: ::buffa::RepeatedView<'a, i64>,
16215            /// Opaque cursor for the next page. Empty when no more results exist.
16216            ///
16217            /// Field 15: `next_page_token`
16218            pub next_page_token: &'a str,
16219            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
16220        }
16221        impl<'a> ::buffa::MessageView<'a> for GetCandlesColumnsResponseView<'a> {
16222            type Owned = super::super::GetCandlesColumnsResponse;
16223            fn decode_view(
16224                buf: &'a [u8],
16225            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16226                let __limit = ::core::cell::Cell::new(
16227                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
16228                );
16229                <Self as ::buffa::MessageView>::decode_view_ctx(
16230                    buf,
16231                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
16232                )
16233            }
16234            fn decode_view_with_ctx(
16235                buf: &'a [u8],
16236                ctx: ::buffa::DecodeContext<'_>,
16237            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
16238                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
16239            }
16240            fn merge_view_field(
16241                &mut self,
16242                tag: ::buffa::encoding::Tag,
16243                cur: &'a [u8],
16244                before_tag: &'a [u8],
16245                ctx: ::buffa::DecodeContext<'_>,
16246            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
16247                let _ = ctx;
16248                #[allow(unused_variables)]
16249                let view = self;
16250                let mut cur = cur;
16251                match tag.field_number() {
16252                    1u32 => {
16253                        ::buffa::encoding::check_wire_type(
16254                            tag,
16255                            ::buffa::encoding::WireType::Varint,
16256                        )?;
16257                        view.symbol_id = ::buffa::types::decode_uint32(&mut cur)?;
16258                    }
16259                    2u32 => {
16260                        ::buffa::encoding::check_wire_type(
16261                            tag,
16262                            ::buffa::encoding::WireType::Varint,
16263                        )?;
16264                        view.timeframe = ::buffa::EnumValue::from(
16265                            ::buffa::types::decode_int32(&mut cur)?,
16266                        );
16267                    }
16268                    15u32 => {
16269                        ::buffa::encoding::check_wire_type(
16270                            tag,
16271                            ::buffa::encoding::WireType::LengthDelimited,
16272                        )?;
16273                        view.next_page_token = ::buffa::types::borrow_str(&mut cur)?;
16274                    }
16275                    3u32 => {
16276                        if tag.wire_type()
16277                            == ::buffa::encoding::WireType::LengthDelimited
16278                        {
16279                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
16280                            view.ts_sec
16281                                .reserve(::buffa::encoding::count_varints(payload));
16282                            let mut pcur: &[u8] = payload;
16283                            while !pcur.is_empty() {
16284                                view.ts_sec.push(::buffa::types::decode_uint64(&mut pcur)?);
16285                            }
16286                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
16287                        {
16288                            view.ts_sec.push(::buffa::types::decode_uint64(&mut cur)?);
16289                        } else {
16290                            return Err(
16291                                ::buffa::encoding::wire_type_mismatch(
16292                                    tag,
16293                                    ::buffa::encoding::WireType::LengthDelimited,
16294                                ),
16295                            );
16296                        }
16297                    }
16298                    4u32 => {
16299                        if tag.wire_type()
16300                            == ::buffa::encoding::WireType::LengthDelimited
16301                        {
16302                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
16303                            view.open.reserve(::buffa::encoding::count_varints(payload));
16304                            let mut pcur: &[u8] = payload;
16305                            while !pcur.is_empty() {
16306                                view.open.push(::buffa::types::decode_int64(&mut pcur)?);
16307                            }
16308                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
16309                        {
16310                            view.open.push(::buffa::types::decode_int64(&mut cur)?);
16311                        } else {
16312                            return Err(
16313                                ::buffa::encoding::wire_type_mismatch(
16314                                    tag,
16315                                    ::buffa::encoding::WireType::LengthDelimited,
16316                                ),
16317                            );
16318                        }
16319                    }
16320                    5u32 => {
16321                        if tag.wire_type()
16322                            == ::buffa::encoding::WireType::LengthDelimited
16323                        {
16324                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
16325                            view.high.reserve(::buffa::encoding::count_varints(payload));
16326                            let mut pcur: &[u8] = payload;
16327                            while !pcur.is_empty() {
16328                                view.high.push(::buffa::types::decode_int64(&mut pcur)?);
16329                            }
16330                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
16331                        {
16332                            view.high.push(::buffa::types::decode_int64(&mut cur)?);
16333                        } else {
16334                            return Err(
16335                                ::buffa::encoding::wire_type_mismatch(
16336                                    tag,
16337                                    ::buffa::encoding::WireType::LengthDelimited,
16338                                ),
16339                            );
16340                        }
16341                    }
16342                    6u32 => {
16343                        if tag.wire_type()
16344                            == ::buffa::encoding::WireType::LengthDelimited
16345                        {
16346                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
16347                            view.low.reserve(::buffa::encoding::count_varints(payload));
16348                            let mut pcur: &[u8] = payload;
16349                            while !pcur.is_empty() {
16350                                view.low.push(::buffa::types::decode_int64(&mut pcur)?);
16351                            }
16352                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
16353                        {
16354                            view.low.push(::buffa::types::decode_int64(&mut cur)?);
16355                        } else {
16356                            return Err(
16357                                ::buffa::encoding::wire_type_mismatch(
16358                                    tag,
16359                                    ::buffa::encoding::WireType::LengthDelimited,
16360                                ),
16361                            );
16362                        }
16363                    }
16364                    7u32 => {
16365                        if tag.wire_type()
16366                            == ::buffa::encoding::WireType::LengthDelimited
16367                        {
16368                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
16369                            view.close
16370                                .reserve(::buffa::encoding::count_varints(payload));
16371                            let mut pcur: &[u8] = payload;
16372                            while !pcur.is_empty() {
16373                                view.close.push(::buffa::types::decode_int64(&mut pcur)?);
16374                            }
16375                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
16376                        {
16377                            view.close.push(::buffa::types::decode_int64(&mut cur)?);
16378                        } else {
16379                            return Err(
16380                                ::buffa::encoding::wire_type_mismatch(
16381                                    tag,
16382                                    ::buffa::encoding::WireType::LengthDelimited,
16383                                ),
16384                            );
16385                        }
16386                    }
16387                    8u32 => {
16388                        if tag.wire_type()
16389                            == ::buffa::encoding::WireType::LengthDelimited
16390                        {
16391                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
16392                            view.volume
16393                                .reserve(::buffa::encoding::count_varints(payload));
16394                            let mut pcur: &[u8] = payload;
16395                            while !pcur.is_empty() {
16396                                view.volume.push(::buffa::types::decode_int64(&mut pcur)?);
16397                            }
16398                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
16399                        {
16400                            view.volume.push(::buffa::types::decode_int64(&mut cur)?);
16401                        } else {
16402                            return Err(
16403                                ::buffa::encoding::wire_type_mismatch(
16404                                    tag,
16405                                    ::buffa::encoding::WireType::LengthDelimited,
16406                                ),
16407                            );
16408                        }
16409                    }
16410                    9u32 => {
16411                        if tag.wire_type()
16412                            == ::buffa::encoding::WireType::LengthDelimited
16413                        {
16414                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
16415                            view.reference_ts_sec
16416                                .reserve(::buffa::encoding::count_varints(payload));
16417                            let mut pcur: &[u8] = payload;
16418                            while !pcur.is_empty() {
16419                                view.reference_ts_sec
16420                                    .push(::buffa::types::decode_uint64(&mut pcur)?);
16421                            }
16422                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
16423                        {
16424                            view.reference_ts_sec
16425                                .push(::buffa::types::decode_uint64(&mut cur)?);
16426                        } else {
16427                            return Err(
16428                                ::buffa::encoding::wire_type_mismatch(
16429                                    tag,
16430                                    ::buffa::encoding::WireType::LengthDelimited,
16431                                ),
16432                            );
16433                        }
16434                    }
16435                    10u32 => {
16436                        if tag.wire_type()
16437                            == ::buffa::encoding::WireType::LengthDelimited
16438                        {
16439                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
16440                            view.reference_open
16441                                .reserve(::buffa::encoding::count_varints(payload));
16442                            let mut pcur: &[u8] = payload;
16443                            while !pcur.is_empty() {
16444                                view.reference_open
16445                                    .push(::buffa::types::decode_int64(&mut pcur)?);
16446                            }
16447                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
16448                        {
16449                            view.reference_open
16450                                .push(::buffa::types::decode_int64(&mut cur)?);
16451                        } else {
16452                            return Err(
16453                                ::buffa::encoding::wire_type_mismatch(
16454                                    tag,
16455                                    ::buffa::encoding::WireType::LengthDelimited,
16456                                ),
16457                            );
16458                        }
16459                    }
16460                    11u32 => {
16461                        if tag.wire_type()
16462                            == ::buffa::encoding::WireType::LengthDelimited
16463                        {
16464                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
16465                            view.reference_high
16466                                .reserve(::buffa::encoding::count_varints(payload));
16467                            let mut pcur: &[u8] = payload;
16468                            while !pcur.is_empty() {
16469                                view.reference_high
16470                                    .push(::buffa::types::decode_int64(&mut pcur)?);
16471                            }
16472                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
16473                        {
16474                            view.reference_high
16475                                .push(::buffa::types::decode_int64(&mut cur)?);
16476                        } else {
16477                            return Err(
16478                                ::buffa::encoding::wire_type_mismatch(
16479                                    tag,
16480                                    ::buffa::encoding::WireType::LengthDelimited,
16481                                ),
16482                            );
16483                        }
16484                    }
16485                    12u32 => {
16486                        if tag.wire_type()
16487                            == ::buffa::encoding::WireType::LengthDelimited
16488                        {
16489                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
16490                            view.reference_low
16491                                .reserve(::buffa::encoding::count_varints(payload));
16492                            let mut pcur: &[u8] = payload;
16493                            while !pcur.is_empty() {
16494                                view.reference_low
16495                                    .push(::buffa::types::decode_int64(&mut pcur)?);
16496                            }
16497                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
16498                        {
16499                            view.reference_low
16500                                .push(::buffa::types::decode_int64(&mut cur)?);
16501                        } else {
16502                            return Err(
16503                                ::buffa::encoding::wire_type_mismatch(
16504                                    tag,
16505                                    ::buffa::encoding::WireType::LengthDelimited,
16506                                ),
16507                            );
16508                        }
16509                    }
16510                    13u32 => {
16511                        if tag.wire_type()
16512                            == ::buffa::encoding::WireType::LengthDelimited
16513                        {
16514                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
16515                            view.reference_close
16516                                .reserve(::buffa::encoding::count_varints(payload));
16517                            let mut pcur: &[u8] = payload;
16518                            while !pcur.is_empty() {
16519                                view.reference_close
16520                                    .push(::buffa::types::decode_int64(&mut pcur)?);
16521                            }
16522                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
16523                        {
16524                            view.reference_close
16525                                .push(::buffa::types::decode_int64(&mut cur)?);
16526                        } else {
16527                            return Err(
16528                                ::buffa::encoding::wire_type_mismatch(
16529                                    tag,
16530                                    ::buffa::encoding::WireType::LengthDelimited,
16531                                ),
16532                            );
16533                        }
16534                    }
16535                    14u32 => {
16536                        if tag.wire_type()
16537                            == ::buffa::encoding::WireType::LengthDelimited
16538                        {
16539                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
16540                            view.reference_volume
16541                                .reserve(::buffa::encoding::count_varints(payload));
16542                            let mut pcur: &[u8] = payload;
16543                            while !pcur.is_empty() {
16544                                view.reference_volume
16545                                    .push(::buffa::types::decode_int64(&mut pcur)?);
16546                            }
16547                        } else if tag.wire_type() == ::buffa::encoding::WireType::Varint
16548                        {
16549                            view.reference_volume
16550                                .push(::buffa::types::decode_int64(&mut cur)?);
16551                        } else {
16552                            return Err(
16553                                ::buffa::encoding::wire_type_mismatch(
16554                                    tag,
16555                                    ::buffa::encoding::WireType::LengthDelimited,
16556                                ),
16557                            );
16558                        }
16559                    }
16560                    _ => {
16561                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
16562                        let span_len = before_tag.len() - cur.len();
16563                        view.__buffa_unknown_fields
16564                            .push_record(before_tag, span_len, ctx)?;
16565                    }
16566                }
16567                ::core::result::Result::Ok(cur)
16568            }
16569            fn to_owned_message(
16570                &self,
16571            ) -> ::core::result::Result<
16572                super::super::GetCandlesColumnsResponse,
16573                ::buffa::DecodeError,
16574            > {
16575                self.to_owned_from_source(None)
16576            }
16577            #[allow(clippy::useless_conversion, clippy::needless_update)]
16578            fn to_owned_from_source(
16579                &self,
16580                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
16581            ) -> ::core::result::Result<
16582                super::super::GetCandlesColumnsResponse,
16583                ::buffa::DecodeError,
16584            > {
16585                #[allow(unused_imports)]
16586                use ::buffa::alloc::string::ToString as _;
16587                let _ = __buffa_src;
16588                ::core::result::Result::Ok(super::super::GetCandlesColumnsResponse {
16589                    symbol_id: self.symbol_id,
16590                    timeframe: self.timeframe,
16591                    ts_sec: self.ts_sec.to_vec(),
16592                    open: self.open.to_vec(),
16593                    high: self.high.to_vec(),
16594                    low: self.low.to_vec(),
16595                    close: self.close.to_vec(),
16596                    volume: self.volume.to_vec(),
16597                    reference_ts_sec: self.reference_ts_sec.to_vec(),
16598                    reference_open: self.reference_open.to_vec(),
16599                    reference_high: self.reference_high.to_vec(),
16600                    reference_low: self.reference_low.to_vec(),
16601                    reference_close: self.reference_close.to_vec(),
16602                    reference_volume: self.reference_volume.to_vec(),
16603                    next_page_token: self.next_page_token.to_string(),
16604                    __buffa_unknown_fields: self
16605                        .__buffa_unknown_fields
16606                        .to_owned()?
16607                        .into(),
16608                    ..::core::default::Default::default()
16609                })
16610            }
16611        }
16612        impl<'a> ::buffa::ViewEncode<'a> for GetCandlesColumnsResponseView<'a> {
16613            #[allow(clippy::needless_borrow, clippy::let_and_return)]
16614            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
16615                #[allow(unused_imports)]
16616                use ::buffa::Enumeration as _;
16617                let mut size = 0u32;
16618                if self.symbol_id != 0u32 {
16619                    size
16620                        += 1u32
16621                            + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
16622                }
16623                {
16624                    let val = self.timeframe.to_i32();
16625                    if val != 0 {
16626                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
16627                    }
16628                }
16629                if !self.ts_sec.is_empty() {
16630                    let payload: u32 = self
16631                        .ts_sec
16632                        .iter()
16633                        .map(|&v| ::buffa::types::uint64_encoded_len(v) as u32)
16634                        .sum::<u32>();
16635                    size
16636                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
16637                            + payload;
16638                }
16639                if !self.open.is_empty() {
16640                    let payload: u32 = self
16641                        .open
16642                        .iter()
16643                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
16644                        .sum::<u32>();
16645                    size
16646                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
16647                            + payload;
16648                }
16649                if !self.high.is_empty() {
16650                    let payload: u32 = self
16651                        .high
16652                        .iter()
16653                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
16654                        .sum::<u32>();
16655                    size
16656                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
16657                            + payload;
16658                }
16659                if !self.low.is_empty() {
16660                    let payload: u32 = self
16661                        .low
16662                        .iter()
16663                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
16664                        .sum::<u32>();
16665                    size
16666                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
16667                            + payload;
16668                }
16669                if !self.close.is_empty() {
16670                    let payload: u32 = self
16671                        .close
16672                        .iter()
16673                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
16674                        .sum::<u32>();
16675                    size
16676                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
16677                            + payload;
16678                }
16679                if !self.volume.is_empty() {
16680                    let payload: u32 = self
16681                        .volume
16682                        .iter()
16683                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
16684                        .sum::<u32>();
16685                    size
16686                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
16687                            + payload;
16688                }
16689                if !self.reference_ts_sec.is_empty() {
16690                    let payload: u32 = self
16691                        .reference_ts_sec
16692                        .iter()
16693                        .map(|&v| ::buffa::types::uint64_encoded_len(v) as u32)
16694                        .sum::<u32>();
16695                    size
16696                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
16697                            + payload;
16698                }
16699                if !self.reference_open.is_empty() {
16700                    let payload: u32 = self
16701                        .reference_open
16702                        .iter()
16703                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
16704                        .sum::<u32>();
16705                    size
16706                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
16707                            + payload;
16708                }
16709                if !self.reference_high.is_empty() {
16710                    let payload: u32 = self
16711                        .reference_high
16712                        .iter()
16713                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
16714                        .sum::<u32>();
16715                    size
16716                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
16717                            + payload;
16718                }
16719                if !self.reference_low.is_empty() {
16720                    let payload: u32 = self
16721                        .reference_low
16722                        .iter()
16723                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
16724                        .sum::<u32>();
16725                    size
16726                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
16727                            + payload;
16728                }
16729                if !self.reference_close.is_empty() {
16730                    let payload: u32 = self
16731                        .reference_close
16732                        .iter()
16733                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
16734                        .sum::<u32>();
16735                    size
16736                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
16737                            + payload;
16738                }
16739                if !self.reference_volume.is_empty() {
16740                    let payload: u32 = self
16741                        .reference_volume
16742                        .iter()
16743                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
16744                        .sum::<u32>();
16745                    size
16746                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
16747                            + payload;
16748                }
16749                if !self.next_page_token.is_empty() {
16750                    size
16751                        += 1u32
16752                            + ::buffa::types::string_encoded_len(&self.next_page_token)
16753                                as u32;
16754                }
16755                size += self.__buffa_unknown_fields.encoded_len() as u32;
16756                size
16757            }
16758            #[allow(clippy::needless_borrow)]
16759            fn write_to(
16760                &self,
16761                _cache: &mut ::buffa::SizeCache,
16762                buf: &mut impl ::buffa::bytes::BufMut,
16763            ) {
16764                #[allow(unused_imports)]
16765                use ::buffa::Enumeration as _;
16766                if self.symbol_id != 0u32 {
16767                    ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
16768                }
16769                {
16770                    let val = self.timeframe.to_i32();
16771                    if val != 0 {
16772                        ::buffa::types::put_int32_field(2u32, val, buf);
16773                    }
16774                }
16775                if !self.ts_sec.is_empty() {
16776                    let payload: u32 = self
16777                        .ts_sec
16778                        .iter()
16779                        .map(|&v| ::buffa::types::uint64_encoded_len(v) as u32)
16780                        .sum::<u32>();
16781                    ::buffa::types::put_len_delimited_header(3u32, payload, buf);
16782                    for &v in &self.ts_sec {
16783                        ::buffa::types::encode_uint64(v, buf);
16784                    }
16785                }
16786                if !self.open.is_empty() {
16787                    let payload: u32 = self
16788                        .open
16789                        .iter()
16790                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
16791                        .sum::<u32>();
16792                    ::buffa::types::put_len_delimited_header(4u32, payload, buf);
16793                    for &v in &self.open {
16794                        ::buffa::types::encode_int64(v, buf);
16795                    }
16796                }
16797                if !self.high.is_empty() {
16798                    let payload: u32 = self
16799                        .high
16800                        .iter()
16801                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
16802                        .sum::<u32>();
16803                    ::buffa::types::put_len_delimited_header(5u32, payload, buf);
16804                    for &v in &self.high {
16805                        ::buffa::types::encode_int64(v, buf);
16806                    }
16807                }
16808                if !self.low.is_empty() {
16809                    let payload: u32 = self
16810                        .low
16811                        .iter()
16812                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
16813                        .sum::<u32>();
16814                    ::buffa::types::put_len_delimited_header(6u32, payload, buf);
16815                    for &v in &self.low {
16816                        ::buffa::types::encode_int64(v, buf);
16817                    }
16818                }
16819                if !self.close.is_empty() {
16820                    let payload: u32 = self
16821                        .close
16822                        .iter()
16823                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
16824                        .sum::<u32>();
16825                    ::buffa::types::put_len_delimited_header(7u32, payload, buf);
16826                    for &v in &self.close {
16827                        ::buffa::types::encode_int64(v, buf);
16828                    }
16829                }
16830                if !self.volume.is_empty() {
16831                    let payload: u32 = self
16832                        .volume
16833                        .iter()
16834                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
16835                        .sum::<u32>();
16836                    ::buffa::types::put_len_delimited_header(8u32, payload, buf);
16837                    for &v in &self.volume {
16838                        ::buffa::types::encode_int64(v, buf);
16839                    }
16840                }
16841                if !self.reference_ts_sec.is_empty() {
16842                    let payload: u32 = self
16843                        .reference_ts_sec
16844                        .iter()
16845                        .map(|&v| ::buffa::types::uint64_encoded_len(v) as u32)
16846                        .sum::<u32>();
16847                    ::buffa::types::put_len_delimited_header(9u32, payload, buf);
16848                    for &v in &self.reference_ts_sec {
16849                        ::buffa::types::encode_uint64(v, buf);
16850                    }
16851                }
16852                if !self.reference_open.is_empty() {
16853                    let payload: u32 = self
16854                        .reference_open
16855                        .iter()
16856                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
16857                        .sum::<u32>();
16858                    ::buffa::types::put_len_delimited_header(10u32, payload, buf);
16859                    for &v in &self.reference_open {
16860                        ::buffa::types::encode_int64(v, buf);
16861                    }
16862                }
16863                if !self.reference_high.is_empty() {
16864                    let payload: u32 = self
16865                        .reference_high
16866                        .iter()
16867                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
16868                        .sum::<u32>();
16869                    ::buffa::types::put_len_delimited_header(11u32, payload, buf);
16870                    for &v in &self.reference_high {
16871                        ::buffa::types::encode_int64(v, buf);
16872                    }
16873                }
16874                if !self.reference_low.is_empty() {
16875                    let payload: u32 = self
16876                        .reference_low
16877                        .iter()
16878                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
16879                        .sum::<u32>();
16880                    ::buffa::types::put_len_delimited_header(12u32, payload, buf);
16881                    for &v in &self.reference_low {
16882                        ::buffa::types::encode_int64(v, buf);
16883                    }
16884                }
16885                if !self.reference_close.is_empty() {
16886                    let payload: u32 = self
16887                        .reference_close
16888                        .iter()
16889                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
16890                        .sum::<u32>();
16891                    ::buffa::types::put_len_delimited_header(13u32, payload, buf);
16892                    for &v in &self.reference_close {
16893                        ::buffa::types::encode_int64(v, buf);
16894                    }
16895                }
16896                if !self.reference_volume.is_empty() {
16897                    let payload: u32 = self
16898                        .reference_volume
16899                        .iter()
16900                        .map(|&v| ::buffa::types::int64_encoded_len(v) as u32)
16901                        .sum::<u32>();
16902                    ::buffa::types::put_len_delimited_header(14u32, payload, buf);
16903                    for &v in &self.reference_volume {
16904                        ::buffa::types::encode_int64(v, buf);
16905                    }
16906                }
16907                if !self.next_page_token.is_empty() {
16908                    ::buffa::types::put_string_field(15u32, &self.next_page_token, buf);
16909                }
16910                self.__buffa_unknown_fields.write_to(buf);
16911            }
16912        }
16913        /// Serializes this view as protobuf JSON.
16914        ///
16915        /// Implicit-presence fields with default values are omitted, `required`
16916        /// fields are always emitted, explicit-presence (`optional`) fields are
16917        /// emitted only when set, bytes fields are base64-encoded, and enum
16918        /// values are their proto name strings.
16919        ///
16920        /// This impl uses `serialize_map(None)` because the number of emitted
16921        /// fields depends on default-omission rules; serializers that require
16922        /// known map lengths (e.g. `bincode`) will return a runtime error.
16923        /// Use the owned message type for those formats.
16924        impl<'__a> ::serde::Serialize for GetCandlesColumnsResponseView<'__a> {
16925            fn serialize<__S: ::serde::Serializer>(
16926                &self,
16927                __s: __S,
16928            ) -> ::core::result::Result<__S::Ok, __S::Error> {
16929                use ::serde::ser::SerializeMap as _;
16930                let mut __map = __s.serialize_map(::core::option::Option::None)?;
16931                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.symbol_id) {
16932                    __map
16933                        .serialize_entry(
16934                            "symbolId",
16935                            &::buffa::json_helpers::ProtoJson(&self.symbol_id),
16936                        )?;
16937                }
16938                if !::buffa::json_helpers::skip_if::is_default_enum_value(
16939                    &self.timeframe,
16940                ) {
16941                    __map.serialize_entry("timeframe", &self.timeframe)?;
16942                }
16943                if !self.ts_sec.is_empty() {
16944                    __map
16945                        .serialize_entry(
16946                            "tsSec",
16947                            &::buffa::json_helpers::RepeatedJson(&self.ts_sec),
16948                        )?;
16949                }
16950                if !self.open.is_empty() {
16951                    __map
16952                        .serialize_entry(
16953                            "open",
16954                            &::buffa::json_helpers::RepeatedJson(&self.open),
16955                        )?;
16956                }
16957                if !self.high.is_empty() {
16958                    __map
16959                        .serialize_entry(
16960                            "high",
16961                            &::buffa::json_helpers::RepeatedJson(&self.high),
16962                        )?;
16963                }
16964                if !self.low.is_empty() {
16965                    __map
16966                        .serialize_entry(
16967                            "low",
16968                            &::buffa::json_helpers::RepeatedJson(&self.low),
16969                        )?;
16970                }
16971                if !self.close.is_empty() {
16972                    __map
16973                        .serialize_entry(
16974                            "close",
16975                            &::buffa::json_helpers::RepeatedJson(&self.close),
16976                        )?;
16977                }
16978                if !self.volume.is_empty() {
16979                    __map
16980                        .serialize_entry(
16981                            "volume",
16982                            &::buffa::json_helpers::RepeatedJson(&self.volume),
16983                        )?;
16984                }
16985                if !self.reference_ts_sec.is_empty() {
16986                    __map
16987                        .serialize_entry(
16988                            "referenceTsSec",
16989                            &::buffa::json_helpers::RepeatedJson(&self.reference_ts_sec),
16990                        )?;
16991                }
16992                if !self.reference_open.is_empty() {
16993                    __map
16994                        .serialize_entry(
16995                            "referenceOpen",
16996                            &::buffa::json_helpers::RepeatedJson(&self.reference_open),
16997                        )?;
16998                }
16999                if !self.reference_high.is_empty() {
17000                    __map
17001                        .serialize_entry(
17002                            "referenceHigh",
17003                            &::buffa::json_helpers::RepeatedJson(&self.reference_high),
17004                        )?;
17005                }
17006                if !self.reference_low.is_empty() {
17007                    __map
17008                        .serialize_entry(
17009                            "referenceLow",
17010                            &::buffa::json_helpers::RepeatedJson(&self.reference_low),
17011                        )?;
17012                }
17013                if !self.reference_close.is_empty() {
17014                    __map
17015                        .serialize_entry(
17016                            "referenceClose",
17017                            &::buffa::json_helpers::RepeatedJson(&self.reference_close),
17018                        )?;
17019                }
17020                if !self.reference_volume.is_empty() {
17021                    __map
17022                        .serialize_entry(
17023                            "referenceVolume",
17024                            &::buffa::json_helpers::RepeatedJson(&self.reference_volume),
17025                        )?;
17026                }
17027                if !::buffa::json_helpers::skip_if::is_empty_str(self.next_page_token) {
17028                    __map.serialize_entry("nextPageToken", self.next_page_token)?;
17029                }
17030                __map.end()
17031            }
17032        }
17033        impl<'a> ::buffa::MessageName for GetCandlesColumnsResponseView<'a> {
17034            const PACKAGE: &'static str = "marketdata.v1";
17035            const NAME: &'static str = "GetCandlesColumnsResponse";
17036            const FULL_NAME: &'static str = "marketdata.v1.GetCandlesColumnsResponse";
17037            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetCandlesColumnsResponse";
17038        }
17039        ::buffa::impl_default_view_instance!(GetCandlesColumnsResponseView);
17040        ::buffa::impl_view_reborrow!(GetCandlesColumnsResponseView);
17041        /** Self-contained, `'static` owned view of a `GetCandlesColumnsResponse` message.
17042
17043 Wraps [`::buffa::OwnedView`]`<`[`GetCandlesColumnsResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
17044
17045 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetCandlesColumnsResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
17046        #[derive(Clone, Debug)]
17047        pub struct GetCandlesColumnsResponseOwnedView(
17048            ::buffa::OwnedView<GetCandlesColumnsResponseView<'static>>,
17049        );
17050        impl GetCandlesColumnsResponseOwnedView {
17051            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
17052            ///
17053            /// The view borrows directly from the buffer's data; the buffer is
17054            /// retained inside the returned handle.
17055            ///
17056            /// # Errors
17057            ///
17058            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
17059            /// protobuf data.
17060            pub fn decode(
17061                bytes: ::buffa::bytes::Bytes,
17062            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17063                ::core::result::Result::Ok(
17064                    GetCandlesColumnsResponseOwnedView(
17065                        ::buffa::OwnedView::decode(bytes)?,
17066                    ),
17067                )
17068            }
17069            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
17070            /// max message size).
17071            ///
17072            /// # Errors
17073            ///
17074            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
17075            /// exceeds the configured limits.
17076            pub fn decode_with_options(
17077                bytes: ::buffa::bytes::Bytes,
17078                opts: &::buffa::DecodeOptions,
17079            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17080                ::core::result::Result::Ok(
17081                    GetCandlesColumnsResponseOwnedView(
17082                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
17083                    ),
17084                )
17085            }
17086            /// Build from an owned message via an encode → decode round-trip.
17087            ///
17088            /// # Errors
17089            ///
17090            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
17091            /// somehow invalid (should not happen for well-formed messages).
17092            pub fn from_owned(
17093                msg: &super::super::GetCandlesColumnsResponse,
17094            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17095                ::core::result::Result::Ok(
17096                    GetCandlesColumnsResponseOwnedView(
17097                        ::buffa::OwnedView::from_owned(msg)?,
17098                    ),
17099                )
17100            }
17101            /// Borrow the full [`GetCandlesColumnsResponseView`] with its lifetime tied to `&self`.
17102            #[must_use]
17103            pub fn view(&self) -> &GetCandlesColumnsResponseView<'_> {
17104                self.0.reborrow()
17105            }
17106            /// Convert to the owned message type.
17107            ///
17108            /// # Errors
17109            ///
17110            /// Returns an error if re-materializing preserved unknown fields
17111            /// fails (e.g. the unknown-field limit is exceeded).
17112            pub fn to_owned_message(
17113                &self,
17114            ) -> ::core::result::Result<
17115                super::super::GetCandlesColumnsResponse,
17116                ::buffa::DecodeError,
17117            > {
17118                self.0.to_owned_message()
17119            }
17120            /// The underlying bytes buffer.
17121            #[must_use]
17122            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
17123                self.0.bytes()
17124            }
17125            /// Consume the handle, returning the underlying bytes buffer.
17126            #[must_use]
17127            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
17128                self.0.into_bytes()
17129            }
17130            /// Numeric spot market identifier.
17131            ///
17132            /// Field 1: `symbol_id`
17133            #[must_use]
17134            pub fn symbol_id(&self) -> u32 {
17135                self.0.reborrow().symbol_id
17136            }
17137            /// Timeframe of this series.
17138            ///
17139            /// Field 2: `timeframe`
17140            #[must_use]
17141            pub fn timeframe(&self) -> ::buffa::EnumValue<super::super::Timeframe> {
17142                self.0.reborrow().timeframe
17143            }
17144            /// Candle bucket start timestamps (seconds since epoch, UTC).
17145            ///
17146            /// Field 3: `ts_sec`
17147            #[must_use]
17148            pub fn ts_sec(&self) -> &::buffa::RepeatedView<'_, u64> {
17149                &self.0.reborrow().ts_sec
17150            }
17151            /// Opening prices in quote units scaled by 1e6.
17152            ///
17153            /// Field 4: `open`
17154            #[must_use]
17155            pub fn open(&self) -> &::buffa::RepeatedView<'_, i64> {
17156                &self.0.reborrow().open
17157            }
17158            /// Highest traded prices in quote units scaled by 1e6.
17159            ///
17160            /// Field 5: `high`
17161            #[must_use]
17162            pub fn high(&self) -> &::buffa::RepeatedView<'_, i64> {
17163                &self.0.reborrow().high
17164            }
17165            /// Lowest traded prices in quote units scaled by 1e6.
17166            ///
17167            /// Field 6: `low`
17168            #[must_use]
17169            pub fn low(&self) -> &::buffa::RepeatedView<'_, i64> {
17170                &self.0.reborrow().low
17171            }
17172            /// Closing prices in quote units scaled by 1e6.
17173            ///
17174            /// Field 7: `close`
17175            #[must_use]
17176            pub fn close(&self) -> &::buffa::RepeatedView<'_, i64> {
17177                &self.0.reborrow().close
17178            }
17179            /// Traded base-asset quantities scaled by the pair's base_quantity_scale from
17180            /// GetSpotConfig.
17181            ///
17182            /// Field 8: `volume`
17183            #[must_use]
17184            pub fn volume(&self) -> &::buffa::RepeatedView<'_, i64> {
17185                &self.0.reborrow().volume
17186            }
17187            /// Reference candle series in columnar form (same ordering as ts_sec: oldest-first).
17188            /// Only populated when request.include_reference=true.
17189            ///
17190            /// Field 9: `reference_ts_sec`
17191            #[must_use]
17192            pub fn reference_ts_sec(&self) -> &::buffa::RepeatedView<'_, u64> {
17193                &self.0.reborrow().reference_ts_sec
17194            }
17195            /// Reference opening prices in quote units scaled by 1e6.
17196            ///
17197            /// Field 10: `reference_open`
17198            #[must_use]
17199            pub fn reference_open(&self) -> &::buffa::RepeatedView<'_, i64> {
17200                &self.0.reborrow().reference_open
17201            }
17202            /// Reference high prices in quote units scaled by 1e6.
17203            ///
17204            /// Field 11: `reference_high`
17205            #[must_use]
17206            pub fn reference_high(&self) -> &::buffa::RepeatedView<'_, i64> {
17207                &self.0.reborrow().reference_high
17208            }
17209            /// Reference low prices in quote units scaled by 1e6.
17210            ///
17211            /// Field 12: `reference_low`
17212            #[must_use]
17213            pub fn reference_low(&self) -> &::buffa::RepeatedView<'_, i64> {
17214                &self.0.reborrow().reference_low
17215            }
17216            /// Reference closing prices in quote units scaled by 1e6.
17217            ///
17218            /// Field 13: `reference_close`
17219            #[must_use]
17220            pub fn reference_close(&self) -> &::buffa::RepeatedView<'_, i64> {
17221                &self.0.reborrow().reference_close
17222            }
17223            /// Reference traded base-asset quantities scaled by the pair's
17224            /// base_quantity_scale from GetSpotConfig.
17225            ///
17226            /// Field 14: `reference_volume`
17227            #[must_use]
17228            pub fn reference_volume(&self) -> &::buffa::RepeatedView<'_, i64> {
17229                &self.0.reborrow().reference_volume
17230            }
17231            /// Opaque cursor for the next page. Empty when no more results exist.
17232            ///
17233            /// Field 15: `next_page_token`
17234            #[must_use]
17235            pub fn next_page_token(&self) -> &'_ str {
17236                self.0.reborrow().next_page_token
17237            }
17238        }
17239        impl ::core::convert::From<
17240            ::buffa::OwnedView<GetCandlesColumnsResponseView<'static>>,
17241        > for GetCandlesColumnsResponseOwnedView {
17242            fn from(
17243                inner: ::buffa::OwnedView<GetCandlesColumnsResponseView<'static>>,
17244            ) -> Self {
17245                GetCandlesColumnsResponseOwnedView(inner)
17246            }
17247        }
17248        impl ::core::convert::From<GetCandlesColumnsResponseOwnedView>
17249        for ::buffa::OwnedView<GetCandlesColumnsResponseView<'static>> {
17250            fn from(wrapper: GetCandlesColumnsResponseOwnedView) -> Self {
17251                wrapper.0
17252            }
17253        }
17254        impl ::core::convert::AsRef<
17255            ::buffa::OwnedView<GetCandlesColumnsResponseView<'static>>,
17256        > for GetCandlesColumnsResponseOwnedView {
17257            fn as_ref(
17258                &self,
17259            ) -> &::buffa::OwnedView<GetCandlesColumnsResponseView<'static>> {
17260                &self.0
17261            }
17262        }
17263        impl ::buffa::HasMessageView for super::super::GetCandlesColumnsResponse {
17264            type View<'a> = GetCandlesColumnsResponseView<'a>;
17265            type ViewHandle = GetCandlesColumnsResponseOwnedView;
17266        }
17267        impl ::serde::Serialize for GetCandlesColumnsResponseOwnedView {
17268            fn serialize<__S: ::serde::Serializer>(
17269                &self,
17270                __s: __S,
17271            ) -> ::core::result::Result<__S::Ok, __S::Error> {
17272                ::serde::Serialize::serialize(&self.0, __s)
17273            }
17274        }
17275        /// ---------------------------------------------------------------------------
17276        /// Candle contains one public OHLCV bucket.
17277        /// ---------------------------------------------------------------------------
17278        ///
17279        /// Candle represents a single OHLCV bucket for a symbol and timeframe.
17280        #[derive(Clone, Debug, Default)]
17281        pub struct CandleView<'a> {
17282            /// numeric spot market identifier
17283            ///
17284            /// Field 1: `symbol_id`
17285            pub symbol_id: u32,
17286            /// timeframe of this candle
17287            ///
17288            /// Field 2: `timeframe`
17289            pub timeframe: ::buffa::EnumValue<super::super::Timeframe>,
17290            /// bucket start timestamp (seconds since epoch, UTC)
17291            ///
17292            /// Field 3: `ts_sec`
17293            pub ts_sec: u64,
17294            /// opening price in quote units scaled by 1e6
17295            ///
17296            /// Field 4: `open`
17297            pub open: i64,
17298            /// highest traded price in quote units scaled by 1e6
17299            ///
17300            /// Field 5: `high`
17301            pub high: i64,
17302            /// lowest traded price in quote units scaled by 1e6
17303            ///
17304            /// Field 6: `low`
17305            pub low: i64,
17306            /// closing price in quote units scaled by 1e6
17307            ///
17308            /// Field 7: `close`
17309            pub close: i64,
17310            /// Traded base-asset quantity scaled by the pair's base_quantity_scale from
17311            /// GetSpotConfig.
17312            ///
17313            /// Field 8: `volume`
17314            pub volume: i64,
17315            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
17316        }
17317        impl<'a> ::buffa::MessageView<'a> for CandleView<'a> {
17318            type Owned = super::super::Candle;
17319            fn decode_view(
17320                buf: &'a [u8],
17321            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17322                let __limit = ::core::cell::Cell::new(
17323                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
17324                );
17325                <Self as ::buffa::MessageView>::decode_view_ctx(
17326                    buf,
17327                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
17328                )
17329            }
17330            fn decode_view_with_ctx(
17331                buf: &'a [u8],
17332                ctx: ::buffa::DecodeContext<'_>,
17333            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17334                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
17335            }
17336            fn merge_view_field(
17337                &mut self,
17338                tag: ::buffa::encoding::Tag,
17339                cur: &'a [u8],
17340                before_tag: &'a [u8],
17341                ctx: ::buffa::DecodeContext<'_>,
17342            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
17343                let _ = ctx;
17344                #[allow(unused_variables)]
17345                let view = self;
17346                let mut cur = cur;
17347                match tag.field_number() {
17348                    1u32 => {
17349                        ::buffa::encoding::check_wire_type(
17350                            tag,
17351                            ::buffa::encoding::WireType::Varint,
17352                        )?;
17353                        view.symbol_id = ::buffa::types::decode_uint32(&mut cur)?;
17354                    }
17355                    2u32 => {
17356                        ::buffa::encoding::check_wire_type(
17357                            tag,
17358                            ::buffa::encoding::WireType::Varint,
17359                        )?;
17360                        view.timeframe = ::buffa::EnumValue::from(
17361                            ::buffa::types::decode_int32(&mut cur)?,
17362                        );
17363                    }
17364                    3u32 => {
17365                        ::buffa::encoding::check_wire_type(
17366                            tag,
17367                            ::buffa::encoding::WireType::Varint,
17368                        )?;
17369                        view.ts_sec = ::buffa::types::decode_uint64(&mut cur)?;
17370                    }
17371                    4u32 => {
17372                        ::buffa::encoding::check_wire_type(
17373                            tag,
17374                            ::buffa::encoding::WireType::Varint,
17375                        )?;
17376                        view.open = ::buffa::types::decode_int64(&mut cur)?;
17377                    }
17378                    5u32 => {
17379                        ::buffa::encoding::check_wire_type(
17380                            tag,
17381                            ::buffa::encoding::WireType::Varint,
17382                        )?;
17383                        view.high = ::buffa::types::decode_int64(&mut cur)?;
17384                    }
17385                    6u32 => {
17386                        ::buffa::encoding::check_wire_type(
17387                            tag,
17388                            ::buffa::encoding::WireType::Varint,
17389                        )?;
17390                        view.low = ::buffa::types::decode_int64(&mut cur)?;
17391                    }
17392                    7u32 => {
17393                        ::buffa::encoding::check_wire_type(
17394                            tag,
17395                            ::buffa::encoding::WireType::Varint,
17396                        )?;
17397                        view.close = ::buffa::types::decode_int64(&mut cur)?;
17398                    }
17399                    8u32 => {
17400                        ::buffa::encoding::check_wire_type(
17401                            tag,
17402                            ::buffa::encoding::WireType::Varint,
17403                        )?;
17404                        view.volume = ::buffa::types::decode_int64(&mut cur)?;
17405                    }
17406                    _ => {
17407                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
17408                        let span_len = before_tag.len() - cur.len();
17409                        view.__buffa_unknown_fields
17410                            .push_record(before_tag, span_len, ctx)?;
17411                    }
17412                }
17413                ::core::result::Result::Ok(cur)
17414            }
17415            fn to_owned_message(
17416                &self,
17417            ) -> ::core::result::Result<super::super::Candle, ::buffa::DecodeError> {
17418                self.to_owned_from_source(None)
17419            }
17420            #[allow(clippy::useless_conversion, clippy::needless_update)]
17421            fn to_owned_from_source(
17422                &self,
17423                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
17424            ) -> ::core::result::Result<super::super::Candle, ::buffa::DecodeError> {
17425                #[allow(unused_imports)]
17426                use ::buffa::alloc::string::ToString as _;
17427                let _ = __buffa_src;
17428                ::core::result::Result::Ok(super::super::Candle {
17429                    symbol_id: self.symbol_id,
17430                    timeframe: self.timeframe,
17431                    ts_sec: self.ts_sec,
17432                    open: self.open,
17433                    high: self.high,
17434                    low: self.low,
17435                    close: self.close,
17436                    volume: self.volume,
17437                    __buffa_unknown_fields: self
17438                        .__buffa_unknown_fields
17439                        .to_owned()?
17440                        .into(),
17441                    ..::core::default::Default::default()
17442                })
17443            }
17444        }
17445        impl<'a> ::buffa::ViewEncode<'a> for CandleView<'a> {
17446            #[allow(clippy::needless_borrow, clippy::let_and_return)]
17447            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
17448                #[allow(unused_imports)]
17449                use ::buffa::Enumeration as _;
17450                let mut size = 0u32;
17451                if self.symbol_id != 0u32 {
17452                    size
17453                        += 1u32
17454                            + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
17455                }
17456                {
17457                    let val = self.timeframe.to_i32();
17458                    if val != 0 {
17459                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
17460                    }
17461                }
17462                if self.ts_sec != 0u64 {
17463                    size
17464                        += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_sec) as u32;
17465                }
17466                if self.open != 0i64 {
17467                    size += 1u32 + ::buffa::types::int64_encoded_len(self.open) as u32;
17468                }
17469                if self.high != 0i64 {
17470                    size += 1u32 + ::buffa::types::int64_encoded_len(self.high) as u32;
17471                }
17472                if self.low != 0i64 {
17473                    size += 1u32 + ::buffa::types::int64_encoded_len(self.low) as u32;
17474                }
17475                if self.close != 0i64 {
17476                    size += 1u32 + ::buffa::types::int64_encoded_len(self.close) as u32;
17477                }
17478                if self.volume != 0i64 {
17479                    size += 1u32 + ::buffa::types::int64_encoded_len(self.volume) as u32;
17480                }
17481                size += self.__buffa_unknown_fields.encoded_len() as u32;
17482                size
17483            }
17484            #[allow(clippy::needless_borrow)]
17485            fn write_to(
17486                &self,
17487                _cache: &mut ::buffa::SizeCache,
17488                buf: &mut impl ::buffa::bytes::BufMut,
17489            ) {
17490                #[allow(unused_imports)]
17491                use ::buffa::Enumeration as _;
17492                if self.symbol_id != 0u32 {
17493                    ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
17494                }
17495                {
17496                    let val = self.timeframe.to_i32();
17497                    if val != 0 {
17498                        ::buffa::types::put_int32_field(2u32, val, buf);
17499                    }
17500                }
17501                if self.ts_sec != 0u64 {
17502                    ::buffa::types::put_uint64_field(3u32, self.ts_sec, buf);
17503                }
17504                if self.open != 0i64 {
17505                    ::buffa::types::put_int64_field(4u32, self.open, buf);
17506                }
17507                if self.high != 0i64 {
17508                    ::buffa::types::put_int64_field(5u32, self.high, buf);
17509                }
17510                if self.low != 0i64 {
17511                    ::buffa::types::put_int64_field(6u32, self.low, buf);
17512                }
17513                if self.close != 0i64 {
17514                    ::buffa::types::put_int64_field(7u32, self.close, buf);
17515                }
17516                if self.volume != 0i64 {
17517                    ::buffa::types::put_int64_field(8u32, self.volume, buf);
17518                }
17519                self.__buffa_unknown_fields.write_to(buf);
17520            }
17521        }
17522        /// Serializes this view as protobuf JSON.
17523        ///
17524        /// Implicit-presence fields with default values are omitted, `required`
17525        /// fields are always emitted, explicit-presence (`optional`) fields are
17526        /// emitted only when set, bytes fields are base64-encoded, and enum
17527        /// values are their proto name strings.
17528        ///
17529        /// This impl uses `serialize_map(None)` because the number of emitted
17530        /// fields depends on default-omission rules; serializers that require
17531        /// known map lengths (e.g. `bincode`) will return a runtime error.
17532        /// Use the owned message type for those formats.
17533        impl<'__a> ::serde::Serialize for CandleView<'__a> {
17534            fn serialize<__S: ::serde::Serializer>(
17535                &self,
17536                __s: __S,
17537            ) -> ::core::result::Result<__S::Ok, __S::Error> {
17538                use ::serde::ser::SerializeMap as _;
17539                let mut __map = __s.serialize_map(::core::option::Option::None)?;
17540                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.symbol_id) {
17541                    __map
17542                        .serialize_entry(
17543                            "symbolId",
17544                            &::buffa::json_helpers::ProtoJson(&self.symbol_id),
17545                        )?;
17546                }
17547                if !::buffa::json_helpers::skip_if::is_default_enum_value(
17548                    &self.timeframe,
17549                ) {
17550                    __map.serialize_entry("timeframe", &self.timeframe)?;
17551                }
17552                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_sec) {
17553                    __map
17554                        .serialize_entry(
17555                            "tsSec",
17556                            &::buffa::json_helpers::ProtoJson(&self.ts_sec),
17557                        )?;
17558                }
17559                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.open) {
17560                    __map
17561                        .serialize_entry(
17562                            "open",
17563                            &::buffa::json_helpers::ProtoJson(&self.open),
17564                        )?;
17565                }
17566                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.high) {
17567                    __map
17568                        .serialize_entry(
17569                            "high",
17570                            &::buffa::json_helpers::ProtoJson(&self.high),
17571                        )?;
17572                }
17573                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.low) {
17574                    __map
17575                        .serialize_entry(
17576                            "low",
17577                            &::buffa::json_helpers::ProtoJson(&self.low),
17578                        )?;
17579                }
17580                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.close) {
17581                    __map
17582                        .serialize_entry(
17583                            "close",
17584                            &::buffa::json_helpers::ProtoJson(&self.close),
17585                        )?;
17586                }
17587                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.volume) {
17588                    __map
17589                        .serialize_entry(
17590                            "volume",
17591                            &::buffa::json_helpers::ProtoJson(&self.volume),
17592                        )?;
17593                }
17594                __map.end()
17595            }
17596        }
17597        impl<'a> ::buffa::MessageName for CandleView<'a> {
17598            const PACKAGE: &'static str = "marketdata.v1";
17599            const NAME: &'static str = "Candle";
17600            const FULL_NAME: &'static str = "marketdata.v1.Candle";
17601            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.Candle";
17602        }
17603        ::buffa::impl_default_view_instance!(CandleView);
17604        ::buffa::impl_view_reborrow!(CandleView);
17605        /** Self-contained, `'static` owned view of a `Candle` message.
17606
17607 Wraps [`::buffa::OwnedView`]`<`[`CandleView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
17608
17609 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`CandleView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
17610        #[derive(Clone, Debug)]
17611        pub struct CandleOwnedView(::buffa::OwnedView<CandleView<'static>>);
17612        impl CandleOwnedView {
17613            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
17614            ///
17615            /// The view borrows directly from the buffer's data; the buffer is
17616            /// retained inside the returned handle.
17617            ///
17618            /// # Errors
17619            ///
17620            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
17621            /// protobuf data.
17622            pub fn decode(
17623                bytes: ::buffa::bytes::Bytes,
17624            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17625                ::core::result::Result::Ok(
17626                    CandleOwnedView(::buffa::OwnedView::decode(bytes)?),
17627                )
17628            }
17629            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
17630            /// max message size).
17631            ///
17632            /// # Errors
17633            ///
17634            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
17635            /// exceeds the configured limits.
17636            pub fn decode_with_options(
17637                bytes: ::buffa::bytes::Bytes,
17638                opts: &::buffa::DecodeOptions,
17639            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17640                ::core::result::Result::Ok(
17641                    CandleOwnedView(
17642                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
17643                    ),
17644                )
17645            }
17646            /// Build from an owned message via an encode → decode round-trip.
17647            ///
17648            /// # Errors
17649            ///
17650            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
17651            /// somehow invalid (should not happen for well-formed messages).
17652            pub fn from_owned(
17653                msg: &super::super::Candle,
17654            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17655                ::core::result::Result::Ok(
17656                    CandleOwnedView(::buffa::OwnedView::from_owned(msg)?),
17657                )
17658            }
17659            /// Borrow the full [`CandleView`] with its lifetime tied to `&self`.
17660            #[must_use]
17661            pub fn view(&self) -> &CandleView<'_> {
17662                self.0.reborrow()
17663            }
17664            /// Convert to the owned message type.
17665            ///
17666            /// # Errors
17667            ///
17668            /// Returns an error if re-materializing preserved unknown fields
17669            /// fails (e.g. the unknown-field limit is exceeded).
17670            pub fn to_owned_message(
17671                &self,
17672            ) -> ::core::result::Result<super::super::Candle, ::buffa::DecodeError> {
17673                self.0.to_owned_message()
17674            }
17675            /// The underlying bytes buffer.
17676            #[must_use]
17677            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
17678                self.0.bytes()
17679            }
17680            /// Consume the handle, returning the underlying bytes buffer.
17681            #[must_use]
17682            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
17683                self.0.into_bytes()
17684            }
17685            /// numeric spot market identifier
17686            ///
17687            /// Field 1: `symbol_id`
17688            #[must_use]
17689            pub fn symbol_id(&self) -> u32 {
17690                self.0.reborrow().symbol_id
17691            }
17692            /// timeframe of this candle
17693            ///
17694            /// Field 2: `timeframe`
17695            #[must_use]
17696            pub fn timeframe(&self) -> ::buffa::EnumValue<super::super::Timeframe> {
17697                self.0.reborrow().timeframe
17698            }
17699            /// bucket start timestamp (seconds since epoch, UTC)
17700            ///
17701            /// Field 3: `ts_sec`
17702            #[must_use]
17703            pub fn ts_sec(&self) -> u64 {
17704                self.0.reborrow().ts_sec
17705            }
17706            /// opening price in quote units scaled by 1e6
17707            ///
17708            /// Field 4: `open`
17709            #[must_use]
17710            pub fn open(&self) -> i64 {
17711                self.0.reborrow().open
17712            }
17713            /// highest traded price in quote units scaled by 1e6
17714            ///
17715            /// Field 5: `high`
17716            #[must_use]
17717            pub fn high(&self) -> i64 {
17718                self.0.reborrow().high
17719            }
17720            /// lowest traded price in quote units scaled by 1e6
17721            ///
17722            /// Field 6: `low`
17723            #[must_use]
17724            pub fn low(&self) -> i64 {
17725                self.0.reborrow().low
17726            }
17727            /// closing price in quote units scaled by 1e6
17728            ///
17729            /// Field 7: `close`
17730            #[must_use]
17731            pub fn close(&self) -> i64 {
17732                self.0.reborrow().close
17733            }
17734            /// Traded base-asset quantity scaled by the pair's base_quantity_scale from
17735            /// GetSpotConfig.
17736            ///
17737            /// Field 8: `volume`
17738            #[must_use]
17739            pub fn volume(&self) -> i64 {
17740                self.0.reborrow().volume
17741            }
17742        }
17743        impl ::core::convert::From<::buffa::OwnedView<CandleView<'static>>>
17744        for CandleOwnedView {
17745            fn from(inner: ::buffa::OwnedView<CandleView<'static>>) -> Self {
17746                CandleOwnedView(inner)
17747            }
17748        }
17749        impl ::core::convert::From<CandleOwnedView>
17750        for ::buffa::OwnedView<CandleView<'static>> {
17751            fn from(wrapper: CandleOwnedView) -> Self {
17752                wrapper.0
17753            }
17754        }
17755        impl ::core::convert::AsRef<::buffa::OwnedView<CandleView<'static>>>
17756        for CandleOwnedView {
17757            fn as_ref(&self) -> &::buffa::OwnedView<CandleView<'static>> {
17758                &self.0
17759            }
17760        }
17761        impl ::buffa::HasMessageView for super::super::Candle {
17762            type View<'a> = CandleView<'a>;
17763            type ViewHandle = CandleOwnedView;
17764        }
17765        impl ::serde::Serialize for CandleOwnedView {
17766            fn serialize<__S: ::serde::Serializer>(
17767                &self,
17768                __s: __S,
17769            ) -> ::core::result::Result<__S::Ok, __S::Error> {
17770                ::serde::Serialize::serialize(&self.0, __s)
17771            }
17772        }
17773        /// ---------------------------------------------------------------------------
17774        /// GetSpotConfig: spot assets and pair reference data.
17775        /// ---------------------------------------------------------------------------
17776        ///
17777        /// AssetConfig describes one spot asset returned by GetSpotConfig.
17778        #[derive(Clone, Debug, Default)]
17779        pub struct AssetConfigView<'a> {
17780            /// Asset code, e.g. "USDT" or "BTC".
17781            ///
17782            /// Field 1: `asset`
17783            pub asset: &'a str,
17784            /// Stable numeric asset id used by account, balance, and order APIs.
17785            ///
17786            /// Field 2: `ledger_id`
17787            pub ledger_id: u32,
17788            /// Human-friendly display name, e.g. "Bitcoin".
17789            ///
17790            /// Field 3: `name`
17791            pub name: &'a str,
17792            /// Suggested decimal precision for displaying user-facing asset amounts.
17793            ///
17794            /// Field 4: `quantity_display_decimals`
17795            pub quantity_display_decimals: u32,
17796            /// Integer scale for quantities and balances in this asset (0..18).
17797            /// A scale of 8 means one whole asset is represented as 100000000 in scaled
17798            /// integer fields such as qty_scaled.
17799            ///
17800            /// Field 5: `quantity_scale`
17801            pub quantity_scale: u32,
17802            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
17803        }
17804        impl<'a> ::buffa::MessageView<'a> for AssetConfigView<'a> {
17805            type Owned = super::super::AssetConfig;
17806            fn decode_view(
17807                buf: &'a [u8],
17808            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17809                let __limit = ::core::cell::Cell::new(
17810                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
17811                );
17812                <Self as ::buffa::MessageView>::decode_view_ctx(
17813                    buf,
17814                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
17815                )
17816            }
17817            fn decode_view_with_ctx(
17818                buf: &'a [u8],
17819                ctx: ::buffa::DecodeContext<'_>,
17820            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
17821                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
17822            }
17823            fn merge_view_field(
17824                &mut self,
17825                tag: ::buffa::encoding::Tag,
17826                cur: &'a [u8],
17827                before_tag: &'a [u8],
17828                ctx: ::buffa::DecodeContext<'_>,
17829            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
17830                let _ = ctx;
17831                #[allow(unused_variables)]
17832                let view = self;
17833                let mut cur = cur;
17834                match tag.field_number() {
17835                    1u32 => {
17836                        ::buffa::encoding::check_wire_type(
17837                            tag,
17838                            ::buffa::encoding::WireType::LengthDelimited,
17839                        )?;
17840                        view.asset = ::buffa::types::borrow_str(&mut cur)?;
17841                    }
17842                    2u32 => {
17843                        ::buffa::encoding::check_wire_type(
17844                            tag,
17845                            ::buffa::encoding::WireType::Varint,
17846                        )?;
17847                        view.ledger_id = ::buffa::types::decode_uint32(&mut cur)?;
17848                    }
17849                    3u32 => {
17850                        ::buffa::encoding::check_wire_type(
17851                            tag,
17852                            ::buffa::encoding::WireType::LengthDelimited,
17853                        )?;
17854                        view.name = ::buffa::types::borrow_str(&mut cur)?;
17855                    }
17856                    4u32 => {
17857                        ::buffa::encoding::check_wire_type(
17858                            tag,
17859                            ::buffa::encoding::WireType::Varint,
17860                        )?;
17861                        view.quantity_display_decimals = ::buffa::types::decode_uint32(
17862                            &mut cur,
17863                        )?;
17864                    }
17865                    5u32 => {
17866                        ::buffa::encoding::check_wire_type(
17867                            tag,
17868                            ::buffa::encoding::WireType::Varint,
17869                        )?;
17870                        view.quantity_scale = ::buffa::types::decode_uint32(&mut cur)?;
17871                    }
17872                    _ => {
17873                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
17874                        let span_len = before_tag.len() - cur.len();
17875                        view.__buffa_unknown_fields
17876                            .push_record(before_tag, span_len, ctx)?;
17877                    }
17878                }
17879                ::core::result::Result::Ok(cur)
17880            }
17881            fn to_owned_message(
17882                &self,
17883            ) -> ::core::result::Result<
17884                super::super::AssetConfig,
17885                ::buffa::DecodeError,
17886            > {
17887                self.to_owned_from_source(None)
17888            }
17889            #[allow(clippy::useless_conversion, clippy::needless_update)]
17890            fn to_owned_from_source(
17891                &self,
17892                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
17893            ) -> ::core::result::Result<
17894                super::super::AssetConfig,
17895                ::buffa::DecodeError,
17896            > {
17897                #[allow(unused_imports)]
17898                use ::buffa::alloc::string::ToString as _;
17899                let _ = __buffa_src;
17900                ::core::result::Result::Ok(super::super::AssetConfig {
17901                    asset: self.asset.to_string(),
17902                    ledger_id: self.ledger_id,
17903                    name: self.name.to_string(),
17904                    quantity_display_decimals: self.quantity_display_decimals,
17905                    quantity_scale: self.quantity_scale,
17906                    __buffa_unknown_fields: self
17907                        .__buffa_unknown_fields
17908                        .to_owned()?
17909                        .into(),
17910                    ..::core::default::Default::default()
17911                })
17912            }
17913        }
17914        impl<'a> ::buffa::ViewEncode<'a> for AssetConfigView<'a> {
17915            #[allow(clippy::needless_borrow, clippy::let_and_return)]
17916            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
17917                #[allow(unused_imports)]
17918                use ::buffa::Enumeration as _;
17919                let mut size = 0u32;
17920                if !self.asset.is_empty() {
17921                    size
17922                        += 1u32 + ::buffa::types::string_encoded_len(&self.asset) as u32;
17923                }
17924                if self.ledger_id != 0u32 {
17925                    size
17926                        += 1u32
17927                            + ::buffa::types::uint32_encoded_len(self.ledger_id) as u32;
17928                }
17929                if !self.name.is_empty() {
17930                    size += 1u32 + ::buffa::types::string_encoded_len(&self.name) as u32;
17931                }
17932                if self.quantity_display_decimals != 0u32 {
17933                    size
17934                        += 1u32
17935                            + ::buffa::types::uint32_encoded_len(
17936                                self.quantity_display_decimals,
17937                            ) as u32;
17938                }
17939                if self.quantity_scale != 0u32 {
17940                    size
17941                        += 1u32
17942                            + ::buffa::types::uint32_encoded_len(self.quantity_scale)
17943                                as u32;
17944                }
17945                size += self.__buffa_unknown_fields.encoded_len() as u32;
17946                size
17947            }
17948            #[allow(clippy::needless_borrow)]
17949            fn write_to(
17950                &self,
17951                _cache: &mut ::buffa::SizeCache,
17952                buf: &mut impl ::buffa::bytes::BufMut,
17953            ) {
17954                #[allow(unused_imports)]
17955                use ::buffa::Enumeration as _;
17956                if !self.asset.is_empty() {
17957                    ::buffa::types::put_string_field(1u32, &self.asset, buf);
17958                }
17959                if self.ledger_id != 0u32 {
17960                    ::buffa::types::put_uint32_field(2u32, self.ledger_id, buf);
17961                }
17962                if !self.name.is_empty() {
17963                    ::buffa::types::put_string_field(3u32, &self.name, buf);
17964                }
17965                if self.quantity_display_decimals != 0u32 {
17966                    ::buffa::types::put_uint32_field(
17967                        4u32,
17968                        self.quantity_display_decimals,
17969                        buf,
17970                    );
17971                }
17972                if self.quantity_scale != 0u32 {
17973                    ::buffa::types::put_uint32_field(5u32, self.quantity_scale, buf);
17974                }
17975                self.__buffa_unknown_fields.write_to(buf);
17976            }
17977        }
17978        /// Serializes this view as protobuf JSON.
17979        ///
17980        /// Implicit-presence fields with default values are omitted, `required`
17981        /// fields are always emitted, explicit-presence (`optional`) fields are
17982        /// emitted only when set, bytes fields are base64-encoded, and enum
17983        /// values are their proto name strings.
17984        ///
17985        /// This impl uses `serialize_map(None)` because the number of emitted
17986        /// fields depends on default-omission rules; serializers that require
17987        /// known map lengths (e.g. `bincode`) will return a runtime error.
17988        /// Use the owned message type for those formats.
17989        impl<'__a> ::serde::Serialize for AssetConfigView<'__a> {
17990            fn serialize<__S: ::serde::Serializer>(
17991                &self,
17992                __s: __S,
17993            ) -> ::core::result::Result<__S::Ok, __S::Error> {
17994                use ::serde::ser::SerializeMap as _;
17995                let mut __map = __s.serialize_map(::core::option::Option::None)?;
17996                if !::buffa::json_helpers::skip_if::is_empty_str(self.asset) {
17997                    __map.serialize_entry("asset", self.asset)?;
17998                }
17999                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.ledger_id) {
18000                    __map
18001                        .serialize_entry(
18002                            "ledgerId",
18003                            &::buffa::json_helpers::ProtoJson(&self.ledger_id),
18004                        )?;
18005                }
18006                if !::buffa::json_helpers::skip_if::is_empty_str(self.name) {
18007                    __map.serialize_entry("name", self.name)?;
18008                }
18009                if !::buffa::json_helpers::skip_if::is_zero_u32(
18010                    &self.quantity_display_decimals,
18011                ) {
18012                    __map
18013                        .serialize_entry(
18014                            "quantityDisplayDecimals",
18015                            &::buffa::json_helpers::ProtoJson(
18016                                &self.quantity_display_decimals,
18017                            ),
18018                        )?;
18019                }
18020                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.quantity_scale) {
18021                    __map
18022                        .serialize_entry(
18023                            "quantityScale",
18024                            &::buffa::json_helpers::ProtoJson(&self.quantity_scale),
18025                        )?;
18026                }
18027                __map.end()
18028            }
18029        }
18030        impl<'a> ::buffa::MessageName for AssetConfigView<'a> {
18031            const PACKAGE: &'static str = "marketdata.v1";
18032            const NAME: &'static str = "AssetConfig";
18033            const FULL_NAME: &'static str = "marketdata.v1.AssetConfig";
18034            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.AssetConfig";
18035        }
18036        ::buffa::impl_default_view_instance!(AssetConfigView);
18037        ::buffa::impl_view_reborrow!(AssetConfigView);
18038        /** Self-contained, `'static` owned view of a `AssetConfig` message.
18039
18040 Wraps [`::buffa::OwnedView`]`<`[`AssetConfigView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
18041
18042 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`AssetConfigView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
18043        #[derive(Clone, Debug)]
18044        pub struct AssetConfigOwnedView(::buffa::OwnedView<AssetConfigView<'static>>);
18045        impl AssetConfigOwnedView {
18046            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
18047            ///
18048            /// The view borrows directly from the buffer's data; the buffer is
18049            /// retained inside the returned handle.
18050            ///
18051            /// # Errors
18052            ///
18053            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
18054            /// protobuf data.
18055            pub fn decode(
18056                bytes: ::buffa::bytes::Bytes,
18057            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18058                ::core::result::Result::Ok(
18059                    AssetConfigOwnedView(::buffa::OwnedView::decode(bytes)?),
18060                )
18061            }
18062            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
18063            /// max message size).
18064            ///
18065            /// # Errors
18066            ///
18067            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
18068            /// exceeds the configured limits.
18069            pub fn decode_with_options(
18070                bytes: ::buffa::bytes::Bytes,
18071                opts: &::buffa::DecodeOptions,
18072            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18073                ::core::result::Result::Ok(
18074                    AssetConfigOwnedView(
18075                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
18076                    ),
18077                )
18078            }
18079            /// Build from an owned message via an encode → decode round-trip.
18080            ///
18081            /// # Errors
18082            ///
18083            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
18084            /// somehow invalid (should not happen for well-formed messages).
18085            pub fn from_owned(
18086                msg: &super::super::AssetConfig,
18087            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18088                ::core::result::Result::Ok(
18089                    AssetConfigOwnedView(::buffa::OwnedView::from_owned(msg)?),
18090                )
18091            }
18092            /// Borrow the full [`AssetConfigView`] with its lifetime tied to `&self`.
18093            #[must_use]
18094            pub fn view(&self) -> &AssetConfigView<'_> {
18095                self.0.reborrow()
18096            }
18097            /// Convert to the owned message type.
18098            ///
18099            /// # Errors
18100            ///
18101            /// Returns an error if re-materializing preserved unknown fields
18102            /// fails (e.g. the unknown-field limit is exceeded).
18103            pub fn to_owned_message(
18104                &self,
18105            ) -> ::core::result::Result<
18106                super::super::AssetConfig,
18107                ::buffa::DecodeError,
18108            > {
18109                self.0.to_owned_message()
18110            }
18111            /// The underlying bytes buffer.
18112            #[must_use]
18113            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
18114                self.0.bytes()
18115            }
18116            /// Consume the handle, returning the underlying bytes buffer.
18117            #[must_use]
18118            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
18119                self.0.into_bytes()
18120            }
18121            /// Asset code, e.g. "USDT" or "BTC".
18122            ///
18123            /// Field 1: `asset`
18124            #[must_use]
18125            pub fn asset(&self) -> &'_ str {
18126                self.0.reborrow().asset
18127            }
18128            /// Stable numeric asset id used by account, balance, and order APIs.
18129            ///
18130            /// Field 2: `ledger_id`
18131            #[must_use]
18132            pub fn ledger_id(&self) -> u32 {
18133                self.0.reborrow().ledger_id
18134            }
18135            /// Human-friendly display name, e.g. "Bitcoin".
18136            ///
18137            /// Field 3: `name`
18138            #[must_use]
18139            pub fn name(&self) -> &'_ str {
18140                self.0.reborrow().name
18141            }
18142            /// Suggested decimal precision for displaying user-facing asset amounts.
18143            ///
18144            /// Field 4: `quantity_display_decimals`
18145            #[must_use]
18146            pub fn quantity_display_decimals(&self) -> u32 {
18147                self.0.reborrow().quantity_display_decimals
18148            }
18149            /// Integer scale for quantities and balances in this asset (0..18).
18150            /// A scale of 8 means one whole asset is represented as 100000000 in scaled
18151            /// integer fields such as qty_scaled.
18152            ///
18153            /// Field 5: `quantity_scale`
18154            #[must_use]
18155            pub fn quantity_scale(&self) -> u32 {
18156                self.0.reborrow().quantity_scale
18157            }
18158        }
18159        impl ::core::convert::From<::buffa::OwnedView<AssetConfigView<'static>>>
18160        for AssetConfigOwnedView {
18161            fn from(inner: ::buffa::OwnedView<AssetConfigView<'static>>) -> Self {
18162                AssetConfigOwnedView(inner)
18163            }
18164        }
18165        impl ::core::convert::From<AssetConfigOwnedView>
18166        for ::buffa::OwnedView<AssetConfigView<'static>> {
18167            fn from(wrapper: AssetConfigOwnedView) -> Self {
18168                wrapper.0
18169            }
18170        }
18171        impl ::core::convert::AsRef<::buffa::OwnedView<AssetConfigView<'static>>>
18172        for AssetConfigOwnedView {
18173            fn as_ref(&self) -> &::buffa::OwnedView<AssetConfigView<'static>> {
18174                &self.0
18175            }
18176        }
18177        impl ::buffa::HasMessageView for super::super::AssetConfig {
18178            type View<'a> = AssetConfigView<'a>;
18179            type ViewHandle = AssetConfigOwnedView;
18180        }
18181        impl ::serde::Serialize for AssetConfigOwnedView {
18182            fn serialize<__S: ::serde::Serializer>(
18183                &self,
18184                __s: __S,
18185            ) -> ::core::result::Result<__S::Ok, __S::Error> {
18186                ::serde::Serialize::serialize(&self.0, __s)
18187            }
18188        }
18189        /// PairMarketdataConfig describes market-data display settings for a spot pair.
18190        #[derive(Clone, Debug, Default)]
18191        pub struct PairMarketdataConfigView<'a> {
18192            /// Suggested order book aggregation bucket sizes in quote-asset price units,
18193            /// e.g. 0.01, 0.1, 1, or 10.
18194            ///
18195            /// Field 1: `orderbook_price_buckets`
18196            pub orderbook_price_buckets: ::buffa::RepeatedView<'a, f64>,
18197            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
18198        }
18199        impl<'a> ::buffa::MessageView<'a> for PairMarketdataConfigView<'a> {
18200            type Owned = super::super::PairMarketdataConfig;
18201            fn decode_view(
18202                buf: &'a [u8],
18203            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18204                let __limit = ::core::cell::Cell::new(
18205                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
18206                );
18207                <Self as ::buffa::MessageView>::decode_view_ctx(
18208                    buf,
18209                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
18210                )
18211            }
18212            fn decode_view_with_ctx(
18213                buf: &'a [u8],
18214                ctx: ::buffa::DecodeContext<'_>,
18215            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18216                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
18217            }
18218            fn merge_view_field(
18219                &mut self,
18220                tag: ::buffa::encoding::Tag,
18221                cur: &'a [u8],
18222                before_tag: &'a [u8],
18223                ctx: ::buffa::DecodeContext<'_>,
18224            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
18225                let _ = ctx;
18226                #[allow(unused_variables)]
18227                let view = self;
18228                let mut cur = cur;
18229                match tag.field_number() {
18230                    1u32 => {
18231                        if tag.wire_type()
18232                            == ::buffa::encoding::WireType::LengthDelimited
18233                        {
18234                            let payload = ::buffa::types::borrow_bytes(&mut cur)?;
18235                            view.orderbook_price_buckets.reserve(payload.len() / 8usize);
18236                            let mut pcur: &[u8] = payload;
18237                            while !pcur.is_empty() {
18238                                view.orderbook_price_buckets
18239                                    .push(::buffa::types::decode_double(&mut pcur)?);
18240                            }
18241                        } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed64
18242                        {
18243                            view.orderbook_price_buckets
18244                                .push(::buffa::types::decode_double(&mut cur)?);
18245                        } else {
18246                            return Err(
18247                                ::buffa::encoding::wire_type_mismatch(
18248                                    tag,
18249                                    ::buffa::encoding::WireType::LengthDelimited,
18250                                ),
18251                            );
18252                        }
18253                    }
18254                    _ => {
18255                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
18256                        let span_len = before_tag.len() - cur.len();
18257                        view.__buffa_unknown_fields
18258                            .push_record(before_tag, span_len, ctx)?;
18259                    }
18260                }
18261                ::core::result::Result::Ok(cur)
18262            }
18263            fn to_owned_message(
18264                &self,
18265            ) -> ::core::result::Result<
18266                super::super::PairMarketdataConfig,
18267                ::buffa::DecodeError,
18268            > {
18269                self.to_owned_from_source(None)
18270            }
18271            #[allow(clippy::useless_conversion, clippy::needless_update)]
18272            fn to_owned_from_source(
18273                &self,
18274                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
18275            ) -> ::core::result::Result<
18276                super::super::PairMarketdataConfig,
18277                ::buffa::DecodeError,
18278            > {
18279                #[allow(unused_imports)]
18280                use ::buffa::alloc::string::ToString as _;
18281                let _ = __buffa_src;
18282                ::core::result::Result::Ok(super::super::PairMarketdataConfig {
18283                    orderbook_price_buckets: self.orderbook_price_buckets.to_vec(),
18284                    __buffa_unknown_fields: self
18285                        .__buffa_unknown_fields
18286                        .to_owned()?
18287                        .into(),
18288                    ..::core::default::Default::default()
18289                })
18290            }
18291        }
18292        impl<'a> ::buffa::ViewEncode<'a> for PairMarketdataConfigView<'a> {
18293            #[allow(clippy::needless_borrow, clippy::let_and_return)]
18294            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
18295                #[allow(unused_imports)]
18296                use ::buffa::Enumeration as _;
18297                let mut size = 0u32;
18298                if !self.orderbook_price_buckets.is_empty() {
18299                    let payload: u32 = self.orderbook_price_buckets.len() as u32
18300                        * ::buffa::types::FIXED64_ENCODED_LEN as u32;
18301                    size
18302                        += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
18303                            + payload;
18304                }
18305                size += self.__buffa_unknown_fields.encoded_len() as u32;
18306                size
18307            }
18308            #[allow(clippy::needless_borrow)]
18309            fn write_to(
18310                &self,
18311                _cache: &mut ::buffa::SizeCache,
18312                buf: &mut impl ::buffa::bytes::BufMut,
18313            ) {
18314                #[allow(unused_imports)]
18315                use ::buffa::Enumeration as _;
18316                if !self.orderbook_price_buckets.is_empty() {
18317                    let payload: u32 = self.orderbook_price_buckets.len() as u32
18318                        * ::buffa::types::FIXED64_ENCODED_LEN as u32;
18319                    ::buffa::types::put_len_delimited_header(1u32, payload, buf);
18320                    for &v in &self.orderbook_price_buckets {
18321                        ::buffa::types::encode_double(v, buf);
18322                    }
18323                }
18324                self.__buffa_unknown_fields.write_to(buf);
18325            }
18326        }
18327        /// Serializes this view as protobuf JSON.
18328        ///
18329        /// Implicit-presence fields with default values are omitted, `required`
18330        /// fields are always emitted, explicit-presence (`optional`) fields are
18331        /// emitted only when set, bytes fields are base64-encoded, and enum
18332        /// values are their proto name strings.
18333        ///
18334        /// This impl uses `serialize_map(None)` because the number of emitted
18335        /// fields depends on default-omission rules; serializers that require
18336        /// known map lengths (e.g. `bincode`) will return a runtime error.
18337        /// Use the owned message type for those formats.
18338        impl<'__a> ::serde::Serialize for PairMarketdataConfigView<'__a> {
18339            fn serialize<__S: ::serde::Serializer>(
18340                &self,
18341                __s: __S,
18342            ) -> ::core::result::Result<__S::Ok, __S::Error> {
18343                use ::serde::ser::SerializeMap as _;
18344                let mut __map = __s.serialize_map(::core::option::Option::None)?;
18345                if !self.orderbook_price_buckets.is_empty() {
18346                    __map
18347                        .serialize_entry(
18348                            "orderbookPriceBuckets",
18349                            &::buffa::json_helpers::RepeatedJson(
18350                                &self.orderbook_price_buckets,
18351                            ),
18352                        )?;
18353                }
18354                __map.end()
18355            }
18356        }
18357        impl<'a> ::buffa::MessageName for PairMarketdataConfigView<'a> {
18358            const PACKAGE: &'static str = "marketdata.v1";
18359            const NAME: &'static str = "PairMarketdataConfig";
18360            const FULL_NAME: &'static str = "marketdata.v1.PairMarketdataConfig";
18361            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.PairMarketdataConfig";
18362        }
18363        ::buffa::impl_default_view_instance!(PairMarketdataConfigView);
18364        ::buffa::impl_view_reborrow!(PairMarketdataConfigView);
18365        /** Self-contained, `'static` owned view of a `PairMarketdataConfig` message.
18366
18367 Wraps [`::buffa::OwnedView`]`<`[`PairMarketdataConfigView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
18368
18369 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`PairMarketdataConfigView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
18370        #[derive(Clone, Debug)]
18371        pub struct PairMarketdataConfigOwnedView(
18372            ::buffa::OwnedView<PairMarketdataConfigView<'static>>,
18373        );
18374        impl PairMarketdataConfigOwnedView {
18375            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
18376            ///
18377            /// The view borrows directly from the buffer's data; the buffer is
18378            /// retained inside the returned handle.
18379            ///
18380            /// # Errors
18381            ///
18382            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
18383            /// protobuf data.
18384            pub fn decode(
18385                bytes: ::buffa::bytes::Bytes,
18386            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18387                ::core::result::Result::Ok(
18388                    PairMarketdataConfigOwnedView(::buffa::OwnedView::decode(bytes)?),
18389                )
18390            }
18391            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
18392            /// max message size).
18393            ///
18394            /// # Errors
18395            ///
18396            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
18397            /// exceeds the configured limits.
18398            pub fn decode_with_options(
18399                bytes: ::buffa::bytes::Bytes,
18400                opts: &::buffa::DecodeOptions,
18401            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18402                ::core::result::Result::Ok(
18403                    PairMarketdataConfigOwnedView(
18404                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
18405                    ),
18406                )
18407            }
18408            /// Build from an owned message via an encode → decode round-trip.
18409            ///
18410            /// # Errors
18411            ///
18412            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
18413            /// somehow invalid (should not happen for well-formed messages).
18414            pub fn from_owned(
18415                msg: &super::super::PairMarketdataConfig,
18416            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18417                ::core::result::Result::Ok(
18418                    PairMarketdataConfigOwnedView(::buffa::OwnedView::from_owned(msg)?),
18419                )
18420            }
18421            /// Borrow the full [`PairMarketdataConfigView`] with its lifetime tied to `&self`.
18422            #[must_use]
18423            pub fn view(&self) -> &PairMarketdataConfigView<'_> {
18424                self.0.reborrow()
18425            }
18426            /// Convert to the owned message type.
18427            ///
18428            /// # Errors
18429            ///
18430            /// Returns an error if re-materializing preserved unknown fields
18431            /// fails (e.g. the unknown-field limit is exceeded).
18432            pub fn to_owned_message(
18433                &self,
18434            ) -> ::core::result::Result<
18435                super::super::PairMarketdataConfig,
18436                ::buffa::DecodeError,
18437            > {
18438                self.0.to_owned_message()
18439            }
18440            /// The underlying bytes buffer.
18441            #[must_use]
18442            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
18443                self.0.bytes()
18444            }
18445            /// Consume the handle, returning the underlying bytes buffer.
18446            #[must_use]
18447            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
18448                self.0.into_bytes()
18449            }
18450            /// Suggested order book aggregation bucket sizes in quote-asset price units,
18451            /// e.g. 0.01, 0.1, 1, or 10.
18452            ///
18453            /// Field 1: `orderbook_price_buckets`
18454            #[must_use]
18455            pub fn orderbook_price_buckets(&self) -> &::buffa::RepeatedView<'_, f64> {
18456                &self.0.reborrow().orderbook_price_buckets
18457            }
18458        }
18459        impl ::core::convert::From<::buffa::OwnedView<PairMarketdataConfigView<'static>>>
18460        for PairMarketdataConfigOwnedView {
18461            fn from(
18462                inner: ::buffa::OwnedView<PairMarketdataConfigView<'static>>,
18463            ) -> Self {
18464                PairMarketdataConfigOwnedView(inner)
18465            }
18466        }
18467        impl ::core::convert::From<PairMarketdataConfigOwnedView>
18468        for ::buffa::OwnedView<PairMarketdataConfigView<'static>> {
18469            fn from(wrapper: PairMarketdataConfigOwnedView) -> Self {
18470                wrapper.0
18471            }
18472        }
18473        impl ::core::convert::AsRef<
18474            ::buffa::OwnedView<PairMarketdataConfigView<'static>>,
18475        > for PairMarketdataConfigOwnedView {
18476            fn as_ref(&self) -> &::buffa::OwnedView<PairMarketdataConfigView<'static>> {
18477                &self.0
18478            }
18479        }
18480        impl ::buffa::HasMessageView for super::super::PairMarketdataConfig {
18481            type View<'a> = PairMarketdataConfigView<'a>;
18482            type ViewHandle = PairMarketdataConfigOwnedView;
18483        }
18484        impl ::serde::Serialize for PairMarketdataConfigOwnedView {
18485            fn serialize<__S: ::serde::Serializer>(
18486                &self,
18487                __s: __S,
18488            ) -> ::core::result::Result<__S::Ok, __S::Error> {
18489                ::serde::Serialize::serialize(&self.0, __s)
18490            }
18491        }
18492        /// PairConfig describes one spot trading pair and its trading constraints.
18493        #[derive(Clone, Debug, Default)]
18494        pub struct PairConfigView<'a> {
18495            /// Stable numeric pair id used by low-latency ConnectRPC requests and streams.
18496            ///
18497            /// Field 1: `symbol_id`
18498            pub symbol_id: u32,
18499            /// Trading pair symbol, e.g. "BTC-USDT".
18500            ///
18501            /// Field 2: `symbol`
18502            pub symbol: &'a str,
18503            /// Base asset code. For BTC-USDT, this is "BTC".
18504            ///
18505            /// Field 3: `base_asset`
18506            pub base_asset: &'a str,
18507            /// Quote asset code. For BTC-USDT, this is "USDT".
18508            ///
18509            /// Field 4: `quote_asset`
18510            pub quote_asset: &'a str,
18511            /// Minimum allowed price increment as a decimal string in quote-asset units.
18512            /// Prices use 6 decimal places in scaled integer fields; for example "0.01"
18513            /// means orders must be priced in 0.01 quote-asset increments.
18514            ///
18515            /// Field 5: `tick_size`
18516            pub tick_size: &'a str,
18517            /// Minimum allowed quantity increment as a decimal string in base-asset units.
18518            ///
18519            /// Field 6: `step_size`
18520            pub step_size: &'a str,
18521            /// Minimum order notional as a decimal string in quote-asset units.
18522            ///
18523            /// Field 7: `min_notional_quote`
18524            pub min_notional_quote: &'a str,
18525            /// Minimum order quantity as a decimal string in base-asset units.
18526            ///
18527            /// Field 8: `min_qty_base`
18528            pub min_qty_base: &'a str,
18529            /// Whether BUY order fees may be paid from the base asset instead of the
18530            /// spent quote asset when the order request selects the base fee asset.
18531            ///
18532            /// Field 9: `allow_buy_fee_from_base`
18533            pub allow_buy_fee_from_base: bool,
18534            /// Quantity scale for base-asset amounts in this pair.
18535            ///
18536            /// Field 10: `base_quantity_scale`
18537            pub base_quantity_scale: u32,
18538            /// Quantity scale for quote-asset amounts in this pair.
18539            ///
18540            /// Field 11: `quote_quantity_scale`
18541            pub quote_quantity_scale: u32,
18542            /// Market-data display settings for this pair.
18543            ///
18544            /// Field 12: `marketdata`
18545            pub marketdata: ::buffa::MessageFieldView<
18546                super::super::__buffa::view::PairMarketdataConfigView<'a>,
18547            >,
18548            /// Scheduled listing timestamp. When unset, the pair has no explicit future
18549            /// listing time.
18550            ///
18551            /// Field 13: `listing_at`
18552            pub listing_at: ::buffa::MessageFieldView<
18553                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
18554            >,
18555            /// Scheduled delisting timestamp. When unset, the pair has no explicit
18556            /// delisting time.
18557            ///
18558            /// Field 14: `delisting_at`
18559            pub delisting_at: ::buffa::MessageFieldView<
18560                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
18561            >,
18562            /// Current trading status.
18563            ///
18564            /// Field 15: `status`
18565            pub status: ::buffa::EnumValue<super::super::PairStatus>,
18566            /// Default MARKET order slippage cap for BUY orders, in basis points
18567            /// (1 bp = 0.01%). A request-level slippage setting can override this value.
18568            ///
18569            /// Field 16: `default_market_slippage_bps_buy`
18570            pub default_market_slippage_bps_buy: i32,
18571            /// Default MARKET order slippage cap for SELL orders, in basis points
18572            /// (1 bp = 0.01%). A request-level slippage setting can override this value.
18573            ///
18574            /// Field 17: `default_market_slippage_bps_sell`
18575            pub default_market_slippage_bps_sell: i32,
18576            /// Maximum allowed drift between client reference price and server reference
18577            /// price for MARKET orders, in basis points (1 bp = 0.01%), when client
18578            /// reference pricing is used.
18579            ///
18580            /// Field 18: `max_client_ref_drift_bps`
18581            pub max_client_ref_drift_bps: i32,
18582            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
18583        }
18584        impl<'a> ::buffa::MessageView<'a> for PairConfigView<'a> {
18585            type Owned = super::super::PairConfig;
18586            fn decode_view(
18587                buf: &'a [u8],
18588            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18589                let __limit = ::core::cell::Cell::new(
18590                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
18591                );
18592                <Self as ::buffa::MessageView>::decode_view_ctx(
18593                    buf,
18594                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
18595                )
18596            }
18597            fn decode_view_with_ctx(
18598                buf: &'a [u8],
18599                ctx: ::buffa::DecodeContext<'_>,
18600            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18601                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
18602            }
18603            fn merge_view_field(
18604                &mut self,
18605                tag: ::buffa::encoding::Tag,
18606                cur: &'a [u8],
18607                before_tag: &'a [u8],
18608                ctx: ::buffa::DecodeContext<'_>,
18609            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
18610                let _ = ctx;
18611                #[allow(unused_variables)]
18612                let view = self;
18613                let mut cur = cur;
18614                match tag.field_number() {
18615                    1u32 => {
18616                        ::buffa::encoding::check_wire_type(
18617                            tag,
18618                            ::buffa::encoding::WireType::Varint,
18619                        )?;
18620                        view.symbol_id = ::buffa::types::decode_uint32(&mut cur)?;
18621                    }
18622                    2u32 => {
18623                        ::buffa::encoding::check_wire_type(
18624                            tag,
18625                            ::buffa::encoding::WireType::LengthDelimited,
18626                        )?;
18627                        view.symbol = ::buffa::types::borrow_str(&mut cur)?;
18628                    }
18629                    3u32 => {
18630                        ::buffa::encoding::check_wire_type(
18631                            tag,
18632                            ::buffa::encoding::WireType::LengthDelimited,
18633                        )?;
18634                        view.base_asset = ::buffa::types::borrow_str(&mut cur)?;
18635                    }
18636                    4u32 => {
18637                        ::buffa::encoding::check_wire_type(
18638                            tag,
18639                            ::buffa::encoding::WireType::LengthDelimited,
18640                        )?;
18641                        view.quote_asset = ::buffa::types::borrow_str(&mut cur)?;
18642                    }
18643                    5u32 => {
18644                        ::buffa::encoding::check_wire_type(
18645                            tag,
18646                            ::buffa::encoding::WireType::LengthDelimited,
18647                        )?;
18648                        view.tick_size = ::buffa::types::borrow_str(&mut cur)?;
18649                    }
18650                    6u32 => {
18651                        ::buffa::encoding::check_wire_type(
18652                            tag,
18653                            ::buffa::encoding::WireType::LengthDelimited,
18654                        )?;
18655                        view.step_size = ::buffa::types::borrow_str(&mut cur)?;
18656                    }
18657                    7u32 => {
18658                        ::buffa::encoding::check_wire_type(
18659                            tag,
18660                            ::buffa::encoding::WireType::LengthDelimited,
18661                        )?;
18662                        view.min_notional_quote = ::buffa::types::borrow_str(&mut cur)?;
18663                    }
18664                    8u32 => {
18665                        ::buffa::encoding::check_wire_type(
18666                            tag,
18667                            ::buffa::encoding::WireType::LengthDelimited,
18668                        )?;
18669                        view.min_qty_base = ::buffa::types::borrow_str(&mut cur)?;
18670                    }
18671                    9u32 => {
18672                        ::buffa::encoding::check_wire_type(
18673                            tag,
18674                            ::buffa::encoding::WireType::Varint,
18675                        )?;
18676                        view.allow_buy_fee_from_base = ::buffa::types::decode_bool(
18677                            &mut cur,
18678                        )?;
18679                    }
18680                    10u32 => {
18681                        ::buffa::encoding::check_wire_type(
18682                            tag,
18683                            ::buffa::encoding::WireType::Varint,
18684                        )?;
18685                        view.base_quantity_scale = ::buffa::types::decode_uint32(
18686                            &mut cur,
18687                        )?;
18688                    }
18689                    11u32 => {
18690                        ::buffa::encoding::check_wire_type(
18691                            tag,
18692                            ::buffa::encoding::WireType::Varint,
18693                        )?;
18694                        view.quote_quantity_scale = ::buffa::types::decode_uint32(
18695                            &mut cur,
18696                        )?;
18697                    }
18698                    12u32 => {
18699                        ::buffa::encoding::check_wire_type(
18700                            tag,
18701                            ::buffa::encoding::WireType::LengthDelimited,
18702                        )?;
18703                        let __sub_ctx = ctx.descend()?;
18704                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
18705                        match view.marketdata.as_mut() {
18706                            Some(existing) => {
18707                                ::buffa::MessageView::merge_into_view(
18708                                    existing,
18709                                    sub,
18710                                    __sub_ctx,
18711                                )?
18712                            }
18713                            None => {
18714                                view.marketdata = ::buffa::MessageFieldView::set(
18715                                    <super::super::__buffa::view::PairMarketdataConfigView as ::buffa::MessageView>::decode_view_ctx(
18716                                        sub,
18717                                        __sub_ctx,
18718                                    )?,
18719                                );
18720                            }
18721                        }
18722                    }
18723                    13u32 => {
18724                        ::buffa::encoding::check_wire_type(
18725                            tag,
18726                            ::buffa::encoding::WireType::LengthDelimited,
18727                        )?;
18728                        let __sub_ctx = ctx.descend()?;
18729                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
18730                        match view.listing_at.as_mut() {
18731                            Some(existing) => {
18732                                ::buffa::MessageView::merge_into_view(
18733                                    existing,
18734                                    sub,
18735                                    __sub_ctx,
18736                                )?
18737                            }
18738                            None => {
18739                                view.listing_at = ::buffa::MessageFieldView::set(
18740                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
18741                                        sub,
18742                                        __sub_ctx,
18743                                    )?,
18744                                );
18745                            }
18746                        }
18747                    }
18748                    14u32 => {
18749                        ::buffa::encoding::check_wire_type(
18750                            tag,
18751                            ::buffa::encoding::WireType::LengthDelimited,
18752                        )?;
18753                        let __sub_ctx = ctx.descend()?;
18754                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
18755                        match view.delisting_at.as_mut() {
18756                            Some(existing) => {
18757                                ::buffa::MessageView::merge_into_view(
18758                                    existing,
18759                                    sub,
18760                                    __sub_ctx,
18761                                )?
18762                            }
18763                            None => {
18764                                view.delisting_at = ::buffa::MessageFieldView::set(
18765                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
18766                                        sub,
18767                                        __sub_ctx,
18768                                    )?,
18769                                );
18770                            }
18771                        }
18772                    }
18773                    15u32 => {
18774                        ::buffa::encoding::check_wire_type(
18775                            tag,
18776                            ::buffa::encoding::WireType::Varint,
18777                        )?;
18778                        view.status = ::buffa::EnumValue::from(
18779                            ::buffa::types::decode_int32(&mut cur)?,
18780                        );
18781                    }
18782                    16u32 => {
18783                        ::buffa::encoding::check_wire_type(
18784                            tag,
18785                            ::buffa::encoding::WireType::Varint,
18786                        )?;
18787                        view.default_market_slippage_bps_buy = ::buffa::types::decode_int32(
18788                            &mut cur,
18789                        )?;
18790                    }
18791                    17u32 => {
18792                        ::buffa::encoding::check_wire_type(
18793                            tag,
18794                            ::buffa::encoding::WireType::Varint,
18795                        )?;
18796                        view.default_market_slippage_bps_sell = ::buffa::types::decode_int32(
18797                            &mut cur,
18798                        )?;
18799                    }
18800                    18u32 => {
18801                        ::buffa::encoding::check_wire_type(
18802                            tag,
18803                            ::buffa::encoding::WireType::Varint,
18804                        )?;
18805                        view.max_client_ref_drift_bps = ::buffa::types::decode_int32(
18806                            &mut cur,
18807                        )?;
18808                    }
18809                    _ => {
18810                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
18811                        let span_len = before_tag.len() - cur.len();
18812                        view.__buffa_unknown_fields
18813                            .push_record(before_tag, span_len, ctx)?;
18814                    }
18815                }
18816                ::core::result::Result::Ok(cur)
18817            }
18818            fn to_owned_message(
18819                &self,
18820            ) -> ::core::result::Result<super::super::PairConfig, ::buffa::DecodeError> {
18821                self.to_owned_from_source(None)
18822            }
18823            #[allow(clippy::useless_conversion, clippy::needless_update)]
18824            fn to_owned_from_source(
18825                &self,
18826                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
18827            ) -> ::core::result::Result<super::super::PairConfig, ::buffa::DecodeError> {
18828                #[allow(unused_imports)]
18829                use ::buffa::alloc::string::ToString as _;
18830                let _ = __buffa_src;
18831                ::core::result::Result::Ok(super::super::PairConfig {
18832                    symbol_id: self.symbol_id,
18833                    symbol: self.symbol.to_string(),
18834                    base_asset: self.base_asset.to_string(),
18835                    quote_asset: self.quote_asset.to_string(),
18836                    tick_size: self.tick_size.to_string(),
18837                    step_size: self.step_size.to_string(),
18838                    min_notional_quote: self.min_notional_quote.to_string(),
18839                    min_qty_base: self.min_qty_base.to_string(),
18840                    allow_buy_fee_from_base: self.allow_buy_fee_from_base,
18841                    base_quantity_scale: self.base_quantity_scale,
18842                    quote_quantity_scale: self.quote_quantity_scale,
18843                    marketdata: match self.marketdata.as_option() {
18844                        Some(v) => {
18845                            ::buffa::MessageField::<
18846                                super::super::PairMarketdataConfig,
18847                            >::some(v.to_owned_from_source(__buffa_src)?)
18848                        }
18849                        None => ::buffa::MessageField::none(),
18850                    },
18851                    listing_at: match self.listing_at.as_option() {
18852                        Some(v) => {
18853                            ::buffa::MessageField::<
18854                                ::buffa_types::google::protobuf::Timestamp,
18855                            >::some(v.to_owned_from_source(__buffa_src)?)
18856                        }
18857                        None => ::buffa::MessageField::none(),
18858                    },
18859                    delisting_at: match self.delisting_at.as_option() {
18860                        Some(v) => {
18861                            ::buffa::MessageField::<
18862                                ::buffa_types::google::protobuf::Timestamp,
18863                            >::some(v.to_owned_from_source(__buffa_src)?)
18864                        }
18865                        None => ::buffa::MessageField::none(),
18866                    },
18867                    status: self.status,
18868                    default_market_slippage_bps_buy: self
18869                        .default_market_slippage_bps_buy,
18870                    default_market_slippage_bps_sell: self
18871                        .default_market_slippage_bps_sell,
18872                    max_client_ref_drift_bps: self.max_client_ref_drift_bps,
18873                    __buffa_unknown_fields: self
18874                        .__buffa_unknown_fields
18875                        .to_owned()?
18876                        .into(),
18877                    ..::core::default::Default::default()
18878                })
18879            }
18880        }
18881        impl<'a> ::buffa::ViewEncode<'a> for PairConfigView<'a> {
18882            #[allow(clippy::needless_borrow, clippy::let_and_return)]
18883            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
18884                #[allow(unused_imports)]
18885                use ::buffa::Enumeration as _;
18886                let mut size = 0u32;
18887                if self.symbol_id != 0u32 {
18888                    size
18889                        += 1u32
18890                            + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
18891                }
18892                if !self.symbol.is_empty() {
18893                    size
18894                        += 1u32
18895                            + ::buffa::types::string_encoded_len(&self.symbol) as u32;
18896                }
18897                if !self.base_asset.is_empty() {
18898                    size
18899                        += 1u32
18900                            + ::buffa::types::string_encoded_len(&self.base_asset)
18901                                as u32;
18902                }
18903                if !self.quote_asset.is_empty() {
18904                    size
18905                        += 1u32
18906                            + ::buffa::types::string_encoded_len(&self.quote_asset)
18907                                as u32;
18908                }
18909                if !self.tick_size.is_empty() {
18910                    size
18911                        += 1u32
18912                            + ::buffa::types::string_encoded_len(&self.tick_size) as u32;
18913                }
18914                if !self.step_size.is_empty() {
18915                    size
18916                        += 1u32
18917                            + ::buffa::types::string_encoded_len(&self.step_size) as u32;
18918                }
18919                if !self.min_notional_quote.is_empty() {
18920                    size
18921                        += 1u32
18922                            + ::buffa::types::string_encoded_len(
18923                                &self.min_notional_quote,
18924                            ) as u32;
18925                }
18926                if !self.min_qty_base.is_empty() {
18927                    size
18928                        += 1u32
18929                            + ::buffa::types::string_encoded_len(&self.min_qty_base)
18930                                as u32;
18931                }
18932                if self.allow_buy_fee_from_base {
18933                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
18934                }
18935                if self.base_quantity_scale != 0u32 {
18936                    size
18937                        += 1u32
18938                            + ::buffa::types::uint32_encoded_len(
18939                                self.base_quantity_scale,
18940                            ) as u32;
18941                }
18942                if self.quote_quantity_scale != 0u32 {
18943                    size
18944                        += 1u32
18945                            + ::buffa::types::uint32_encoded_len(
18946                                self.quote_quantity_scale,
18947                            ) as u32;
18948                }
18949                if self.marketdata.is_set() {
18950                    let __slot = __cache.reserve();
18951                    let inner_size = self.marketdata.compute_size(__cache);
18952                    __cache.set(__slot, inner_size);
18953                    size
18954                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
18955                            + inner_size;
18956                }
18957                if self.listing_at.is_set() {
18958                    let __slot = __cache.reserve();
18959                    let inner_size = self.listing_at.compute_size(__cache);
18960                    __cache.set(__slot, inner_size);
18961                    size
18962                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
18963                            + inner_size;
18964                }
18965                if self.delisting_at.is_set() {
18966                    let __slot = __cache.reserve();
18967                    let inner_size = self.delisting_at.compute_size(__cache);
18968                    __cache.set(__slot, inner_size);
18969                    size
18970                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
18971                            + inner_size;
18972                }
18973                {
18974                    let val = self.status.to_i32();
18975                    if val != 0 {
18976                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
18977                    }
18978                }
18979                if self.default_market_slippage_bps_buy != 0i32 {
18980                    size
18981                        += 2u32
18982                            + ::buffa::types::int32_encoded_len(
18983                                self.default_market_slippage_bps_buy,
18984                            ) as u32;
18985                }
18986                if self.default_market_slippage_bps_sell != 0i32 {
18987                    size
18988                        += 2u32
18989                            + ::buffa::types::int32_encoded_len(
18990                                self.default_market_slippage_bps_sell,
18991                            ) as u32;
18992                }
18993                if self.max_client_ref_drift_bps != 0i32 {
18994                    size
18995                        += 2u32
18996                            + ::buffa::types::int32_encoded_len(
18997                                self.max_client_ref_drift_bps,
18998                            ) as u32;
18999                }
19000                size += self.__buffa_unknown_fields.encoded_len() as u32;
19001                size
19002            }
19003            #[allow(clippy::needless_borrow)]
19004            fn write_to(
19005                &self,
19006                __cache: &mut ::buffa::SizeCache,
19007                buf: &mut impl ::buffa::bytes::BufMut,
19008            ) {
19009                #[allow(unused_imports)]
19010                use ::buffa::Enumeration as _;
19011                if self.symbol_id != 0u32 {
19012                    ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
19013                }
19014                if !self.symbol.is_empty() {
19015                    ::buffa::types::put_string_field(2u32, &self.symbol, buf);
19016                }
19017                if !self.base_asset.is_empty() {
19018                    ::buffa::types::put_string_field(3u32, &self.base_asset, buf);
19019                }
19020                if !self.quote_asset.is_empty() {
19021                    ::buffa::types::put_string_field(4u32, &self.quote_asset, buf);
19022                }
19023                if !self.tick_size.is_empty() {
19024                    ::buffa::types::put_string_field(5u32, &self.tick_size, buf);
19025                }
19026                if !self.step_size.is_empty() {
19027                    ::buffa::types::put_string_field(6u32, &self.step_size, buf);
19028                }
19029                if !self.min_notional_quote.is_empty() {
19030                    ::buffa::types::put_string_field(
19031                        7u32,
19032                        &self.min_notional_quote,
19033                        buf,
19034                    );
19035                }
19036                if !self.min_qty_base.is_empty() {
19037                    ::buffa::types::put_string_field(8u32, &self.min_qty_base, buf);
19038                }
19039                if self.allow_buy_fee_from_base {
19040                    ::buffa::types::put_bool_field(
19041                        9u32,
19042                        self.allow_buy_fee_from_base,
19043                        buf,
19044                    );
19045                }
19046                if self.base_quantity_scale != 0u32 {
19047                    ::buffa::types::put_uint32_field(
19048                        10u32,
19049                        self.base_quantity_scale,
19050                        buf,
19051                    );
19052                }
19053                if self.quote_quantity_scale != 0u32 {
19054                    ::buffa::types::put_uint32_field(
19055                        11u32,
19056                        self.quote_quantity_scale,
19057                        buf,
19058                    );
19059                }
19060                if self.marketdata.is_set() {
19061                    ::buffa::types::put_len_delimited_header(
19062                        12u32,
19063                        __cache.consume_next(),
19064                        buf,
19065                    );
19066                    self.marketdata.write_to(__cache, buf);
19067                }
19068                if self.listing_at.is_set() {
19069                    ::buffa::types::put_len_delimited_header(
19070                        13u32,
19071                        __cache.consume_next(),
19072                        buf,
19073                    );
19074                    self.listing_at.write_to(__cache, buf);
19075                }
19076                if self.delisting_at.is_set() {
19077                    ::buffa::types::put_len_delimited_header(
19078                        14u32,
19079                        __cache.consume_next(),
19080                        buf,
19081                    );
19082                    self.delisting_at.write_to(__cache, buf);
19083                }
19084                {
19085                    let val = self.status.to_i32();
19086                    if val != 0 {
19087                        ::buffa::types::put_int32_field(15u32, val, buf);
19088                    }
19089                }
19090                if self.default_market_slippage_bps_buy != 0i32 {
19091                    ::buffa::types::put_int32_field(
19092                        16u32,
19093                        self.default_market_slippage_bps_buy,
19094                        buf,
19095                    );
19096                }
19097                if self.default_market_slippage_bps_sell != 0i32 {
19098                    ::buffa::types::put_int32_field(
19099                        17u32,
19100                        self.default_market_slippage_bps_sell,
19101                        buf,
19102                    );
19103                }
19104                if self.max_client_ref_drift_bps != 0i32 {
19105                    ::buffa::types::put_int32_field(
19106                        18u32,
19107                        self.max_client_ref_drift_bps,
19108                        buf,
19109                    );
19110                }
19111                self.__buffa_unknown_fields.write_to(buf);
19112            }
19113        }
19114        /// Serializes this view as protobuf JSON.
19115        ///
19116        /// Implicit-presence fields with default values are omitted, `required`
19117        /// fields are always emitted, explicit-presence (`optional`) fields are
19118        /// emitted only when set, bytes fields are base64-encoded, and enum
19119        /// values are their proto name strings.
19120        ///
19121        /// This impl uses `serialize_map(None)` because the number of emitted
19122        /// fields depends on default-omission rules; serializers that require
19123        /// known map lengths (e.g. `bincode`) will return a runtime error.
19124        /// Use the owned message type for those formats.
19125        impl<'__a> ::serde::Serialize for PairConfigView<'__a> {
19126            fn serialize<__S: ::serde::Serializer>(
19127                &self,
19128                __s: __S,
19129            ) -> ::core::result::Result<__S::Ok, __S::Error> {
19130                use ::serde::ser::SerializeMap as _;
19131                let mut __map = __s.serialize_map(::core::option::Option::None)?;
19132                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.symbol_id) {
19133                    __map
19134                        .serialize_entry(
19135                            "symbolId",
19136                            &::buffa::json_helpers::ProtoJson(&self.symbol_id),
19137                        )?;
19138                }
19139                if !::buffa::json_helpers::skip_if::is_empty_str(self.symbol) {
19140                    __map.serialize_entry("symbol", self.symbol)?;
19141                }
19142                if !::buffa::json_helpers::skip_if::is_empty_str(self.base_asset) {
19143                    __map.serialize_entry("baseAsset", self.base_asset)?;
19144                }
19145                if !::buffa::json_helpers::skip_if::is_empty_str(self.quote_asset) {
19146                    __map.serialize_entry("quoteAsset", self.quote_asset)?;
19147                }
19148                if !::buffa::json_helpers::skip_if::is_empty_str(self.tick_size) {
19149                    __map.serialize_entry("tickSize", self.tick_size)?;
19150                }
19151                if !::buffa::json_helpers::skip_if::is_empty_str(self.step_size) {
19152                    __map.serialize_entry("stepSize", self.step_size)?;
19153                }
19154                if !::buffa::json_helpers::skip_if::is_empty_str(
19155                    self.min_notional_quote,
19156                ) {
19157                    __map.serialize_entry("minNotionalQuote", self.min_notional_quote)?;
19158                }
19159                if !::buffa::json_helpers::skip_if::is_empty_str(self.min_qty_base) {
19160                    __map.serialize_entry("minQtyBase", self.min_qty_base)?;
19161                }
19162                if self.allow_buy_fee_from_base {
19163                    __map
19164                        .serialize_entry(
19165                            "allowBuyFeeFromBase",
19166                            &self.allow_buy_fee_from_base,
19167                        )?;
19168                }
19169                if !::buffa::json_helpers::skip_if::is_zero_u32(
19170                    &self.base_quantity_scale,
19171                ) {
19172                    __map
19173                        .serialize_entry(
19174                            "baseQuantityScale",
19175                            &::buffa::json_helpers::ProtoJson(&self.base_quantity_scale),
19176                        )?;
19177                }
19178                if !::buffa::json_helpers::skip_if::is_zero_u32(
19179                    &self.quote_quantity_scale,
19180                ) {
19181                    __map
19182                        .serialize_entry(
19183                            "quoteQuantityScale",
19184                            &::buffa::json_helpers::ProtoJson(&self.quote_quantity_scale),
19185                        )?;
19186                }
19187                {
19188                    if let ::core::option::Option::Some(__v) = self
19189                        .marketdata
19190                        .as_option()
19191                    {
19192                        __map.serialize_entry("marketdata", __v)?;
19193                    }
19194                }
19195                {
19196                    if let ::core::option::Option::Some(__v) = self
19197                        .listing_at
19198                        .as_option()
19199                    {
19200                        __map.serialize_entry("listingAt", __v)?;
19201                    }
19202                }
19203                {
19204                    if let ::core::option::Option::Some(__v) = self
19205                        .delisting_at
19206                        .as_option()
19207                    {
19208                        __map.serialize_entry("delistingAt", __v)?;
19209                    }
19210                }
19211                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.status) {
19212                    __map.serialize_entry("status", &self.status)?;
19213                }
19214                if !::buffa::json_helpers::skip_if::is_zero_i32(
19215                    &self.default_market_slippage_bps_buy,
19216                ) {
19217                    __map
19218                        .serialize_entry(
19219                            "defaultMarketSlippageBpsBuy",
19220                            &::buffa::json_helpers::ProtoJson(
19221                                &self.default_market_slippage_bps_buy,
19222                            ),
19223                        )?;
19224                }
19225                if !::buffa::json_helpers::skip_if::is_zero_i32(
19226                    &self.default_market_slippage_bps_sell,
19227                ) {
19228                    __map
19229                        .serialize_entry(
19230                            "defaultMarketSlippageBpsSell",
19231                            &::buffa::json_helpers::ProtoJson(
19232                                &self.default_market_slippage_bps_sell,
19233                            ),
19234                        )?;
19235                }
19236                if !::buffa::json_helpers::skip_if::is_zero_i32(
19237                    &self.max_client_ref_drift_bps,
19238                ) {
19239                    __map
19240                        .serialize_entry(
19241                            "maxClientRefDriftBps",
19242                            &::buffa::json_helpers::ProtoJson(
19243                                &self.max_client_ref_drift_bps,
19244                            ),
19245                        )?;
19246                }
19247                __map.end()
19248            }
19249        }
19250        impl<'a> ::buffa::MessageName for PairConfigView<'a> {
19251            const PACKAGE: &'static str = "marketdata.v1";
19252            const NAME: &'static str = "PairConfig";
19253            const FULL_NAME: &'static str = "marketdata.v1.PairConfig";
19254            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.PairConfig";
19255        }
19256        ::buffa::impl_default_view_instance!(PairConfigView);
19257        ::buffa::impl_view_reborrow!(PairConfigView);
19258        /** Self-contained, `'static` owned view of a `PairConfig` message.
19259
19260 Wraps [`::buffa::OwnedView`]`<`[`PairConfigView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
19261
19262 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`PairConfigView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
19263        #[derive(Clone, Debug)]
19264        pub struct PairConfigOwnedView(::buffa::OwnedView<PairConfigView<'static>>);
19265        impl PairConfigOwnedView {
19266            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
19267            ///
19268            /// The view borrows directly from the buffer's data; the buffer is
19269            /// retained inside the returned handle.
19270            ///
19271            /// # Errors
19272            ///
19273            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
19274            /// protobuf data.
19275            pub fn decode(
19276                bytes: ::buffa::bytes::Bytes,
19277            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19278                ::core::result::Result::Ok(
19279                    PairConfigOwnedView(::buffa::OwnedView::decode(bytes)?),
19280                )
19281            }
19282            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
19283            /// max message size).
19284            ///
19285            /// # Errors
19286            ///
19287            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
19288            /// exceeds the configured limits.
19289            pub fn decode_with_options(
19290                bytes: ::buffa::bytes::Bytes,
19291                opts: &::buffa::DecodeOptions,
19292            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19293                ::core::result::Result::Ok(
19294                    PairConfigOwnedView(
19295                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
19296                    ),
19297                )
19298            }
19299            /// Build from an owned message via an encode → decode round-trip.
19300            ///
19301            /// # Errors
19302            ///
19303            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
19304            /// somehow invalid (should not happen for well-formed messages).
19305            pub fn from_owned(
19306                msg: &super::super::PairConfig,
19307            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19308                ::core::result::Result::Ok(
19309                    PairConfigOwnedView(::buffa::OwnedView::from_owned(msg)?),
19310                )
19311            }
19312            /// Borrow the full [`PairConfigView`] with its lifetime tied to `&self`.
19313            #[must_use]
19314            pub fn view(&self) -> &PairConfigView<'_> {
19315                self.0.reborrow()
19316            }
19317            /// Convert to the owned message type.
19318            ///
19319            /// # Errors
19320            ///
19321            /// Returns an error if re-materializing preserved unknown fields
19322            /// fails (e.g. the unknown-field limit is exceeded).
19323            pub fn to_owned_message(
19324                &self,
19325            ) -> ::core::result::Result<super::super::PairConfig, ::buffa::DecodeError> {
19326                self.0.to_owned_message()
19327            }
19328            /// The underlying bytes buffer.
19329            #[must_use]
19330            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
19331                self.0.bytes()
19332            }
19333            /// Consume the handle, returning the underlying bytes buffer.
19334            #[must_use]
19335            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
19336                self.0.into_bytes()
19337            }
19338            /// Stable numeric pair id used by low-latency ConnectRPC requests and streams.
19339            ///
19340            /// Field 1: `symbol_id`
19341            #[must_use]
19342            pub fn symbol_id(&self) -> u32 {
19343                self.0.reborrow().symbol_id
19344            }
19345            /// Trading pair symbol, e.g. "BTC-USDT".
19346            ///
19347            /// Field 2: `symbol`
19348            #[must_use]
19349            pub fn symbol(&self) -> &'_ str {
19350                self.0.reborrow().symbol
19351            }
19352            /// Base asset code. For BTC-USDT, this is "BTC".
19353            ///
19354            /// Field 3: `base_asset`
19355            #[must_use]
19356            pub fn base_asset(&self) -> &'_ str {
19357                self.0.reborrow().base_asset
19358            }
19359            /// Quote asset code. For BTC-USDT, this is "USDT".
19360            ///
19361            /// Field 4: `quote_asset`
19362            #[must_use]
19363            pub fn quote_asset(&self) -> &'_ str {
19364                self.0.reborrow().quote_asset
19365            }
19366            /// Minimum allowed price increment as a decimal string in quote-asset units.
19367            /// Prices use 6 decimal places in scaled integer fields; for example "0.01"
19368            /// means orders must be priced in 0.01 quote-asset increments.
19369            ///
19370            /// Field 5: `tick_size`
19371            #[must_use]
19372            pub fn tick_size(&self) -> &'_ str {
19373                self.0.reborrow().tick_size
19374            }
19375            /// Minimum allowed quantity increment as a decimal string in base-asset units.
19376            ///
19377            /// Field 6: `step_size`
19378            #[must_use]
19379            pub fn step_size(&self) -> &'_ str {
19380                self.0.reborrow().step_size
19381            }
19382            /// Minimum order notional as a decimal string in quote-asset units.
19383            ///
19384            /// Field 7: `min_notional_quote`
19385            #[must_use]
19386            pub fn min_notional_quote(&self) -> &'_ str {
19387                self.0.reborrow().min_notional_quote
19388            }
19389            /// Minimum order quantity as a decimal string in base-asset units.
19390            ///
19391            /// Field 8: `min_qty_base`
19392            #[must_use]
19393            pub fn min_qty_base(&self) -> &'_ str {
19394                self.0.reborrow().min_qty_base
19395            }
19396            /// Whether BUY order fees may be paid from the base asset instead of the
19397            /// spent quote asset when the order request selects the base fee asset.
19398            ///
19399            /// Field 9: `allow_buy_fee_from_base`
19400            #[must_use]
19401            pub fn allow_buy_fee_from_base(&self) -> bool {
19402                self.0.reborrow().allow_buy_fee_from_base
19403            }
19404            /// Quantity scale for base-asset amounts in this pair.
19405            ///
19406            /// Field 10: `base_quantity_scale`
19407            #[must_use]
19408            pub fn base_quantity_scale(&self) -> u32 {
19409                self.0.reborrow().base_quantity_scale
19410            }
19411            /// Quantity scale for quote-asset amounts in this pair.
19412            ///
19413            /// Field 11: `quote_quantity_scale`
19414            #[must_use]
19415            pub fn quote_quantity_scale(&self) -> u32 {
19416                self.0.reborrow().quote_quantity_scale
19417            }
19418            /// Market-data display settings for this pair.
19419            ///
19420            /// Field 12: `marketdata`
19421            #[must_use]
19422            pub fn marketdata(
19423                &self,
19424            ) -> &::buffa::MessageFieldView<
19425                super::super::__buffa::view::PairMarketdataConfigView<'_>,
19426            > {
19427                &self.0.reborrow().marketdata
19428            }
19429            /// Scheduled listing timestamp. When unset, the pair has no explicit future
19430            /// listing time.
19431            ///
19432            /// Field 13: `listing_at`
19433            #[must_use]
19434            pub fn listing_at(
19435                &self,
19436            ) -> &::buffa::MessageFieldView<
19437                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
19438            > {
19439                &self.0.reborrow().listing_at
19440            }
19441            /// Scheduled delisting timestamp. When unset, the pair has no explicit
19442            /// delisting time.
19443            ///
19444            /// Field 14: `delisting_at`
19445            #[must_use]
19446            pub fn delisting_at(
19447                &self,
19448            ) -> &::buffa::MessageFieldView<
19449                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
19450            > {
19451                &self.0.reborrow().delisting_at
19452            }
19453            /// Current trading status.
19454            ///
19455            /// Field 15: `status`
19456            #[must_use]
19457            pub fn status(&self) -> ::buffa::EnumValue<super::super::PairStatus> {
19458                self.0.reborrow().status
19459            }
19460            /// Default MARKET order slippage cap for BUY orders, in basis points
19461            /// (1 bp = 0.01%). A request-level slippage setting can override this value.
19462            ///
19463            /// Field 16: `default_market_slippage_bps_buy`
19464            #[must_use]
19465            pub fn default_market_slippage_bps_buy(&self) -> i32 {
19466                self.0.reborrow().default_market_slippage_bps_buy
19467            }
19468            /// Default MARKET order slippage cap for SELL orders, in basis points
19469            /// (1 bp = 0.01%). A request-level slippage setting can override this value.
19470            ///
19471            /// Field 17: `default_market_slippage_bps_sell`
19472            #[must_use]
19473            pub fn default_market_slippage_bps_sell(&self) -> i32 {
19474                self.0.reborrow().default_market_slippage_bps_sell
19475            }
19476            /// Maximum allowed drift between client reference price and server reference
19477            /// price for MARKET orders, in basis points (1 bp = 0.01%), when client
19478            /// reference pricing is used.
19479            ///
19480            /// Field 18: `max_client_ref_drift_bps`
19481            #[must_use]
19482            pub fn max_client_ref_drift_bps(&self) -> i32 {
19483                self.0.reborrow().max_client_ref_drift_bps
19484            }
19485        }
19486        impl ::core::convert::From<::buffa::OwnedView<PairConfigView<'static>>>
19487        for PairConfigOwnedView {
19488            fn from(inner: ::buffa::OwnedView<PairConfigView<'static>>) -> Self {
19489                PairConfigOwnedView(inner)
19490            }
19491        }
19492        impl ::core::convert::From<PairConfigOwnedView>
19493        for ::buffa::OwnedView<PairConfigView<'static>> {
19494            fn from(wrapper: PairConfigOwnedView) -> Self {
19495                wrapper.0
19496            }
19497        }
19498        impl ::core::convert::AsRef<::buffa::OwnedView<PairConfigView<'static>>>
19499        for PairConfigOwnedView {
19500            fn as_ref(&self) -> &::buffa::OwnedView<PairConfigView<'static>> {
19501                &self.0
19502            }
19503        }
19504        impl ::buffa::HasMessageView for super::super::PairConfig {
19505            type View<'a> = PairConfigView<'a>;
19506            type ViewHandle = PairConfigOwnedView;
19507        }
19508        impl ::serde::Serialize for PairConfigOwnedView {
19509            fn serialize<__S: ::serde::Serializer>(
19510                &self,
19511                __s: __S,
19512            ) -> ::core::result::Result<__S::Ok, __S::Error> {
19513                ::serde::Serialize::serialize(&self.0, __s)
19514            }
19515        }
19516        /// GetSpotConfigRequest has no parameters.
19517        #[derive(Clone, Debug, Default)]
19518        pub struct GetSpotConfigRequestView<'a> {
19519            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
19520        }
19521        impl<'a> ::buffa::MessageView<'a> for GetSpotConfigRequestView<'a> {
19522            type Owned = super::super::GetSpotConfigRequest;
19523            fn decode_view(
19524                buf: &'a [u8],
19525            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19526                let __limit = ::core::cell::Cell::new(
19527                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
19528                );
19529                <Self as ::buffa::MessageView>::decode_view_ctx(
19530                    buf,
19531                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
19532                )
19533            }
19534            fn decode_view_with_ctx(
19535                buf: &'a [u8],
19536                ctx: ::buffa::DecodeContext<'_>,
19537            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19538                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
19539            }
19540            fn merge_view_field(
19541                &mut self,
19542                tag: ::buffa::encoding::Tag,
19543                cur: &'a [u8],
19544                before_tag: &'a [u8],
19545                ctx: ::buffa::DecodeContext<'_>,
19546            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
19547                let _ = ctx;
19548                #[allow(unused_variables)]
19549                let view = self;
19550                let mut cur = cur;
19551                match tag.field_number() {
19552                    _ => {
19553                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
19554                        let span_len = before_tag.len() - cur.len();
19555                        view.__buffa_unknown_fields
19556                            .push_record(before_tag, span_len, ctx)?;
19557                    }
19558                }
19559                ::core::result::Result::Ok(cur)
19560            }
19561            fn to_owned_message(
19562                &self,
19563            ) -> ::core::result::Result<
19564                super::super::GetSpotConfigRequest,
19565                ::buffa::DecodeError,
19566            > {
19567                self.to_owned_from_source(None)
19568            }
19569            #[allow(clippy::useless_conversion, clippy::needless_update)]
19570            fn to_owned_from_source(
19571                &self,
19572                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
19573            ) -> ::core::result::Result<
19574                super::super::GetSpotConfigRequest,
19575                ::buffa::DecodeError,
19576            > {
19577                #[allow(unused_imports)]
19578                use ::buffa::alloc::string::ToString as _;
19579                let _ = __buffa_src;
19580                ::core::result::Result::Ok(super::super::GetSpotConfigRequest {
19581                    __buffa_unknown_fields: self
19582                        .__buffa_unknown_fields
19583                        .to_owned()?
19584                        .into(),
19585                    ..::core::default::Default::default()
19586                })
19587            }
19588        }
19589        impl<'a> ::buffa::ViewEncode<'a> for GetSpotConfigRequestView<'a> {
19590            #[allow(clippy::needless_borrow, clippy::let_and_return)]
19591            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
19592                #[allow(unused_imports)]
19593                use ::buffa::Enumeration as _;
19594                let mut size = 0u32;
19595                size += self.__buffa_unknown_fields.encoded_len() as u32;
19596                size
19597            }
19598            #[allow(clippy::needless_borrow)]
19599            fn write_to(
19600                &self,
19601                _cache: &mut ::buffa::SizeCache,
19602                buf: &mut impl ::buffa::bytes::BufMut,
19603            ) {
19604                #[allow(unused_imports)]
19605                use ::buffa::Enumeration as _;
19606                self.__buffa_unknown_fields.write_to(buf);
19607            }
19608        }
19609        /// Serializes this view as protobuf JSON.
19610        ///
19611        /// Implicit-presence fields with default values are omitted, `required`
19612        /// fields are always emitted, explicit-presence (`optional`) fields are
19613        /// emitted only when set, bytes fields are base64-encoded, and enum
19614        /// values are their proto name strings.
19615        ///
19616        /// This impl uses `serialize_map(None)` because the number of emitted
19617        /// fields depends on default-omission rules; serializers that require
19618        /// known map lengths (e.g. `bincode`) will return a runtime error.
19619        /// Use the owned message type for those formats.
19620        impl<'__a> ::serde::Serialize for GetSpotConfigRequestView<'__a> {
19621            fn serialize<__S: ::serde::Serializer>(
19622                &self,
19623                __s: __S,
19624            ) -> ::core::result::Result<__S::Ok, __S::Error> {
19625                use ::serde::ser::SerializeMap as _;
19626                let mut __map = __s.serialize_map(::core::option::Option::None)?;
19627                __map.end()
19628            }
19629        }
19630        impl<'a> ::buffa::MessageName for GetSpotConfigRequestView<'a> {
19631            const PACKAGE: &'static str = "marketdata.v1";
19632            const NAME: &'static str = "GetSpotConfigRequest";
19633            const FULL_NAME: &'static str = "marketdata.v1.GetSpotConfigRequest";
19634            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetSpotConfigRequest";
19635        }
19636        ::buffa::impl_default_view_instance!(GetSpotConfigRequestView);
19637        ::buffa::impl_view_reborrow!(GetSpotConfigRequestView);
19638        /** Self-contained, `'static` owned view of a `GetSpotConfigRequest` message.
19639
19640 Wraps [`::buffa::OwnedView`]`<`[`GetSpotConfigRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
19641
19642 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetSpotConfigRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
19643        #[derive(Clone, Debug)]
19644        pub struct GetSpotConfigRequestOwnedView(
19645            ::buffa::OwnedView<GetSpotConfigRequestView<'static>>,
19646        );
19647        impl GetSpotConfigRequestOwnedView {
19648            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
19649            ///
19650            /// The view borrows directly from the buffer's data; the buffer is
19651            /// retained inside the returned handle.
19652            ///
19653            /// # Errors
19654            ///
19655            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
19656            /// protobuf data.
19657            pub fn decode(
19658                bytes: ::buffa::bytes::Bytes,
19659            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19660                ::core::result::Result::Ok(
19661                    GetSpotConfigRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
19662                )
19663            }
19664            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
19665            /// max message size).
19666            ///
19667            /// # Errors
19668            ///
19669            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
19670            /// exceeds the configured limits.
19671            pub fn decode_with_options(
19672                bytes: ::buffa::bytes::Bytes,
19673                opts: &::buffa::DecodeOptions,
19674            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19675                ::core::result::Result::Ok(
19676                    GetSpotConfigRequestOwnedView(
19677                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
19678                    ),
19679                )
19680            }
19681            /// Build from an owned message via an encode → decode round-trip.
19682            ///
19683            /// # Errors
19684            ///
19685            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
19686            /// somehow invalid (should not happen for well-formed messages).
19687            pub fn from_owned(
19688                msg: &super::super::GetSpotConfigRequest,
19689            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19690                ::core::result::Result::Ok(
19691                    GetSpotConfigRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
19692                )
19693            }
19694            /// Borrow the full [`GetSpotConfigRequestView`] with its lifetime tied to `&self`.
19695            #[must_use]
19696            pub fn view(&self) -> &GetSpotConfigRequestView<'_> {
19697                self.0.reborrow()
19698            }
19699            /// Convert to the owned message type.
19700            ///
19701            /// # Errors
19702            ///
19703            /// Returns an error if re-materializing preserved unknown fields
19704            /// fails (e.g. the unknown-field limit is exceeded).
19705            pub fn to_owned_message(
19706                &self,
19707            ) -> ::core::result::Result<
19708                super::super::GetSpotConfigRequest,
19709                ::buffa::DecodeError,
19710            > {
19711                self.0.to_owned_message()
19712            }
19713            /// The underlying bytes buffer.
19714            #[must_use]
19715            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
19716                self.0.bytes()
19717            }
19718            /// Consume the handle, returning the underlying bytes buffer.
19719            #[must_use]
19720            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
19721                self.0.into_bytes()
19722            }
19723        }
19724        impl ::core::convert::From<::buffa::OwnedView<GetSpotConfigRequestView<'static>>>
19725        for GetSpotConfigRequestOwnedView {
19726            fn from(
19727                inner: ::buffa::OwnedView<GetSpotConfigRequestView<'static>>,
19728            ) -> Self {
19729                GetSpotConfigRequestOwnedView(inner)
19730            }
19731        }
19732        impl ::core::convert::From<GetSpotConfigRequestOwnedView>
19733        for ::buffa::OwnedView<GetSpotConfigRequestView<'static>> {
19734            fn from(wrapper: GetSpotConfigRequestOwnedView) -> Self {
19735                wrapper.0
19736            }
19737        }
19738        impl ::core::convert::AsRef<
19739            ::buffa::OwnedView<GetSpotConfigRequestView<'static>>,
19740        > for GetSpotConfigRequestOwnedView {
19741            fn as_ref(&self) -> &::buffa::OwnedView<GetSpotConfigRequestView<'static>> {
19742                &self.0
19743            }
19744        }
19745        impl ::buffa::HasMessageView for super::super::GetSpotConfigRequest {
19746            type View<'a> = GetSpotConfigRequestView<'a>;
19747            type ViewHandle = GetSpotConfigRequestOwnedView;
19748        }
19749        impl ::serde::Serialize for GetSpotConfigRequestOwnedView {
19750            fn serialize<__S: ::serde::Serializer>(
19751                &self,
19752                __s: __S,
19753            ) -> ::core::result::Result<__S::Ok, __S::Error> {
19754                ::serde::Serialize::serialize(&self.0, __s)
19755            }
19756        }
19757        /// GetSpotConfigResponse contains a cacheable spot reference-data snapshot.
19758        #[derive(Clone, Debug, Default)]
19759        pub struct GetSpotConfigResponseView<'a> {
19760            /// Assets ordered by asset code in ascending alphabetical order.
19761            ///
19762            /// Field 1: `assets`
19763            pub assets: ::buffa::RepeatedView<
19764                'a,
19765                super::super::__buffa::view::AssetConfigView<'a>,
19766            >,
19767            /// Pairs ordered by symbol in ascending alphabetical order.
19768            ///
19769            /// Field 2: `pairs`
19770            pub pairs: ::buffa::RepeatedView<
19771                'a,
19772                super::super::__buffa::view::PairConfigView<'a>,
19773            >,
19774            /// Snapshot generation timestamp, in seconds since the Unix epoch (UTC).
19775            ///
19776            /// Field 3: `ts_sec`
19777            pub ts_sec: u64,
19778            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
19779        }
19780        impl<'a> ::buffa::MessageView<'a> for GetSpotConfigResponseView<'a> {
19781            type Owned = super::super::GetSpotConfigResponse;
19782            fn decode_view(
19783                buf: &'a [u8],
19784            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19785                let __limit = ::core::cell::Cell::new(
19786                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
19787                );
19788                <Self as ::buffa::MessageView>::decode_view_ctx(
19789                    buf,
19790                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
19791                )
19792            }
19793            fn decode_view_with_ctx(
19794                buf: &'a [u8],
19795                ctx: ::buffa::DecodeContext<'_>,
19796            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
19797                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
19798            }
19799            fn merge_view_field(
19800                &mut self,
19801                tag: ::buffa::encoding::Tag,
19802                cur: &'a [u8],
19803                before_tag: &'a [u8],
19804                ctx: ::buffa::DecodeContext<'_>,
19805            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
19806                let _ = ctx;
19807                #[allow(unused_variables)]
19808                let view = self;
19809                let mut cur = cur;
19810                match tag.field_number() {
19811                    3u32 => {
19812                        ::buffa::encoding::check_wire_type(
19813                            tag,
19814                            ::buffa::encoding::WireType::Varint,
19815                        )?;
19816                        view.ts_sec = ::buffa::types::decode_uint64(&mut cur)?;
19817                    }
19818                    1u32 => {
19819                        ::buffa::encoding::check_wire_type(
19820                            tag,
19821                            ::buffa::encoding::WireType::LengthDelimited,
19822                        )?;
19823                        let __sub_ctx = ctx.descend()?;
19824                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
19825                        view.assets
19826                            .push(
19827                                <super::super::__buffa::view::AssetConfigView as ::buffa::MessageView>::decode_view_ctx(
19828                                    sub,
19829                                    __sub_ctx,
19830                                )?,
19831                            );
19832                    }
19833                    2u32 => {
19834                        ::buffa::encoding::check_wire_type(
19835                            tag,
19836                            ::buffa::encoding::WireType::LengthDelimited,
19837                        )?;
19838                        let __sub_ctx = ctx.descend()?;
19839                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
19840                        view.pairs
19841                            .push(
19842                                <super::super::__buffa::view::PairConfigView as ::buffa::MessageView>::decode_view_ctx(
19843                                    sub,
19844                                    __sub_ctx,
19845                                )?,
19846                            );
19847                    }
19848                    _ => {
19849                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
19850                        let span_len = before_tag.len() - cur.len();
19851                        view.__buffa_unknown_fields
19852                            .push_record(before_tag, span_len, ctx)?;
19853                    }
19854                }
19855                ::core::result::Result::Ok(cur)
19856            }
19857            fn to_owned_message(
19858                &self,
19859            ) -> ::core::result::Result<
19860                super::super::GetSpotConfigResponse,
19861                ::buffa::DecodeError,
19862            > {
19863                self.to_owned_from_source(None)
19864            }
19865            #[allow(clippy::useless_conversion, clippy::needless_update)]
19866            fn to_owned_from_source(
19867                &self,
19868                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
19869            ) -> ::core::result::Result<
19870                super::super::GetSpotConfigResponse,
19871                ::buffa::DecodeError,
19872            > {
19873                #[allow(unused_imports)]
19874                use ::buffa::alloc::string::ToString as _;
19875                let _ = __buffa_src;
19876                ::core::result::Result::Ok(super::super::GetSpotConfigResponse {
19877                    assets: self
19878                        .assets
19879                        .iter()
19880                        .map(|v| v.to_owned_from_source(__buffa_src))
19881                        .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
19882                    pairs: self
19883                        .pairs
19884                        .iter()
19885                        .map(|v| v.to_owned_from_source(__buffa_src))
19886                        .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
19887                    ts_sec: self.ts_sec,
19888                    __buffa_unknown_fields: self
19889                        .__buffa_unknown_fields
19890                        .to_owned()?
19891                        .into(),
19892                    ..::core::default::Default::default()
19893                })
19894            }
19895        }
19896        impl<'a> ::buffa::ViewEncode<'a> for GetSpotConfigResponseView<'a> {
19897            #[allow(clippy::needless_borrow, clippy::let_and_return)]
19898            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
19899                #[allow(unused_imports)]
19900                use ::buffa::Enumeration as _;
19901                let mut size = 0u32;
19902                for v in &self.assets {
19903                    let __slot = __cache.reserve();
19904                    let inner_size = v.compute_size(__cache);
19905                    __cache.set(__slot, inner_size);
19906                    size
19907                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
19908                            + inner_size;
19909                }
19910                for v in &self.pairs {
19911                    let __slot = __cache.reserve();
19912                    let inner_size = v.compute_size(__cache);
19913                    __cache.set(__slot, inner_size);
19914                    size
19915                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
19916                            + inner_size;
19917                }
19918                if self.ts_sec != 0u64 {
19919                    size
19920                        += 1u32 + ::buffa::types::uint64_encoded_len(self.ts_sec) as u32;
19921                }
19922                size += self.__buffa_unknown_fields.encoded_len() as u32;
19923                size
19924            }
19925            #[allow(clippy::needless_borrow)]
19926            fn write_to(
19927                &self,
19928                __cache: &mut ::buffa::SizeCache,
19929                buf: &mut impl ::buffa::bytes::BufMut,
19930            ) {
19931                #[allow(unused_imports)]
19932                use ::buffa::Enumeration as _;
19933                for v in &self.assets {
19934                    ::buffa::types::put_len_delimited_header(
19935                        1u32,
19936                        __cache.consume_next(),
19937                        buf,
19938                    );
19939                    v.write_to(__cache, buf);
19940                }
19941                for v in &self.pairs {
19942                    ::buffa::types::put_len_delimited_header(
19943                        2u32,
19944                        __cache.consume_next(),
19945                        buf,
19946                    );
19947                    v.write_to(__cache, buf);
19948                }
19949                if self.ts_sec != 0u64 {
19950                    ::buffa::types::put_uint64_field(3u32, self.ts_sec, buf);
19951                }
19952                self.__buffa_unknown_fields.write_to(buf);
19953            }
19954        }
19955        /// Serializes this view as protobuf JSON.
19956        ///
19957        /// Implicit-presence fields with default values are omitted, `required`
19958        /// fields are always emitted, explicit-presence (`optional`) fields are
19959        /// emitted only when set, bytes fields are base64-encoded, and enum
19960        /// values are their proto name strings.
19961        ///
19962        /// This impl uses `serialize_map(None)` because the number of emitted
19963        /// fields depends on default-omission rules; serializers that require
19964        /// known map lengths (e.g. `bincode`) will return a runtime error.
19965        /// Use the owned message type for those formats.
19966        impl<'__a> ::serde::Serialize for GetSpotConfigResponseView<'__a> {
19967            fn serialize<__S: ::serde::Serializer>(
19968                &self,
19969                __s: __S,
19970            ) -> ::core::result::Result<__S::Ok, __S::Error> {
19971                use ::serde::ser::SerializeMap as _;
19972                let mut __map = __s.serialize_map(::core::option::Option::None)?;
19973                if !self.assets.is_empty() {
19974                    __map.serialize_entry("assets", &*self.assets)?;
19975                }
19976                if !self.pairs.is_empty() {
19977                    __map.serialize_entry("pairs", &*self.pairs)?;
19978                }
19979                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.ts_sec) {
19980                    __map
19981                        .serialize_entry(
19982                            "tsSec",
19983                            &::buffa::json_helpers::ProtoJson(&self.ts_sec),
19984                        )?;
19985                }
19986                __map.end()
19987            }
19988        }
19989        impl<'a> ::buffa::MessageName for GetSpotConfigResponseView<'a> {
19990            const PACKAGE: &'static str = "marketdata.v1";
19991            const NAME: &'static str = "GetSpotConfigResponse";
19992            const FULL_NAME: &'static str = "marketdata.v1.GetSpotConfigResponse";
19993            const TYPE_URL: &'static str = "type.googleapis.com/marketdata.v1.GetSpotConfigResponse";
19994        }
19995        ::buffa::impl_default_view_instance!(GetSpotConfigResponseView);
19996        ::buffa::impl_view_reborrow!(GetSpotConfigResponseView);
19997        /** Self-contained, `'static` owned view of a `GetSpotConfigResponse` message.
19998
19999 Wraps [`::buffa::OwnedView`]`<`[`GetSpotConfigResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
20000
20001 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetSpotConfigResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
20002        #[derive(Clone, Debug)]
20003        pub struct GetSpotConfigResponseOwnedView(
20004            ::buffa::OwnedView<GetSpotConfigResponseView<'static>>,
20005        );
20006        impl GetSpotConfigResponseOwnedView {
20007            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
20008            ///
20009            /// The view borrows directly from the buffer's data; the buffer is
20010            /// retained inside the returned handle.
20011            ///
20012            /// # Errors
20013            ///
20014            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
20015            /// protobuf data.
20016            pub fn decode(
20017                bytes: ::buffa::bytes::Bytes,
20018            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20019                ::core::result::Result::Ok(
20020                    GetSpotConfigResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
20021                )
20022            }
20023            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
20024            /// max message size).
20025            ///
20026            /// # Errors
20027            ///
20028            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
20029            /// exceeds the configured limits.
20030            pub fn decode_with_options(
20031                bytes: ::buffa::bytes::Bytes,
20032                opts: &::buffa::DecodeOptions,
20033            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20034                ::core::result::Result::Ok(
20035                    GetSpotConfigResponseOwnedView(
20036                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
20037                    ),
20038                )
20039            }
20040            /// Build from an owned message via an encode → decode round-trip.
20041            ///
20042            /// # Errors
20043            ///
20044            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
20045            /// somehow invalid (should not happen for well-formed messages).
20046            pub fn from_owned(
20047                msg: &super::super::GetSpotConfigResponse,
20048            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
20049                ::core::result::Result::Ok(
20050                    GetSpotConfigResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
20051                )
20052            }
20053            /// Borrow the full [`GetSpotConfigResponseView`] with its lifetime tied to `&self`.
20054            #[must_use]
20055            pub fn view(&self) -> &GetSpotConfigResponseView<'_> {
20056                self.0.reborrow()
20057            }
20058            /// Convert to the owned message type.
20059            ///
20060            /// # Errors
20061            ///
20062            /// Returns an error if re-materializing preserved unknown fields
20063            /// fails (e.g. the unknown-field limit is exceeded).
20064            pub fn to_owned_message(
20065                &self,
20066            ) -> ::core::result::Result<
20067                super::super::GetSpotConfigResponse,
20068                ::buffa::DecodeError,
20069            > {
20070                self.0.to_owned_message()
20071            }
20072            /// The underlying bytes buffer.
20073            #[must_use]
20074            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
20075                self.0.bytes()
20076            }
20077            /// Consume the handle, returning the underlying bytes buffer.
20078            #[must_use]
20079            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
20080                self.0.into_bytes()
20081            }
20082            /// Assets ordered by asset code in ascending alphabetical order.
20083            ///
20084            /// Field 1: `assets`
20085            #[must_use]
20086            pub fn assets(
20087                &self,
20088            ) -> &::buffa::RepeatedView<
20089                '_,
20090                super::super::__buffa::view::AssetConfigView<'_>,
20091            > {
20092                &self.0.reborrow().assets
20093            }
20094            /// Pairs ordered by symbol in ascending alphabetical order.
20095            ///
20096            /// Field 2: `pairs`
20097            #[must_use]
20098            pub fn pairs(
20099                &self,
20100            ) -> &::buffa::RepeatedView<
20101                '_,
20102                super::super::__buffa::view::PairConfigView<'_>,
20103            > {
20104                &self.0.reborrow().pairs
20105            }
20106            /// Snapshot generation timestamp, in seconds since the Unix epoch (UTC).
20107            ///
20108            /// Field 3: `ts_sec`
20109            #[must_use]
20110            pub fn ts_sec(&self) -> u64 {
20111                self.0.reborrow().ts_sec
20112            }
20113        }
20114        impl ::core::convert::From<
20115            ::buffa::OwnedView<GetSpotConfigResponseView<'static>>,
20116        > for GetSpotConfigResponseOwnedView {
20117            fn from(
20118                inner: ::buffa::OwnedView<GetSpotConfigResponseView<'static>>,
20119            ) -> Self {
20120                GetSpotConfigResponseOwnedView(inner)
20121            }
20122        }
20123        impl ::core::convert::From<GetSpotConfigResponseOwnedView>
20124        for ::buffa::OwnedView<GetSpotConfigResponseView<'static>> {
20125            fn from(wrapper: GetSpotConfigResponseOwnedView) -> Self {
20126                wrapper.0
20127            }
20128        }
20129        impl ::core::convert::AsRef<
20130            ::buffa::OwnedView<GetSpotConfigResponseView<'static>>,
20131        > for GetSpotConfigResponseOwnedView {
20132            fn as_ref(&self) -> &::buffa::OwnedView<GetSpotConfigResponseView<'static>> {
20133                &self.0
20134            }
20135        }
20136        impl ::buffa::HasMessageView for super::super::GetSpotConfigResponse {
20137            type View<'a> = GetSpotConfigResponseView<'a>;
20138            type ViewHandle = GetSpotConfigResponseOwnedView;
20139        }
20140        impl ::serde::Serialize for GetSpotConfigResponseOwnedView {
20141            fn serialize<__S: ::serde::Serializer>(
20142                &self,
20143                __s: __S,
20144            ) -> ::core::result::Result<__S::Ok, __S::Error> {
20145                ::serde::Serialize::serialize(&self.0, __s)
20146            }
20147        }
20148    }
20149    /// Register this package's `Any` type entries and extension entries.
20150    pub fn register_types(reg: &mut ::buffa::type_registry::TypeRegistry) {
20151        reg.register_json_any(super::__HEATMAP_TIME_RANGE_JSON_ANY);
20152        reg.register_json_any(super::__GET_ORDERBOOK_HEATMAP_REQUEST_JSON_ANY);
20153        reg.register_json_any(super::__HEATMAP_LEVELS_JSON_ANY);
20154        reg.register_json_any(super::__HEATMAP_DELTA_LEVELS_JSON_ANY);
20155        reg.register_json_any(super::__HEATMAP_KEYFRAME_JSON_ANY);
20156        reg.register_json_any(super::__HEATMAP_DELTA_BUCKET_JSON_ANY);
20157        reg.register_json_any(super::__HEATMAP_LIVE_BUCKET_JSON_ANY);
20158        reg.register_json_any(super::__HEATMAP_DELTA_CHAIN_JSON_ANY);
20159        reg.register_json_any(super::__GET_ORDERBOOK_HEATMAP_RESPONSE_JSON_ANY);
20160        reg.register_json_any(super::__GET_TRADES_REQUEST_JSON_ANY);
20161        reg.register_json_any(super::__MARKET_TRADE_JSON_ANY);
20162        reg.register_json_any(super::__GET_TRADES_RESPONSE_JSON_ANY);
20163        reg.register_json_any(super::__GET_CANDLES_REQUEST_JSON_ANY);
20164        reg.register_json_any(super::__GET_CANDLES_COLUMNS_REQUEST_JSON_ANY);
20165        reg.register_json_any(super::__CANDLE_POINT_JSON_ANY);
20166        reg.register_json_any(super::__GET_CANDLES_RESPONSE_JSON_ANY);
20167        reg.register_json_any(super::__GET_CANDLES_COLUMNS_RESPONSE_JSON_ANY);
20168        reg.register_json_any(super::__CANDLE_JSON_ANY);
20169        reg.register_json_any(super::__ASSET_CONFIG_JSON_ANY);
20170        reg.register_json_any(super::__PAIR_MARKETDATA_CONFIG_JSON_ANY);
20171        reg.register_json_any(super::__PAIR_CONFIG_JSON_ANY);
20172        reg.register_json_any(super::__GET_SPOT_CONFIG_REQUEST_JSON_ANY);
20173        reg.register_json_any(super::__GET_SPOT_CONFIG_RESPONSE_JSON_ANY);
20174    }
20175}
20176#[doc(inline)]
20177pub use self::__buffa::view::HeatmapTimeRangeView;
20178#[doc(inline)]
20179pub use self::__buffa::view::HeatmapTimeRangeOwnedView;
20180#[doc(inline)]
20181pub use self::__buffa::view::GetOrderbookHeatmapRequestView;
20182#[doc(inline)]
20183pub use self::__buffa::view::GetOrderbookHeatmapRequestOwnedView;
20184#[doc(inline)]
20185pub use self::__buffa::view::HeatmapLevelsView;
20186#[doc(inline)]
20187pub use self::__buffa::view::HeatmapLevelsOwnedView;
20188#[doc(inline)]
20189pub use self::__buffa::view::HeatmapDeltaLevelsView;
20190#[doc(inline)]
20191pub use self::__buffa::view::HeatmapDeltaLevelsOwnedView;
20192#[doc(inline)]
20193pub use self::__buffa::view::HeatmapKeyframeView;
20194#[doc(inline)]
20195pub use self::__buffa::view::HeatmapKeyframeOwnedView;
20196#[doc(inline)]
20197pub use self::__buffa::view::HeatmapDeltaBucketView;
20198#[doc(inline)]
20199pub use self::__buffa::view::HeatmapDeltaBucketOwnedView;
20200#[doc(inline)]
20201pub use self::__buffa::view::HeatmapLiveBucketView;
20202#[doc(inline)]
20203pub use self::__buffa::view::HeatmapLiveBucketOwnedView;
20204#[doc(inline)]
20205pub use self::__buffa::view::HeatmapDeltaChainView;
20206#[doc(inline)]
20207pub use self::__buffa::view::HeatmapDeltaChainOwnedView;
20208#[doc(inline)]
20209pub use self::__buffa::view::GetOrderbookHeatmapResponseView;
20210#[doc(inline)]
20211pub use self::__buffa::view::GetOrderbookHeatmapResponseOwnedView;
20212#[doc(inline)]
20213pub use self::__buffa::view::GetTradesRequestView;
20214#[doc(inline)]
20215pub use self::__buffa::view::GetTradesRequestOwnedView;
20216#[doc(inline)]
20217pub use self::__buffa::view::MarketTradeView;
20218#[doc(inline)]
20219pub use self::__buffa::view::MarketTradeOwnedView;
20220#[doc(inline)]
20221pub use self::__buffa::view::GetTradesResponseView;
20222#[doc(inline)]
20223pub use self::__buffa::view::GetTradesResponseOwnedView;
20224#[doc(inline)]
20225pub use self::__buffa::view::GetCandlesRequestView;
20226#[doc(inline)]
20227pub use self::__buffa::view::GetCandlesRequestOwnedView;
20228#[doc(inline)]
20229pub use self::__buffa::view::GetCandlesColumnsRequestView;
20230#[doc(inline)]
20231pub use self::__buffa::view::GetCandlesColumnsRequestOwnedView;
20232#[doc(inline)]
20233pub use self::__buffa::view::CandlePointView;
20234#[doc(inline)]
20235pub use self::__buffa::view::CandlePointOwnedView;
20236#[doc(inline)]
20237pub use self::__buffa::view::GetCandlesResponseView;
20238#[doc(inline)]
20239pub use self::__buffa::view::GetCandlesResponseOwnedView;
20240#[doc(inline)]
20241pub use self::__buffa::view::GetCandlesColumnsResponseView;
20242#[doc(inline)]
20243pub use self::__buffa::view::GetCandlesColumnsResponseOwnedView;
20244#[doc(inline)]
20245pub use self::__buffa::view::CandleView;
20246#[doc(inline)]
20247pub use self::__buffa::view::CandleOwnedView;
20248#[doc(inline)]
20249pub use self::__buffa::view::AssetConfigView;
20250#[doc(inline)]
20251pub use self::__buffa::view::AssetConfigOwnedView;
20252#[doc(inline)]
20253pub use self::__buffa::view::PairMarketdataConfigView;
20254#[doc(inline)]
20255pub use self::__buffa::view::PairMarketdataConfigOwnedView;
20256#[doc(inline)]
20257pub use self::__buffa::view::PairConfigView;
20258#[doc(inline)]
20259pub use self::__buffa::view::PairConfigOwnedView;
20260#[doc(inline)]
20261pub use self::__buffa::view::GetSpotConfigRequestView;
20262#[doc(inline)]
20263pub use self::__buffa::view::GetSpotConfigRequestOwnedView;
20264#[doc(inline)]
20265pub use self::__buffa::view::GetSpotConfigResponseView;
20266#[doc(inline)]
20267pub use self::__buffa::view::GetSpotConfigResponseOwnedView;
20268#[doc(inline)]
20269pub use self::__buffa::register_types;