20: Create new ResolvedPriceAlarm and resolve note
This commit is contained in:
@@ -98,6 +98,20 @@ public final class PriceAlarm {
|
|||||||
private void trigger(OraclePrice price) {
|
private void trigger(OraclePrice price) {
|
||||||
triggerCount++;
|
triggerCount++;
|
||||||
lastTriggeredAt = Instant.now();
|
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);
|
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
|
||||||
|
) {
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user