diff options
| author | Tyler Hoang <tyler@tylerhoang.xyz> | 2026-05-18 01:33:41 -0700 |
|---|---|---|
| committer | Tyler Hoang <tyler@tylerhoang.xyz> | 2026-05-18 01:33:41 -0700 |
| commit | fdaef36d7ede89e6711ae65948b7c85d23c8f716 (patch) | |
| tree | b14399309f0cc871304aedea14d87b950a3e3dfa | |
| parent | 0662a31869ad60dbb76b2f534fe294d15b3b3492 (diff) | |
feat: add ValuationResponse types and api.valuation() method
| -rw-r--r-- | frontend/lib/api.ts | 7 | ||||
| -rw-r--r-- | frontend/types/api.ts | 36 |
2 files changed, 42 insertions, 1 deletions
diff --git a/frontend/lib/api.ts b/frontend/lib/api.ts index 05af5ae..53b3dd3 100644 --- a/frontend/lib/api.ts +++ b/frontend/lib/api.ts @@ -1,4 +1,4 @@ -import type { FinancialsResponse, HistoryPoint, MarketIndex, SearchResult, TickerOverview, WatchlistResponse } from "@/types/api"; +import type { FinancialsResponse, HistoryPoint, MarketIndex, SearchResult, TickerOverview, ValuationResponse, WatchlistResponse } from "@/types/api"; const API_BASE = process.env.NEXT_PUBLIC_API_BASE_URL || "http://localhost:8000"; @@ -53,5 +53,10 @@ export const api = { return request<FinancialsResponse>( `/api/tickers/${encodeURIComponent(symbol)}/financials?period=${encodeURIComponent(period)}` ); + }, + valuation(symbol: string) { + return request<ValuationResponse>( + `/api/tickers/${encodeURIComponent(symbol)}/valuation` + ); } }; diff --git a/frontend/types/api.ts b/frontend/types/api.ts index 3cc93e4..998f618 100644 --- a/frontend/types/api.ts +++ b/frontend/types/api.ts @@ -120,3 +120,39 @@ export type FinancialsResponse = { balance: FinancialStatement; cash_flow: FinancialStatement; }; + +export type DcfResult = { + available: boolean; + error?: string | null; + intrinsic_value_per_share?: number | null; + enterprise_value?: number | null; + equity_value?: number | null; + net_debt?: number | null; + cash_and_equivalents?: number | null; + total_debt?: number | null; + terminal_value_pv?: number | null; + fcf_pv_sum?: number | null; + growth_rate_used?: number | null; + base_fcf?: number | null; + wacc: number; + terminal_growth: number; +}; + +export type MultipleResult = { + available: boolean; + implied_price_per_share?: number | null; + implied_ev?: number | null; + equity_value?: number | null; + net_debt?: number | null; + multiple_used?: number | null; +}; + +export type ValuationResponse = { + symbol: string; + current_price?: number | null; + shares_outstanding?: number | null; + dcf: DcfResult; + ev_ebitda: MultipleResult; + ev_revenue: MultipleResult; + price_to_book: MultipleResult; +}; |
