diff --git a/src/lib/components/FinancialTable.svelte b/src/lib/components/FinancialTable.svelte index 98b4f56a..27268c38 100644 --- a/src/lib/components/FinancialTable.svelte +++ b/src/lib/components/FinancialTable.svelte @@ -13,9 +13,15 @@ {#each data as item} - {@html item[key] !== null && item[key] !== 0 - ? abbreviateNumber(item[key]?.toFixed(2), false, true) - : "n/a"} + {#if ["pretaxProfitMargin", "freeCashFlowMargin", "grossProfitMargin", "netProfitMargin", "operatingProfitMargin", "ebitdaMargin"]?.includes(key)} + {item[key] !== null && item[key] !== 0 + ? abbreviateNumber(item[key]?.toFixed(2)) + "%" + : "n/a"} + {:else} + {item[key] !== null && item[key] !== 0 + ? abbreviateNumber(item[key]?.toFixed(2)) + : "n/a"} + {/if} {/each} diff --git a/src/routes/stocks/[tickerID]/financials/ratios/+page.server.ts b/src/routes/stocks/[tickerID]/financials/ratios/+page.server.ts index 4fc545f7..8f95a3e0 100644 --- a/src/routes/stocks/[tickerID]/financials/ratios/+page.server.ts +++ b/src/routes/stocks/[tickerID]/financials/ratios/+page.server.ts @@ -17,7 +17,7 @@ export const load = async ({ locals, params }) => { }); const output = await response.json(); - + return output; }; diff --git a/src/routes/stocks/[tickerID]/financials/ratios/+page.svelte b/src/routes/stocks/[tickerID]/financials/ratios/+page.svelte index 168b604b..8d8ed0ce 100644 --- a/src/routes/stocks/[tickerID]/financials/ratios/+page.svelte +++ b/src/routes/stocks/[tickerID]/financials/ratios/+page.svelte @@ -133,6 +133,26 @@ label: "Net Profit Margin", text: "Net Profit Margin is the percentage of revenue left as net income, or profits, after subtracting all costs and expenses from the revenue.", }, + { + propertyName: "pretaxProfitMargin", + label: "Pretax Profit Margin", + text: "Pretax margin is the percentage of revenue left as profits before subtracting taxes.", + }, + { + propertyName: "operatingProfitMargin", + label: "Operating Profit Margin", + text: "Operating margin is the percentage of revenue left as operating income, after subtracting cost of revenue and all operating expenses from the revenue.", + }, + { + propertyName: "freeCashFlowMargin", + label: "FCF Margin", + text: "FCF margin is the percentage of revenue left as free cash flow. FCF is calculated by subtracting capital expenditures (CapEx) from the operating cash flow (OCF). Both CapEx and OCF are shown on the cash flow statement.", + }, + { + propertyName: "ebitdaMargin", + label: "EBITDA Margin", + text: "EBITDA margin is the percentage of revenue left as EBITDA, after subtracting all expenses except interest, taxes, depreciation and amortization from revenue.", + }, ]; const fields = statementConfig.map((item) => ({ @@ -607,7 +627,7 @@ class="w-36 select select-bordered select-sm p-0 pl-5 overflow-y-auto bg-secondary" on:change={changeStatement} > - + @@ -645,6 +665,14 @@ >Gross Profit Margin + + + + diff --git a/src/routes/stocks/[tickerID]/metrics/[slug]/+page.svelte b/src/routes/stocks/[tickerID]/metrics/[slug]/+page.svelte index a2b3cb76..7c84f8aa 100644 --- a/src/routes/stocks/[tickerID]/metrics/[slug]/+page.svelte +++ b/src/routes/stocks/[tickerID]/metrics/[slug]/+page.svelte @@ -245,7 +245,8 @@ - {@html item?.value !== null + {@html item?.value !== null && + item?.value !== undefined ? abbreviateNumber(item?.value, false, true) : "n/a"}