27 lines
791 B
JavaScript
27 lines
791 B
JavaScript
import { Asset } from './Asset.js';
|
|
|
|
export class Etf extends Asset {
|
|
constructor(data) {
|
|
super(data);
|
|
this.metrics = {
|
|
expenseRatio: parseFloat(data.expenseRatio) || 0,
|
|
totalAssets: parseFloat(data.totalAssets) || 0,
|
|
yield: parseFloat(data.yield) || 0,
|
|
volume: parseFloat(data.volume) || 0,
|
|
fiveYearReturn: parseFloat(data.fiveYearReturn) || 0,
|
|
};
|
|
}
|
|
|
|
getDisplayMetrics() {
|
|
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)}%`,
|
|
};
|
|
}
|
|
}
|