@page "/settings" @using TradingBot.Services @using TradingBot.Models @inject SettingsService SettingsService @inject TradingBotService TradingBotService @inject TradeHistoryService HistoryService @implements IDisposable @rendermode InteractiveServer Impostazioni - TradingBot

Generale

Modalitā Simulazione
Utilizza dati simulati invece di dati reali di mercato
Notifiche Desktop
Ricevi notifiche per operazioni importanti

Trading

Auto-Start Bot
Avvia automaticamente il bot all'apertura dell'applicazione
Conferma Operazioni Manuali
Richiedi conferma prima di eseguire operazioni manuali

Dati Persistenti

Trade Salvati
@TradingBotService.Trades.Count trade nella cronologia
@FormatBytes(dataSize)
Posizioni Attive
@TradingBotService.ActivePositions.Count posizioni aperte
Cancella Tutti i Dati
Elimina cronologia trade e resetta i saldi

Avanzate

Intervallo Aggiornamento
Frequenza di aggiornamento dei dati di mercato
Log Level
Livello di dettaglio dei log di sistema
@if (showNotification) {
Impostazioni salvate con successo!
} @if (showClearConfirmation) { }
@code { private AppSettings settings = new(); private bool showNotification = false; private bool showClearConfirmation = false; private long dataSize = 0; protected override void OnInitialized() { settings = SettingsService.GetSettings(); SettingsService.OnSettingsChanged += HandleSettingsChanged; TradingBotService.OnStatusChanged += HandleStatusChanged; UpdateDataSize(); } private void UpdateDataSize() { dataSize = HistoryService.GetDataSize(); } private void UpdateSetting(string propertyName, T value) { SettingsService.UpdateSetting(propertyName, value); settings = SettingsService.GetSettings(); ShowNotification(); } private void SaveSettings() { SettingsService.UpdateSettings(settings); ShowNotification(); } private void ResetToDefaults() { SettingsService.ResetToDefaults(); settings = SettingsService.GetSettings(); ShowNotification(); } private void ShowClearDataConfirmation() { showClearConfirmation = true; } private void HideClearDataConfirmation() { showClearConfirmation = false; } private async Task ConfirmClearData() { await TradingBotService.ClearAllDataAsync(); UpdateDataSize(); showClearConfirmation = false; showNotification = true; StateHasChanged(); await Task.Delay(3000); showNotification = false; StateHasChanged(); } private async void ShowNotification() { showNotification = true; StateHasChanged(); await Task.Delay(3000); showNotification = false; StateHasChanged(); } private string FormatBytes(long bytes) { string[] sizes = { "B", "KB", "MB", "GB" }; double len = bytes; int order = 0; while (len >= 1024 && order < sizes.Length - 1) { order++; len = len / 1024; } return $"{len:0.##} {sizes[order]}"; } private void HandleSettingsChanged() { settings = SettingsService.GetSettings(); InvokeAsync(StateHasChanged); } private void HandleStatusChanged() { UpdateDataSize(); InvokeAsync(StateHasChanged); } public void Dispose() { SettingsService.OnSettingsChanged -= HandleSettingsChanged; TradingBotService.OnStatusChanged -= HandleStatusChanged; } }