Add GOLD/SILVER ratio indicator to dashboard

Add gold_silver_ratio indicator (xyz:GOLD / xyz:SILVER) with fallback
reference of 61.59, mirroring the existing WTI/BRENT ratio setup.
Also register xyz:GOLD and xyz:SILVER in WATCHED_COINS and data_fetcher
defaults so the candle data is fetched for the new indicator.
This commit is contained in:
DiTus
2026-07-29 17:02:15 +02:00
parent 8b88aee61f
commit f6d95de49f
4 changed files with 28 additions and 3 deletions

View File

@ -73,6 +73,19 @@ Computes `numerator / denominator`.
- **1D Change**: compares to ratio from 1d candle close prices - **1D Change**: compares to ratio from 1d candle close prices
- **Deviation**: `(current - long_avg) / long_avg * 100`, where `long_avg` is the mean of daily ratios over all available history. If fewer than `min_data_points` (default 100) daily data points exist and `fallback_reference` is set, the fallback value is used instead. - **Deviation**: `(current - long_avg) / long_avg * 100`, where `long_avg` is the mean of daily ratios over all available history. If fewer than `min_data_points` (default 100) daily data points exist and `fallback_reference` is set, the fallback value is used instead.
```json
"gold_silver_ratio": {
"display_name": "GOLD/SILVER",
"type": "ratio",
"numerator": "xyz:GOLD",
"denominator": "xyz:SILVER",
"changes": ["1h", "1d"],
"show_deviation": true,
"min_data_points": 100,
"fallback_reference": 61.59
}
```
### `price` — Single Price ### `price` — Single Price
```json ```json

View File

@ -8,5 +8,15 @@
"show_deviation": true, "show_deviation": true,
"min_data_points": 100, "min_data_points": 100,
"fallback_reference": 0.96065 "fallback_reference": 0.96065
},
"gold_silver_ratio": {
"display_name": "GOLD/SILVER",
"type": "ratio",
"numerator": "xyz:GOLD",
"denominator": "xyz:SILVER",
"changes": ["1h", "1d"],
"show_deviation": true,
"min_data_points": 100,
"fallback_reference": 61.59
} }
} }

View File

@ -175,7 +175,7 @@ if __name__ == "__main__":
parser.add_argument( parser.add_argument(
"--coins", "--coins",
nargs='+', nargs='+',
default=["BTC", "ETH", "xyz:BRENTOIL", "xyz:CL"], default=["BTC", "ETH", "xyz:BRENTOIL", "xyz:CL", "xyz:GOLD", "xyz:SILVER"],
help="List of coins to fetch (e.g., BTC ETH), or 'all' to fetch all coins." help="List of coins to fetch (e.g., BTC ETH), or 'all' to fetch all coins."
) )
parser.add_argument("--interval", default="1m", help="Candle interval (e.g., 1m, 5m, 1h).") parser.add_argument("--interval", default="1m", help="Candle interval (e.g., 1m, 5m, 1h).")

View File

@ -23,11 +23,13 @@ from dashboard import DashboardRenderer
from rich.live import Live from rich.live import Live
# --- Configuration --- # --- Configuration ---
WATCHED_COINS = ["BTC", "ETH", "SOL", "BNB", "HYPE", "SUI", "xyz:BRENTOIL", "xyz:CL"] WATCHED_COINS = ["BTC", "ETH", "SOL", "BNB", "HYPE", "SUI", "xyz:BRENTOIL", "xyz:CL", "xyz:GOLD", "xyz:SILVER"]
# Display name mapping for dashboard (internal symbol -> display name) # Display name mapping for dashboard (internal symbol -> display name)
COIN_DISPLAY_NAMES = { COIN_DISPLAY_NAMES = {
"xyz:BRENTOIL": "BRENT", "xyz:BRENTOIL": "BRENT",
"xyz:CL": "WTI" "xyz:CL": "WTI",
"xyz:GOLD": "GOLD",
"xyz:SILVER": "SILVER"
} }
LIVE_CANDLE_FETCHER_SCRIPT = "live_candle_fetcher.py" LIVE_CANDLE_FETCHER_SCRIPT = "live_candle_fetcher.py"
RESAMPLER_SCRIPT = "resampler.py" RESAMPLER_SCRIPT = "resampler.py"