c388b6d83c
- Restructured server layer with 5 domains: shared, screener, portfolio, calls, finance - Migrated 58 TypeScript files to domain-driven structure - Updated CLAUDE.md with new architecture documentation - Added .gitignore rules for .md files (except CLAUDE.md) - Removed unused CatalystAnalyst import from app.ts - Fixed lint errors: removed unused imports, fixed regex escape, added console suppressions - Verified no sensitive data in git history - Server code compiles cleanly with TypeScript strict mode
27 lines
815 B
TypeScript
27 lines
815 B
TypeScript
import type { AssetType } from '../types';
|
|
import type { AssetData } from '../types/models.model';
|
|
|
|
export class Asset {
|
|
ticker: string;
|
|
currentPrice: number;
|
|
type: AssetType;
|
|
|
|
constructor(data: AssetData) {
|
|
this.ticker = (data.ticker || 'UNKNOWN').toUpperCase();
|
|
this.currentPrice = (data.currentPrice as number) || 0;
|
|
this.type = (data.type || 'STOCK').toUpperCase() as AssetType;
|
|
}
|
|
|
|
formatCurrency(val: number | null | undefined): string {
|
|
return val ? `$${val.toFixed(2)}` : 'N/A';
|
|
}
|
|
|
|
formatLargeNumber(num: number | null | undefined): string {
|
|
if (!num) return 'N/A';
|
|
if (num >= 1e12) return `${(num / 1e12).toFixed(2)}T`;
|
|
if (num >= 1e9) return `${(num / 1e9).toFixed(2)}B`;
|
|
if (num >= 1e6) return `${(num / 1e6).toFixed(2)}M`;
|
|
return num.toString();
|
|
}
|
|
}
|