{"record":{"id":"ba79a99ae6607d7c","repo":"we-promise/sure","slug":"no-time-series-data-returned-for-symbol-av-symbo","errorCode":null,"errorMessage":"No time series data returned for symbol #{av_symbol}","messagePattern":"No time series data returned for symbol #(.+?)","errorType":"exception","errorClass":"Provider::AlphaVantage::InvalidSecurityPriceError","httpStatus":null,"severity":"error","filePath":"app/models/provider/alpha_vantage.rb","lineNumber":190,"sourceCode":"  end\n\n  def fetch_security_prices(symbol:, exchange_operating_mic: nil, start_date:, end_date:)\n    with_provider_response do\n      av_symbol = to_av_symbol(symbol, exchange_operating_mic)\n\n      throttle_request\n      response = client.get(\"#{base_url}/query\") do |req|\n        req.params[\"function\"] = \"TIME_SERIES_DAILY\"\n        req.params[\"symbol\"] = av_symbol\n        req.params[\"outputsize\"] = \"compact\"\n      end\n\n      parsed = JSON.parse(response.body)\n      check_api_error!(parsed)\n      time_series = parsed.dig(\"Time Series (Daily)\")\n\n      if time_series.nil?\n        raise InvalidSecurityPriceError, \"No time series data returned for symbol #{av_symbol}\"\n      end\n\n      currency = infer_currency_from_symbol(av_symbol)\n\n      time_series.filter_map do |date_str, values|\n        date = Date.parse(date_str)\n        next unless date >= start_date && date <= end_date\n\n        price = values[\"4. close\"]\n\n        if price.nil? || price.to_f <= 0\n          Rails.logger.warn(\"#{self.class.name} returned invalid price data for security #{symbol} on: #{date_str}.  Price data: #{price.inspect}\")\n          next\n        end\n\n        Price.new(\n          symbol: symbol,\n          date: date,","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/we-promise/sure/blob/e69894adb92547273377398c15f45c979cd9416a/app/models/provider/alpha_vantage.rb#L172-L208","documentation":"The TIME_SERIES_DAILY fetch raises Provider::AlphaVantage::InvalidSecurityPriceError 'No time series data returned for symbol X' when the response JSON lacks the 'Time Series (Daily)' key after check_api_error! passed. Typical cause: Alpha Vantage returned an empty payload for an unknown/invalid symbol (HTTP 200 with {} or an informational key not covered by check_api_error!).","triggerScenarios":"fetch_security_prices with a symbol AV does not recognize (wrong ticker or wrong MIC-derived suffix); API returning an unmapped informational message; empty response on premium-only endpoints.","commonSituations":"Custom securities added by users; non-US symbols without the correct .LON/.DEX-style suffix; upstream response drift.","solutions":["Confirm the symbol on Alpha Vantage; fix the ticker or the exchange_operating_mic used for suffix mapping.","Log response.body when the key is missing to catch new undocumented AV message keys and extend check_api_error!.","Rescue InvalidSecurityPriceError at the sync level and mark the security as unpriced rather than aborting.","For search-driven flows, resolve the AV ticker via search_securities before fetching prices."],"exampleFix":"# before\ndata = provider.fetch_security_prices(symbol: \"INVALID1\", start_date: from, end_date: to)\n\n# after\nbegin\n  data = provider.fetch_security_prices(symbol: symbol, start_date: from, end_date: to)\nrescue Provider::AlphaVantage::InvalidSecurityPriceError => e\n  Rails.logger.warn(\"AV price fetch failed: #{e.message}\")\n  data = ProviderResponse.new(data: [], error: nil)\nend","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"begin\n  provider.fetch_security_prices(symbol: s, start_date: a, end_date: b)\nrescue Provider::AlphaVantage::InvalidSecurityPriceError => e\n  Rails.logger.warn(\"AV time series missing for #{s}: #{e.message}\")\n  mark_unpriceable(s)\nend","preventionTips":["Validate/resolve symbols through search_securities before time-series calls.","Log raw body when the key is missing to detect new AV message keys.","Degrade per-security; never let one bad ticker abort a batch price sync."],"tags":["alpha-vantage","provider","api-response","prices","ruby"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"e69894adb92547273377398c15f45c979cd9416a","analyzedAt":"2026-08-21T18:22:41.165Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}