{"record":{"id":"f8eb183196adb0e1","repo":"we-promise/sure","slug":"no-price-found-for-symbol-on-or-before-date","errorCode":null,"errorMessage":"No price found for #{symbol} on or before #{date}","messagePattern":"No price found for #(.+?) on or before #(.+?)","errorType":"exception","errorClass":"Provider::YahooFinance::Error","httpStatus":null,"severity":"error","filePath":"app/models/provider/yahoo_finance.rb","lineNumber":315,"sourceCode":"\n        prices_response = fetch_security_prices(\n          symbol: symbol,\n          exchange_operating_mic: exchange_operating_mic,\n          start_date: start_date,\n          end_date: end_date\n        )\n\n        raise Error, \"Failed to fetch security prices: #{prices_response.error.message}\" unless prices_response.success?\n\n        prices = prices_response.data\n        if prices.length == 1\n          target_price = prices.first\n        else\n          # Find the exact date or the closest previous date\n          target_price = prices.find { |p| p.date == date } ||\n                        prices.select { |p| p.date <= date }.max_by(&:date)\n\n          raise Error, \"No price found for #{symbol} on or before #{date}\" unless target_price\n        end\n\n        cache_result(cache_key, target_price)\n        target_price\n      end\n    end\n  end\n\n  def fetch_security_prices(symbol:, exchange_operating_mic: nil, start_date:, end_date:)\n    with_provider_response do\n      symbol = normalize_symbol(symbol, exchange_operating_mic)\n      validate_date_params!(start_date, end_date)\n      # Convert dates to Unix timestamps using UTC to ensure consistent epoch boundaries across timezones\n      period1 = start_date.to_time.utc.to_i\n      period2 = end_date.end_of_day.to_time.utc.to_i\n\n      throttle_request\n      data = fetch_authenticated_chart(symbol, {","sourceCodeStart":297,"sourceCodeEnd":333,"githubUrl":"https://github.com/we-promise/sure/blob/e69894adb92547273377398c15f45c979cd9416a/app/models/provider/yahoo_finance.rb#L297-L333","documentation":"Error \"No price found for #{symbol} on or before #{date}\" thrown in we-promise/sure.","triggerScenarios":"Thrown at app/models/provider/yahoo_finance.rb:315 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e69894adb92547273377398c15f45c979cd9416a","analyzedAt":"2026-08-21T18:22:41.165Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}