diff --git a/src/routes/stocks/[tickerID]/+layout.svelte b/src/routes/stocks/[tickerID]/+layout.svelte index 3271d9d0..22490d1e 100644 --- a/src/routes/stocks/[tickerID]/+layout.svelte +++ b/src/routes/stocks/[tickerID]/+layout.svelte @@ -267,7 +267,6 @@ async function websocketRealtimeData() { $realtimePrice = typeof JSON.parse(data)?.bp !== 'undefined' ? JSON.parse(data)?.bp : null; //console.log('Received message:', $realtimePrice); - if ($realtimePrice > previousRealtimePrice) { $priceIncrease = true; previousRealtimePrice = $realtimePrice; diff --git a/src/routes/stocks/[tickerID]/+page.svelte b/src/routes/stocks/[tickerID]/+page.svelte index 64af3b40..70f8a47b 100644 --- a/src/routes/stocks/[tickerID]/+page.svelte +++ b/src/routes/stocks/[tickerID]/+page.svelte @@ -135,8 +135,9 @@ $: { if ($stockTicker && typeof window !== 'undefined') // add a check to see if running on client-side { - if ($realtimePrice !== null) + if ($realtimePrice !== null && $realtimePrice !== 0) { + $realtimePrice = $realtimePrice !== 0 ? $realtimePrice : data?.getStockQuote?.price; $currentPortfolioPrice = $realtimePrice; } @@ -770,7 +771,7 @@ function changeChartType() { {#if $isCrosshairMoveActive } {$stockTicker?.includes('.DE') || $stockTicker?.includes('.PA') || $stockTicker?.includes('.F') ? `${displayLegend?.close}€` : ` $${displayLegend?.close}`} {:else if !$isCrosshairMoveActive && $realtimePrice !== null} - {$stockTicker?.includes('.DE') || $stockTicker?.includes('.PA') || $stockTicker?.includes('.F') ? `${$realtimePrice}€` : ` $${$realtimePrice}`} + {$stockTicker?.includes('.DE') || $stockTicker?.includes('.PA') || $stockTicker?.includes('.F') ? `${$currentPortfolioPrice}€` : ` $${$currentPortfolioPrice}`} {:else} {$stockTicker?.includes('.DE') || $stockTicker?.includes('.PA') || $stockTicker?.includes('.F') ? `${displayLegend?.close}€` : ` $${displayLegend?.close}`}