Trait hftbacktest::backtest::proc::Processor
source · pub trait Processor {
// Required methods
fn initialize_data(&mut self) -> Result<i64, BacktestError>;
fn process_data(&mut self) -> Result<(i64, i64), BacktestError>;
fn process_recv_order(
&mut self,
timestamp: i64,
wait_resp_order_id: i64,
) -> Result<bool, BacktestError>;
fn earliest_recv_order_timestamp(&self) -> i64;
fn earliest_send_order_timestamp(&self) -> i64;
}
Expand description
Processes the historical feed data and the order interaction.
Required Methods§
sourcefn initialize_data(&mut self) -> Result<i64, BacktestError>
fn initialize_data(&mut self) -> Result<i64, BacktestError>
Prepares to process the data. This is invoked when the backtesting is initiated. If successful, returns the timestamp of the first event.
sourcefn process_data(&mut self) -> Result<(i64, i64), BacktestError>
fn process_data(&mut self) -> Result<(i64, i64), BacktestError>
Processes the data. This is invoked when the backtesting time reaches the timestamp of the event to be processed in the data. If successful, returns the timestamp of the next event.
sourcefn process_recv_order(
&mut self,
timestamp: i64,
wait_resp_order_id: i64,
) -> Result<bool, BacktestError>
fn process_recv_order( &mut self, timestamp: i64, wait_resp_order_id: i64, ) -> Result<bool, BacktestError>
Processes an order upon receipt. This is invoked when the backtesting time reaches the order
receipt timestamp.
Returns Ok(true) if the order with wait_resp_order_id
is received and processed.
sourcefn earliest_recv_order_timestamp(&self) -> i64
fn earliest_recv_order_timestamp(&self) -> i64
Returns the foremost timestamp at which an order is to be received by this processor.
sourcefn earliest_send_order_timestamp(&self) -> i64
fn earliest_send_order_timestamp(&self) -> i64
Returns the foremost timestamp at which an order sent by this processor is to be received by the corresponding processor.