OpenBB-finance/OpenBB · error · ValueError

Adjustment can only be applied to daily ('1d') interval.

Error message

Adjustment can only be applied to daily ('1d') interval.

What it means

A Pydantic model_validator ValueError on FMPEquityHistoricalQueryParams: FMP only serves adjusted prices (adjustment='splits_only' is a no-op baseline) on the daily interval. If you request any other adjustment ('split', 'dividend', 'all') together with an intraday interval (anything other than '1d'), validation fails before any request is made.

Source

Thrown at openbb_platform/providers/fmp/openbb_fmp/models/equity_historical.py:48

    }

    interval: Literal["1m", "5m", "15m", "30m", "1h", "4h", "1d"] = Field(
        default="1d", description=QUERY_DESCRIPTIONS.get("interval", "")
    )
    adjustment: Literal["splits_only", "splits_and_dividends", "unadjusted"] = Field(
        default="splits_only",
        description="Type of adjustment for historical prices. Only applies to daily data.",
    )

    @model_validator(mode="before")
    @classmethod
    def _validate_params(cls, values: dict) -> dict:
        """Validate query parameters."""
        interval = values.get("interval", "1d")
        adjustment = values.get("adjustment", "splits_only")

        if adjustment != "splits_only" and interval != "1d":
            raise ValueError("Adjustment can only be applied to daily ('1d') interval.")
        return values


class FMPEquityHistoricalData(EquityHistoricalData):
    """FMP Equity Historical Price Data."""

    __alias_dict__ = {
        "open": "adjOpen",
        "high": "adjHigh",
        "low": "adjLow",
        "close": "adjClose",
    }

    change: float | None = Field(
        default=None,
        description="Change in the price from the previous close.",
    )
    change_percent: float | None = Field(

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Drop the adjustment parameter for intraday requests (intraday data is unadjusted anyway)
  2. Or switch interval to '1d' if you truly need adjusted prices
  3. Catch the pydantic ValidationError client-side and report 'adjustment requires daily interval' to the caller

Example fix

# before
res = obb.equity.price.historical(symbol='AAPL', provider='fmp', interval='1h', adjustment='all')  # ValueError

# after
res = obb.equity.price.historical(symbol='AAPL', provider='fmp', interval='1h')          # unadjusted intraday
# or
res = obb.equity.price.historical(symbol='AAPL', provider='fmp', interval='1d', adjustment='all')
Defensive patterns

Strategy: validation

Validate before calling

interval, adjustment = '1h', 'all'
if adjustment and adjustment != 'splits_only' and interval != '1d':
    adjustment = None  # or raise, per your UX
    # FMP only supports adjustment on daily bars

Type guard

def fmp_historical_params_ok(interval: str, adjustment: str | None) -> bool:
    return adjustment in (None, 'splits_only') or interval == '1d'

Try / catch

from pydantic import ValidationError
try:
    res = obb.equity.price.historical(symbol=s, provider='fmp', interval=i, adjustment=a)
except ValidationError:
    if a not in (None, 'splits_only') and i != '1d':
        res = obb.equity.price.historical(symbol=s, provider='fmp', interval=i)  # drop adjustment
    else:
        raise

Prevention

When it happens

Trigger: Calling obb.equity.price.historical(symbol=X, provider='fmp', interval='1m'|'1h'|..., adjustment='split') etc. The defaults (interval='1d', adjustment='splits_only') never trigger it; only a non-default adjustment paired with a non-daily interval does.

Common situations: Reusing query params built for daily data on an intraday call, UI defaults that always pass adjustment='all', or porting code from a provider (e.g. Yahoo) where intraday dividend/split adjustment was accepted.

Related errors


AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14). Data as JSON: /api/errors/c44e64b9ab78b2b9. Report an issue: GitHub.