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§

source

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.

source

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.

source

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.

source

fn earliest_recv_order_timestamp(&self) -> i64

Returns the foremost timestamp at which an order is to be received by this processor.

source

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.

Implementors§

source§

impl<AT, LM, MD> Processor for Local<AT, LM, MD>

source§

impl<AT, LM, QM, MD> Processor for NoPartialFillExchange<AT, LM, QM, MD>

source§

impl<AT, LM, QM, MD> Processor for PartialFillExchange<AT, LM, QM, MD>