diff --git a/src/lib/components/FinancialTable.svelte b/src/lib/components/FinancialTable.svelte index 6aa2eb19..c77a6a08 100644 --- a/src/lib/components/FinancialTable.svelte +++ b/src/lib/components/FinancialTable.svelte @@ -2,7 +2,6 @@ import { abbreviateNumber } from "$lib/utils"; export let data; export let fields; - export let filterRule = null; {#each fields as { label, key }} @@ -14,15 +13,9 @@ {#each data as item} - {#if filterRule === "annual"} - {item[key] !== null && item[key] !== 0 - ? abbreviateNumber((item[key] / 4).toFixed(2)) - : "-"} - {:else} - {item[key] !== null && item[key] !== 0 - ? abbreviateNumber(item[key]?.toFixed(2)) - : "-"} - {/if} + {item[key] !== null && item[key] !== 0 + ? abbreviateNumber(item[key]?.toFixed(2)) + : "-"} {/each} diff --git a/src/routes/stocks/[tickerID]/financials/ratios/+page.svelte b/src/routes/stocks/[tickerID]/financials/ratios/+page.svelte index 466765d1..02144eaf 100644 --- a/src/routes/stocks/[tickerID]/financials/ratios/+page.svelte +++ b/src/routes/stocks/[tickerID]/financials/ratios/+page.svelte @@ -15,7 +15,6 @@ import { LineChart, BarChart } from "echarts/charts"; import { GridComponent, TooltipComponent } from "echarts/components"; import { CanvasRenderer } from "echarts/renderers"; - import FinancialTable from "$lib/components/FinancialTable.svelte"; use([LineChart, BarChart, GridComponent, TooltipComponent, CanvasRenderer]); @@ -134,11 +133,6 @@ }, ]; - const fields = statementConfig.map((item) => ({ - label: item.label, - key: item.propertyName, - })); - function toggleMode() { $coolMode = !$coolMode; } @@ -738,7 +732,246 @@ - + + PE Ratio + {#each ratios as item} + + {filterRule === "annual" + ? (item?.priceEarningsRatio / 4)?.toFixed(2) + : item?.priceEarningsRatio?.toFixed(2)} + + {/each} + + + PS Ratio + {#each ratios as item} + + {filterRule === "annual" + ? (item?.priceToSalesRatio / 4)?.toFixed(2) + : item?.priceToSalesRatio?.toFixed(2)} + + {/each} + + + + PB Ratio + {#each ratios as item} + + {filterRule === "annual" + ? (item?.priceToBookRatio / 4)?.toFixed(2) + : item?.priceToBookRatio?.toFixed(2)} + + {/each} + + + P/FCF Ratio + {#each ratios as item} + + {filterRule === "annual" + ? (item?.priceToFreeCashFlowsRatio / 4)?.toFixed( + 2, + ) + : item?.priceToFreeCashFlowsRatio?.toFixed(2)} + + {/each} + + + P/OCF Ratio + {#each ratios as item} + + {filterRule === "annual" + ? ( + item?.priceToOperatingCashFlowsRatio / 4 + )?.toFixed(2) + : item?.priceToOperatingCashFlowsRatio?.toFixed( + 2, + )} + + {/each} + + + OCF/S Ratio + {#each ratios as item} + + {filterRule === "annual" + ? ( + item?.operatingCashFlowSalesRatio / 4 + )?.toFixed(2) + : item?.operatingCashFlowSalesRatio?.toFixed(2)} + + {/each} + + + Debt / Equity Ratio + {#each ratios as item} + + {filterRule === "annual" + ? (item?.debtEquityRatio / 4)?.toFixed(2) + : item?.debtEquityRatio?.toFixed(2)} + + {/each} + + + + Quick Ratio + {#each ratios as item} + + {filterRule === "annual" + ? (item?.quickRatio / 4)?.toFixed(2) + : item?.quickRatio?.toFixed(2)} + + {/each} + + + + Current Ratio + {#each ratios as item} + + {filterRule === "annual" + ? (item?.currentRatio / 4)?.toFixed(2) + : item?.currentRatio?.toFixed(2)} + + {/each} + + + Asset Turnover + {#each ratios as item} + + {item?.assetTurnover?.toFixed(2)} + + {/each} + + + Interest Coverage + {#each ratios as item} + + {filterRule === "annual" + ? (item?.interestCoverage / 4)?.toFixed(2) + : item?.interestCoverage?.toFixed(2)} + + {/each} + + + + Return on Equity (ROE) + {#each ratios as item} + + {(item?.returnOnEquity * 100)?.toFixed(2)}% + + {/each} + + + Return on Assets (ROA) + {#each ratios as item} + {(item?.returnOnAssets * 100)?.toFixed(2)}% + {/each} + + + Return on Capital (ROIC) + {#each ratios as item} + + {(item?.returnOnCapitalEmployed * 100)?.toFixed( + 2, + )}% + {/each} + + + Dividend Yield + {#each ratios as item} + + {(item?.dividendYield * 100)?.toFixed(2)}% + {/each} + + + Payout Ratio + {#each ratios as item} + + {filterRule === "annual" + ? ((item?.payoutRatio / 4) * 100)?.toFixed(2) + : (item?.payoutRatio * 100)?.toFixed(2)}% + + {/each} + + + Gross Profit Margin + {#each ratios as item} + + {filterRule === "annual" + ? ((item?.grossProfitMargin / 4) * 100)?.toFixed( + 2, + ) + : (item?.grossProfitMargin * 100)?.toFixed(2)}% + + {/each} + + + Net Profit Margin + {#each ratios as item} + + {filterRule === "annual" + ? ((item?.netProfitMargin / 4) * 100)?.toFixed(2) + : (item?.netProfitMargin * 100)?.toFixed(2)}% + + {/each} +