import { Fragment, useEffect, useMemo, useState } from 'react'; import EmptyState from '../components/EmptyState.jsx'; import MetricCard from '../components/MetricCard.jsx'; import Pill from '../components/Pill.jsx'; import TableFrame from '../components/TableFrame.jsx'; import { formatAgeFromTimestamp, formatBoolean, formatEur, formatTimestamp, truncateMiddle } from '../lib/format.js'; const RESPONDED_STATES = new Set(['submitted', 'awaiting_outcome', 'not_filled', 'completed']); const TRADING_PAIR_MODES = new Set(['maker', 'taker', 'both']); async function copyIdentifier(value) { if (!value || !navigator?.clipboard?.writeText) return; try { await navigator.clipboard.writeText(value); } catch { // Best-effort copy affordance; keep the full identifier visible regardless. } } function useNow(intervalMs = 1000) { const [now, setNow] = useState(() => Date.now()); useEffect(() => { const timer = window.setInterval(() => setNow(Date.now()), intervalMs); return () => window.clearInterval(timer); }, [intervalMs]); return now; } function formatRelativeAge(value, now) { const age = formatAgeFromTimestamp(value, now); return age === 'Unavailable' ? 'Age unavailable' : `${age} ago`; } function formatTimingMs(value) { const number = Number(value); if (!Number.isFinite(number)) return null; return `${number < 10 ? number.toFixed(1) : number.toFixed(0)} ms`; } function formatRate(value) { const number = Number(value); if (!Number.isFinite(number)) return 'Unavailable'; return `${(number * 100).toFixed(1)}%`; } function stageLabel(value) { return plainCodeLabel(value).replace(/\bms\b/i, '').trim(); } function formatExecutionTiming(timing) { if (!timing) return null; const saltMs = formatTimingMs(timing.current_salt_ms); const saltAgeMs = formatTimingMs(timing.current_salt_age_ms); const saltSource = timing.current_salt_source ? ` ${plainCodeLabel(timing.current_salt_source).toLowerCase()}` : ''; const parts = [ ['total', timing.executor_total_ms], ['cmd age', timing.command_event_age_ms], ['sign', timing.sign_ms], ['relay', timing.relay_response_ms], ] .map(([label, value]) => { const formatted = formatTimingMs(value); return formatted ? `${label} ${formatted}` : null; }) .filter(Boolean); if (saltMs) { parts.splice(2, 0, `salt ${saltMs}${saltSource}${saltAgeMs ? ` age ${saltAgeMs}` : ''}`); } return parts.length ? `Timing: ${parts.join(', ')}` : null; } function IdentifierRow({ label, value }) { if (!value) return
{`${label}: unavailable`}
; return (
{`${label}:`} {value}
); } function formatTerms(terms) { if (!terms) return 'Unavailable'; const input = terms.amount_in ? `${terms.amount_in} ${terms.asset_in_symbol || ''}`.trim() : terms.asset_in_symbol || terms.asset_in || 'input unavailable'; const output = terms.amount_out ? `${terms.amount_out} ${terms.asset_out_symbol || ''}`.trim() : terms.asset_out_symbol || terms.asset_out || 'output unavailable'; return `${input} -> ${output}`; } function responseLabel(item) { if (RESPONDED_STATES.has(item.lifecycle_state)) return 'Yes'; if (item.lifecycle_state === 'failed') return 'Attempt failed'; if (item.lifecycle_state === 'blocked' && item.reason_code?.startsWith('maker_')) return 'No - policy skip'; if (item.lifecycle_state === 'blocked') return 'No - blocked'; if (item.lifecycle_state === 'rejected') return 'No - strategy rejected'; if (item.lifecycle_state === 'command_emitted') return 'Pending executor'; if (item.lifecycle_state === 'evaluated') return 'Approved, not sent'; return 'No decision yet'; } function grossEdgeEstimate(item) { if (!item.gross_edge_value) return 'Unavailable'; const symbol = item.notional_symbol || (item.eure_notional ? 'EURe' : null); if (symbol === 'EURe') return formatEur(item.gross_edge_value); return symbol ? `${item.gross_edge_value} ${symbol}` : item.gross_edge_value; } function formatGrossEdgePct(value) { if (value == null || value === '') return 'Gross edge unavailable'; return `Gross edge ${value}%`; } function formatConfiguredEdgeBps(value, { prefix = true } = {}) { const number = Number(value); if (!Number.isFinite(number)) return prefix ? 'Configured edge unavailable' : 'Unavailable'; const label = `${value} bps (${(number / 100).toFixed(2)}%)`; return prefix ? `Configured edge ${label}` : label; } function notionalLabel(item) { if (item.notional_display) return item.notional_display; if (item.notional != null) return `${item.notional}${item.notional_symbol ? ` ${item.notional_symbol}` : ''}`; return item.eure_notional ? formatEur(item.eure_notional) : 'Notional unavailable'; } function plainCodeLabel(value, fallback = 'Unavailable') { const text = String(value || '').trim(); if (!text) return fallback; return text.replaceAll('_', ' '); } function strategyDecisionStatus(decision) { if (decision?.decision === 'approved') return 'Strategy approved'; if (decision?.decision === 'rejected') return 'Strategy rejected'; return plainCodeLabel(decision?.decision, 'No strategy decision'); } function isStrategyRejected(item) { return item?.lifecycle_state === 'rejected' || item?.decision?.decision === 'rejected' || String(item?.lifecycle_label || '').toLowerCase() === 'rejected by strategy'; } function StageCard({ title, at, status, children }) { return (
{title}
{formatTimestamp(at)}
{status || 'Not recorded'}
{children ?
{children}
: null}
); } function TimingWaterfall({ timing }) { if (!timing) return null; const rows = [ ['Quote observed', timing.quote_observed_at], ['Quote received', timing.quote_received_at], ['Normalized', timing.quote_normalized_at], ['Published', timing.quote_published_at], ['Strategy received', timing.strategy_received_at], ['Strategy decided', timing.strategy_decided_at, timing.quote_to_decision_ms], ['Command published', timing.command_published_at, timing.decision_to_command_ms], ['Executor received', timing.executor_received_at, timing.command_to_executor_ms], ['Relay result', timing.relay_result_at, timing.executor_to_relay_result_ms], ['Outcome observed', timing.outcome_observed_at, timing.quote_to_outcome_ms], ]; const hasEvidence = rows.some(([, at, duration]) => at || duration != null); if (!hasEvidence) return null; return ( {rows.map(([label, at, duration]) => ( ))}
Stage Timestamp Step From quote
{label} {formatTimestamp(at)} {formatTimingMs(duration) || 'Unavailable'} {label === 'Strategy decided' ? formatTimingMs(timing.quote_age_at_decision_ms) : label === 'Executor received' ? formatTimingMs(timing.quote_age_at_executor_receipt_ms) : label === 'Relay result' ? formatTimingMs(timing.quote_age_at_relay_result_ms) : label === 'Outcome observed' ? formatTimingMs(timing.quote_to_outcome_ms) : 'Unavailable'}
); } function LifecycleDetails({ item }) { const executionTiming = formatExecutionTiming(item.execution?.timing); return (
{formatTerms(item.request_terms)}
{item.pair || 'pair unavailable'}
{plainCodeLabel(item.decision?.decision_reason || item.reason_code, 'No decision reason recorded')}
{formatGrossEdgePct(item.gross_edge_pct)}
{formatConfiguredEdgeBps(item.edge_bps)}
{notionalLabel(item)}
{formatTerms(item.submitted_terms)}
{item.execution?.result_code || 'No executor result code stored'}
{item.execution?.error_message ?
{item.execution.error_message}
: null} {!item.execution?.error_message && item.execution?.note ?
{item.execution.note}
: null} {executionTiming ?
{executionTiming}
: null} {item.execution?.status === 'submitted' ? (
Submitted means the relay accepted the response; it does not prove a trade.
) : null}
{item.reason_text}
{item.settlement_summary?.text || 'No settled inventory delta is linked to this quote.'}
{item.settlement_summary?.caveat ?
{item.settlement_summary.caveat}
: null}
); } function pairDisplayLabel(pairId, pairConfig) { const pair = (pairConfig?.pairs || []).find((entry) => ( (entry.pair_id || entry.pairId || entry.pair) === pairId )); if (!pair) return truncateMiddle(pairId || 'Unknown pair', 42); return `${pair.asset_in_symbol || pair.asset_in || pair.assetIn} -> ${pair.asset_out_symbol || pair.asset_out || pair.assetOut}`; } function MakerCompetitivenessSection({ summary, pairConfig }) { const total = summary?.total || {}; const groups = summary?.groups || []; const ageBuckets = summary?.age_buckets || []; const latestErrors = summary?.latest_errors || []; const policySkips = summary?.policy_skips || []; return (
Maker competitiveness

Response timing and quote-age outcomes

Pair-native response evidence from durable quote, decision, command, executor result, and outcome rows.
0 ? 'warning' : 'unknown'} />
{groups.length ? groups.slice(0, 12).map((group, index) => { const quoteToRelay = group.latency_stages?.find((stage) => stage.stage === 'quote_to_relay_result_ms'); return ( ); }) : ( )}
Pair Direction Request Edge Result Age / notional Outcome Counts Quote to relay
{pairDisplayLabel(group.pair, pairConfig)}
{truncateMiddle(group.pair || '', 42)}
{plainCodeLabel(group.direction)} {plainCodeLabel(group.request_kind)} {group.edge_bps == null ? 'Unavailable' : `${group.edge_bps} bps`}
{plainCodeLabel(group.result_code)}
{group.failure_category ?
{plainCodeLabel(group.failure_category)}
: null}
{group.quote_age_bucket}
{group.notional_bucket}
{plainCodeLabel(group.outcome_status)}
{group.count}
{`${group.accepted_count || 0} accepted / ${group.policy_skip_count || 0} skipped`}
{formatTimingMs(quoteToRelay?.p50_ms) || 'Unavailable'}
{`p90 ${formatTimingMs(quoteToRelay?.p90_ms) || 'Unavailable'}`}
No competitiveness rows are available yet.
{(summary?.latency_stages || []).length ? summary.latency_stages.map((stage) => ( )) : ( )}
Latency stage p50 p90 p99
{stageLabel(stage.stage)} {formatTimingMs(stage.p50_ms)} {formatTimingMs(stage.p90_ms)} {formatTimingMs(stage.p99_ms)}
No stage timing percentiles are available yet.
{ageBuckets.length ? ageBuckets.slice(0, 12).map((bucket, index) => ( )) : ( )}
Age bucket Outcome Count Accepted
{bucket.quote_age_bucket}
{pairDisplayLabel(bucket.pair, pairConfig)}
{plainCodeLabel(bucket.outcome_status)} {bucket.count} {bucket.accepted_count || 0}
No quote-age buckets are available yet.
{latestErrors.length ? latestErrors.map((error) => ( )) : ( )}
Latest relay errors Quote age Error
{pairDisplayLabel(error.pair, pairConfig)}
{plainCodeLabel(error.failure_category || error.result_code)}
{formatTimingMs(error.quote_age_ms) || 'Unavailable'}
{error.quote_age_bucket}
{error.error_message || 'Error text unavailable'}
No relay errors are available yet.
{policySkips.length ? policySkips.map((skip) => ( )) : ( )}
Policy skips Age Config
{plainCodeLabel(skip.reason_code)}
{formatTimingMs(skip.quote_age_ms) || 'Unavailable'}
{`max ${formatTimingMs(skip.max_quote_age_ms) || 'Unavailable'}`}
{skip.pair_config_version ? `v${skip.pair_config_version}` : 'Version unavailable'}
{truncateMiddle(skip.pair_config_id || '', 36)}
No policy skips are available yet.
); } function QuoteLifecycleTable({ items }) { const [expanded, setExpanded] = useState(() => new Set()); const [showStrategyRejected, setShowStrategyRejected] = useState(true); const [quoteDisplayPaused, setQuoteDisplayPaused] = useState(false); const [displayItems, setDisplayItems] = useState(() => items || []); const liveNow = useNow(); const [displayNow, setDisplayNow] = useState(() => Date.now()); useEffect(() => { if (!quoteDisplayPaused) setDisplayItems(items || []); }, [items, quoteDisplayPaused]); useEffect(() => { if (!quoteDisplayPaused) setDisplayNow(liveNow); }, [liveNow, quoteDisplayPaused]); const rejectedCount = useMemo( () => displayItems.filter((item) => isStrategyRejected(item)).length, [displayItems], ); const visibleItems = useMemo( () => (showStrategyRejected ? displayItems : displayItems.filter((item) => !isStrategyRejected(item))), [displayItems, showStrategyRejected], ); function toggle(rowKey) { setExpanded((current) => { const next = new Set(current); if (next.has(rowKey)) next.delete(rowKey); else next.add(rowKey); return next; }); } return ( <>
{quoteDisplayPaused ? : null}
{!displayItems.length ? ( No quote lifecycle evidence has been observed yet. ) : !visibleItems.length ? ( No quote lifecycle rows match the current filters. ) : ( {visibleItems.map((item, index) => { const rowKey = item.quote_id || item.decision_id || item.command_id || item.latest_stage_at || String(index); const isExpanded = expanded.has(rowKey); const quoteTime = item.quote_activity_at || item.latest_stage_at; return ( {isExpanded ? ( ) : null} ); })}
Quote time Quote id Request Responded? Result Reason Gross edge / notional Lifecycle
{formatTimestamp(quoteTime)}
{formatRelativeAge(quoteTime, displayNow)}
{item.latest_stage_at && item.latest_stage_at !== item.quote_activity_at ? (
Updated {formatTimestamp(item.latest_stage_at)} ยท {formatRelativeAge(item.latest_stage_at, displayNow)}
) : null}
{formatTerms(item.request_terms || item.submitted_terms)}
{truncateMiddle(item.pair || '', 34)}
{responseLabel(item)}
{item.reason_text}
{item.reason_code || 'reason_unknown'}
0 ? 'value-positive' : Number(item.gross_edge_pct) < 0 ? 'value-negative' : ''}>{formatGrossEdgePct(item.gross_edge_pct)}
{formatConfiguredEdgeBps(item.edge_bps)}
{notionalLabel(item)}
)} ); } function SuccessfulTradesTable({ items }) { const [expanded, setExpanded] = useState(() => new Set()); if (!items?.length) { return ( No successful trades with linked settlement evidence yet. A submitted quote response is not counted here until a durable terminal outcome and settled asset movement are linked to the quote. ); } function toggle(rowKey) { setExpanded((current) => { const next = new Set(current); if (next.has(rowKey)) next.delete(rowKey); else next.add(rowKey); return next; }); } return ( {items.map((item, index) => { const rowKey = item.quote_id || item.command_id || item.latest_stage_at || String(index); const isExpanded = expanded.has(rowKey); return ( {isExpanded ? ( ) : null} ); })}
Completed Quote id Gross edge Gross edge est. Settlement Realized PnL Lifecycle
{formatTimestamp(item.latest_stage_at)}
{formatGrossEdgePct(item.gross_edge_pct)}
{formatConfiguredEdgeBps(item.edge_bps)}
{notionalLabel(item)}
{grossEdgeEstimate(item)}
Estimate from edge x notional, not realized PnL.
{item.settlement_summary?.text || 'No settled inventory delta is linked to this quote.'}
{item.settlement_summary?.method ?
{item.settlement_summary.method}
: null}
Unavailable
Fees and venue-native terminal fill are not stored.
); } function AssetCatalogSection({ assetCatalog, onControl }) { const latest = assetCatalog?.latest_import || null; const counts = assetCatalog?.counts || {}; const items = assetCatalog?.items || []; return (
Asset registry

Supported-token import status

Last import {latest?.fetched_at ? formatTimestamp(latest.fetched_at) : 'not run'}
{items.length ? items.map((asset) => ( )) : ( )}
Asset Decimals Chain Deposit Price Status
{asset.label || asset.symbol}
{truncateMiddle(asset.asset_id || asset.assetId, 42)}
{asset.decimals} {asset.blockchain || asset.chain || 'Unavailable'} {asset.deposit_address || asset.depositAddress ? ( <>
{truncateMiddle(asset.deposit_address || asset.depositAddress, 34)}
{asset.deposit_memo || asset.depositMemo ? `Memo ${asset.deposit_memo || asset.depositMemo}` : asset.deposit_chain || asset.depositChain || 'Deposit handle'}
) : (
Unavailable
)}
{asset.latest_price || asset.latestPrice || 'Unavailable'}
No DB asset registry rows are available.
); } function assetOptionLabel(asset) { return `${asset.label || asset.symbol || asset.asset_id || asset.assetId} - ${truncateMiddle(asset.asset_id || asset.assetId, 34)}`; } function PairConfigSection({ assetCatalog, pairConfig, onControl }) { const pairs = pairConfig?.pairs || []; const assets = useMemo(() => (assetCatalog?.items || []) .filter((asset) => asset.asset_id || asset.assetId) .sort((left, right) => String(left.label || left.symbol || left.asset_id || '').localeCompare( String(right.label || right.symbol || right.asset_id || ''), )), [assetCatalog?.items]); const [pairForm, setPairForm] = useState({ asset_in: '', asset_out: '', mode: 'observe_only', edge_bps: '49', min_notional: '0', max_notional: '150', }); const [edgeDrafts, setEdgeDrafts] = useState({}); const [minNotionalDrafts, setMinNotionalDrafts] = useState({}); const [maxNotionalDrafts, setMaxNotionalDrafts] = useState({}); const [policyEnabledDrafts, setPolicyEnabledDrafts] = useState({}); const [maxQuoteAgeDrafts, setMaxQuoteAgeDrafts] = useState({}); useEffect(() => { if (!assets.length) return; setPairForm((current) => ({ ...current, asset_in: current.asset_in || assets[0]?.asset_id || assets[0]?.assetId || '', asset_out: current.asset_out || assets[1]?.asset_id || assets[1]?.assetId || assets[0]?.asset_id || assets[0]?.assetId || '', })); }, [assets]); useEffect(() => { setEdgeDrafts(Object.fromEntries(pairs.map((pair) => { const pairId = pair.pair_id || pair.pairId; const strategyConfig = pair.strategyConfig || pair.strategy_config || {}; const tradingMode = TRADING_PAIR_MODES.has(pair.mode); return [pairId, String(strategyConfig.edge_bps ?? pair.edge_bps ?? (tradingMode ? '49' : ''))]; }))); setMaxNotionalDrafts(Object.fromEntries(pairs.map((pair) => { const pairId = pair.pair_id || pair.pairId; const strategyConfig = pair.strategyConfig || pair.strategy_config || {}; const tradingMode = TRADING_PAIR_MODES.has(pair.mode); return [pairId, String(strategyConfig.max_notional ?? pair.max_notional ?? (tradingMode ? '150' : ''))]; }))); setMinNotionalDrafts(Object.fromEntries(pairs.map((pair) => { const pairId = pair.pair_id || pair.pairId; const strategyConfig = pair.strategyConfig || pair.strategy_config || {}; const tradingMode = TRADING_PAIR_MODES.has(pair.mode); return [pairId, String(strategyConfig.min_notional ?? pair.min_notional ?? (tradingMode ? '0' : ''))]; }))); setPolicyEnabledDrafts(Object.fromEntries(pairs.map((pair) => { const pairId = pair.pair_id || pair.pairId; const strategyConfig = pair.strategyConfig || pair.strategy_config || {}; return [pairId, Boolean( strategyConfig.maker_max_quote_age_enabled ?? strategyConfig.makerMaxQuoteAgeEnabled, )]; }))); setMaxQuoteAgeDrafts(Object.fromEntries(pairs.map((pair) => { const pairId = pair.pair_id || pair.pairId; const strategyConfig = pair.strategyConfig || pair.strategy_config || {}; return [pairId, String( strategyConfig.maker_max_quote_age_ms ?? strategyConfig.makerMaxQuoteAgeMs ?? '', )]; }))); }, [pairs]); async function updatePairConfig(pair) { const pairId = pair.pair_id || pair.pairId; const strategyConfig = pair.strategyConfig || pair.strategy_config || {}; const hasStrategyConfig = Boolean(strategyConfig.config_id || strategyConfig.configId); const edgeBps = edgeDrafts[pairId]; const maxNotional = maxNotionalDrafts[pairId]; const minNotional = minNotionalDrafts[pairId]; const policyEnabled = policyEnabledDrafts[pairId] === true; const maxQuoteAgeMs = maxQuoteAgeDrafts[pairId]; if (!edgeBps || !maxNotional || minNotional === undefined || minNotional === '') return; if (policyEnabled && !maxQuoteAgeMs) return; if (!hasStrategyConfig) { const mode = pair.mode || pair.status || 'observe_only'; if ( TRADING_PAIR_MODES.has(mode) && !window.confirm('Initialize strategy config for this trading pair?') ) { return; } await onControl?.('operator-dashboard', 'set-pair-mode', { pair_id: pairId, mode, edge_bps: Number(edgeBps), max_notional: maxNotional, min_notional: minNotional, maker_max_quote_age_enabled: policyEnabled, maker_max_quote_age_ms: policyEnabled ? Number(maxQuoteAgeMs) : null, maker_latency_policy_reason: policyEnabled ? 'operator dashboard maker response-age policy' : null, }); return; } await onControl?.('operator-dashboard', 'update-pair-edge', { pair_id: pairId, edge_bps: Number(edgeBps), max_notional: maxNotional, min_notional: minNotional, maker_max_quote_age_enabled: policyEnabled, maker_max_quote_age_ms: policyEnabled ? Number(maxQuoteAgeMs) : null, maker_latency_policy_reason: policyEnabled ? 'operator dashboard maker response-age policy' : null, }); } async function applyPairMode(event) { event.preventDefault(); if (!pairForm.asset_in || !pairForm.asset_out || pairForm.asset_in === pairForm.asset_out) return; if ( TRADING_PAIR_MODES.has(pairForm.mode) && !window.confirm('Activate trading mode for this directed pair?') ) { return; } await onControl?.('operator-dashboard', 'set-pair-mode', { asset_in: pairForm.asset_in, asset_out: pairForm.asset_out, mode: pairForm.mode, edge_bps: Number(pairForm.edge_bps), max_notional: pairForm.max_notional, min_notional: pairForm.min_notional, }); } async function pausePair(pair) { await onControl?.('operator-dashboard', 'pause-pair', { pair_id: pair.pair_id || pair.pairId, }); } async function activatePair(pair) { const pairId = pair.pair_id || pair.pairId; const nextMode = ['maker', 'taker', 'both'].includes(pair.mode) ? pair.mode : 'observe_only'; if ( TRADING_PAIR_MODES.has(nextMode) && !window.confirm('Reactivate trading mode for this directed pair?') ) { return; } await onControl?.('operator-dashboard', 'set-pair-mode', { pair_id: pairId, mode: nextMode, }); } const tradingModeSelected = TRADING_PAIR_MODES.has(pairForm.mode); const pairFormDisabled = !assets.length || pairForm.asset_in === pairForm.asset_out || (tradingModeSelected && (!pairForm.edge_bps || !pairForm.max_notional || pairForm.min_notional === '')); return (
Pair config

Add, pause, and tune directed pairs

Loaded {pairConfig?.loaded_at ? formatTimestamp(pairConfig.loaded_at) : 'unavailable'}
setPairForm((current) => ({ ...current, edge_bps: event.target.value }))} required={tradingModeSelected} step="1" type="number" value={pairForm.edge_bps} />
setPairForm((current) => ({ ...current, min_notional: event.target.value }))} required={tradingModeSelected} step="0.00000001" type="number" value={pairForm.min_notional} />
setPairForm((current) => ({ ...current, max_notional: event.target.value }))} required={tradingModeSelected} step="0.00000001" type="number" value={pairForm.max_notional} />
{pairs.length ? pairs.map((pair) => { const pairId = pair.pair_id || pair.pairId; const strategyConfig = pair.strategyConfig || pair.strategy_config || {}; const route = pair.priceRoute || pair.price_route || {}; const hasStrategyConfig = Boolean(strategyConfig.config_id || strategyConfig.configId); const tradingMode = TRADING_PAIR_MODES.has(pair.mode); const policyEnabled = policyEnabledDrafts[pairId] === true; const configButtonDisabled = !edgeDrafts[pairId] || minNotionalDrafts[pairId] === undefined || minNotionalDrafts[pairId] === '' || !maxNotionalDrafts[pairId] || (policyEnabled && !maxQuoteAgeDrafts[pairId]) || (!hasStrategyConfig && !tradingMode); return ( ); }) : ( )}
Pair Mode Configured edge Limits Route Blocked Config Controls
{pair.asset_in_symbol || pair.asset_in} {'->'} {pair.asset_out_symbol || pair.asset_out}
{truncateMiddle(pairId, 42)}
{formatConfiguredEdgeBps(strategyConfig.edge_bps, { prefix: false })}
{strategyConfig.min_notional ?? '0'} min
{strategyConfig.max_notional || 'Unavailable'} max
{strategyConfig.request_max_notional == null ? 'No request cap' : `${strategyConfig.request_max_notional} request max`}
{strategyConfig.request_max_slippage_bps == null ? 'No slippage cap' : `${strategyConfig.request_max_slippage_bps} bps slippage max`}
{strategyConfig.price_max_age_ms || 'Unavailable'} ms price max age
{strategyConfig.maker_max_quote_age_enabled || strategyConfig.makerMaxQuoteAgeEnabled ? `${strategyConfig.maker_max_quote_age_ms ?? strategyConfig.makerMaxQuoteAgeMs} ms response max age` : 'Response age policy disabled'}
{route.source || 'Unavailable'} {pair.blockReason || pair.block_reason || 'No'}
v{strategyConfig.version || 'Unavailable'}
Edge setEdgeDrafts((current) => ({ ...current, [pairId]: event.target.value, }))} step="1" style={{ maxWidth: 92 }} type="number" value={edgeDrafts[pairId] ?? ''} />
Min setMinNotionalDrafts((current) => ({ ...current, [pairId]: event.target.value, }))} step="0.00000001" style={{ maxWidth: 112 }} type="number" value={minNotionalDrafts[pairId] ?? ''} />
Max setMaxNotionalDrafts((current) => ({ ...current, [pairId]: event.target.value, }))} step="0.00000001" style={{ maxWidth: 112 }} type="number" value={maxNotionalDrafts[pairId] ?? ''} />
Max age setMaxQuoteAgeDrafts((current) => ({ ...current, [pairId]: event.target.value, }))} step="1" style={{ maxWidth: 112 }} type="number" value={maxQuoteAgeDrafts[pairId] ?? ''} />
{pair.enabled && pair.status !== 'disabled' ? ( ) : ( )}
No directed pairs are configured.
); } function StrategyOverviewSection({ strategy }) { const funnel = strategy.strategy_state.trade_funnel || {}; const counts = funnel.counts || {}; return (
Trading evidence

Quotes, responses, and proven trades

One place for quote truth: every row starts at the incoming quote, then shows whether we responded, why not, and whether any asset movement was proven.
); } function SuccessfulTradesSection({ funnel, counts }) { return (
Successful trades only

Trades with proven asset movement

This table excludes submitted-only quote responses. Realized PnL remains unavailable until fees and venue-native terminal fills are stored.
0 ? 'healthy' : 'unknown'} /> 0 ? 'warning' : 'unknown'} />
); } function QuoteLifecycleSection({ items }) { return (
Quote lifecycle

Incoming quotes and what happened next

Full-width quote table: incoming quote, response decision, result, decisive reason, and expandable lifecycle stages.
); } export default function StrategyPage({ strategy, onControl, page = 'strategy' }) { const funnel = strategy.strategy_state.trade_funnel || {}; const counts = funnel.counts || {}; switch (page) { case 'strategy-pairs': return ; case 'strategy-competitiveness': return ( ); case 'strategy-assets': return ; case 'strategy-trades': return ; case 'strategy-lifecycle': return ; case 'strategy': default: return ; } }