import type { AssetType } from '../../types.js'; interface AssetData { ticker?: string; currentPrice?: number; type?: string; [key: string]: unknown; } 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(); } }