From 547a74768ed34ae4278f11be0960fc27a99f58b1 Mon Sep 17 00:00:00 2001 From: Rufus King Date: Mon, 27 Jul 2026 20:45:17 -0400 Subject: [PATCH] removed duplciate files --- ...onlyoffice_macro_stockprice_finnhub (1).js | 55 ------------------- 1 file changed, 55 deletions(-) delete mode 100644 Stocks/onlyoffice_macro_stockprice_finnhub (1).js diff --git a/Stocks/onlyoffice_macro_stockprice_finnhub (1).js b/Stocks/onlyoffice_macro_stockprice_finnhub (1).js deleted file mode 100644 index 8290df0..0000000 --- a/Stocks/onlyoffice_macro_stockprice_finnhub (1).js +++ /dev/null @@ -1,55 +0,0 @@ -// ONLYOFFICE Custom Function -// Location: View -> Macros -> Custom Functions -// Used on: "Dashboard" tab (regular equities only -- Finnhub does NOT support mutual funds) -// Data source: Finnhub (https://finnhub.io) -- free tier, real-time US equity quotes -// -// Real API key lives in Vaultwarden -- never commit the real key to this file. - -(function () { - /** - * Latest stock price for a ticker, via Finnhub. - * @customfunction - * @param {string} ticker Stock ticker symbol, e.g. "AAPL" - * @returns {any} Latest price, or an error string - */ - async function STOCKPRICE(ticker) { - var apiKey = "YOUR_FINNHUB_API_KEY"; - var url = "https://finnhub.io/api/v1/quote?symbol=" + - encodeURIComponent(ticker) + "&token=" + apiKey; - try { - var r = await fetch(url); - var data = await r.json(); - if (data && typeof data.c === "number" && data.c !== 0) { - return data.c; - } - return "#N/A"; - } catch (e) { - return "#ERROR"; - } - } - - /** - * Exchange-reported timestamp of the last quote for a ticker, via Finnhub. - * @customfunction - * @param {string} ticker Stock ticker symbol, e.g. "AAPL" - * @returns {any} Last-updated time, or an error string - */ - async function STOCKTIME(ticker) { - var apiKey = "YOUR_FINNHUB_API_KEY"; - var url = "https://finnhub.io/api/v1/quote?symbol=" + - encodeURIComponent(ticker) + "&token=" + apiKey; - try { - var r = await fetch(url); - var data = await r.json(); - if (data && data.t) { - return new Date(data.t * 1000).toLocaleString(); - } - return "#N/A"; - } catch (e) { - return "#ERROR"; - } - } - - Api.AddCustomFunction(STOCKPRICE); - Api.AddCustomFunction(STOCKTIME); -})();