hftbacktest 0.9.4

A high-frequency trading and market-making backtesting tool accounts for limit orders, queue positions, and latencies, utilizing full tick data for trades and order books.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
mod aligned;

pub use aligned::{AlignedArray, CACHE_LINE_SIZE};

/// Gets price precision.
///
/// * `tick_size` - This should not be a computed value.
pub fn get_precision(tick_size: f64) -> usize {
    let s = tick_size.to_string();
    let mut prec = 0;
    for (i, c) in s.chars().enumerate() {
        if c == '.' {
            prec = s.len() - i - 1;
            break;
        }
    }
    prec
}