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