diff --git a/src/pages/api/widgets/stocks.js b/src/pages/api/widgets/stocks.js index d80842e1b..3941a773d 100644 --- a/src/pages/api/widgets/stocks.js +++ b/src/pages/api/widgets/stocks.js @@ -1,9 +1,14 @@ import cachedFetch from "utils/proxy/cached-fetch"; import { getSettings } from "utils/config/config"; +import createLogger from "utils/logger"; + +const logger = createLogger("stocks"); export default async function handler(req, res) { const { watchlist, provider, cache } = req.query; + logger.debug("Stocks API request: %o", { watchlist, provider, cache }); + if (!watchlist) { return res.status(400).json({ error: "Missing watchlist" }); } @@ -56,6 +61,7 @@ export default async function handler(req, res) { // Finnhub free accounts allow up to 60 calls/minute // https://finnhub.io/pricing const { c, dp } = await cachedFetch(apiUrl, cache || 1); + logger.debug("Finnhub API response for %s: %o", ticker, { c, dp }); // API sometimes returns 200, but values returned are `null` if (c === null || dp === null) {