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

Function bars_build_volume_bars

crates/pyopenquant/src/bars.rs:38–50  ·  view source on GitHub ↗
(
    timestamps: Vec<String>,
    prices: Vec<f64>,
    volumes: Vec<f64>,
    volume_per_bar: f64,
)

Source from the content-addressed store, hash-verified

36 Ok(bars_to_rows(bars))
37}
38
39#[pyfunction(name = "build_volume_bars")]
40fn bars_build_volume_bars(
41 timestamps: Vec<String>,
42 prices: Vec<f64>,
43 volumes: Vec<f64>,
44 volume_per_bar: f64,
45) -> PyResult<Vec<(String, String, f64, f64, f64, f64, f64, f64, usize)>> {
46 if !volume_per_bar.is_finite() || volume_per_bar <= 0.0 {
47 return Err(PyValueError::new_err("volume_per_bar must be > 0"));
48 }
49 let trades = build_trades(timestamps, prices, volumes)?;
50 let bars = standard_bars(&trades, volume_per_bar, StandardBarType::Volume);
51 Ok(bars_to_rows(bars))
52}
53

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