From e97b356d27648decee2d1a9d6845b120ff9460f8 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Sun, 12 Jan 2025 11:29:54 +0100 Subject: [PATCH] clean code --- src/lib/components/BorrowedShare.svelte | 147 ------- src/lib/components/CountrySegmentation.svelte | 159 -------- src/lib/components/ESGCard.svelte | 288 ------------- src/lib/components/Enterprise.svelte | 145 ------- src/lib/components/FOMCImpact.svelte | 356 ----------------- src/lib/components/FailToDeliver.svelte | 1 - src/lib/components/GovernmentContract.svelte | 266 ------------ src/lib/components/MarketMaker.svelte | 258 ------------ src/lib/components/Markethour.svelte | 135 ------- src/lib/components/MobileCommentEditor.svelte | 378 ------------------ src/lib/components/OptionsNetFlow.svelte | 214 ---------- src/lib/components/ReturnCard.svelte | 233 ----------- src/lib/components/VaR.svelte | 91 ++--- src/lib/components/VideoPlayer.svelte | 145 ------- .../[tickerID]/statistics/+layout.svelte | 3 +- .../value-at-risk/+layout.server.ts | 27 ++ .../statistics/value-at-risk/+layout.svelte | 92 +++++ .../statistics/value-at-risk/+page.server.ts | 46 +++ .../statistics/value-at-risk/+page.svelte | 98 +++++ 19 files changed, 297 insertions(+), 2785 deletions(-) delete mode 100644 src/lib/components/BorrowedShare.svelte delete mode 100644 src/lib/components/CountrySegmentation.svelte delete mode 100644 src/lib/components/ESGCard.svelte delete mode 100644 src/lib/components/Enterprise.svelte delete mode 100644 src/lib/components/FOMCImpact.svelte delete mode 100644 src/lib/components/GovernmentContract.svelte delete mode 100644 src/lib/components/MarketMaker.svelte delete mode 100644 src/lib/components/Markethour.svelte delete mode 100644 src/lib/components/MobileCommentEditor.svelte delete mode 100644 src/lib/components/OptionsNetFlow.svelte delete mode 100644 src/lib/components/ReturnCard.svelte delete mode 100644 src/lib/components/VideoPlayer.svelte create mode 100644 src/routes/stocks/[tickerID]/statistics/value-at-risk/+layout.server.ts create mode 100644 src/routes/stocks/[tickerID]/statistics/value-at-risk/+layout.svelte create mode 100644 src/routes/stocks/[tickerID]/statistics/value-at-risk/+page.server.ts create mode 100644 src/routes/stocks/[tickerID]/statistics/value-at-risk/+page.svelte diff --git a/src/lib/components/BorrowedShare.svelte b/src/lib/components/BorrowedShare.svelte deleted file mode 100644 index 14cd0371..00000000 --- a/src/lib/components/BorrowedShare.svelte +++ /dev/null @@ -1,147 +0,0 @@ - - -
-
-
- - -
- - {#if isLoaded} - {#if rawData?.length !== 0} -
-
- Over the past six months, Interactive Brokers had {abbreviateNumber( - totalAvailableShares, - )} shares available for borrowing, with an average fee of {avgFee}%. -
-
- -
-
- -
-
- -
-
- - - - Available Shares - -
-
- - - - Fee - -
-
- -

- Latest Information -

- -
- - - - - - - - - - - - - - - -
- Date - - {formatDateRange(rawData?.slice(-1)?.at(0)?.date)} -
- Fee Range - - {lowestFee + "%" + "-" + highestFee + "%"} -
- Total Available Shares - - {abbreviateNumber(monthlyAvailableShares)} -
-
- {/if} - {:else} -
-
- -
-
- {/if} -
-
- - diff --git a/src/lib/components/CountrySegmentation.svelte b/src/lib/components/CountrySegmentation.svelte deleted file mode 100644 index 20576032..00000000 --- a/src/lib/components/CountrySegmentation.svelte +++ /dev/null @@ -1,159 +0,0 @@ - - -
-
-
-
-
- - -
- - {#if geographicList?.length !== 0} -
- The ETF is build on top of {geographicList?.length} regions: -
- -
-
- - {#each showFullStats ? geographicList : geographicList?.slice(0, 3) as item, index} -
-
- Country Logo -
- -
-
- - {item?.country?.length > charNumber - ? formatString(item?.country)?.slice(0, charNumber) + - "..." - : formatString(item?.country)} - - - {item?.weightPercentage <= 0.01 - ? "< 0.01%" - : item?.weightPercentage?.toFixed(2) + "%"} - -
- -
-
- {/each} - -
-
- - {#if geographicList?.length > 2} - - {/if} - {:else} -

- No data available - -

- {/if} -
-
-
-
diff --git a/src/lib/components/ESGCard.svelte b/src/lib/components/ESGCard.svelte deleted file mode 100644 index 9f7ff8e0..00000000 --- a/src/lib/components/ESGCard.svelte +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - - -
-
- -
-

- ESG Score -

- -
- - Gain valuable insights into a company's sustainability by evaluating - its ESG (Environmental, Social, and Governance) scores. - -
-
- - - {#if esgScore && esgRiskRating && environmentalScore && governanceScore !== "n/a"} -
-
-
-
- - Total - - - {esgScore} - -
- -
-
- -
-
-
- - Environment - - - {environmentalScore} - -
- -
-
- -
-
-
- - Social - - - {socialScore} - -
- -
-
- -
-
-
- - Governance - - - {governanceScore} - -
- -
-
-
- {:else} -
- No data available -
- {/if} -
-
- diff --git a/src/lib/components/Enterprise.svelte b/src/lib/components/Enterprise.svelte deleted file mode 100644 index a8a8c8bb..00000000 --- a/src/lib/components/Enterprise.svelte +++ /dev/null @@ -1,145 +0,0 @@ - - -
-
-
- - -
- - {#if isLoaded} - {#if rawData?.length !== 0} -
-
-
- {$displayCompanyName}'s' enterprise value provides a comprehensive - snapshot of its total worth, crucial for assessing its financial - health and making informed investment decisions. -
-
- - - Full report - - -
- -
- -
-
- - - - Enterprise Value - -
-
- - - - Mkt Cap - -
-
- - - - Debt - -
-
- - - - Cash Equivalents - -
-
-
- {/if} - {:else} -
-
- -
-
- {/if} -
-
- - diff --git a/src/lib/components/FOMCImpact.svelte b/src/lib/components/FOMCImpact.svelte deleted file mode 100644 index 831c6858..00000000 --- a/src/lib/components/FOMCImpact.svelte +++ /dev/null @@ -1,356 +0,0 @@ - - -
-
-
- - -
- - {#if isLoaded} - {#if Object?.keys(rawData)?.length !== 0} -
-
-
- Examine how sensitive {$displayCompanyName}'s stock price is to - the decisions made during FOMC meetings. The vertical line marks - the interest rate decision. -
-
- -
- -
- -

- Latest FED Interest Rate -

- -
- The latest list of previous, forecasted, and actual interest rate - decisions made by the FED. -
- The "% Price Change" column reflects the performance for each interval - leading up to the next FOMC meeting. -
- -
- - - - - - - - - - - - {#each showFullStats ? tableList?.slice(0, 10) : tableList?.slice(0, 3) as item, index} - - - - - - - - - - - - {/each} - -
DatePreviousForecastActual% Price Change
- {new Date(item?.date ?? null)?.toLocaleString("en-US", { - month: "short", - day: "numeric", - year: "numeric", - })} - - {item?.previous}% - - {item?.estimate}% - - {item?.actual}% - - {#if item?.changePercentage >= 0} - +{item?.changePercentage?.toFixed(2)}% - {:else} - {item?.changePercentage?.toFixed(2)}% - - {/if} -
-
- - -
- {:else} -

- No data available - -

- {/if} - {:else} -
-
- -
-
- {/if} -
-
- - diff --git a/src/lib/components/FailToDeliver.svelte b/src/lib/components/FailToDeliver.svelte index 28ab704b..b0a6b6c3 100644 --- a/src/lib/components/FailToDeliver.svelte +++ b/src/lib/components/FailToDeliver.svelte @@ -172,7 +172,6 @@ const ticker = $assetType === "stock" ? $stockTicker : $etfTicker; if (ticker) { isLoaded = false; - console.log(rawData); if (rawData?.length > 0) { weightedFTD = ( (rawData?.slice(-1)?.at(0)?.failToDeliver / diff --git a/src/lib/components/GovernmentContract.svelte b/src/lib/components/GovernmentContract.svelte deleted file mode 100644 index fba9d6cd..00000000 --- a/src/lib/components/GovernmentContract.svelte +++ /dev/null @@ -1,266 +0,0 @@ - - -
-
-
- - -
- - {#if isLoaded} - {#if rawData?.length !== 0} -
-
- Since 2015, {$displayCompanyName} has secured a total of {totalContract} - government contracts, amassing {abbreviateNumber(totalAmount, true)} - in revenue. The company has averaged {avgNumberOfContracts} contracts - per year, with a peak of {displayMaxContracts} contracts in {displayYear}. -
-
- -
-
- -
-
- -
-
- - - - # of Contracts - -
- -
- - - - Amount - -
-
- {/if} - {:else} -
-
- -
-
- {/if} -
-
- - diff --git a/src/lib/components/MarketMaker.svelte b/src/lib/components/MarketMaker.svelte deleted file mode 100644 index 9f059be1..00000000 --- a/src/lib/components/MarketMaker.svelte +++ /dev/null @@ -1,258 +0,0 @@ - - -
-
-
- - -
- - {#if isLoaded} - {#if historyData?.length !== 0} -
-
- Over the past year, {$displayCompanyName} has seen a weekly average of - {abbreviateNumber(avgTradeCount)} - trades, involving an average of - {abbreviateNumber(avgShareQuantity)} - shares bought and sold. This activity sums up to an average total - notional value of - {abbreviateNumber(avgNotionalSum, true)}. -
-
- -
-
- -
-
- -
-
- - - - Notional Sum - -
-
- - - - Share Quantity - -
-
- -

- Latest Information -

- -
- - - - - - - - - - - - - - - - - - - -
- Date - - {formatDateRange(historyData?.slice(-1)?.at(0)?.date)} -
- Total Notional Sum - - ${abbreviateNumber( - historyData?.slice(-1)?.at(0)?.totalNotionalSum, - )} -
- Total Trade Count - - {abbreviateNumber( - historyData?.slice(-1)?.at(0)?.totalWeeklyTradeCount, - )} -
- Total Share Quantity - - {abbreviateNumber( - historyData?.slice(-1)?.at(0)?.totalWeeklyShareQuantity, - )} -
-
- -

- Top 10 Market Makers Activity -

- These market makers represent the highest average trading activity for {$displayCompanyName} - over the past 12 months, calculated on a weekly basis. - -
- - - - - - - - - - - {#each showFullStats ? topMarketMakers?.slice(0, 10) : topMarketMakers?.slice(0, 3) as item, index} - - - - - - - - - - {/each} - -
NameTrade CountShare QuantityNotional Sum
- {item?.name?.length > charNumber - ? formatString(item?.name?.slice(0, charNumber)) + "..." - : formatString(item?.name)} - - {abbreviateNumber(Math.floor(item?.avgWeeklyTradeCount))} - - {abbreviateNumber(Math.floor(item?.avgWeeklyShareQuantity))} - - {abbreviateNumber(item?.avgNotionalSum, true)} -
-
- - - {/if} - {:else} -
-
- -
-
- {/if} -
-
- - diff --git a/src/lib/components/Markethour.svelte b/src/lib/components/Markethour.svelte deleted file mode 100644 index 3be55e0b..00000000 --- a/src/lib/components/Markethour.svelte +++ /dev/null @@ -1,135 +0,0 @@ - - -
- -
- - - - - diff --git a/src/lib/components/MobileCommentEditor.svelte b/src/lib/components/MobileCommentEditor.svelte deleted file mode 100644 index 4bea3a42..00000000 --- a/src/lib/components/MobileCommentEditor.svelte +++ /dev/null @@ -1,378 +0,0 @@ - - - - - - -
- -
-
- - -

Share your opinion

- - -
-
- -
-
- - - - -