we-promise/sure · error · Provider::YahooFinance::Error

No price found for #{symbol} on or before #{date}

Error message

No price found for #{symbol} on or before #{date}

What it means

Error "No price found for #{symbol} on or before #{date}" thrown in we-promise/sure.

Source

Thrown at app/models/provider/yahoo_finance.rb:315

        prices_response = fetch_security_prices(
          symbol: symbol,
          exchange_operating_mic: exchange_operating_mic,
          start_date: start_date,
          end_date: end_date
        )

        raise Error, "Failed to fetch security prices: #{prices_response.error.message}" unless prices_response.success?

        prices = prices_response.data
        if prices.length == 1
          target_price = prices.first
        else
          # Find the exact date or the closest previous date
          target_price = prices.find { |p| p.date == date } ||
                        prices.select { |p| p.date <= date }.max_by(&:date)

          raise Error, "No price found for #{symbol} on or before #{date}" unless target_price
        end

        cache_result(cache_key, target_price)
        target_price
      end
    end
  end

  def fetch_security_prices(symbol:, exchange_operating_mic: nil, start_date:, end_date:)
    with_provider_response do
      symbol = normalize_symbol(symbol, exchange_operating_mic)
      validate_date_params!(start_date, end_date)
      # Convert dates to Unix timestamps using UTC to ensure consistent epoch boundaries across timezones
      period1 = start_date.to_time.utc.to_i
      period2 = end_date.end_of_day.to_time.utc.to_i

      throttle_request
      data = fetch_authenticated_chart(symbol, {

View on GitHub (pinned to e69894adb9)

When it happens

Trigger: Thrown at app/models/provider/yahoo_finance.rb:315 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of we-promise/sure@e69894adb9 (2026-08-21). Data as JSON: /api/errors/f8eb183196adb0e1. Report an issue: GitHub.