20: Use resolved node in PriceAlarm trigger
This commit is contained in:
@@ -57,13 +57,13 @@ public final class PriceAlarm {
|
||||
return;
|
||||
}
|
||||
|
||||
trigger(price);
|
||||
trigger(price, target);
|
||||
return;
|
||||
}
|
||||
|
||||
if (definition.trigger() == AlarmTrigger.PERSISTENT) {
|
||||
if (lastTriggeredAt == null || persistentGracePeriodHasPassed()) {
|
||||
trigger(price);
|
||||
trigger(price, target);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public final class PriceAlarm {
|
||||
);
|
||||
}
|
||||
|
||||
private void trigger(OraclePrice price) {
|
||||
private void trigger(OraclePrice price, BigDecimal target) {
|
||||
triggerCount++;
|
||||
lastTriggeredAt = Instant.now();
|
||||
|
||||
@@ -112,7 +112,18 @@ public final class PriceAlarm {
|
||||
return;
|
||||
}
|
||||
|
||||
action.trigger(price, definition);
|
||||
ResolvedPriceAlarm resolvedAlarm = new ResolvedPriceAlarm(
|
||||
definition.id(),
|
||||
definition.asset(),
|
||||
definition.direction(),
|
||||
target,
|
||||
definition.trigger(),
|
||||
definition.triggerGracePeriod(),
|
||||
definition.severity(),
|
||||
note
|
||||
);
|
||||
|
||||
action.trigger(price, resolvedAlarm);
|
||||
}
|
||||
|
||||
private final PriceAlarmDefinition definition;
|
||||
|
||||
Reference in New Issue
Block a user