From cb86785d1def14a2e7a676b5a85da6f67ee4cb94 Mon Sep 17 00:00:00 2001 From: mx57 <38256814+mx57@users.noreply.github.com> Date: Fri, 4 Sep 2026 20:20:54 +0000 Subject: [PATCH] feat: add custom notification threshold settings on Dashboard and Settings - Add minimum USDT trade size threshold input (`realtime_min_trade_size`) on Dashboard real-time trade monitoring bar. - Filter incoming real-time trade alerts in `checkNewTrades()` based on trade value (Amount * SellPrice). - Add notification settings card in `Settings.cshtml` for sound toggle, volume, sound profile, and minimum trade size threshold. - Update `web-dashboard-custom-alerts` task status to completed and replenish task pool in `agent_tasks.json`. --- IntelliTrader.Web/Views/Home/Dashboard.cshtml | 37 ++++++-- IntelliTrader.Web/Views/Home/Settings.cshtml | 95 +++++++++++++++++++ magda_agent_system/agent_tasks.json | 34 ++++++- 3 files changed, 157 insertions(+), 9 deletions(-) diff --git a/IntelliTrader.Web/Views/Home/Dashboard.cshtml b/IntelliTrader.Web/Views/Home/Dashboard.cshtml index ce9e3fe..a154e98 100644 --- a/IntelliTrader.Web/Views/Home/Dashboard.cshtml +++ b/IntelliTrader.Web/Views/Home/Dashboard.cshtml @@ -27,25 +27,27 @@ - +
-
+
Громкость: 50%
-
+
- Профиль звука: + Профиль:
-
- Настройки звука +
+ + Мин. объем ($): +
@@ -59,6 +61,7 @@ const soundVolumeSlider = document.getElementById("soundVolumeSlider"); const soundVolumeValue = document.getElementById("soundVolumeValue"); const soundProfileSelect = document.getElementById("soundProfileSelect"); + const minTradeSizeInput = document.getElementById("minTradeSizeInput"); const notificationContainer = document.getElementById("notificationContainer"); let isSoundEnabled = localStorage.getItem("realtime_sound_enabled") !== "false"; @@ -74,10 +77,15 @@ // Load sound profile with fallback to 'chime' let soundProfile = localStorage.getItem("realtime_sound_profile") || "chime"; + // Load minimum trade size threshold in USDT (default 0) + let minTradeSize = parseFloat(localStorage.getItem("realtime_min_trade_size") || "0"); + if (isNaN(minTradeSize) || minTradeSize < 0) minTradeSize = 0; + // Sync UI controls with values soundVolumeSlider.value = soundVolume; soundVolumeValue.textContent = Math.round(soundVolume * 100) + "%"; soundProfileSelect.value = soundProfile; + if (minTradeSizeInput) minTradeSizeInput.value = minTradeSize; updateSoundButtonUI(); @@ -206,6 +214,16 @@ playNotificationSound(); }); + // Min trade size threshold input handling + if (minTradeSizeInput) { + minTradeSizeInput.addEventListener("input", function () { + let val = parseFloat(minTradeSizeInput.value); + if (isNaN(val) || val < 0) val = 0; + minTradeSize = val; + localStorage.setItem("realtime_min_trade_size", minTradeSize); + }); + } + // Sound profile select handling soundProfileSelect.addEventListener("change", function () { soundProfile = soundProfileSelect.value; @@ -332,8 +350,11 @@ knownTrades.add(tradeId); if (!isFirstLoad) { - hasNewTrade = true; - showToastNotification(trade); + const tradeValue = (parseFloat(trade.Amount) || 0) * (parseFloat(trade.SellPrice) || parseFloat(trade.AveragePrice) || 0); + if (minTradeSize === 0 || tradeValue >= minTradeSize) { + hasNewTrade = true; + showToastNotification(trade); + } } } }); diff --git a/IntelliTrader.Web/Views/Home/Settings.cshtml b/IntelliTrader.Web/Views/Home/Settings.cshtml index 88c654d..26fd1a3 100644 --- a/IntelliTrader.Web/Views/Home/Settings.cshtml +++ b/IntelliTrader.Web/Views/Home/Settings.cshtml @@ -49,6 +49,39 @@
+ +
+

Уведомления и оповещения

+
+ +
+ + +
+
+ +
+ + + 50% +
+ +
+ + +
+ +
+ + + (0 = показывать все сделки) +
+
+ diff --git a/magda_agent_system/agent_tasks.json b/magda_agent_system/agent_tasks.json index 7d53bc6..7da92a0 100644 --- a/magda_agent_system/agent_tasks.json +++ b/magda_agent_system/agent_tasks.json @@ -446,7 +446,7 @@ }, { "id": "web-dashboard-custom-alerts", - "status": "todo", + "status": "done", "area": "web", "risk": "low", "title": "Add custom notification threshold settings on Dashboard", @@ -473,6 +473,38 @@ "acceptance": [ "Order caching mechanism is integrated and avoids frequent disk reads for historical trade logs." ] + }, + { + "id": "web-dashboard-log-filter-search", + "status": "todo", + "area": "web", + "risk": "low", + "title": "Add real-time log search and level filtering on Dashboard", + "description": "Implement client-side search input and log level dropdown filters (All, Info, Warning, Error) for the live log monitor terminal in Dashboard.", + "allowed_paths": [ + "IntelliTrader.Web/Views/**", + "IntelliTrader.Web/Static/**", + "magda_agent_system/agent_tasks.json" + ], + "acceptance": [ + "The live log monitor terminal supports searching log text and filtering by severity level." + ] + }, + { + "id": "web-dashboard-pair-favorite-pinning", + "status": "todo", + "area": "web", + "risk": "low", + "title": "Add favorite pair pinning and persistence on Dashboard", + "description": "Allow users to pin favorite trading pairs to the top of the trading pairs table with persistence in localStorage.", + "allowed_paths": [ + "IntelliTrader.Web/Views/**", + "IntelliTrader.Web/Static/**", + "magda_agent_system/agent_tasks.json" + ], + "acceptance": [ + "Users can click a star icon on any trading pair to pin it to the top of the table." + ] } ] }