summaryrefslogtreecommitdiff
path: root/frontend/lib/api.ts
diff options
context:
space:
mode:
authorTyler Hoang <tyler@tylerhoang.xyz>2026-05-18 00:17:17 -0700
committerTyler Hoang <tyler@tylerhoang.xyz>2026-05-18 00:17:17 -0700
commit121aaba0bca0d01584505e6096e7ddb76983094b (patch)
tree73d3ca391489e3257c5298c770c266fd50811bc0 /frontend/lib/api.ts
parentadb3ee2fbf0b0686afc3e51b2bccc3423448ded9 (diff)
feat: add api.financials() and enable financials nav item
Diffstat (limited to 'frontend/lib/api.ts')
-rw-r--r--frontend/lib/api.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/frontend/lib/api.ts b/frontend/lib/api.ts
index b2f0dea..05af5ae 100644
--- a/frontend/lib/api.ts
+++ b/frontend/lib/api.ts
@@ -1,4 +1,4 @@
-import type { HistoryPoint, MarketIndex, SearchResult, TickerOverview, WatchlistResponse } from "@/types/api";
+import type { FinancialsResponse, HistoryPoint, MarketIndex, SearchResult, TickerOverview, WatchlistResponse } from "@/types/api";
const API_BASE = process.env.NEXT_PUBLIC_API_BASE_URL || "http://localhost:8000";
@@ -48,5 +48,10 @@ export const api = {
},
removeWatchlist(symbol: string) {
return request<WatchlistResponse>(`/api/watchlist/${encodeURIComponent(symbol)}`, { method: "DELETE" });
+ },
+ financials(symbol: string, period: "annual" | "quarterly" = "annual") {
+ return request<FinancialsResponse>(
+ `/api/tickers/${encodeURIComponent(symbol)}/financials?period=${encodeURIComponent(period)}`
+ );
}
};