OpenBB-finance/OpenBB · error · ValueError
Error: lower_q and upper_q must be between 0 and 1
Error message
Error: lower_q and upper_q must be between 0 and 1
What it means
In the cones helper (openbb_technical/helpers.py), after normalizing lower_q/upper_q so lower <= upper, a hard check rejects quantile values >= 1. Quantiles must be strictly within [0, 1) as fractions, not percentages.
Source
Thrown at openbb_platform/extensions/technical/openbb_technical/helpers.py:419
"parkinson",
"garman_klass",
"hodges_tompkins",
"rogers_satchell",
"yang_zhang",
],
trading_periods: int | None = None,
) -> "DataFrame":
"""Calculate Cones."""
# pylint: disable=import-outside-toplevel
from pandas import DataFrame
estimator = DataFrame()
if lower_q > upper_q:
lower_q, upper_q = upper_q, lower_q
if (lower_q >= 1) or (upper_q >= 1):
raise ValueError("Error: lower_q and upper_q must be between 0 and 1")
lower_q_label = str(int(lower_q * 100))
upper_q_label = str(int(upper_q * 100))
quantiles = [lower_q, upper_q]
windows = [3, 10, 30, 60, 90, 120, 150, 180, 210, 240, 300, 360]
min_ = []
max_ = []
median = []
top_q = []
bottom_q = []
realized = []
allowed_windows = []
data = data.sort_index(ascending=True)
model_functions = {
"std": standard_deviation,
"parkinson": parkinson,
"garman_klass": garman_klass,View on GitHub (pinned to 3e071fcc2c)
Solutions
- Express quantiles as fractions: lower_q=0.10, upper_q=0.90.
- Divide percentage-style values by 100 before the call.
- Note bounds are auto-swapped if reversed, so only the 0-1 range matters.
- Validate inputs at the config layer of your app so users cannot enter percent integers.
Example fix
# before cones(data, lower_q=10, upper_q=90) # interpreted as >= 1 # after cones(data, lower_q=0.10, upper_q=0.90)
Defensive patterns
Strategy: validation
Validate before calling
assert 0 <= lower_q < 1 and 0 <= upper_q < 1, "quantiles must be fractions in [0, 1)" lower_q, upper_q = sorted([lower_q, upper_q])
Type guard
def valid_quantile(q) -> bool:
return isinstance(q, (int, float)) and 0 <= q < 1 Try / catch
try:
out = cones(data, lower_q=lower_q, upper_q=upper_q)
except ValueError as e:
if "must be between 0 and 1" in str(e):
out = cones(data, lower_q=lower_q/100, upper_q=upper_q/100)
else:
raise Prevention
- Use fractions (0.90), never percent integers (90)
- Bounds are auto-swapped; only range matters
- Centralize quantile config in one validated place
When it happens
Trigger: Calling cones(data, lower_q=0.25, upper_q=95) style code where one bound is passed as a percentage (>= 1) instead of a fraction; also lower_q=1 or upper_q=1 exactly.
Common situations: Translating percentile integers (e.g. '95th percentile') directly into the parameter; copying configs from libraries that accept 0-100 quantiles; mixing conventions between lower_q and upper_q.
Related errors
- Data length is less than required by parameters: {max(length
- Column {close_col} not in data
- At least one extension type must be selected.
- Incorrect email or password
- Charting is not installed. Please install `openbb-charting`.
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/4d539c5b6d1b63ac.
Report an issue: GitHub.