{"record":{"id":"c62f8afd84dfc462","repo":"HKUDS/Vibe-Trading","slug":"market-price-market-price-is-at-or-above-the-no","errorCode":null,"errorMessage":"market price {market_price} is at or above the no-arbitrage ceiling {upper}; no implied volatility exists","messagePattern":"market price (.+?) is at or above the no-arbitrage ceiling (.+?); no implied volatility exists","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/src/quantlib/options.py","lineNumber":453,"sourceCode":"    Raises:\n        ValueError: If ``option_type`` is invalid, if ``T``, ``S`` or ``K`` is\n            non-positive, or if ``market_price`` lies outside the no-arbitrage\n            interval, which includes the intrinsic-value violation\n            ``market_price < discounted intrinsic``.\n    \"\"\"\n    option_type = normalise_option_type(option_type)\n    if T <= 0:\n        raise ValueError(f\"T must be > 0 to imply a volatility, got {T}\")\n    if S <= 0 or K <= 0:\n        raise ValueError(f\"S and K must be > 0, got S={S}, K={K}\")\n\n    lower, upper = _no_arbitrage_bounds(S, K, T, r, option_type, q)\n    if market_price < lower - tol:\n        raise ValueError(\n            f\"market price {market_price} is below intrinsic value {lower}\"\n        )\n    if market_price >= upper:\n        raise ValueError(\n            f\"market price {market_price} is at or above the no-arbitrage \"\n            f\"ceiling {upper}; no implied volatility exists\"\n        )\n\n    def identified(candidate: float) -> float:\n        \"\"\"Return the candidate only if the quote actually pins it down.\n\n        The test is whether one volatility point of movement shifts the price by\n        more than the tolerance the solve was run to. If it does not, then a\n        whole band of volatilities reprices within ``tol`` and whichever one the\n        search happens to land on is an artefact of the search, not a reading of\n        the market. Comparing vega against an absolute floor cannot express\n        this, because the threshold has to scale with ``tol``.\n\n        Args:\n            candidate: A volatility that reprices to within ``tol``.\n\n        Returns:","sourceCodeStart":435,"sourceCodeEnd":471,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/quantlib/options.py#L435-L471","documentation":"The upper no-arbitrage bound is the discounted maximum payoff (S for a call, K for a put). At or above that ceiling no implied volatility exists — the price cannot be matched even as sigma -> infinity — so implied_volatility raises rather than returning an arbitrary large sigma.","triggerScenarios":"A call quoted at >= S (e.g. price 105 with S=100); quotes scaled by a contract multiplier of 100 fed in unadjusted; premium in different currency units or per-lot versus per-share.","commonSituations":"Forgetting to divide exchange prices by the lot multiplier (e.g. 100); mixing ticks and decimal price units; obviously bad data such as fat-fingered quotes surviving a screen.","solutions":["Normalise the quote to per-underlying-unit terms (divide by multiplier, handle tick size).","If the price is at exactly the ceiling legitimately (sigma -> inf), treat it as a cap: report None/inf per your convention instead of calling the solver.","Sanity-screen quotes: lower <= price < upper before the vol loop."],"exampleFix":"# before\niv = implied_volatility(market_price=10500, S=100, K=95, T=1, r=0.05, option_type='call')  # lot price\n\n# after\niv = implied_volatility(10500 / 100, 100, 95, 1, 0.05, 'call')  # per-share price 105 -> still bound-checked; fix quote source if wrong","handlingStrategy":"validation","validationCode":"ceiling = S if option_type == 'call' else K * math.exp(-r * T)\nassert market_price < ceiling, 'quote at/above no-arbitrage ceiling'","typeGuard":"def quote_below_ceiling(price: float, ceiling: float) -> bool:\n    return price < ceiling","tryCatchPattern":"try:\n    iv = implied_volatility(px, S, K, T, r, option_type)\nexcept ValueError as e:\n    if 'no-arbitrage ceiling' in str(e):\n        iv = float('inf')  # or None, per your reporting convention\n    else:\n        raise","preventionTips":["Normalise quotes to per-unit terms (divide lot multipliers) before solving.","Validate tick/price units at ingestion.","Treat ceiling-touching quotes as capped vols, not solver inputs."],"tags":["options","implied-volatility","no-arbitrage","price-bounds"],"backgroundTag":"no-arbitrage-bound-violation","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}