Intelligence, Advanced Charting & Trading Platform
security(alert): bind every processed tick to exact quality-gate accepted quote
davoodmehraban89 committed
Oct 21, 2026 at 08:55 UTC
e34478b1a9c34de5c87b71a6c71830cfac9d1adb
1 file changed
+4
-1
packages/market-domain/src/informational-alert-engine.mjs
+4
-1
@@ -63,7 +63,10 @@ export function stepAlert(rule,previous,quote,gate) {
63
const state=previous??initialAlertState(rule.id);
64
if(state.id!==rule.id||!PHASE.has(state.phase))throw new RangeError('corrupt state');
65
if(state.phase!=='ARMED')return {state,events:[],reason:'ALREADY_TRIGGERED_OR_CLOSED'};
66
- if(gate?.status!=='GOOD'||gate.alertsSuspended||gate.accepted===null||!quote)
66
+ if(gate?.status!=='GOOD'||gate.alertsSuspended||!gate.accepted||!quote||
67
+ gate.accepted.symbol!==quote.symbol||gate.accepted.provider!==quote.provider||
68
+ gate.accepted.side!==quote.side||gate.accepted.unit!==quote.unit||
69
+ gate.accepted.price!==quote.price||gate.accepted.timestamp!==quote.timestamp)
70
return {state:{...state,consecutive:0,firstCandidateAt:null},events:[],reason:'QUALITY_HOLD'};
71
const t=when(quote.timestamp),last=state.lastTimestamp===null?null:when(state.lastTimestamp);
72
if(last!==null&&t<=last)return {state,events:[],reason:t===last?'DUPLICATE':'OUT_OF_ORDER'};