nautilus_common/messages/defi/
subscribe.rs1use nautilus_core::{Params, UUID4, UnixNanos};
17use nautilus_model::{
18 defi::chain::Blockchain,
19 identifiers::{ClientId, InstrumentId},
20};
21
22#[derive(Debug, Clone)]
23pub struct SubscribeBlocks {
24 pub chain: Blockchain,
25 pub client_id: Option<ClientId>,
26 pub command_id: UUID4,
27 pub ts_init: UnixNanos,
28 pub params: Option<Params>,
29}
30
31impl SubscribeBlocks {
32 #[must_use]
34 pub fn new(
35 chain: Blockchain,
36 client_id: Option<ClientId>,
37 command_id: UUID4,
38 ts_init: UnixNanos,
39 params: Option<Params>,
40 ) -> Self {
41 Self {
42 chain,
43 client_id,
44 command_id,
45 ts_init,
46 params,
47 }
48 }
49}
50
51#[derive(Debug, Clone)]
53pub struct SubscribePool {
54 pub instrument_id: InstrumentId,
55 pub client_id: Option<ClientId>,
56 pub command_id: UUID4,
57 pub ts_init: UnixNanos,
58 pub params: Option<Params>,
59}
60
61impl SubscribePool {
62 #[must_use]
64 pub fn new(
65 instrument_id: InstrumentId,
66 client_id: Option<ClientId>,
67 command_id: UUID4,
68 ts_init: UnixNanos,
69 params: Option<Params>,
70 ) -> Self {
71 Self {
72 instrument_id,
73 client_id,
74 command_id,
75 ts_init,
76 params,
77 }
78 }
79}
80
81#[derive(Debug, Clone)]
82pub struct SubscribePoolSwaps {
83 pub instrument_id: InstrumentId,
84 pub client_id: Option<ClientId>,
85 pub command_id: UUID4,
86 pub ts_init: UnixNanos,
87 pub params: Option<Params>,
88}
89
90impl SubscribePoolSwaps {
91 #[must_use]
93 pub fn new(
94 instrument_id: InstrumentId,
95 client_id: Option<ClientId>,
96 command_id: UUID4,
97 ts_init: UnixNanos,
98 params: Option<Params>,
99 ) -> Self {
100 Self {
101 instrument_id,
102 client_id,
103 command_id,
104 ts_init,
105 params,
106 }
107 }
108}
109
110#[derive(Debug, Clone)]
112pub struct SubscribePoolLiquidityUpdates {
113 pub instrument_id: InstrumentId,
114 pub client_id: Option<ClientId>,
115 pub command_id: UUID4,
116 pub ts_init: UnixNanos,
117 pub params: Option<Params>,
118}
119
120impl SubscribePoolLiquidityUpdates {
121 #[must_use]
123 pub fn new(
124 instrument_id: InstrumentId,
125 client_id: Option<ClientId>,
126 command_id: UUID4,
127 ts_init: UnixNanos,
128 params: Option<Params>,
129 ) -> Self {
130 Self {
131 instrument_id,
132 client_id,
133 command_id,
134 ts_init,
135 params,
136 }
137 }
138}
139
140#[derive(Debug, Clone)]
142pub struct SubscribePoolFeeCollects {
143 pub instrument_id: InstrumentId,
144 pub client_id: Option<ClientId>,
145 pub command_id: UUID4,
146 pub ts_init: UnixNanos,
147 pub params: Option<Params>,
148}
149
150impl SubscribePoolFeeCollects {
151 #[must_use]
153 pub fn new(
154 instrument_id: InstrumentId,
155 client_id: Option<ClientId>,
156 command_id: UUID4,
157 ts_init: UnixNanos,
158 params: Option<Params>,
159 ) -> Self {
160 Self {
161 instrument_id,
162 client_id,
163 command_id,
164 ts_init,
165 params,
166 }
167 }
168}
169
170#[derive(Debug, Clone)]
172pub struct SubscribePoolFlashEvents {
173 pub instrument_id: InstrumentId,
174 pub client_id: Option<ClientId>,
175 pub command_id: UUID4,
176 pub ts_init: UnixNanos,
177 pub params: Option<Params>,
178}
179
180impl SubscribePoolFlashEvents {
181 #[must_use]
183 pub fn new(
184 instrument_id: InstrumentId,
185 client_id: Option<ClientId>,
186 command_id: UUID4,
187 ts_init: UnixNanos,
188 params: Option<Params>,
189 ) -> Self {
190 Self {
191 instrument_id,
192 client_id,
193 command_id,
194 ts_init,
195 params,
196 }
197 }
198}