pub struct MockExchange {
pub exchange: ExchangeId,
pub latency_ms: u64,
pub fee_model: FeeModelConfig,
pub fill_model: SimFillConfig,
pub request_rx: UnboundedReceiver<MockExchangeRequest>,
pub event_tx: Sender<UnindexedAccountEvent>,
pub instruments: FnvHashMap<InstrumentNameExchange, Instrument<ExchangeId, AssetNameExchange>>,
pub account: AccountState,
pub order_sequence: u64,
pub time_exchange_latest: DateTime<Utc>,
}Fields§
§exchange: ExchangeId§latency_ms: u64§fee_model: FeeModelConfig§fill_model: SimFillConfig§request_rx: UnboundedReceiver<MockExchangeRequest>§event_tx: Sender<UnindexedAccountEvent>§instruments: FnvHashMap<InstrumentNameExchange, Instrument<ExchangeId, AssetNameExchange>>§account: AccountState§order_sequence: u64§time_exchange_latest: DateTime<Utc>Implementations§
Source§impl MockExchange
impl MockExchange
pub fn new( config: MockExecutionConfig, request_rx: UnboundedReceiver<MockExchangeRequest>, event_tx: Sender<UnindexedAccountEvent>, instruments: FnvHashMap<InstrumentNameExchange, Instrument<ExchangeId, AssetNameExchange>>, ) -> Self
pub async fn run(self)
pub fn time_exchange(&self) -> DateTime<Utc>
pub fn account_snapshot(&self) -> UnindexedAccountSnapshot
pub fn account_stream(&self) -> BoxStream<'static, UnindexedAccountEvent>
pub fn cancel_order( &mut self, _: OrderRequestCancel<ExchangeId, InstrumentNameExchange>, ) -> Order<ExchangeId, InstrumentNameExchange, Result<Cancelled, UnindexedOrderError>>
pub fn open_order( &mut self, request: OrderRequestOpen<ExchangeId, InstrumentNameExchange>, market_prices: MarketPrices, ) -> (Order<ExchangeId, InstrumentNameExchange, UnindexedOrderState>, Option<OpenOrderNotifications>)
pub fn validate_order_kind_supported( &self, order_kind: OrderKind, ) -> Result<(), UnindexedOrderError>
pub fn find_instrument_data( &self, instrument: &InstrumentNameExchange, ) -> Result<&Instrument<ExchangeId, AssetNameExchange>, UnindexedApiError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MockExchange
impl RefUnwindSafe for MockExchange
impl Send for MockExchange
impl Sync for MockExchange
impl Unpin for MockExchange
impl UnsafeUnpin for MockExchange
impl UnwindSafe for MockExchange
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more