nautilus_common/messages/defi/
subscribe.rs1use indexmap::IndexMap;
17use nautilus_core::{UUID4, UnixNanos};
18use nautilus_model::{
19 defi::chain::Blockchain,
20 identifiers::{ClientId, InstrumentId},
21};
22
23#[derive(Debug, Clone)]
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<IndexMap<String, String>>,
30}
31
32impl SubscribeBlocks {
33 #[must_use]
35 pub const fn new(
36 chain: Blockchain,
37 client_id: Option<ClientId>,
38 command_id: UUID4,
39 ts_init: UnixNanos,
40 params: Option<IndexMap<String, String>>,
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)]
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<IndexMap<String, String>>,
60}
61
62impl SubscribePool {
63 #[must_use]
65 pub const fn new(
66 instrument_id: InstrumentId,
67 client_id: Option<ClientId>,
68 command_id: UUID4,
69 ts_init: UnixNanos,
70 params: Option<IndexMap<String, String>>,
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)]
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<IndexMap<String, String>>,
89}
90
91impl SubscribePoolSwaps {
92 #[must_use]
94 pub const fn new(
95 instrument_id: InstrumentId,
96 client_id: Option<ClientId>,
97 command_id: UUID4,
98 ts_init: UnixNanos,
99
100 params: Option<IndexMap<String, String>>,
101 ) -> Self {
102 Self {
103 instrument_id,
104 client_id,
105 command_id,
106 ts_init,
107 params,
108 }
109 }
110}
111
112#[derive(Debug, Clone)]
114pub struct SubscribePoolLiquidityUpdates {
115 pub instrument_id: InstrumentId,
116 pub client_id: Option<ClientId>,
117 pub command_id: UUID4,
118 pub ts_init: UnixNanos,
119 pub params: Option<IndexMap<String, String>>,
120}
121
122impl SubscribePoolLiquidityUpdates {
123 #[must_use]
125 pub const fn new(
126 instrument_id: InstrumentId,
127 client_id: Option<ClientId>,
128 command_id: UUID4,
129 ts_init: UnixNanos,
130 params: Option<IndexMap<String, String>>,
131 ) -> Self {
132 Self {
133 instrument_id,
134 client_id,
135 command_id,
136 ts_init,
137 params,
138 }
139 }
140}