1#[allow(clippy::derive_partial_eq_without_eq)]
9#[derive(Clone, PartialEq, ::prost::Message)]
10pub struct Arbitrage {
11 #[prost(string, tag="1")]
13 pub name: ::prost::alloc::string::String,
14 #[prost(int32, tag="2")]
16 pub id: i32,
17 #[prost(int32, tag="3")]
19 pub portfolio_id: i32,
20 #[prost(int32, tag="5")]
22 pub basket_a_id: i32,
23 #[prost(int32, tag="6")]
25 pub basket_b_id: i32,
26 #[prost(message, optional, tag="7")]
28 pub trigger_config: ::core::option::Option<TriggerConfig>,
29 #[prost(bool, tag="9")]
31 pub is_active: bool,
32 #[prost(message, optional, tag="10")]
34 pub create_time: ::core::option::Option<super::super::super::google::protobuf::Timestamp>,
35 #[prost(message, optional, tag="11")]
37 pub update_time: ::core::option::Option<super::super::super::google::protobuf::Timestamp>,
38 #[prost(message, optional, tag="12")]
40 pub basket_a: ::core::option::Option<super::basket::Basket>,
41 #[prost(message, optional, tag="13")]
43 pub basket_b: ::core::option::Option<super::basket::Basket>,
44}
45#[allow(clippy::derive_partial_eq_without_eq)]
51#[derive(Clone, Copy, PartialEq, ::prost::Message)]
52pub struct TriggerConfig {
53 #[prost(message, optional, tag="1")]
55 pub condition: ::core::option::Option<TriggerCondition>,
56 #[prost(uint64, tag="2")]
58 pub cooldown_ms: u64,
59}
60#[allow(clippy::derive_partial_eq_without_eq)]
62#[derive(Clone, Copy, PartialEq, ::prost::Message)]
63pub struct TriggerCondition {
64 #[prost(oneof="trigger_condition::Condition", tags="1, 2")]
65 pub condition: ::core::option::Option<trigger_condition::Condition>,
66}
67pub mod trigger_condition {
69 #[allow(clippy::derive_partial_eq_without_eq)]
70#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
71 pub enum Condition {
72 #[prost(message, tag="1")]
74 SpreadAmount(super::SpreadAmountCondition),
75 #[prost(message, tag="2")]
77 SpreadBps(super::SpreadBpsCondition),
78 }
79}
80#[allow(clippy::derive_partial_eq_without_eq)]
82#[derive(Clone, Copy, PartialEq, ::prost::Message)]
83pub struct SpreadAmountCondition {
84 #[prost(int64, tag="1")]
86 pub threshold: i64,
87}
88#[allow(clippy::derive_partial_eq_without_eq)]
90#[derive(Clone, Copy, PartialEq, ::prost::Message)]
91pub struct SpreadBpsCondition {
92 #[prost(double, tag="1")]
94 pub threshold_bps: f64,
95}
96#[allow(clippy::derive_partial_eq_without_eq)]
102#[derive(Clone, PartialEq, ::prost::Message)]
103pub struct ArbitrageStatus {
104 #[prost(string, tag="1")]
106 pub name: ::prost::alloc::string::String,
107 #[prost(int32, tag="2")]
109 pub id: i32,
110 #[prost(enumeration="ArbitrageState", tag="3")]
112 pub state: i32,
113 #[prost(int64, tag="4")]
115 pub basket_a_value: i64,
116 #[prost(int64, tag="5")]
118 pub basket_b_value: i64,
119 #[prost(int64, tag="6")]
121 pub current_spread: i64,
122 #[prost(double, tag="7")]
124 pub current_spread_bps: f64,
125 #[prost(message, optional, tag="8")]
127 pub execution_state: ::core::option::Option<ExecutionState>,
128 #[prost(message, optional, tag="9")]
130 pub stats: ::core::option::Option<ArbitrageStats>,
131 #[prost(message, optional, tag="10")]
133 pub estimate: ::core::option::Option<ExecutionEstimate>,
134}
135#[allow(clippy::derive_partial_eq_without_eq)]
137#[derive(Clone, PartialEq, ::prost::Message)]
138pub struct ExecutionEstimate {
139 #[prost(int64, tag="1")]
141 pub buy_a_sell_b_pnl: i64,
142 #[prost(int64, tag="2")]
144 pub buy_b_sell_a_pnl: i64,
145 #[prost(double, tag="3")]
147 pub slippage_bps: f64,
148 #[prost(bool, tag="4")]
150 pub executable: bool,
151 #[prost(string, tag="5")]
153 pub reason: ::prost::alloc::string::String,
154}
155#[allow(clippy::derive_partial_eq_without_eq)]
157#[derive(Clone, PartialEq, ::prost::Message)]
158pub struct ExecutionState {
159 #[prost(enumeration="ArbitrageSide", tag="1")]
161 pub side: i32,
162 #[prost(uint32, tag="2")]
164 pub current_round: u32,
165 #[prost(uint32, tag="3")]
167 pub total_rounds: u32,
168 #[prost(message, repeated, tag="4")]
170 pub round_fills: ::prost::alloc::vec::Vec<RoundFillState>,
171 #[prost(double, tag="5")]
173 pub total_fill_rate: f64,
174 #[prost(int64, tag="6")]
176 pub trigger_spread: i64,
177}
178#[allow(clippy::derive_partial_eq_without_eq)]
180#[derive(Clone, PartialEq, ::prost::Message)]
181pub struct RoundFillState {
182 #[prost(uint32, tag="1")]
184 pub round: u32,
185 #[prost(map="string, int64", tag="2")]
187 pub ordered_quantities: ::std::collections::HashMap<::prost::alloc::string::String, i64>,
188 #[prost(map="string, int64", tag="3")]
190 pub filled_quantities: ::std::collections::HashMap<::prost::alloc::string::String, i64>,
191 #[prost(double, tag="4")]
193 pub fill_rate: f64,
194}
195#[allow(clippy::derive_partial_eq_without_eq)]
197#[derive(Clone, Copy, PartialEq, ::prost::Message)]
198pub struct ArbitrageStats {
199 #[prost(uint64, tag="1")]
201 pub trigger_count: u64,
202 #[prost(uint64, tag="2")]
204 pub execution_count: u64,
205 #[prost(uint64, tag="3")]
207 pub execution_failures: u64,
208 #[prost(int64, tag="4")]
210 pub total_profit: i64,
211}
212#[allow(clippy::derive_partial_eq_without_eq)]
214#[derive(Clone, PartialEq, ::prost::Message)]
215pub struct ArbitrageStatusUpdate {
216 #[prost(string, tag="1")]
218 pub name: ::prost::alloc::string::String,
219 #[prost(int32, tag="2")]
221 pub id: i32,
222 #[prost(message, optional, tag="3")]
224 pub update_mask: ::core::option::Option<super::super::super::google::protobuf::FieldMask>,
225 #[prost(message, optional, tag="4")]
227 pub status: ::core::option::Option<ArbitrageStatus>,
228 #[prost(message, repeated, tag="5")]
230 pub basket_a_prices: ::prost::alloc::vec::Vec<BasketItemPrice>,
231 #[prost(message, repeated, tag="6")]
233 pub basket_b_prices: ::prost::alloc::vec::Vec<BasketItemPrice>,
234}
235#[allow(clippy::derive_partial_eq_without_eq)]
237#[derive(Clone, PartialEq, ::prost::Message)]
238pub struct ArbitrageEvent {
239 #[prost(string, tag="1")]
241 pub name: ::prost::alloc::string::String,
242 #[prost(int32, tag="2")]
244 pub id: i32,
245 #[prost(oneof="arbitrage_event::Event", tags="3, 4, 5, 6, 7, 8, 9, 10, 11, 12")]
247 pub event: ::core::option::Option<arbitrage_event::Event>,
248}
249pub mod arbitrage_event {
251 #[allow(clippy::derive_partial_eq_without_eq)]
253#[derive(Clone, PartialEq, ::prost::Oneof)]
254 pub enum Event {
255 #[prost(message, tag="3")]
256 StateChanged(super::StateChangedEvent),
257 #[prost(message, tag="4")]
258 PriceUpdate(super::PriceUpdateEvent),
259 #[prost(message, tag="5")]
260 Triggered(super::TriggeredEvent),
261 #[prost(message, tag="6")]
262 RoundStarted(super::RoundStartedEvent),
263 #[prost(message, tag="7")]
264 OrderSubmitted(super::OrderSubmittedEvent),
265 #[prost(message, tag="8")]
266 OrderFilled(super::OrderFilledEvent),
267 #[prost(message, tag="9")]
268 RoundCompleted(super::RoundCompletedEvent),
269 #[prost(message, tag="10")]
270 ExecutionCompleted(super::ExecutionCompletedEvent),
271 #[prost(message, tag="11")]
272 Error(super::ErrorEvent),
273 #[prost(message, tag="12")]
274 BasketPrice(super::BasketPriceUpdateEvent),
275 }
276}
277#[allow(clippy::derive_partial_eq_without_eq)]
279#[derive(Clone, Copy, PartialEq, ::prost::Message)]
280pub struct StateChangedEvent {
281 #[prost(enumeration="ArbitrageState", tag="1")]
282 pub old_state: i32,
283 #[prost(enumeration="ArbitrageState", tag="2")]
284 pub new_state: i32,
285}
286#[allow(clippy::derive_partial_eq_without_eq)]
288#[derive(Clone, Copy, PartialEq, ::prost::Message)]
289pub struct PriceUpdateEvent {
290 #[prost(int64, tag="1")]
291 pub basket_a_value: i64,
292 #[prost(int64, tag="2")]
293 pub basket_b_value: i64,
294 #[prost(int64, tag="3")]
295 pub spread: i64,
296 #[prost(double, tag="4")]
297 pub spread_bps: f64,
298}
299#[allow(clippy::derive_partial_eq_without_eq)]
301#[derive(Clone, Copy, PartialEq, ::prost::Message)]
302pub struct TriggeredEvent {
303 #[prost(enumeration="ArbitrageSide", tag="1")]
304 pub side: i32,
305 #[prost(int64, tag="2")]
306 pub spread: i64,
307}
308#[allow(clippy::derive_partial_eq_without_eq)]
310#[derive(Clone, Copy, PartialEq, ::prost::Message)]
311pub struct RoundStartedEvent {
312 #[prost(uint32, tag="1")]
313 pub round: u32,
314 #[prost(uint32, tag="2")]
315 pub total_rounds: u32,
316}
317#[allow(clippy::derive_partial_eq_without_eq)]
319#[derive(Clone, PartialEq, ::prost::Message)]
320pub struct OrderSubmittedEvent {
321 #[prost(uint32, tag="1")]
322 pub round: u32,
323 #[prost(string, tag="2")]
324 pub symbol: ::prost::alloc::string::String,
325 #[prost(int64, tag="3")]
326 pub quantity: i64,
327 #[prost(string, tag="4")]
328 pub price: ::prost::alloc::string::String,
329}
330#[allow(clippy::derive_partial_eq_without_eq)]
332#[derive(Clone, PartialEq, ::prost::Message)]
333pub struct OrderFilledEvent {
334 #[prost(uint32, tag="1")]
335 pub round: u32,
336 #[prost(string, tag="2")]
337 pub symbol: ::prost::alloc::string::String,
338 #[prost(int64, tag="3")]
339 pub filled_quantity: i64,
340 #[prost(int64, tag="4")]
341 pub filled_price: i64,
342}
343#[allow(clippy::derive_partial_eq_without_eq)]
345#[derive(Clone, Copy, PartialEq, ::prost::Message)]
346pub struct RoundCompletedEvent {
347 #[prost(uint32, tag="1")]
348 pub round: u32,
349 #[prost(double, tag="2")]
350 pub fill_rate: f64,
351}
352#[allow(clippy::derive_partial_eq_without_eq)]
354#[derive(Clone, Copy, PartialEq, ::prost::Message)]
355pub struct ExecutionCompletedEvent {
356 #[prost(double, tag="1")]
357 pub total_fill_rate: f64,
358}
359#[allow(clippy::derive_partial_eq_without_eq)]
361#[derive(Clone, PartialEq, ::prost::Message)]
362pub struct ErrorEvent {
363 #[prost(string, tag="1")]
364 pub message: ::prost::alloc::string::String,
365}
366#[allow(clippy::derive_partial_eq_without_eq)]
368#[derive(Clone, PartialEq, ::prost::Message)]
369pub struct BasketItemPrice {
370 #[prost(string, tag="1")]
372 pub symbol: ::prost::alloc::string::String,
373 #[prost(string, tag="2")]
375 pub bid1: ::prost::alloc::string::String,
376 #[prost(string, tag="3")]
378 pub ask1: ::prost::alloc::string::String,
379 #[prost(int64, tag="4")]
381 pub bid1_qty: i64,
382 #[prost(int64, tag="5")]
384 pub ask1_qty: i64,
385}
386#[allow(clippy::derive_partial_eq_without_eq)]
388#[derive(Clone, PartialEq, ::prost::Message)]
389pub struct BasketPriceUpdateEvent {
390 #[prost(enumeration="BasketSide", tag="1")]
392 pub side: i32,
393 #[prost(message, repeated, tag="2")]
395 pub updated_items: ::prost::alloc::vec::Vec<BasketItemPrice>,
396}
397#[allow(clippy::derive_partial_eq_without_eq)]
402#[derive(Clone, PartialEq, ::prost::Message)]
403pub struct GetArbitrageRequest {
404 #[prost(string, tag="1")]
406 pub arbitrage: ::prost::alloc::string::String,
407}
408#[allow(clippy::derive_partial_eq_without_eq)]
409#[derive(Clone, PartialEq, ::prost::Message)]
410pub struct ListArbitragesRequest {
411 #[prost(int32, optional, tag="1")]
413 pub page_size: ::core::option::Option<i32>,
414 #[prost(string, optional, tag="2")]
416 pub page_token: ::core::option::Option<::prost::alloc::string::String>,
417 #[prost(string, tag="3")]
443 pub filter: ::prost::alloc::string::String,
444}
445#[allow(clippy::derive_partial_eq_without_eq)]
446#[derive(Clone, PartialEq, ::prost::Message)]
447pub struct ListArbitragesResponse {
448 #[prost(message, repeated, tag="1")]
450 pub arbitrages: ::prost::alloc::vec::Vec<Arbitrage>,
451 #[prost(string, tag="2")]
453 pub next_page_token: ::prost::alloc::string::String,
454}
455#[allow(clippy::derive_partial_eq_without_eq)]
456#[derive(Clone, PartialEq, ::prost::Message)]
457pub struct CreateArbitrageRequest {
458 #[prost(message, optional, tag="1")]
460 pub arbitrage: ::core::option::Option<Arbitrage>,
461}
462#[allow(clippy::derive_partial_eq_without_eq)]
463#[derive(Clone, PartialEq, ::prost::Message)]
464pub struct UpdateArbitrageRequest {
465 #[prost(message, optional, tag="1")]
467 pub arbitrage: ::core::option::Option<Arbitrage>,
468 #[prost(message, optional, tag="2")]
470 pub update_mask: ::core::option::Option<super::super::super::google::protobuf::FieldMask>,
471}
472#[allow(clippy::derive_partial_eq_without_eq)]
473#[derive(Clone, PartialEq, ::prost::Message)]
474pub struct DeleteArbitrageRequest {
475 #[prost(string, tag="1")]
477 pub arbitrage: ::prost::alloc::string::String,
478}
479#[allow(clippy::derive_partial_eq_without_eq)]
480#[derive(Clone, PartialEq, ::prost::Message)]
481pub struct StartArbitrageRequest {
482 #[prost(string, tag="1")]
484 pub arbitrage: ::prost::alloc::string::String,
485}
486#[allow(clippy::derive_partial_eq_without_eq)]
487#[derive(Clone, PartialEq, ::prost::Message)]
488pub struct StopArbitrageRequest {
489 #[prost(string, tag="1")]
491 pub arbitrage: ::prost::alloc::string::String,
492}
493#[allow(clippy::derive_partial_eq_without_eq)]
494#[derive(Clone, PartialEq, ::prost::Message)]
495pub struct GetArbitrageStatusRequest {
496 #[prost(string, tag="1")]
498 pub arbitrage: ::prost::alloc::string::String,
499}
500#[allow(clippy::derive_partial_eq_without_eq)]
501#[derive(Clone, PartialEq, ::prost::Message)]
502pub struct ListArbitrageStatusesRequest {
503 #[prost(int32, optional, tag="1")]
505 pub page_size: ::core::option::Option<i32>,
506 #[prost(string, optional, tag="2")]
508 pub page_token: ::core::option::Option<::prost::alloc::string::String>,
509 #[prost(string, tag="3")]
517 pub filter: ::prost::alloc::string::String,
518}
519#[allow(clippy::derive_partial_eq_without_eq)]
520#[derive(Clone, PartialEq, ::prost::Message)]
521pub struct ListArbitrageStatusesResponse {
522 #[prost(message, repeated, tag="1")]
524 pub arbitrage_statuses: ::prost::alloc::vec::Vec<ArbitrageStatus>,
525 #[prost(string, tag="2")]
527 pub next_page_token: ::prost::alloc::string::String,
528}
529#[allow(clippy::derive_partial_eq_without_eq)]
530#[derive(Clone, PartialEq, ::prost::Message)]
531pub struct StreamArbitrageStatusRequest {
532 #[prost(string, tag="1")]
534 pub arbitrage: ::prost::alloc::string::String,
535 #[prost(bool, tag="2")]
538 pub include_basket_prices: bool,
539 #[prost(bool, tag="3")]
542 pub include_estimate: bool,
543}
544#[allow(clippy::derive_partial_eq_without_eq)]
545#[derive(Clone, PartialEq, ::prost::Message)]
546pub struct StreamArbitrageEventsRequest {
547 #[prost(string, tag="1")]
549 pub arbitrage: ::prost::alloc::string::String,
550 #[prost(bool, tag="2")]
553 pub include_basket_prices: bool,
554}
555#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
557#[repr(i32)]
558pub enum ArbitrageState {
559 Unspecified = 0,
560 Idle = 1,
562 Monitoring = 2,
564 Triggered = 3,
566 Executing = 4,
568 Stopped = 5,
570 Error = 6,
572}
573impl ArbitrageState {
574 pub fn as_str_name(&self) -> &'static str {
579 match self {
580 ArbitrageState::Unspecified => "ARBITRAGE_STATE_UNSPECIFIED",
581 ArbitrageState::Idle => "ARBITRAGE_STATE_IDLE",
582 ArbitrageState::Monitoring => "ARBITRAGE_STATE_MONITORING",
583 ArbitrageState::Triggered => "ARBITRAGE_STATE_TRIGGERED",
584 ArbitrageState::Executing => "ARBITRAGE_STATE_EXECUTING",
585 ArbitrageState::Stopped => "ARBITRAGE_STATE_STOPPED",
586 ArbitrageState::Error => "ARBITRAGE_STATE_ERROR",
587 }
588 }
589 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
591 match value {
592 "ARBITRAGE_STATE_UNSPECIFIED" => Some(Self::Unspecified),
593 "ARBITRAGE_STATE_IDLE" => Some(Self::Idle),
594 "ARBITRAGE_STATE_MONITORING" => Some(Self::Monitoring),
595 "ARBITRAGE_STATE_TRIGGERED" => Some(Self::Triggered),
596 "ARBITRAGE_STATE_EXECUTING" => Some(Self::Executing),
597 "ARBITRAGE_STATE_STOPPED" => Some(Self::Stopped),
598 "ARBITRAGE_STATE_ERROR" => Some(Self::Error),
599 _ => None,
600 }
601 }
602}
603#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
605#[repr(i32)]
606pub enum ArbitrageSide {
607 Unspecified = 0,
608 BuyASellB = 1,
610 BuyBSellA = 2,
612}
613impl ArbitrageSide {
614 pub fn as_str_name(&self) -> &'static str {
619 match self {
620 ArbitrageSide::Unspecified => "ARBITRAGE_SIDE_UNSPECIFIED",
621 ArbitrageSide::BuyASellB => "ARBITRAGE_SIDE_BUY_A_SELL_B",
622 ArbitrageSide::BuyBSellA => "ARBITRAGE_SIDE_BUY_B_SELL_A",
623 }
624 }
625 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
627 match value {
628 "ARBITRAGE_SIDE_UNSPECIFIED" => Some(Self::Unspecified),
629 "ARBITRAGE_SIDE_BUY_A_SELL_B" => Some(Self::BuyASellB),
630 "ARBITRAGE_SIDE_BUY_B_SELL_A" => Some(Self::BuyBSellA),
631 _ => None,
632 }
633 }
634}
635#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
637#[repr(i32)]
638pub enum BasketSide {
639 Unspecified = 0,
640 A = 1,
641 B = 2,
642}
643impl BasketSide {
644 pub fn as_str_name(&self) -> &'static str {
649 match self {
650 BasketSide::Unspecified => "BASKET_SIDE_UNSPECIFIED",
651 BasketSide::A => "BASKET_SIDE_A",
652 BasketSide::B => "BASKET_SIDE_B",
653 }
654 }
655 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
657 match value {
658 "BASKET_SIDE_UNSPECIFIED" => Some(Self::Unspecified),
659 "BASKET_SIDE_A" => Some(Self::A),
660 "BASKET_SIDE_B" => Some(Self::B),
661 _ => None,
662 }
663 }
664}
665include!("kdo.v1.arbitrage.tonic.rs");
666include!("kdo.v1.arbitrage.serde.rs");
667