import { Asset } from './Asset'; import type { EtfData, EtfMetrics } from '../types/models.model'; export class Etf extends Asset { metrics: EtfMetrics; constructor(data: EtfData) { super(data); this.metrics = { expenseRatio: parseFloat(String(data.expenseRatio)) || 0, totalAssets: parseFloat(String(data.totalAssets)) || 0, yield: parseFloat(String(data.yield)) || 0, volume: parseFloat(String(data.volume)) || 0, fiveYearReturn: parseFloat(String(data.fiveYearReturn)) || 0, }; } getDisplayMetrics(): Record { return { Ticker: this.ticker, Type: 'ETF', Price: this.formatCurrency(this.currentPrice), 'Exp Ratio%': `${this.metrics.expenseRatio.toFixed(2)}%`, 'Yield%': `${this.metrics.yield.toFixed(2)}%`, AUM: this.formatLargeNumber(this.metrics.totalAssets), '5Y Return%': `${this.metrics.fiveYearReturn.toFixed(1)}%`, }; } }