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

Function build_ohlcv_columns

crates/pyopenquant/src/helpers.rs:139–172  ·  view source on GitHub ↗
(
    timestamps_us: Vec<i64>,
    symbols: Vec<String>,
    open: Vec<f64>,
    high: Vec<f64>,
    low: Vec<f64>,
    close: Vec<f64>,
    volume: Vec<f64>,
    adj_close: Vec<f64>,
)

Source from the content-addressed store, hash-verified

137}
138
139pub fn build_ohlcv_columns(
140 timestamps_us: Vec<i64>,
141 symbols: Vec<String>,
142 open: Vec<f64>,
143 high: Vec<f64>,
144 low: Vec<f64>,
145 close: Vec<f64>,
146 volume: Vec<f64>,
147 adj_close: Vec<f64>,
148) -> PyResult<openquant::data_processing::OhlcvColumns> {
149 let n = timestamps_us.len();
150 let lengths = [
151 symbols.len(),
152 open.len(),
153 high.len(),
154 low.len(),
155 close.len(),
156 volume.len(),
157 adj_close.len(),
158 ];
159 if lengths.iter().any(|&len| len != n) {
160 return Err(PyValueError::new_err(format!(
161 "ohlcv vector length mismatch: ts={n}, symbol={}, open={}, high={}, low={}, close={}, volume={}, adj_close={}",
162 symbols.len(),
163 open.len(),
164 high.len(),
165 low.len(),
166 close.len(),
167 volume.len(),
168 adj_close.len(),
169 )));
170 }
171 Ok(openquant::data_processing::OhlcvColumns {
172 timestamps_us,
173 symbols,
174 open,
175 high,

Callers 3

data_clean_ohlcvFunction · 0.85
data_quality_reportFunction · 0.85
data_align_calendarFunction · 0.85

Calls 1

lenMethod · 0.80

Tested by

no test coverage detected