feat: add ALT gate-control card to signals-v53 and paper-v53 latest signals

This commit is contained in:
root 2026-03-03 15:27:03 +00:00
parent 1e982c48f9
commit f87edc0339
2 changed files with 67 additions and 1 deletions

View File

@ -104,6 +104,12 @@ function LatestSignals({ strategy }: { strategy: StrategyTab }) {
</div>
{fc && strategy === "v53_alt" && (
<div className="flex gap-1 mt-1 flex-wrap">
<span className={`text-[9px] px-1 py-0.5 rounded ${(fc.gate_passed ?? true) ? "bg-emerald-100 text-emerald-700" : "bg-red-100 text-red-600"}`}>
{(fc.gate_passed ?? true) ? "✅ Gate通过" : "❌ 否决"}
</span>
{fc.gate_block && (
<span className="text-[9px] px-1 py-0.5 rounded bg-orange-50 text-orange-700">{fc.gate_block}</span>
)}
<span className="text-[9px] px-1 py-0.5 rounded bg-blue-50 text-blue-700">{fc.direction?.score ?? 0}/55</span>
<span className="text-[9px] px-1 py-0.5 rounded bg-violet-50 text-violet-700">{fc.crowding?.score ?? 0}/25</span>
<span className="text-[9px] px-1 py-0.5 rounded bg-emerald-50 text-emerald-700">{fc.environment?.score ?? 0}/15</span>

View File

@ -46,7 +46,8 @@ interface LatestIndicator {
auxiliary?: { score?: number; max?: number; coinbase_premium?: number };
// BTC gate fields
gate_passed?: boolean;
block_reason?: string;
block_reason?: string; // BTC用
gate_block?: string; // ALT用
obi_raw?: number;
spot_perp_div?: number;
whale_cvd_ratio?: number;
@ -91,6 +92,62 @@ function LayerScore({ label, score, max, colorClass }: { label: string; score: n
);
}
// ─── ALT Gate 状态卡片 ──────────────────────────────────────────
const ALT_GATE_THRESHOLDS: Record<string, { vol: string; obi: string; spd: string; whale: string }> = {
ETH: { vol: "0.3%", obi: "0.35", spd: "0.5%", whale: "$50k" },
XRP: { vol: "0.4%", obi: "0.40", spd: "0.6%", whale: "$30k" },
SOL: { vol: "0.6%", obi: "0.45", spd: "0.8%", whale: "$20k" },
};
function ALTGateCard({ symbol, factors }: { symbol: Symbol; factors: LatestIndicator["factors"] }) {
if (!factors || symbol === "BTC") return null;
const thresholds = ALT_GATE_THRESHOLDS[symbol] ?? ALT_GATE_THRESHOLDS["ETH"];
const passed = factors.gate_passed ?? true;
const blockReason = factors.gate_block;
return (
<div className={`rounded-xl border px-3 py-2 mt-2 ${passed ? "border-purple-200 bg-purple-50" : "border-red-200 bg-red-50"}`}>
<div className="flex items-center justify-between mb-1.5">
<p className="text-[10px] font-semibold text-purple-800">🔒 {symbol} Gate-Control</p>
<span className={`text-[10px] font-bold px-2 py-0.5 rounded ${passed ? "bg-emerald-100 text-emerald-700" : "bg-red-100 text-red-600"}`}>
{passed ? "✅ Gate通过" : "❌ 否决"}
</span>
</div>
<div className="grid grid-cols-4 gap-1.5">
<div className="bg-white rounded px-2 py-1">
<p className="text-[10px] text-slate-400"></p>
<p className="text-xs font-mono text-slate-800">{((factors.atr_pct_price ?? 0) * 100).toFixed(3)}%</p>
<p className="text-[9px] text-slate-400"> {thresholds.vol}</p>
</div>
<div className="bg-white rounded px-2 py-1">
<p className="text-[10px] text-slate-400">OBI</p>
<p className={`text-xs font-mono ${(factors.obi_raw ?? 0) >= 0 ? "text-emerald-600" : "text-red-500"}`}>
{((factors.obi_raw ?? 0) * 100).toFixed(2)}%
</p>
<p className="text-[9px] text-slate-400">±{thresholds.obi}</p>
</div>
<div className="bg-white rounded px-2 py-1">
<p className="text-[10px] text-slate-400"></p>
<p className={`text-xs font-mono ${(factors.spot_perp_div ?? 0) >= 0 ? "text-emerald-600" : "text-red-500"}`}>
{((factors.spot_perp_div ?? 0) * 10000).toFixed(2)}bps
</p>
<p className="text-[9px] text-slate-400">±{thresholds.spd}</p>
</div>
<div className="bg-white rounded px-2 py-1">
<p className="text-[10px] text-slate-400"></p>
<p className="text-xs font-mono text-slate-800">{thresholds.whale}</p>
<p className="text-[9px] text-slate-400"></p>
</div>
</div>
{blockReason && (
<p className="text-[10px] text-red-600 mt-1.5 bg-red-50 rounded px-2 py-1">
: <span className="font-mono">{blockReason}</span>
</p>
)}
</div>
);
}
// ─── BTC Gate 状态卡片 ───────────────────────────────────────────
function BTCGateCard({ factors }: { factors: LatestIndicator["factors"] }) {
@ -266,6 +323,9 @@ function IndicatorCards({ symbol }: { symbol: Symbol }) {
)}
</div>
{/* ALT Gate 卡片 */}
{!isBTC && data.factors && <ALTGateCard symbol={symbol} factors={data.factors} />}
{/* BTC Gate 卡片 */}
{isBTC && data.factors && <BTCGateCard factors={data.factors} />}
</div>