Closed ian-wazowski closed 3 months ago
Copying and constructing a vector in the backtesting loop is costly. Therefore, I recommend using the type's method that returns the base data structure of the market depth instead of the trait method. For example, ROIVectorMarketDepth
provides bid_depth
and ask_depth
method that returns a slice of the market depth, allowing you to access market depths quickly.
This feature terminates as soon as it is cost effective
to use the bid_depth
, ask_depth
features of ROIVectorMarketDepth
.
Overview
Currently, the MD (MarketDepth) trait only allows retrieval of the best bid/ask tick and quantity.
Improvements
I have written a function to create a snapshot up to Level L in the format Vec<(f64, f64)>.
Example