Add company analysis view with financials, price history, filings, and AI reports
This commit is contained in:
11
lib/api.ts
11
lib/api.ts
@@ -1,6 +1,7 @@
|
||||
import { edenTreaty } from '@elysiajs/eden';
|
||||
import type { App } from '@/lib/server/api/app';
|
||||
import type {
|
||||
CompanyAnalysis,
|
||||
Filing,
|
||||
Holding,
|
||||
PortfolioInsight,
|
||||
@@ -173,6 +174,16 @@ export async function listFilings(query?: { ticker?: string; limit?: number }) {
|
||||
return await unwrapData<{ filings: Filing[] }>(result, 'Unable to fetch filings');
|
||||
}
|
||||
|
||||
export async function getCompanyAnalysis(ticker: string) {
|
||||
const result = await client.api.analysis.company.get({
|
||||
$query: {
|
||||
ticker: ticker.trim().toUpperCase()
|
||||
}
|
||||
});
|
||||
|
||||
return await unwrapData<{ analysis: CompanyAnalysis }>(result, 'Unable to fetch company analysis');
|
||||
}
|
||||
|
||||
export async function queueFilingSync(input: { ticker: string; limit?: number }) {
|
||||
const result = await client.api.filings.sync.post(input);
|
||||
return await unwrapData<{ task: Task }>(result, 'Unable to queue filing sync');
|
||||
|
||||
Reference in New Issue
Block a user