47 lines
1.7 KiB
TypeScript
47 lines
1.7 KiB
TypeScript
import type { TradeSetup } from './types';
|
|
|
|
export type RecommendationAction = NonNullable<TradeSetup['recommended_action']>;
|
|
|
|
export const RECOMMENDATION_ACTION_LABELS: Record<RecommendationAction, string> = {
|
|
LONG_HIGH: 'LONG (High Confidence)',
|
|
LONG_MODERATE: 'LONG (Moderate Confidence)',
|
|
SHORT_HIGH: 'SHORT (High Confidence)',
|
|
SHORT_MODERATE: 'SHORT (Moderate Confidence)',
|
|
NEUTRAL: 'NEUTRAL (Conflicting Signals)',
|
|
};
|
|
|
|
export const RECOMMENDATION_ACTION_GLOSSARY: Array<{ action: RecommendationAction; description: string }> = [
|
|
{
|
|
action: 'LONG_HIGH',
|
|
description: 'Ticker bias favors LONG strongly. LONG confidence is above the high threshold and clearly above SHORT.',
|
|
},
|
|
{
|
|
action: 'LONG_MODERATE',
|
|
description: 'Ticker bias favors LONG, but with moderate conviction.',
|
|
},
|
|
{
|
|
action: 'SHORT_HIGH',
|
|
description: 'Ticker bias favors SHORT strongly. SHORT confidence is above the high threshold and clearly above LONG.',
|
|
},
|
|
{
|
|
action: 'SHORT_MODERATE',
|
|
description: 'Ticker bias favors SHORT, but with moderate conviction.',
|
|
},
|
|
{
|
|
action: 'NEUTRAL',
|
|
description: 'No strong directional edge. Signals are mixed or confidence gap is too small.',
|
|
},
|
|
];
|
|
|
|
export function recommendationActionLabel(action: TradeSetup['recommended_action']): string {
|
|
if (!action) return RECOMMENDATION_ACTION_LABELS.NEUTRAL;
|
|
return RECOMMENDATION_ACTION_LABELS[action] ?? RECOMMENDATION_ACTION_LABELS.NEUTRAL;
|
|
}
|
|
|
|
export function recommendationActionDirection(action: TradeSetup['recommended_action']): 'long' | 'short' | 'neutral' {
|
|
if (!action || action === 'NEUTRAL') return 'neutral';
|
|
if (action.startsWith('LONG')) return 'long';
|
|
if (action.startsWith('SHORT')) return 'short';
|
|
return 'neutral';
|
|
}
|