use async_trait::async_trait;
use nautilus_core::UnixNanos;
use nautilus_model::{
accounts::AccountAny,
enums::{LiquiditySide, OmsType},
identifiers::{
AccountId, ClientId, ClientOrderId, InstrumentId, StrategyId, Venue, VenueOrderId,
},
instruments::InstrumentAny,
reports::{ExecutionMassStatus, FillReport, OrderStatusReport, PositionStatusReport},
types::{AccountBalance, MarginBalance, Money, Price, Quantity},
};
use super::log_not_implemented;
use crate::messages::execution::{
BatchCancelOrders, CancelAllOrders, CancelOrder, GenerateFillReports,
GenerateOrderStatusReport, GenerateOrderStatusReports, GeneratePositionStatusReports,
ModifyOrder, QueryAccount, QueryOrder, SubmitOrder, SubmitOrderList,
};
#[async_trait(?Send)]
pub trait ExecutionClient {
fn is_connected(&self) -> bool;
fn client_id(&self) -> ClientId;
fn account_id(&self) -> AccountId;
fn venue(&self) -> Venue;
fn oms_type(&self) -> OmsType;
fn get_account(&self) -> Option<AccountAny>;
fn generate_account_state(
&self,
balances: Vec<AccountBalance>,
margins: Vec<MarginBalance>,
reported: bool,
ts_event: UnixNanos,
) -> anyhow::Result<()>;
fn start(&mut self) -> anyhow::Result<()>;
fn stop(&mut self) -> anyhow::Result<()>;
async fn connect(&mut self) -> anyhow::Result<()> {
Ok(())
}
async fn disconnect(&mut self) -> anyhow::Result<()> {
Ok(())
}
fn submit_order(&self, cmd: SubmitOrder) -> anyhow::Result<()> {
log_not_implemented(&cmd);
Ok(())
}
fn submit_order_list(&self, cmd: SubmitOrderList) -> anyhow::Result<()> {
log_not_implemented(&cmd);
Ok(())
}
fn modify_order(&self, cmd: ModifyOrder) -> anyhow::Result<()> {
log_not_implemented(&cmd);
Ok(())
}
fn cancel_order(&self, cmd: CancelOrder) -> anyhow::Result<()> {
log_not_implemented(&cmd);
Ok(())
}
fn cancel_all_orders(&self, cmd: CancelAllOrders) -> anyhow::Result<()> {
log_not_implemented(&cmd);
Ok(())
}
fn batch_cancel_orders(&self, cmd: BatchCancelOrders) -> anyhow::Result<()> {
log_not_implemented(&cmd);
Ok(())
}
fn query_account(&self, cmd: QueryAccount) -> anyhow::Result<()> {
log_not_implemented(&cmd);
Ok(())
}
fn query_order(&self, cmd: QueryOrder) -> anyhow::Result<()> {
log_not_implemented(&cmd);
Ok(())
}
async fn generate_order_status_report(
&self,
cmd: &GenerateOrderStatusReport,
) -> anyhow::Result<Option<OrderStatusReport>> {
log_not_implemented(cmd);
Ok(None)
}
async fn generate_order_status_reports(
&self,
cmd: &GenerateOrderStatusReports,
) -> anyhow::Result<Vec<OrderStatusReport>> {
log_not_implemented(cmd);
Ok(Vec::new())
}
async fn generate_fill_reports(
&self,
cmd: GenerateFillReports,
) -> anyhow::Result<Vec<FillReport>> {
log_not_implemented(&cmd);
Ok(Vec::new())
}
async fn generate_position_status_reports(
&self,
cmd: &GeneratePositionStatusReports,
) -> anyhow::Result<Vec<PositionStatusReport>> {
log_not_implemented(cmd);
Ok(Vec::new())
}
async fn generate_mass_status(
&self,
lookback_mins: Option<u64>,
) -> anyhow::Result<Option<ExecutionMassStatus>> {
log_not_implemented(&lookback_mins);
Ok(None)
}
fn register_external_order(
&self,
_client_order_id: ClientOrderId,
_venue_order_id: VenueOrderId,
_instrument_id: InstrumentId,
_strategy_id: StrategyId,
_ts_init: UnixNanos,
) {
}
fn on_instrument(&mut self, _instrument: InstrumentAny) {
}
#[expect(unused_variables)]
fn calculate_commission(
&self,
instrument: &InstrumentAny,
last_qty: Quantity,
last_px: Price,
liquidity_side: LiquiditySide,
) -> Option<Money> {
None
}
}