feat: instrument analysis

This commit is contained in:
OpenSquared
2026-06-29 22:24:24 +02:00
parent 4c85d9d23b
commit ce96e55314

View File

@@ -711,9 +711,9 @@ function comprehensionScore(ev: SnapshotEvent, tmpl: CausalTemplate, instrument:
const actual = actuals[instrument] ?? actuals[instrument.toUpperCase()] ?? actuals[instrument.toLowerCase()]
if (actual == null) return null
// Find the market_asset node for this instrument
// Find the output node for this instrument (built-in templates use "output", auto-generated use "market_asset")
const outputNode = tmpl.graph_json.nodes.find(n =>
n.type === 'market_asset' && n.instrument?.toUpperCase() === instrument.toUpperCase()
(n.type === 'market_asset' || n.type === 'output') && n.instrument?.toUpperCase() === instrument.toUpperCase()
)
const predicted = outputNode ? (preds[outputNode.id] ?? null) : null
if (predicted == null) return null