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

Function to_polars_df

crates/openquant/src/data_processing.rs:290–303  ·  view source on GitHub ↗
(columns: &OhlcvColumns)

Source from the content-addressed store, hash-verified

288}
289
290fn to_polars_df(columns: &OhlcvColumns) -> Result<DataFrame, String> {
291 validate_lengths(columns)?;
292 df!(
293 "symbol" => columns.symbols.clone(),
294 "ts_us" => columns.timestamps_us.clone(),
295 "open" => columns.open.clone(),
296 "high" => columns.high.clone(),
297 "low" => columns.low.clone(),
298 "close" => columns.close.clone(),
299 "volume" => columns.volume.clone(),
300 "adj_close" => columns.adj_close.clone(),
301 )
302 .map_err(|e| format!("polars df build failed: {e}"))
303}
304
305fn df_to_ohlcv_columns(df: &DataFrame) -> Result<OhlcvColumns, String> {
306 let timestamps_us = df

Callers 3

quality_report_columnsFunction · 0.85
clean_ohlcv_columnsFunction · 0.85
align_calendar_columnsFunction · 0.85

Calls 1

validate_lengthsFunction · 0.85

Tested by

no test coverage detected