Add fallback_reference for deviation when insufficient data points

Add optional min_data_points (default 100) and fallback_reference config
fields to indicator definitions. When available daily data points are
below min_data_points, the fallback_reference value is used as the
deviation reference instead of the computed mean.

Applied to ratio, price, spread, and diff_pct indicator types.
Configured WTI/BRENT ratio with fallback_reference=0.96065.
This commit is contained in:
DiTus
2026-07-29 09:36:35 +02:00
parent 63bab43557
commit 8b88aee61f
3 changed files with 50 additions and 7 deletions

12
_data/indicators.json Normal file
View File

@ -0,0 +1,12 @@
{
"wti_brent_ratio": {
"display_name": "WTI/BRENT",
"type": "ratio",
"numerator": "xyz:CL",
"denominator": "xyz:BRENTOIL",
"changes": ["1h", "1d"],
"show_deviation": true,
"min_data_points": 100,
"fallback_reference": 0.96065
}
}