pub struct SimulatedExchange { /* private fields */ }
Implementations§
Source§impl SimulatedExchange
impl SimulatedExchange
Sourcepub fn new(
venue: Venue,
oms_type: OmsType,
account_type: AccountType,
starting_balances: Vec<Money>,
base_currency: Option<Currency>,
default_leverage: Decimal,
leverages: HashMap<InstrumentId, Decimal>,
modules: Vec<Box<dyn SimulationModule>>,
msgbus: Rc<RefCell<MessageBus>>,
cache: Rc<RefCell<Cache>>,
clock: &'static AtomicTime,
fill_model: FillModel,
fee_model: FeeModelAny,
latency_model: LatencyModel,
book_type: BookType,
frozen_account: Option<bool>,
bar_execution: Option<bool>,
reject_stop_orders: Option<bool>,
support_gtd_orders: Option<bool>,
support_contingent_orders: Option<bool>,
use_position_ids: Option<bool>,
use_random_ids: Option<bool>,
use_reduce_only: Option<bool>,
use_message_queue: Option<bool>,
) -> Result<Self>
pub fn new( venue: Venue, oms_type: OmsType, account_type: AccountType, starting_balances: Vec<Money>, base_currency: Option<Currency>, default_leverage: Decimal, leverages: HashMap<InstrumentId, Decimal>, modules: Vec<Box<dyn SimulationModule>>, msgbus: Rc<RefCell<MessageBus>>, cache: Rc<RefCell<Cache>>, clock: &'static AtomicTime, fill_model: FillModel, fee_model: FeeModelAny, latency_model: LatencyModel, book_type: BookType, frozen_account: Option<bool>, bar_execution: Option<bool>, reject_stop_orders: Option<bool>, support_gtd_orders: Option<bool>, support_contingent_orders: Option<bool>, use_position_ids: Option<bool>, use_random_ids: Option<bool>, use_reduce_only: Option<bool>, use_message_queue: Option<bool>, ) -> Result<Self>
Creates a new SimulatedExchange
instance.
pub fn register_client(&mut self, client: ExecutionClient)
pub fn set_fill_model(&mut self, fill_model: FillModel)
pub fn set_latency_model(&mut self, latency_model: LatencyModel)
pub fn initialize_account(&mut self, _account_id: u64)
pub fn add_instrument(&mut self, instrument: InstrumentAny) -> Result<()>
pub fn best_bid_price(&self, instrument_id: InstrumentId) -> Option<Price>
pub fn best_ask_price(&self, instrument_id: InstrumentId) -> Option<Price>
pub fn get_book(&self, instrument_id: InstrumentId) -> Option<&OrderBook>
pub fn get_matching_engine( &self, instrument_id: InstrumentId, ) -> Option<&OrderMatchingEngine>
pub const fn get_matching_engines( &self, ) -> &HashMap<InstrumentId, OrderMatchingEngine>
pub fn get_books(&self) -> HashMap<InstrumentId, OrderBook>
pub fn get_open_orders( &self, instrument_id: Option<InstrumentId>, ) -> Vec<PassiveOrderAny>
pub fn get_open_bid_orders( &self, instrument_id: Option<InstrumentId>, ) -> Vec<PassiveOrderAny>
pub fn get_open_ask_orders( &self, instrument_id: Option<InstrumentId>, ) -> Vec<PassiveOrderAny>
pub fn get_account(&self) -> Option<AccountAny>
pub fn adjust_account(&mut self, _adjustment: Money)
pub fn send(&self, _command: TradingCommand)
pub fn generate_inflight_command(&self, _command: TradingCommand)
pub fn process_order_book_delta(&mut self, delta: OrderBookDelta)
pub fn process_order_book_deltas(&mut self, deltas: OrderBookDeltas)
pub fn process_quote_tick(&mut self, quote: &QuoteTick)
pub fn process_trade_tick(&mut self, trade: &TradeTick)
pub fn process_bar(&mut self, bar: Bar)
pub fn process_instrument_status(&mut self, status: InstrumentStatus)
pub fn process(&mut self, _ts_now: UnixNanos)
pub fn reset(&mut self)
pub fn process_trading_command(&mut self, _command: TradingCommand)
pub fn generate_fresh_account_state(&self)
Auto Trait Implementations§
impl Freeze for SimulatedExchange
impl !RefUnwindSafe for SimulatedExchange
impl !Send for SimulatedExchange
impl !Sync for SimulatedExchange
impl Unpin for SimulatedExchange
impl !UnwindSafe for SimulatedExchange
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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