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

Function aligned_columns_to_rows

crates/openquant/src/data_processing.rs:521–540  ·  view source on GitHub ↗
(columns: &AlignedOhlcvColumns)

Source from the content-addressed store, hash-verified

519 i = j;
520 }
521
522 let calendar = df!("symbol" => cal_symbols, "ts_us" => cal_ts)
523 .map_err(|e| DataProcessingError::frame("calendar df build failed", e))?;
524
525 // Polars does not keep the left order of a join unless asked; the calendar is already
526 // sorted by `(symbol, ts_us)`, which is the documented output order.
527 let mut join_args = JoinArgs::new(JoinType::Left);
528 join_args.maintain_order = MaintainOrderJoin::Left;
529 let mut out = calendar
530 .join(&cleaned, ["symbol", "ts_us"], ["symbol", "ts_us"], join_args, None)
531 .map_err(|e| DataProcessingError::frame("calendar join failed", e))?;
532
533 let mut missing = out
534 .column("open")
535 .map_err(|e| DataProcessingError::frame("column lookup", e))?
536 .is_null()
537 .into_column();
538 missing.rename("is_missing_bar".into());
539 out.with_column(missing)
540 .map_err(|e| DataProcessingError::frame("failed to add is_missing_bar", e))?;
541
542 Ok((out, report))
543}

Callers 1

align_calendar_rowsFunction · 0.85

Calls 1

lenMethod · 0.80

Tested by

no test coverage detected