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

Function bars_build_dollar_bars

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

Source from the content-addressed store, hash-verified

51 Ok(bars_to_rows(bars))
52}
53
54#[pyfunction(name = "build_dollar_bars")]
55fn bars_build_dollar_bars(
56 timestamps: Vec<String>,
57 prices: Vec<f64>,
58 volumes: Vec<f64>,
59 dollar_value_per_bar: f64,
60) -> PyResult<Vec<(String, String, f64, f64, f64, f64, f64, f64, usize)>> {
61 if !dollar_value_per_bar.is_finite() || dollar_value_per_bar <= 0.0 {
62 return Err(PyValueError::new_err("dollar_value_per_bar must be > 0"));
63 }
64 let trades = build_trades(timestamps, prices, volumes)?;
65 let bars = standard_bars(&trades, dollar_value_per_bar, StandardBarType::Dollar);
66 Ok(bars_to_rows(bars))
67}
68

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