From 6db97c89a0b5a86599ace3ea5e91d0c52a710687 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Sat, 15 Jun 2024 11:14:25 +0200 Subject: [PATCH] bugfixing: add historical data back --- src/routes/stocks/[tickerID]/insider/+page.svelte | 1 + src/routes/stocks/[tickerID]/insider/+page.ts | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/routes/stocks/[tickerID]/insider/+page.svelte b/src/routes/stocks/[tickerID]/insider/+page.svelte index 4fa2a716..ada05b55 100644 --- a/src/routes/stocks/[tickerID]/insider/+page.svelte +++ b/src/routes/stocks/[tickerID]/insider/+page.svelte @@ -117,6 +117,7 @@ const handleMessage = async (event) => { options = { + silent: true, grid: { left: '0%', right: '0%', diff --git a/src/routes/stocks/[tickerID]/insider/+page.ts b/src/routes/stocks/[tickerID]/insider/+page.ts index 44b1559c..61559e70 100644 --- a/src/routes/stocks/[tickerID]/insider/+page.ts +++ b/src/routes/stocks/[tickerID]/insider/+page.ts @@ -125,7 +125,7 @@ export const load = async ({ params }) => { async function historicalPrice() { let output; - const cachedData = getCache(params.tickerID, 'historicalPrice'+'max'); + const cachedData = getCache(params.tickerID, 'historicalPrice'+'insider'); if (cachedData) { output = cachedData; } else { @@ -144,8 +144,10 @@ async function historicalPrice() { output = await response?.json() ?? []; - /* - const mapData = (data) => data?.map(({ time, open, high, low, close }) => ({ + //Adding this would create a bug hence I cant use the historicalPrice endpoint such as in +page.svelte but rather need to call + // it again without modification. + /* + output= (data) => data?.map(({ time, open, high, low, close }) => ({ time: Date.parse(time), open, high, @@ -153,8 +155,9 @@ async function historicalPrice() { close })); */ + - setCache(params.tickerID, output, 'historicalPrice'+'max'); + setCache(params.tickerID, output, 'historicalPrice'+'insider'); }