diff --git a/src/lib/components/FailToDeliver.svelte b/src/lib/components/FailToDeliver.svelte index 801ab5bc..9d5e1067 100644 --- a/src/lib/components/FailToDeliver.svelte +++ b/src/lib/components/FailToDeliver.svelte @@ -16,13 +16,12 @@ let isLoaded = false; - let rawData = []; let optionsData; let avgFailToDeliver; let lowestPrice; let highestPrice; - + let weightedFTD; function findLowestAndHighestPrice(data, lastDateStr) { @@ -212,7 +211,10 @@ function findLowestAndHighestPrice(data, lastDateStr) { ]; Promise.all(asyncFunctions) .then((results) => { - optionsData = getPlotOptions() + if(rawData?.length !== 0) { + weightedFTD = ((rawData?.slice(-1)?.at(0)?.failToDeliver/data?.getStockQuote?.avgVolume) * 100)?.toFixed(2); + optionsData = getPlotOptions() + } }) .catch((error) => { console.error('An error occurred:', error); @@ -222,19 +224,7 @@ function findLowestAndHighestPrice(data, lastDateStr) { } } - let charNumber = 20; - - $: { - if($screenWidth < 640) - { - charNumber = 20; - } - else { - charNumber =40; - } - } - - + let charNumber = $screenWidth < 640 ? 20 : 40; @@ -330,7 +320,13 @@ function findLowestAndHighestPrice(data, lastDateStr) { - +