pub struct MultiAssetSingleExchangeBacktest<MD, Local, Exchange> { /* private fields */ }Available on crate feature
backtest only.Expand description
Implementations§
source§impl<MD, Local, Exchange> MultiAssetSingleExchangeBacktest<MD, Local, Exchange>
impl<MD, Local, Exchange> MultiAssetSingleExchangeBacktest<MD, Local, Exchange>
pub fn builder() -> MultiAssetSingleExchangeBacktestBuilder<Local, Exchange>
pub fn new(local: Vec<Local>, exch: Vec<Exchange>) -> Self
pub fn goto<const WAIT_NEXT_FEED: bool>( &mut self, timestamp: i64, wait_order_response: WaitOrderResponse, ) -> Result<bool, BacktestError>
Trait Implementations§
source§impl<MD, Local, Exchange> Bot<MD> for MultiAssetSingleExchangeBacktest<MD, Local, Exchange>
impl<MD, Local, Exchange> Bot<MD> for MultiAssetSingleExchangeBacktest<MD, Local, Exchange>
type Error = BacktestError
source§fn current_timestamp(&self) -> i64
fn current_timestamp(&self) -> i64
In backtesting, this timestamp reflects the time at which the backtesting is conducted
within the provided data. In a live bot, it’s literally the current local timestamp.
source§fn num_assets(&self) -> usize
fn num_assets(&self) -> usize
Returns the number of assets.
source§fn state_values(&self, asset_no: usize) -> &StateValues
fn state_values(&self, asset_no: usize) -> &StateValues
Returns the state’s values such as balance, fee, and so on.
source§fn clear_last_trades(&mut self, asset_no: Option<usize>)
fn clear_last_trades(&mut self, asset_no: Option<usize>)
Clears the last market trades from the buffer. Read more
source§fn submit_buy_order(
&mut self,
asset_no: usize,
order_id: OrderId,
price: f64,
qty: f64,
time_in_force: TimeInForce,
order_type: OrdType,
wait: bool,
) -> Result<bool, Self::Error>
fn submit_buy_order( &mut self, asset_no: usize, order_id: OrderId, price: f64, qty: f64, time_in_force: TimeInForce, order_type: OrdType, wait: bool, ) -> Result<bool, Self::Error>
Places a buy order. Read more
source§fn submit_sell_order(
&mut self,
asset_no: usize,
order_id: OrderId,
price: f64,
qty: f64,
time_in_force: TimeInForce,
order_type: OrdType,
wait: bool,
) -> Result<bool, Self::Error>
fn submit_sell_order( &mut self, asset_no: usize, order_id: OrderId, price: f64, qty: f64, time_in_force: TimeInForce, order_type: OrdType, wait: bool, ) -> Result<bool, Self::Error>
Places a sell order. Read more
source§fn submit_order(
&mut self,
asset_no: usize,
order: OrderRequest,
wait: bool,
) -> Result<bool, Self::Error>
fn submit_order( &mut self, asset_no: usize, order: OrderRequest, wait: bool, ) -> Result<bool, Self::Error>
Places an order.
source§fn cancel(
&mut self,
asset_no: usize,
order_id: OrderId,
wait: bool,
) -> Result<bool, Self::Error>
fn cancel( &mut self, asset_no: usize, order_id: OrderId, wait: bool, ) -> Result<bool, Self::Error>
Cancels the specified order. Read more
source§fn clear_inactive_orders(&mut self, asset_no: Option<usize>)
fn clear_inactive_orders(&mut self, asset_no: Option<usize>)
Clears inactive orders from the local orders whose status is neither
Status::New nor
Status::PartiallyFilled.source§fn wait_order_response(
&mut self,
asset_no: usize,
order_id: OrderId,
timeout: i64,
) -> Result<bool, BacktestError>
fn wait_order_response( &mut self, asset_no: usize, order_id: OrderId, timeout: i64, ) -> Result<bool, BacktestError>
Waits for the response of the order with the given order ID until timeout.
source§fn wait_next_feed(
&mut self,
include_order_resp: bool,
timeout: i64,
) -> Result<bool, Self::Error>
fn wait_next_feed( &mut self, include_order_resp: bool, timeout: i64, ) -> Result<bool, Self::Error>
Wait until the next feed is received, or until timeout.
source§fn elapse(&mut self, duration: i64) -> Result<bool, Self::Error>
fn elapse(&mut self, duration: i64) -> Result<bool, Self::Error>
Elapses the specified duration. Read more
source§fn elapse_bt(&mut self, duration: i64) -> Result<bool, Self::Error>
fn elapse_bt(&mut self, duration: i64) -> Result<bool, Self::Error>
Elapses time only in backtesting. In live mode, it is ignored. Read more
Auto Trait Implementations§
impl<MD, Local, Exchange> Freeze for MultiAssetSingleExchangeBacktest<MD, Local, Exchange>
impl<MD, Local, Exchange> RefUnwindSafe for MultiAssetSingleExchangeBacktest<MD, Local, Exchange>
impl<MD, Local, Exchange> !Send for MultiAssetSingleExchangeBacktest<MD, Local, Exchange>
impl<MD, Local, Exchange> !Sync for MultiAssetSingleExchangeBacktest<MD, Local, Exchange>
impl<MD, Local, Exchange> Unpin for MultiAssetSingleExchangeBacktest<MD, Local, Exchange>
impl<MD, Local, Exchange> UnwindSafe for MultiAssetSingleExchangeBacktest<MD, Local, Exchange>
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