Find an API by task
Start with the task below, then follow the linked signature and its input contract. The module index groups concepts; the Python reference lists importable namespaces, and rustdoc lists Rust paths. A module guide’s title is not necessarily its Python import name. If a call rejects your inputs or returns an unsuitable result, use Diagnose input errors.
Choose the operation
Section titled “Choose the operation”| Task | Python entry point | What to check before using it |
|---|---|---|
| Preserve selected source values through cleaning | provenance.select_revisions, rejoin_selected | Select before cleaning and rejoin by stable IDs. Exact typed identity does not prove provider authenticity or history completeness. |
| Assemble complete declared feature rows | feature_assembly.assemble_features | Specify feature order and required source fields. Retain missing-input exclusions and remap original row indices after filtering. |
| Audit training-time availability | availability.select_available_training | Supply explicit source and label clocks and the splitter’s original training indices; this filter does not replace purging or fold-local preprocessing. |
| Build meta-labels from a primary model’s sides | labeling.get_events, labeling.get_bins | Preserve primary-side provenance. These functions consume supplied sides; they do not fit either model or enforce out-of-sample prediction boundaries. |
| Load and inspect local OHLCV data | data.load_ohlcv, data.data_quality_report | First resolve point-in-time revision availability; loading and cleaning do not enforce it. The Python interface takes frames/files; the native _core.data exposes separate column and frame calls. Rust uses data_processing. |
| Explain why rows left a validation fold | cross_validation.split_with_diagnostics | Supply ordered label spans in consistent units. Diagnostics describe purge/embargo exclusions, not whether feature construction leaked. |
| Bootstrap labels inside a training fold | sampling.seq_bootstrap; worked handoff | Draws index training-local label columns. Map through training indices to original rows, preserve multiplicity across fitting arrays, and keep test rows excluded. Repeated draws are not independent new observations. |
| Score predictions already produced out of sample | feature_importance.mda_from_probabilities, sfi_from_probabilities | These consume predictions you supply; they do not fit your model. Preserve original rows and feature columns; see saved-prediction handoffs. |
| Fit the built-in diagnostic models on features | feature_diagnostics.mda_importance, sfi_importance | These are different interfaces from the prediction consumers above. Read the diagnostic model and preprocessing assumptions. |
| Track the trial count used for selection-adjusted reporting | evaluation.TrialRegistry | Counts unique explicit configuration keys; repeating a key replaces its entry. Include all attempted choices in those keys; see the trial-identity contract. |
| Allocate using supplied returns or covariance | portfolio.allocate_from_inputs | Follow observations to named weights for timestamp/asset alignment, then check covariance validity, bounds and units in portfolio optimization. |
| Assemble predictions into CPCV paths | backtesting_engine.assemble_cpcv_paths | Restore split and sample order before assembly. Paths reuse observations and are dependent; their spread is descriptive. |
| Convert an API result into a frame for analysis | adapters | Choose the adapter for the result type. Conversion does not establish timestamp alignment, calibration, or account-level P&L. |
For an integrated example, use the Python workflow or Rust workflow. Both are API demonstrations; training and held-out evaluation remain separate work. For a fitted baseline and held-out predictions, follow the end-to-end research journey. For parameter selection before one final chronological assessment, use the model-selection walkthrough. It connects purged inner splits, training-only preprocessing and explicit refitting; its final classification score is separate from the search score and is not trading P&L.
Python wrappers and native calls
Section titled “Python wrappers and native calls”Use openquant.<namespace> as the starting point. Seven namespaces have a
Python wrapper and a separately documented native surface:
backtesting_engine, bars, cross_validation, data, feature_importance,
hyperparameter_tuning, and pipeline. Their low-level references are named
openquant._core.<namespace>. A shared function name does not imply identical
accepted inputs or return types.
For example, the validation wrapper returns NumPy index arrays while its native counterpart returns lists. This small example also checks that fold row positions agree; the integers here are abstract, consistently ordered time units.
import numpy as npfrom openquant import cross_validationfrom openquant._core import cross_validation as native_cv
t0 = [0, 2, 4, 6, 8, 10]t1 = [1, 3, 5, 7, 9, 11]wrapped = cross_validation.purged_kfold_splits(t0, t1, 3, 0.0)native = native_cv.purged_kfold_splits(t0, t1, 3, 0.0)assert isinstance(wrapped[0][0], np.ndarray)assert isinstance(native[0][0], list)assert [(train.tolist(), test.tolist()) for train, test in wrapped] == nativeprint(wrapped[0][0].tolist(), wrapped[0][1].tolist())[2, 3, 4, 5] [0, 1]Other native namespaces such as risk, hrp, and fracdiff are re-exported
directly at the package root. Pure-Python namespaces such as evaluation,
feature_diagnostics, and viz have no same-name _core module.
Translate a name between languages
Section titled “Translate a name between languages”These common aliases help when moving from a Python example to rustdoc. They identify related modules, not interchangeable function signatures.
| Python namespace | Rust module |
|---|---|
bars | data_structures |
data | data_processing for OHLCV operations; Python caching/fetching is a separate layer |
risk | risk_metrics |
portfolio | portfolio_optimization |
backtest_stats | backtest_statistics |
synthetic_bt | synthetic_backtesting |
microstructural | microstructural_features |
ensemble | ensemble_methods |
fast_ewma, volatility | util::fast_ewma, util::volatility |
Tasks that currently require Rust
Section titled “Tasks that currently require Rust”These public Rust APIs have no Python binding. Similar names elsewhere do not supply the same operation.
| Task | Rust entry point and worked guide |
|---|---|
| Build a rebalanced futures basket or roll series | etf_trick::EtfTrick, get_futures_roll_series; guide |
| Decompose a fitted predictor’s feature effects | fingerprint::RegressionModelFingerprint; guide. Python feature importance measures are different diagnostics. |
| Dispatch a user-supplied computation over partitions | hpc_parallel::run_parallel; guide. Python streaming_hpc supplies specific streaming calculations, not this generic executor. |
| Supply a custom integer objective or solver adapter | combinatorial_optimization::IntegerObjective, SolverAdapter; guide. Python dynamic_allocation exposes a particular allocation problem, not these traits. |