- financialService.d.ts: 为 JS 服务文件提供 TypeScript 类型声明 - EChartsWrapper.tsx: 按需引入的 ECharts 包装组件,减小打包体积 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
50 lines
2.1 KiB
TypeScript
50 lines
2.1 KiB
TypeScript
// financialService 类型声明
|
|
|
|
export interface RequestOptions {
|
|
signal?: AbortSignal;
|
|
}
|
|
|
|
export interface ApiResponse<T> {
|
|
success: boolean;
|
|
data: T;
|
|
message?: string;
|
|
}
|
|
|
|
export interface FinancialService {
|
|
getStockInfo(seccode: string, options?: RequestOptions): Promise<ApiResponse<any>>;
|
|
getBalanceSheet(seccode: string, limit?: number, options?: RequestOptions): Promise<ApiResponse<any[]>>;
|
|
getIncomeStatement(seccode: string, limit?: number, options?: RequestOptions): Promise<ApiResponse<any[]>>;
|
|
getCashflow(seccode: string, limit?: number, options?: RequestOptions): Promise<ApiResponse<any[]>>;
|
|
getFinancialMetrics(seccode: string, limit?: number, options?: RequestOptions): Promise<ApiResponse<any[]>>;
|
|
getMainBusiness(seccode: string, periods?: number, options?: RequestOptions): Promise<ApiResponse<any>>;
|
|
getForecast(seccode: string, options?: RequestOptions): Promise<ApiResponse<any>>;
|
|
getIndustryRank(seccode: string, limit?: number, options?: RequestOptions): Promise<ApiResponse<any[]>>;
|
|
getPeriodComparison(seccode: string, periods?: number, options?: RequestOptions): Promise<ApiResponse<any[]>>;
|
|
}
|
|
|
|
export const financialService: FinancialService;
|
|
|
|
export interface FormatUtils {
|
|
formatLargeNumber(num: number, decimal?: number): string;
|
|
formatPercent(num: number, decimal?: number): string;
|
|
formatDate(dateStr: string): string;
|
|
getReportType(dateStr: string): string;
|
|
getGrowthColor(value: number): string;
|
|
getTrendIcon(current: number, previous: number): 'up' | 'down' | 'stable';
|
|
calculateYoY(current: number, yearAgo: number): number | null;
|
|
calculateQoQ(current: number, previous: number): number | null;
|
|
getFinancialHealthScore(metrics: any): { score: number; level: string; color: string } | null;
|
|
getTableColumns(type: string): any[];
|
|
}
|
|
|
|
export const formatUtils: FormatUtils;
|
|
|
|
export interface ChartUtils {
|
|
prepareTrendData(data: any[], metrics: any[]): any[];
|
|
preparePieData(data: any[], valueKey: string, nameKey: string): any[];
|
|
prepareComparisonData(data: any[], periods: any[], metrics: any[]): any[];
|
|
getChartColors(theme?: string): string[];
|
|
}
|
|
|
|
export const chartUtils: ChartUtils;
|