microsoft/qlib · error · NotImplementedError
This type of input is not supported
Error message
This type of input is not supported
What it means
TradeDecision-related analysis in report.py (_get_base_vol_pri, the source of all base prices for PA/aggrotor-style analysis) selects the price source from pa_config['price']: only 'deal_price' is implemented, so any other value raises NotImplementedError('This type of input is not supported'). (The same message appears again a few lines down if get_deal_price returns an unexpected type.)
Source
Thrown at qlib/backtest/report.py:413
agg = pa_config.get("agg", "twap").lower()
price = pa_config.get("price", "deal_price").lower()
if decision.trade_range is not None:
trade_start_time, trade_end_time = decision.trade_range.clip_time_range(
start_time=trade_start_time,
end_time=trade_end_time,
)
if price == "deal_price":
price_s = trade_exchange.get_deal_price(
inst,
trade_start_time,
trade_end_time,
direction=direction,
method=None,
)
else:
raise NotImplementedError(f"This type of input is not supported")
# if there is no stock data during the time period
if price_s is None:
return None, None
if isinstance(price_s, (int, float, np.number)):
price_s = idd.SingleData(price_s, [trade_start_time])
elif isinstance(price_s, idd.SingleData):
pass
else:
raise NotImplementedError(f"This type of input is not supported")
# NOTE: there are some zeros in the trading price. These cases are known meaningless
# for aligning the previous logic, remove it.
# remove zero and negative values.
assert isinstance(price_s, idd.SingleData)
price_s = price_s.loc[(price_s > 1e-08).data.astype(bool)]
# NOTE ~(price_s < 1e-08) is different from price_s >= 1e-8View on GitHub (pinned to 79633dd950)
Solutions
- Set pa_config['price'] = 'deal_price' (case-insensitive) or omit it — 'deal_price' is the default
- If you need another price, compute it yourself against exchange.get_deal_price-like data instead of this API
- Update qlib if a newer release adds the price source you need
Example fix
# before
pa_config = {"agg": "twap", "price": "close"}
# after
pa_config = {"agg": "twap", "price": "deal_price"} Defensive patterns
Strategy: validation
Validate before calling
price = pa_config.get("price", "deal_price").lower()
assert price == "deal_price", f"unsupported price source {price!r}; only 'deal_price' is implemented" Type guard
def is_supported_price(pa_config: dict) -> bool:
return pa_config.get("price", "deal_price").lower() == "deal_price" Try / catch
try:
_get_base_vol_pri(...)
except NotImplementedError:
pa_config = {**pa_config, "price": "deal_price"} # retry with the supported source Prevention
- Omit 'price' in pa_config to use the default
- Check release notes before configuring non-deal_price sources
- Normalize keys to lowercase before passing configs through
When it happens
Trigger: Passing pa_config with price='close', 'vwap', 'twap_price' etc. into the trade-analysis flow that calls _get_base_vol_pri; the key is lowercased before comparison, so 'Deal_Price' is fine but any non-deal_price name fails.
Common situations: Trying to analyze orders against raw close/vwap prices (unsupported in this build); copying pa_config from older/newer qlib examples where more price sources existed; misspelling 'deal_price'.
Related errors
- trade_calendar is necessary for getting TradeRangeByTime.
- The decision didn't provide an index range
- There is no trade_range in this case
- This type of input {rtype} is not supported
- Please implement the `get_data` method
AI-assisted analysis of microsoft/qlib@79633dd950 (2026-08-15).
Data as JSON: /api/errors/88833a958f3894b4.
Report an issue: GitHub.