MCPcopy Create free account
hub / github.com/Open-Quant/openquant / bars_build_tick_bars

Function bars_build_tick_bars

crates/pyopenquant/src/bars.rs:23–35  ·  view source on GitHub ↗
(
    timestamps: Vec<String>,
    prices: Vec<f64>,
    volumes: Vec<f64>,
    ticks_per_bar: usize,
)

Source from the content-addressed store, hash-verified

21 Ok(bars_to_rows(bars))
22}
23
24#[pyfunction(name = "build_tick_bars")]
25fn bars_build_tick_bars(
26 timestamps: Vec<String>,
27 prices: Vec<f64>,
28 volumes: Vec<f64>,
29 ticks_per_bar: usize,
30) -> PyResult<Vec<(String, String, f64, f64, f64, f64, f64, f64, usize)>> {
31 if ticks_per_bar == 0 {
32 return Err(PyValueError::new_err("ticks_per_bar must be > 0"));
33 }
34 let trades = build_trades(timestamps, prices, volumes)?;
35 let bars = standard_bars(&trades, ticks_per_bar as f64, StandardBarType::Tick);
36 Ok(bars_to_rows(bars))
37}
38

Callers

nothing calls this directly

Calls 3

build_tradesFunction · 0.85
standard_barsFunction · 0.85
bars_to_rowsFunction · 0.85

Tested by

no test coverage detected