apple_quant_algorithmic/order/dependency/
remote.rs1use crate::{instrument::InstrumentSpec, price::BidAskPriceSpread};
2
3mod cancel;
4mod submit;
5
6pub use cancel::*;
7pub use submit::*;
8
9use super::{
10 OrderAction,
11 client::{CancelClientOrder, SubmitClientOrder},
12};
13
14#[derive(Debug, Clone, PartialEq, Eq, Hash)]
15pub enum RemoteOrderAction<IS: InstrumentSpec> {
16 SubmitRemoteOrder(SubmitRemoteOrder<IS>),
17 SubmitClientOrder(SubmitClientOrder<IS>),
18 CancelRemoteOrder(CancelRemoteOrder),
19 CancelClientOrder(CancelClientOrder),
20}
21
22impl<IS: InstrumentSpec> RemoteOrderAction<IS> {
23 pub(crate) fn parent_processed(
24 &mut self,
25 bid_ask_price_spread: &BidAskPriceSpread<IS>,
26 ) {
27 match self {
28 Self::SubmitRemoteOrder(submit_remote_order) => {
29 submit_remote_order.parent_processed(bid_ask_price_spread)
30 }
31 Self::SubmitClientOrder(submit_client_order) => {
32 submit_client_order.parent_processed(bid_ask_price_spread)
33 }
34 _ => {}
35 }
36 }
37
38 pub fn into_order_action(self) -> OrderAction<IS> {
39 self.into()
40 }
41}