pt/models/
forex_aggregate.rs1#![allow(unused_imports)]
11
12use serde_json::Value;
13use bigdecimal::BigDecimal;
14use chrono::{NaiveDateTime, DateTime, FixedOffset, Utc};
15
16use crate::models::*;
17#[derive(Debug, Serialize, Deserialize, Clone)]
21pub struct ForexAggregate {
22 #[serde(rename = "o")]
23 o: f32, #[serde(rename = "c")]
25 c: f32, #[serde(rename = "l")]
27 l: f32, #[serde(rename = "h")]
29 h: f32, #[serde(rename = "v")]
31 v: i64, #[serde(rename = "t")]
33 t: i64 }
35
36impl ForexAggregate {
37 pub fn new(o: f32, c: f32, l: f32, h: f32, v: i64, t: i64, ) -> ForexAggregate {
38 ForexAggregate {
39 o: o,
40 c: c,
41 l: l,
42 h: h,
43 v: v,
44 t: t
45 }
46 }
47
48 pub fn set_o(&mut self, o: f32) {
49 self.o = o;
50 }
51
52 pub fn with_o(mut self, o: f32) -> ForexAggregate {
53 self.o = o;
54 self
55 }
56
57 pub fn o(&self) -> &f32 {
58 &self.o
59 }
60
61
62 pub fn set_c(&mut self, c: f32) {
63 self.c = c;
64 }
65
66 pub fn with_c(mut self, c: f32) -> ForexAggregate {
67 self.c = c;
68 self
69 }
70
71 pub fn c(&self) -> &f32 {
72 &self.c
73 }
74
75
76 pub fn set_l(&mut self, l: f32) {
77 self.l = l;
78 }
79
80 pub fn with_l(mut self, l: f32) -> ForexAggregate {
81 self.l = l;
82 self
83 }
84
85 pub fn l(&self) -> &f32 {
86 &self.l
87 }
88
89
90 pub fn set_h(&mut self, h: f32) {
91 self.h = h;
92 }
93
94 pub fn with_h(mut self, h: f32) -> ForexAggregate {
95 self.h = h;
96 self
97 }
98
99 pub fn h(&self) -> &f32 {
100 &self.h
101 }
102
103
104 pub fn set_v(&mut self, v: i64) {
105 self.v = v;
106 }
107
108 pub fn with_v(mut self, v: i64) -> ForexAggregate {
109 self.v = v;
110 self
111 }
112
113 pub fn v(&self) -> &i64 {
114 &self.v
115 }
116
117
118 pub fn set_t(&mut self, t: i64) {
119 self.t = t;
120 }
121
122 pub fn with_t(mut self, t: i64) -> ForexAggregate {
123 self.t = t;
124 self
125 }
126
127 pub fn t(&self) -> &i64 {
128 &self.t
129 }
130
131
132}
133
134