From 7a2cea0a26001d8a7b94423606b650d878df8162 Mon Sep 17 00:00:00 2001 From: Tyler Hoang Date: Mon, 18 May 2026 02:37:36 -0700 Subject: feat: add RatioPoint, RatiosResponse types and api.ratios() --- frontend/lib/api.ts | 7 ++++++- frontend/types/api.ts | 30 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) (limited to 'frontend') diff --git a/frontend/lib/api.ts b/frontend/lib/api.ts index 53b3dd3..b23edee 100644 --- a/frontend/lib/api.ts +++ b/frontend/lib/api.ts @@ -1,4 +1,4 @@ -import type { FinancialsResponse, HistoryPoint, MarketIndex, SearchResult, TickerOverview, ValuationResponse, WatchlistResponse } from "@/types/api"; +import type { FinancialsResponse, HistoryPoint, MarketIndex, RatiosResponse, SearchResult, TickerOverview, ValuationResponse, WatchlistResponse } from "@/types/api"; const API_BASE = process.env.NEXT_PUBLIC_API_BASE_URL || "http://localhost:8000"; @@ -58,5 +58,10 @@ export const api = { return request( `/api/tickers/${encodeURIComponent(symbol)}/valuation` ); + }, + ratios(symbol: string) { + return request( + `/api/tickers/${encodeURIComponent(symbol)}/ratios` + ); } }; diff --git a/frontend/types/api.ts b/frontend/types/api.ts index 998f618..7efe628 100644 --- a/frontend/types/api.ts +++ b/frontend/types/api.ts @@ -156,3 +156,33 @@ export type ValuationResponse = { ev_revenue: MultipleResult; price_to_book: MultipleResult; }; + +export type RatioPoint = { + value: number | null; + spark: (number | null)[]; + vs_sector: number | null; +}; + +export type RatiosResponse = { + pe_ttm: RatioPoint; + ev_ebitda: RatioPoint; + gross_margin: RatioPoint; + net_margin: RatioPoint; + price_to_book: RatioPoint; + price_to_sales: RatioPoint; + ev_to_sales: RatioPoint; + p_fcf: RatioPoint; + forward_pe: RatioPoint; + operating_margin: RatioPoint; + ebitda_margin: RatioPoint; + fcf_margin: RatioPoint; + roe: RatioPoint; + roa: RatioPoint; + roic: RatioPoint; + debt_to_equity: RatioPoint; + current_ratio: RatioPoint; + quick_ratio: RatioPoint; + interest_coverage: RatioPoint; + dividend_yield: RatioPoint; + dividend_payout: RatioPoint; +}; -- cgit v1.3-2-g0d8e