Yahoo finance quote

Dear all,

I have a small script, which should retrieve the current price of a stock, but on execution it does literally nothing. What’s my error?

Version 9.0.0 on MacOS

function getYahooFinancePrice() 
{
    const sheet = Api.GetActiveSheet();
    const ticker = sheet.GetRange("A1").GetValue();

    if (!ticker) {
        Api.Ui.MessageBox("Please enter a stock ticker in cell A1.");
        return;
    }

    const url = `https://query1.finance.yahoo.com/v7/finance/quote?symbols=${ticker}`;

    ApiUrlRequest.Get(url, {}, function (response) {
        try {
            const data = JSON.parse(response);
            const result = data.quoteResponse.result;

            if (result && result.length > 0) {
                const price = result[0].regularMarketPrice;
                sheet.GetRange("B1").SetValue(price);
                Api.Ui.MessageBox(`The current price of ${ticker} is ${price}`);
            } else {
                Api.Ui.MessageBox(`No data found for ticker: ${ticker}`);
            }
        } catch (e) {
            Api.Ui.MessageBox("Failed to parse response or fetch price.");
        }
    
 } }})();

Hello @promexio

Try running the app in debug mode to get more information about the process of code execution: