1use std::num::NonZeroUsize;
17
18use nautilus_core::{Params, UUID4, UnixNanos};
19use nautilus_model::{
20 data::{BarType, DataType},
21 identifiers::{ClientId, InstrumentId, OptionSeriesId, Venue},
22};
23
24use super::check_client_id_or_venue;
25
26#[derive(Clone, Debug)]
27pub struct UnsubscribeCustomData {
28 pub client_id: Option<ClientId>,
29 pub venue: Option<Venue>,
30 pub data_type: DataType,
31 pub command_id: UUID4,
32 pub ts_init: UnixNanos,
33 pub correlation_id: Option<UUID4>,
34 pub params: Option<Params>,
35}
36
37impl UnsubscribeCustomData {
38 pub fn new(
40 client_id: Option<ClientId>,
41 venue: Option<Venue>,
42 data_type: DataType,
43 command_id: UUID4,
44 ts_init: UnixNanos,
45 correlation_id: Option<UUID4>,
46 params: Option<Params>,
47 ) -> Self {
48 check_client_id_or_venue(&client_id, &venue);
49 Self {
50 client_id,
51 venue,
52 data_type,
53 command_id,
54 ts_init,
55 correlation_id,
56 params,
57 }
58 }
59}
60
61#[derive(Clone, Debug)]
62pub struct UnsubscribeInstrument {
63 pub instrument_id: InstrumentId,
64 pub client_id: Option<ClientId>,
65 pub venue: Option<Venue>,
66 pub command_id: UUID4,
67 pub ts_init: UnixNanos,
68 pub correlation_id: Option<UUID4>,
69 pub params: Option<Params>,
70}
71
72impl UnsubscribeInstrument {
73 pub fn new(
75 instrument_id: InstrumentId,
76 client_id: Option<ClientId>,
77 venue: Option<Venue>,
78 command_id: UUID4,
79 ts_init: UnixNanos,
80 correlation_id: Option<UUID4>,
81 params: Option<Params>,
82 ) -> Self {
83 check_client_id_or_venue(&client_id, &venue);
84 Self {
85 instrument_id,
86 client_id,
87 venue,
88 command_id,
89 ts_init,
90 correlation_id,
91 params,
92 }
93 }
94}
95
96#[derive(Clone, Debug)]
97pub struct UnsubscribeInstruments {
98 pub client_id: Option<ClientId>,
99 pub venue: Venue,
100 pub command_id: UUID4,
101 pub ts_init: UnixNanos,
102 pub correlation_id: Option<UUID4>,
103 pub params: Option<Params>,
104}
105
106impl UnsubscribeInstruments {
107 pub fn new(
109 client_id: Option<ClientId>,
110 venue: Venue,
111 command_id: UUID4,
112 ts_init: UnixNanos,
113 correlation_id: Option<UUID4>,
114 params: Option<Params>,
115 ) -> Self {
116 Self {
117 client_id,
118 venue,
119 command_id,
120 ts_init,
121 correlation_id,
122 params,
123 }
124 }
125}
126
127#[derive(Clone, Debug)]
128pub struct UnsubscribeBookDeltas {
129 pub instrument_id: InstrumentId,
130 pub client_id: Option<ClientId>,
131 pub venue: Option<Venue>,
132 pub command_id: UUID4,
133 pub ts_init: UnixNanos,
134 pub correlation_id: Option<UUID4>,
135 pub params: Option<Params>,
136}
137
138impl UnsubscribeBookDeltas {
139 pub fn new(
141 instrument_id: InstrumentId,
142 client_id: Option<ClientId>,
143 venue: Option<Venue>,
144 command_id: UUID4,
145 ts_init: UnixNanos,
146 correlation_id: Option<UUID4>,
147 params: Option<Params>,
148 ) -> Self {
149 check_client_id_or_venue(&client_id, &venue);
150 Self {
151 instrument_id,
152 client_id,
153 venue,
154 command_id,
155 ts_init,
156 correlation_id,
157 params,
158 }
159 }
160}
161
162#[derive(Clone, Debug)]
163pub struct UnsubscribeBookDepth10 {
164 pub instrument_id: InstrumentId,
165 pub client_id: Option<ClientId>,
166 pub venue: Option<Venue>,
167 pub command_id: UUID4,
168 pub ts_init: UnixNanos,
169 pub correlation_id: Option<UUID4>,
170 pub params: Option<Params>,
171}
172
173impl UnsubscribeBookDepth10 {
174 pub fn new(
176 instrument_id: InstrumentId,
177 client_id: Option<ClientId>,
178 venue: Option<Venue>,
179 command_id: UUID4,
180 ts_init: UnixNanos,
181 correlation_id: Option<UUID4>,
182 params: Option<Params>,
183 ) -> Self {
184 check_client_id_or_venue(&client_id, &venue);
185 Self {
186 instrument_id,
187 client_id,
188 venue,
189 command_id,
190 ts_init,
191 correlation_id,
192 params,
193 }
194 }
195}
196
197#[derive(Clone, Debug)]
198pub struct UnsubscribeBookSnapshots {
199 pub instrument_id: InstrumentId,
200 pub interval_ms: NonZeroUsize,
201 pub client_id: Option<ClientId>,
202 pub venue: Option<Venue>,
203 pub command_id: UUID4,
204 pub ts_init: UnixNanos,
205 pub correlation_id: Option<UUID4>,
206 pub params: Option<Params>,
207}
208
209impl UnsubscribeBookSnapshots {
210 #[expect(clippy::too_many_arguments)]
212 pub fn new(
213 instrument_id: InstrumentId,
214 interval_ms: NonZeroUsize,
215 client_id: Option<ClientId>,
216 venue: Option<Venue>,
217 command_id: UUID4,
218 ts_init: UnixNanos,
219 correlation_id: Option<UUID4>,
220 params: Option<Params>,
221 ) -> Self {
222 check_client_id_or_venue(&client_id, &venue);
223 Self {
224 instrument_id,
225 interval_ms,
226 client_id,
227 venue,
228 command_id,
229 ts_init,
230 correlation_id,
231 params,
232 }
233 }
234}
235
236#[derive(Clone, Debug)]
237pub struct UnsubscribeQuotes {
238 pub instrument_id: InstrumentId,
239 pub client_id: Option<ClientId>,
240 pub venue: Option<Venue>,
241 pub command_id: UUID4,
242 pub ts_init: UnixNanos,
243 pub correlation_id: Option<UUID4>,
244 pub params: Option<Params>,
245}
246
247impl UnsubscribeQuotes {
248 pub fn new(
250 instrument_id: InstrumentId,
251 client_id: Option<ClientId>,
252 venue: Option<Venue>,
253 command_id: UUID4,
254 ts_init: UnixNanos,
255 correlation_id: Option<UUID4>,
256 params: Option<Params>,
257 ) -> Self {
258 check_client_id_or_venue(&client_id, &venue);
259 Self {
260 instrument_id,
261 client_id,
262 venue,
263 command_id,
264 ts_init,
265 correlation_id,
266 params,
267 }
268 }
269}
270
271#[derive(Clone, Debug)]
272pub struct UnsubscribeTrades {
273 pub instrument_id: InstrumentId,
274 pub client_id: Option<ClientId>,
275 pub venue: Option<Venue>,
276 pub command_id: UUID4,
277 pub ts_init: UnixNanos,
278 pub correlation_id: Option<UUID4>,
279 pub params: Option<Params>,
280}
281
282impl UnsubscribeTrades {
283 pub fn new(
285 instrument_id: InstrumentId,
286 client_id: Option<ClientId>,
287 venue: Option<Venue>,
288 command_id: UUID4,
289 ts_init: UnixNanos,
290 correlation_id: Option<UUID4>,
291 params: Option<Params>,
292 ) -> Self {
293 check_client_id_or_venue(&client_id, &venue);
294 Self {
295 instrument_id,
296 client_id,
297 venue,
298 command_id,
299 ts_init,
300 correlation_id,
301 params,
302 }
303 }
304}
305
306#[derive(Clone, Debug)]
307pub struct UnsubscribeBars {
308 pub bar_type: BarType,
309 pub client_id: Option<ClientId>,
310 pub venue: Option<Venue>,
311 pub command_id: UUID4,
312 pub ts_init: UnixNanos,
313 pub correlation_id: Option<UUID4>,
314 pub params: Option<Params>,
315}
316
317impl UnsubscribeBars {
318 pub fn new(
320 bar_type: BarType,
321 client_id: Option<ClientId>,
322 venue: Option<Venue>,
323 command_id: UUID4,
324 ts_init: UnixNanos,
325 correlation_id: Option<UUID4>,
326 params: Option<Params>,
327 ) -> Self {
328 check_client_id_or_venue(&client_id, &venue);
329 Self {
330 bar_type,
331 client_id,
332 venue,
333 command_id,
334 ts_init,
335 correlation_id,
336 params,
337 }
338 }
339}
340
341#[derive(Clone, Debug)]
342pub struct UnsubscribeMarkPrices {
343 pub instrument_id: InstrumentId,
344 pub client_id: Option<ClientId>,
345 pub venue: Option<Venue>,
346 pub command_id: UUID4,
347 pub ts_init: UnixNanos,
348 pub correlation_id: Option<UUID4>,
349 pub params: Option<Params>,
350}
351
352impl UnsubscribeMarkPrices {
353 pub fn new(
355 instrument_id: InstrumentId,
356 client_id: Option<ClientId>,
357 venue: Option<Venue>,
358 command_id: UUID4,
359 ts_init: UnixNanos,
360 correlation_id: Option<UUID4>,
361 params: Option<Params>,
362 ) -> Self {
363 check_client_id_or_venue(&client_id, &venue);
364 Self {
365 instrument_id,
366 client_id,
367 venue,
368 command_id,
369 ts_init,
370 correlation_id,
371 params,
372 }
373 }
374}
375
376#[derive(Clone, Debug)]
377pub struct UnsubscribeIndexPrices {
378 pub instrument_id: InstrumentId,
379 pub client_id: Option<ClientId>,
380 pub venue: Option<Venue>,
381 pub command_id: UUID4,
382 pub ts_init: UnixNanos,
383 pub correlation_id: Option<UUID4>,
384 pub params: Option<Params>,
385}
386
387impl UnsubscribeIndexPrices {
388 pub fn new(
390 instrument_id: InstrumentId,
391 client_id: Option<ClientId>,
392 venue: Option<Venue>,
393 command_id: UUID4,
394 ts_init: UnixNanos,
395 correlation_id: Option<UUID4>,
396 params: Option<Params>,
397 ) -> Self {
398 check_client_id_or_venue(&client_id, &venue);
399 Self {
400 instrument_id,
401 client_id,
402 venue,
403 command_id,
404 ts_init,
405 correlation_id,
406 params,
407 }
408 }
409}
410
411#[derive(Clone, Debug)]
412pub struct UnsubscribeFundingRates {
413 pub instrument_id: InstrumentId,
414 pub client_id: Option<ClientId>,
415 pub venue: Option<Venue>,
416 pub command_id: UUID4,
417 pub ts_init: UnixNanos,
418 pub correlation_id: Option<UUID4>,
419 pub params: Option<Params>,
420}
421
422impl UnsubscribeFundingRates {
423 pub fn new(
425 instrument_id: InstrumentId,
426 client_id: Option<ClientId>,
427 venue: Option<Venue>,
428 command_id: UUID4,
429 ts_init: UnixNanos,
430 correlation_id: Option<UUID4>,
431 params: Option<Params>,
432 ) -> Self {
433 check_client_id_or_venue(&client_id, &venue);
434 Self {
435 instrument_id,
436 client_id,
437 venue,
438 command_id,
439 ts_init,
440 correlation_id,
441 params,
442 }
443 }
444}
445
446#[derive(Clone, Debug)]
447pub struct UnsubscribeInstrumentStatus {
448 pub instrument_id: InstrumentId,
449 pub client_id: Option<ClientId>,
450 pub venue: Option<Venue>,
451 pub command_id: UUID4,
452 pub ts_init: UnixNanos,
453 pub correlation_id: Option<UUID4>,
454 pub params: Option<Params>,
455}
456
457impl UnsubscribeInstrumentStatus {
458 pub fn new(
460 instrument_id: InstrumentId,
461 client_id: Option<ClientId>,
462 venue: Option<Venue>,
463 command_id: UUID4,
464 ts_init: UnixNanos,
465 correlation_id: Option<UUID4>,
466 params: Option<Params>,
467 ) -> Self {
468 check_client_id_or_venue(&client_id, &venue);
469 Self {
470 instrument_id,
471 client_id,
472 venue,
473 command_id,
474 ts_init,
475 correlation_id,
476 params,
477 }
478 }
479}
480
481#[derive(Clone, Debug)]
482pub struct UnsubscribeOptionGreeks {
483 pub instrument_id: InstrumentId,
484 pub client_id: Option<ClientId>,
485 pub venue: Option<Venue>,
486 pub command_id: UUID4,
487 pub ts_init: UnixNanos,
488 pub correlation_id: Option<UUID4>,
489 pub params: Option<Params>,
490}
491
492impl UnsubscribeOptionGreeks {
493 pub fn new(
495 instrument_id: InstrumentId,
496 client_id: Option<ClientId>,
497 venue: Option<Venue>,
498 command_id: UUID4,
499 ts_init: UnixNanos,
500 correlation_id: Option<UUID4>,
501 params: Option<Params>,
502 ) -> Self {
503 check_client_id_or_venue(&client_id, &venue);
504 Self {
505 instrument_id,
506 client_id,
507 venue,
508 command_id,
509 ts_init,
510 correlation_id,
511 params,
512 }
513 }
514}
515
516#[derive(Clone, Debug)]
517pub struct UnsubscribeInstrumentClose {
518 pub instrument_id: InstrumentId,
519 pub client_id: Option<ClientId>,
520 pub venue: Option<Venue>,
521 pub command_id: UUID4,
522 pub ts_init: UnixNanos,
523 pub correlation_id: Option<UUID4>,
524 pub params: Option<Params>,
525}
526
527impl UnsubscribeInstrumentClose {
528 pub fn new(
530 instrument_id: InstrumentId,
531 client_id: Option<ClientId>,
532 venue: Option<Venue>,
533 command_id: UUID4,
534 ts_init: UnixNanos,
535 correlation_id: Option<UUID4>,
536 params: Option<Params>,
537 ) -> Self {
538 check_client_id_or_venue(&client_id, &venue);
539 Self {
540 instrument_id,
541 client_id,
542 venue,
543 command_id,
544 ts_init,
545 correlation_id,
546 params,
547 }
548 }
549}
550
551#[derive(Clone, Debug)]
552pub struct UnsubscribeOptionChain {
553 pub series_id: OptionSeriesId,
554 pub command_id: UUID4,
555 pub ts_init: UnixNanos,
556 pub client_id: Option<ClientId>,
557 pub venue: Option<Venue>,
558}
559
560impl UnsubscribeOptionChain {
561 pub fn new(
563 series_id: OptionSeriesId,
564 command_id: UUID4,
565 ts_init: UnixNanos,
566 client_id: Option<ClientId>,
567 venue: Option<Venue>,
568 ) -> Self {
569 check_client_id_or_venue(&client_id, &venue);
570 Self {
571 series_id,
572 command_id,
573 ts_init,
574 client_id,
575 venue,
576 }
577 }
578}