From f1453093cbc37fae9b8fedf4dee1c7473004dc6b Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Mon, 1 Jul 2024 20:30:33 +0200 Subject: [PATCH] ui fixes && add Implied Volatility Component --- src/lib/components/BorrowedShare.svelte | 1 + src/lib/components/DarkPool.svelte | 1 + src/lib/components/FailToDeliver.svelte | 4 +- src/lib/components/ImpliedVolatility.svelte | 438 ++++++++++++++++++++ src/lib/components/MarketMaker.svelte | 8 +- src/lib/store.ts | 1 + src/routes/stocks/[tickerID]/+page.svelte | 10 +- 7 files changed, 455 insertions(+), 8 deletions(-) create mode 100644 src/lib/components/ImpliedVolatility.svelte diff --git a/src/lib/components/BorrowedShare.svelte b/src/lib/components/BorrowedShare.svelte index 258abeba..0c99f89e 100644 --- a/src/lib/components/BorrowedShare.svelte +++ b/src/lib/components/BorrowedShare.svelte @@ -175,6 +175,7 @@ function findLowestAndHighestFee(data, lastDateStr) { { data: feeList, type: 'line', + areaStyle: {opacity: 0.3}, yAxisIndex: 1, itemStyle: { color: '#FF9E21' // Change bar color to white diff --git a/src/lib/components/DarkPool.svelte b/src/lib/components/DarkPool.svelte index 04a9092c..8dd6fa16 100644 --- a/src/lib/components/DarkPool.svelte +++ b/src/lib/components/DarkPool.svelte @@ -116,6 +116,7 @@ function getPlotOptions() { data: shortVolumeList, type: 'line', + areaStyle: {opacity: 0.3}, itemStyle: { color: '#536FC5' // Change bar color to white }, diff --git a/src/lib/components/FailToDeliver.svelte b/src/lib/components/FailToDeliver.svelte index c0d97676..b2dc25a7 100644 --- a/src/lib/components/FailToDeliver.svelte +++ b/src/lib/components/FailToDeliver.svelte @@ -171,12 +171,12 @@ function findLowestAndHighestPrice(data, lastDateStr) { }, { data: failToDeliverList, - type: 'bar', + type: 'line', + areaStyle: {opacity: 0.3}, yAxisIndex: 1, itemStyle: { color: '#FF9E21' // Change bar color to white }, - barWidth: "40%", showSymbol: false }, ] diff --git a/src/lib/components/ImpliedVolatility.svelte b/src/lib/components/ImpliedVolatility.svelte new file mode 100644 index 00000000..8c176588 --- /dev/null +++ b/src/lib/components/ImpliedVolatility.svelte @@ -0,0 +1,438 @@ + + + + +
+
+ +
+ + +
+ + {#if data?.user?.tier === 'Pro'} + {#if isLoaded} + + {#if rawData?.length !== 0} + +
+
+ Based on the past 12 months of historical data, {$displayCompanyName} has an IV Rank of {ivRank}%, with the current implied volatility standing at {rawData?.slice(-1)?.at(0)?.iv60}%. +
+
+ +
+ + + +
+ +
+
+ +
+ +
+
+ + + + Close Price + +
+
+ + + + Implied Volatility + +
+ +
+ + + + Realized Volatility + +
+ +
+ + +

+ Latest Information +

+ + +
+ + + + + + + + + + + + + + + +
+ Date + + {formatDateRange(rawData?.slice(-1)?.at(0)?.date)} +
+ IV Range + + {lowestIV+'%'+'-'+highestIV+'%'} +
+ RV Range + + {lowestRV+'%'+'-'+highestRV+'%'} +
+
+ + + + {/if} + + {:else} +
+
+ +
+
+ {/if} + + {:else} +
+ + Unlock content with Pro Subscription +
+ {/if} + +
+
+ + + + + \ No newline at end of file diff --git a/src/lib/components/MarketMaker.svelte b/src/lib/components/MarketMaker.svelte index 34834934..811b16db 100644 --- a/src/lib/components/MarketMaker.svelte +++ b/src/lib/components/MarketMaker.svelte @@ -156,12 +156,12 @@ function getPlotOptions() { }, { data: shareQuantityList, - type: 'bar', + type: 'line', + areaStyle: {opacity: 0.3}, yAxisIndex: 1, itemStyle: { - color: '#536FC5' // Change bar color to white + color: '#00BBFF' // Change bar color to white }, - barWidth: "40%", showSymbol: false }, ] @@ -292,7 +292,7 @@ else {
- + Share Quantity diff --git a/src/lib/store.ts b/src/lib/store.ts index ada83bae..1cf6c7a4 100644 --- a/src/lib/store.ts +++ b/src/lib/store.ts @@ -75,6 +75,7 @@ export const optionComponent = writable((false)); export const clinicalTrialComponent = writable((false)); export const failToDeliverComponent= writable((false)); export const borrowedShareComponent= writable((false)); +export const impliedVolatilityComponent= writable((false)); export const strategyId = writable( ("")); diff --git a/src/routes/stocks/[tickerID]/+page.svelte b/src/routes/stocks/[tickerID]/+page.svelte index ef07de29..f83bd688 100644 --- a/src/routes/stocks/[tickerID]/+page.svelte +++ b/src/routes/stocks/[tickerID]/+page.svelte @@ -3,7 +3,7 @@ import {AreaSeries, Chart, PriceLine, CandlestickSeries} from 'svelte-lightweight-charts'; import { TrackingModeExitMode } from 'lightweight-charts'; - import {getCache, setCache, borrowedShareComponent, clinicalTrialComponent, optionComponent, failToDeliverComponent, marketMakerComponent, analystEstimateComponent, sentimentComponent, screenWidth, displayCompanyName, numberOfUnreadNotification, globalForm, varComponent, shareStatisticsComponent, enterpriseComponent, darkPoolComponent, retailVolumeComponent, shareholderComponent, trendAnalysisComponent, revenueSegmentationComponent, priceAnalysisComponent, fundamentalAnalysisComponent, userRegion, isCrosshairMoveActive, realtimePrice, priceIncrease, currentPortfolioPrice, currentPrice, stockTicker, isOpen, isBeforeMarketOpen, isWeekend} from '$lib/store'; + import {getCache, setCache, impliedVolatilityComponent, borrowedShareComponent, clinicalTrialComponent, optionComponent, failToDeliverComponent, marketMakerComponent, analystEstimateComponent, sentimentComponent, screenWidth, displayCompanyName, numberOfUnreadNotification, globalForm, varComponent, shareStatisticsComponent, enterpriseComponent, darkPoolComponent, retailVolumeComponent, shareholderComponent, trendAnalysisComponent, revenueSegmentationComponent, priceAnalysisComponent, fundamentalAnalysisComponent, userRegion, isCrosshairMoveActive, realtimePrice, priceIncrease, currentPortfolioPrice, currentPrice, stockTicker, isOpen, isBeforeMarketOpen, isWeekend} from '$lib/store'; import { onDestroy, onMount } from 'svelte'; import BullBearSay from '$lib/components/BullBearSay.svelte'; import CommunitySentiment from '$lib/components/CommunitySentiment.svelte'; @@ -1321,7 +1321,13 @@ function changeChartType() {
- + +
+ {#await import('$lib/components/ImpliedVolatility.svelte') then {default: Comp}} + + {/await} +
+