11 lines
380 B
TypeScript
11 lines
380 B
TypeScript
import type { ExperimentTrial } from '@stock-bot/stock-config/experiments';
|
|
|
|
export function metricText(
|
|
trial: ExperimentTrial,
|
|
key: keyof NonNullable<ExperimentTrial['metrics']>
|
|
) {
|
|
const value = trial.metrics?.[key];
|
|
return value === null || value === undefined
|
|
? `Unavailable${trial.unavailable?.[key] ? `: ${trial.unavailable[key]}` : ''}`
|
|
: String(value);
|
|
}
|