use crate::{
prelude::{
Currency,
LimitOrder,
MarketState,
Mon,
Pending,
PriceFilter,
},
types::{
PriceFilterError,
TimestampNs,
UserOrderId,
},
};
pub(crate) type Exhausted = bool;
pub trait MarketUpdate<I, const D: u8, BaseOrQuote>:
Clone + std::fmt::Debug + std::fmt::Display
where
I: Mon<D>,
BaseOrQuote: Currency<I, D>,
{
const CAN_FILL_LIMIT_ORDERS: bool;
fn can_fill_bids(&self) -> bool;
fn can_fill_asks(&self) -> bool;
fn limit_order_filled<UserOrderIdT: UserOrderId>(
&mut self,
limit_order: &LimitOrder<I, D, BaseOrQuote, UserOrderIdT, Pending<I, D, BaseOrQuote>>,
) -> Option<(BaseOrQuote, Exhausted)>;
fn validate_market_update(
&self,
price_filter: &PriceFilter<I, D>,
) -> Result<(), PriceFilterError>;
fn update_market_state(&self, market_state: &mut MarketState<I, D>);
fn timestamp_exchange_ns(&self) -> TimestampNs;
}