20: Create new ResolvedPriceAlarm and resolve note

This commit is contained in:
2026-06-27 21:03:21 +02:00
parent 2953b07609
commit a5e5470c2b
2 changed files with 30 additions and 0 deletions
@@ -98,6 +98,20 @@ public final class PriceAlarm {
private void trigger(OraclePrice price) {
triggerCount++;
lastTriggeredAt = Instant.now();
String note;
try {
note = variableResolver.resolve(definition.note());
} catch (RuntimeException exception) {
System.err.printf(
"Could not resolve note for alarm %d: %s%n",
definition.id(),
exception.getMessage()
);
return;
}
action.trigger(price, definition);
}
@@ -0,0 +1,16 @@
package com.r35157.jupiterperpsalarm.impl.ref;
import com.r35157.jupiterperpsalarm.AlarmSeverity;
import java.math.BigDecimal;
public record ResolvedPriceAlarm(
int id,
JupiterPerpsAsset asset,
PriceDirection direction,
BigDecimal target,
AlarmTrigger trigger,
ΩsecondsΩ triggerGracePeriod,
AlarmSeverity severity,
String note
) {
}