20: Use resolved node in PriceAlarm trigger
This commit is contained in:
@@ -57,13 +57,13 @@ public final class PriceAlarm {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger(price);
|
trigger(price, target);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (definition.trigger() == AlarmTrigger.PERSISTENT) {
|
if (definition.trigger() == AlarmTrigger.PERSISTENT) {
|
||||||
if (lastTriggeredAt == null || persistentGracePeriodHasPassed()) {
|
if (lastTriggeredAt == null || persistentGracePeriodHasPassed()) {
|
||||||
trigger(price);
|
trigger(price, target);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,7 @@ public final class PriceAlarm {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void trigger(OraclePrice price) {
|
private void trigger(OraclePrice price, BigDecimal target) {
|
||||||
triggerCount++;
|
triggerCount++;
|
||||||
lastTriggeredAt = Instant.now();
|
lastTriggeredAt = Instant.now();
|
||||||
|
|
||||||
@@ -112,7 +112,18 @@ public final class PriceAlarm {
|
|||||||
return;
|
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;
|
private final PriceAlarmDefinition definition;
|
||||||
|
|||||||
Reference in New Issue
Block a user