Promote production portfolio strategy
This commit is contained in:
@@ -75,7 +75,9 @@ export function topPickSymbol(
|
||||
if (all.length === 0) return null;
|
||||
const qualified = activation ? all.filter((t) => qualifiesSetup(t, activation)) : [];
|
||||
const top = [...qualified].sort(
|
||||
(a, b) => (b.momentum_percentile ?? -Infinity) - (a.momentum_percentile ?? -Infinity),
|
||||
(a, b) =>
|
||||
(b.strategy_rank ?? b.momentum_percentile ?? -Infinity) -
|
||||
(a.strategy_rank ?? a.momentum_percentile ?? -Infinity),
|
||||
)[0];
|
||||
return top?.symbol ?? null;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ export interface WatchlistEntry {
|
||||
rr_ratio: number | null;
|
||||
rr_direction: string | null;
|
||||
momentum_percentile: number | null;
|
||||
strategy_rank: number | null;
|
||||
sr_levels: SRLevelSummary[];
|
||||
last_close: number | null;
|
||||
change_pct: number | null;
|
||||
@@ -141,6 +142,8 @@ export interface TradeSetup {
|
||||
evaluated_at: string | null;
|
||||
current_price: number | null;
|
||||
momentum_percentile?: number | null;
|
||||
strategy_rank?: number | null;
|
||||
volatility_percentile?: number | null;
|
||||
context_as_of?: TradeSetupContextAsOf | null;
|
||||
recommendation_summary?: RecommendationSummary;
|
||||
}
|
||||
@@ -227,8 +230,9 @@ export interface PaperTrade {
|
||||
}
|
||||
|
||||
export interface ExitPolicy {
|
||||
mode: 'time' | 'trailing' | 'target';
|
||||
mode: 'time' | 'trailing' | 'atr_trailing' | 'target';
|
||||
trailing_pct: number;
|
||||
atr_multiplier: number;
|
||||
hold_days: number;
|
||||
}
|
||||
|
||||
@@ -276,7 +280,7 @@ export interface BacktestTimeExitRow {
|
||||
}
|
||||
|
||||
export interface BacktestPortfolioPolicy {
|
||||
policy: string;
|
||||
policy?: string;
|
||||
starting_capital: number;
|
||||
final_equity: number;
|
||||
total_return_pct: number;
|
||||
@@ -294,10 +298,19 @@ export interface BacktestPortfolioPolicy {
|
||||
skipped_book_full: number;
|
||||
spy_return_pct: number | null;
|
||||
yearly_returns?: { year: number; return_pct: number | null }[];
|
||||
exit_reasons?: Record<string, number>;
|
||||
equity_curve?: BacktestCurvePoint[];
|
||||
benchmark_curve?: BacktestCurvePoint[];
|
||||
start_date: string;
|
||||
end_date: string;
|
||||
}
|
||||
|
||||
export interface BacktestCurvePoint {
|
||||
date: string;
|
||||
equity: number;
|
||||
return_pct: number | null;
|
||||
}
|
||||
|
||||
export interface BacktestRecommendation {
|
||||
headline: string | null;
|
||||
items: { topic: string; text: string }[];
|
||||
@@ -337,6 +350,25 @@ export interface BacktestStrategyVariants {
|
||||
note?: string;
|
||||
}
|
||||
|
||||
export interface BacktestPortfolioMonitorRun extends BacktestPortfolioPolicy {
|
||||
strategy: string;
|
||||
label: string;
|
||||
description: string;
|
||||
is_production: boolean;
|
||||
entry_variant: string;
|
||||
exit_policy: string;
|
||||
lookback: string;
|
||||
lookback_label: string;
|
||||
}
|
||||
|
||||
export interface BacktestPortfolioMonitor {
|
||||
production_strategy: string;
|
||||
strategies: { strategy: string; label: string; description: string; is_production: boolean }[];
|
||||
lookbacks: { lookback: string; label: string }[];
|
||||
runs: BacktestPortfolioMonitorRun[];
|
||||
note?: string;
|
||||
}
|
||||
|
||||
export interface BacktestGateAblationRow extends BacktestBucket {
|
||||
variant: string;
|
||||
// The same variant graded under the hold-to-horizon time exit.
|
||||
@@ -378,6 +410,8 @@ export interface BacktestReport {
|
||||
time_exit_sweep?: BacktestTimeExitRow[];
|
||||
portfolio_sim?: BacktestPortfolioSim;
|
||||
strategy_variants?: BacktestStrategyVariants;
|
||||
exit_policy_variants?: { variants: BacktestStrategyVariant[]; note?: string };
|
||||
portfolio_monitor?: BacktestPortfolioMonitor | null;
|
||||
recommendation?: BacktestRecommendation;
|
||||
research_recommendation?: BacktestResearchRecommendation;
|
||||
signal_eval?: BacktestSignalEvalRow[];
|
||||
|
||||
Reference in New Issue
Block a user