Show the news and the market, and set news and calendar from the settings (refs #60)
ci / test (postgres) (pull_request) Successful in 9m38s
ci / test (sqlite) (pull_request) Successful in 5m26s
ci / image (pull_request) Successful in 2m23s
ci / test (postgres) (push) Successful in 9m28s
ci / test (sqlite) (push) Successful in 5m3s
ci / image (push) Successful in 1m56s
ci / test (postgres) (pull_request) Successful in 9m38s
ci / test (sqlite) (pull_request) Successful in 5m26s
ci / image (pull_request) Successful in 2m23s
ci / test (postgres) (push) Successful in 9m28s
ci / test (sqlite) (push) Successful in 5m3s
ci / image (push) Successful in 1m56s
The news screen of SPEC 13 lists what the bot read in the last 24 hours and what it did about each story, with the three filters of the mockup, the mood of the market, the calendar with the effect of each event, the sources and the spending of the day. Each note of the bot now keeps its action sentence and the end of its restriction, so the screen shows the decision as it was. Settings gain a news section: the rows of SPEC 10.5, the sources (enable and trust), the key and daily cap of the language model, the Finnhub and FRED keys and the central bank meetings. The demo seeds the F.9 data and matches the mockup; the overview tile now shows the real news that matter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b087dd215b
commit
959fe6ccba
22 files changed
+1378
-25
No files matched your search
@@ -28,6 +28,9 @@
|
||||
"telegram-tolto" => "Telegram tolto: non ti scrivo più finché non lo rimetti.",
|
||||
"segnale" => "Segnale di vita salvato: la prima chiamata è andata bene, da adesso lo chiamo ogni minuto.",
|
||||
"segnale-tolto" => "Segnale di vita tolto.",
|
||||
"fonte" => "Fonte aggiornata: vale dal prossimo giro delle notizie, tra al massimo 2 minuti.",
|
||||
"chiave" => "Chiave salvata. Non la mostro più: se serve cambiarla, scrivine una nuova.",
|
||||
"chiave-tolta" => "Chiave tolta.",
|
||||
|
||||
_ => "Fatto.",
|
||||
})</p>
|
||||
@@ -38,7 +41,7 @@
|
||||
}
|
||||
|
||||
<nav class="tabs" aria-label="Sezioni delle impostazioni">
|
||||
<a href="#aspetto">Aspetto</a><a href="#conti">Conti</a><a href="#rischio">Rischio</a><a href="#telegram">Telegram</a><a href="#dati">Dati</a><a href="#sicurezza">Sicurezza</a><a href="#sistema">Sistema</a><a href="#modifiche">Modifiche</a>
|
||||
<a href="#aspetto">Aspetto</a><a href="#conti">Conti</a><a href="#rischio">Rischio</a><a href="#telegram">Telegram</a><a href="#dati">Dati</a><a href="#notizie">Notizie</a><a href="#sicurezza">Sicurezza</a><a href="#sistema">Sistema</a><a href="#modifiche">Modifiche</a>
|
||||
</nav>
|
||||
|
||||
<section class="panel" id="aspetto">
|
||||
@@ -314,10 +317,91 @@
|
||||
}
|
||||
<p class="hint"><a href="/api/data/quality?format=md&days=30">Rapporto sulla qualità dei dati degli ultimi 30 giorni</a></p>
|
||||
|
||||
</section>
|
||||
|
||||
<section class="panel" id="notizie">
|
||||
<h2>Notizie e calendario</h2>
|
||||
<p class="hint">Le notizie e gli eventi in calendario non fanno mai comprare: possono solo fermare o rimandare un acquisto, e ogni volta il diario dice perché.</p>
|
||||
|
||||
<h3>Regole</h3>
|
||||
@foreach (var rule in _newsRules)
|
||||
{
|
||||
var definition = SettingsStore.Definition(rule.Key);
|
||||
<form method="post" action="/azioni/impostazioni/@rule.Key" class="form-inline">
|
||||
<AntiforgeryToken />
|
||||
<input type="hidden" name="ritorno" value="/impostazioni#notizie" />
|
||||
<label for="@rule.Key">@definition.Label</label>
|
||||
<select id="@rule.Key" name="valore" disabled="@(rule.ReadOnly || Shell.IsDemo)" data-autosubmit>
|
||||
<option value="on" selected="@(rule.Value != "off")">Accesa</option>
|
||||
<option value="off" selected="@(rule.Value == "off")">Spenta</option>
|
||||
</select>
|
||||
@if (rule.ReadOnly)
|
||||
{
|
||||
<span class="hint">Fissato da @rule.Source: si cambia lì.</span>
|
||||
}
|
||||
else if (!Shell.IsDemo)
|
||||
{
|
||||
<noscript><button class="btn btn-small" type="submit">Salva</button></noscript>
|
||||
}
|
||||
</form>
|
||||
}
|
||||
|
||||
<h3>Fonti delle notizie</h3>
|
||||
@if (_newsSources.Count == 0)
|
||||
{
|
||||
<p class="note">Le fonti compaiono qui dopo il primo giro delle notizie, che parte con i dati di mercato.</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p class="hint">Una notizia da una sola fonte non affidabile non cambia nulla finché un'altra fonte non la conferma.</p>
|
||||
<div class="table-wrap">
|
||||
<table class="table">
|
||||
<thead><tr><th scope="col">Fonte</th><th scope="col">Leggo</th><th scope="col">Affidabile</th><th scope="col">Ultima lettura</th><th scope="col">Stato</th><th scope="col"><span class="sr-only">Salva</span></th></tr></thead>
|
||||
<tbody>
|
||||
@foreach (var f in _newsSources)
|
||||
{
|
||||
var form = "fonte-" + f.Id.ToString("N");
|
||||
<tr>
|
||||
<td>@f.Name</td>
|
||||
<td><input type="checkbox" name="attiva" form="@form" checked="@f.Enabled" disabled="@Shell.IsDemo" aria-label="Leggo @f.Name" /></td>
|
||||
<td><input type="checkbox" name="affidabile" form="@form" checked="@f.Trusted" disabled="@Shell.IsDemo" aria-label="@f.Name è affidabile" /></td>
|
||||
<td class="nowrap">@(f.LastOkAt is { } at ? Format.ShortDate(at, Shell.Now, Shell.Zone) : "—")</td>
|
||||
<td>@(!f.Enabled ? "spenta" : f.LastError is { } problem ? "non risponde: " + problem : "risponde")</td>
|
||||
<td>
|
||||
@if (!Shell.IsDemo)
|
||||
{
|
||||
<form id="@form" method="post" action="/azioni/notizie/fonti/@f.Id"><AntiforgeryToken /><button class="btn btn-small" type="submit">Salva</button></form>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
|
||||
<h3>Modello linguistico</h3>
|
||||
<p class="hint">Facoltativo. Rilegge solo le notizie sulle tue posizioni e sugli strumenti candidati: può aggiungere una restrizione, mai toglierla, e non vede né chiavi né conti. Senza modello tutto funziona lo stesso con il classificatore locale. La rilettura non è ancora attiva: chiave e tetto restano pronti per quando lo sarà.</p>
|
||||
@DataKey(Anubis.News.NewsModelSettings.KeySecret, "Chiave del modello linguistico")
|
||||
<form method="post" action="/azioni/impostazioni/@_llmCap.Key" class="form-inline">
|
||||
<AntiforgeryToken />
|
||||
<input type="hidden" name="ritorno" value="/impostazioni#notizie" />
|
||||
<label for="tetto">Tetto di spesa al giorno (€)</label>
|
||||
<input id="tetto" name="valore" inputmode="decimal" autocomplete="off" value="@Format.Number(decimal.Parse(_llmCap.Value, CultureInfo.InvariantCulture), 2)" readonly="@(_llmCap.ReadOnly || Shell.IsDemo)" required />
|
||||
@if (!_llmCap.ReadOnly && !Shell.IsDemo)
|
||||
{
|
||||
<button class="btn btn-small" type="submit">Salva</button>
|
||||
}
|
||||
</form>
|
||||
|
||||
<h3>Calendario</h3>
|
||||
<p class="hint">Senza chiave di Finnhub non conosco le date delle trimestrali e la mean reversion non usa il suo filtro; senza chiave di FRED il calendario usa solo Forex Factory. Le chiavi sono gratuite.</p>
|
||||
@DataKey("FINNHUB_API_KEY", "Chiave di Finnhub")
|
||||
@DataKey("FRED_API_KEY", "Chiave di FRED")
|
||||
<h3>Riunioni di Fed e BCE</h3>
|
||||
<form method="post" action="/azioni/impostazioni/@SettingsStore.CentralBankMeetings.Key" class="form">
|
||||
<AntiforgeryToken />
|
||||
<input type="hidden" name="ritorno" value="/impostazioni#dati" />
|
||||
<input type="hidden" name="ritorno" value="/impostazioni#notizie" />
|
||||
<label for="riunioni">Un giorno di decisione per riga, per esempio «FED 2027-01-27» o «BCE 2027-02-04». Aggiungi le date del nuovo anno quando le banche le pubblicano.</label>
|
||||
<textarea id="riunioni" name="valore" rows="8" spellcheck="false" readonly="@_meetings.ReadOnly">@_meetings.Value</textarea>
|
||||
<button class="btn" type="submit">Salva l'elenco</button>
|
||||
@@ -454,6 +538,10 @@
|
||||
private IReadOnlyList<Anubis.Data.SourceState> _sources = [];
|
||||
|
||||
private SettingValue _meetings = new(SettingsStore.CentralBankMeetings.Key, "", false, null);
|
||||
private readonly List<SettingValue> _newsRules = [];
|
||||
private SettingValue _llmCap = new(Anubis.News.NewsModelSettings.DailyCap.Key, "0.50", false, null);
|
||||
private IReadOnlyList<Anubis.News.NewsSource> _newsSources = [];
|
||||
private readonly Dictionary<string, SecretStatus> _dataKeys = [];
|
||||
private List<SettingChange> _history = [];
|
||||
private IReadOnlyList<BackupInfo> _backups = [];
|
||||
private bool _hasSecondFactor;
|
||||
@@ -483,6 +571,17 @@
|
||||
_history = await services.Settings.HistoryAsync(null, 50, ct);
|
||||
_meetings = await services.Settings.GetAsync(SettingsStore.CentralBankMeetings.Key, ct);
|
||||
_sources = await new Anubis.Data.SourceStateStore(services.Db, Clock).ListAsync(ct);
|
||||
foreach (var rule in Anubis.News.NewsRuleSettings.All)
|
||||
{
|
||||
_newsRules.Add(await services.Settings.GetAsync(rule.Key, ct));
|
||||
}
|
||||
|
||||
_llmCap = await services.Settings.GetAsync(Anubis.News.NewsModelSettings.DailyCap.Key, ct);
|
||||
_newsSources = await new Anubis.News.NewsStore(services.Db, Clock).ListSourcesAsync(ct);
|
||||
foreach (var name in Forms.DataKeys)
|
||||
{
|
||||
_dataKeys[name] = await services.Secrets.StatusAsync(name, ct);
|
||||
}
|
||||
foreach (var definition in Anubis.Risk.RiskSettings.Limits)
|
||||
{
|
||||
var value = await services.Settings.GetAsync(definition.Key, ct);
|
||||
@@ -554,10 +653,44 @@
|
||||
"segnale" => "L'indirizzo non va bene: serve https:// (http solo nella rete di casa).",
|
||||
"segnale-fallito" => "Il servizio di controllo non ha risposto bene alla prova: non ho salvato l'indirizzo.",
|
||||
"scenari" => "Gli scenari non sono validi: una riga ciascuno, con descrizione e tre percentuali separate da punto e virgola.",
|
||||
"fonte" => "Fonte sconosciuta: ricarica la pagina e riprova.",
|
||||
"chiave" => "La chiave è vuota o contiene spazi: copiala di nuovo così come la dà il servizio.",
|
||||
"chiave-ambiente" => "Questa chiave arriva dalle variabili d'ambiente: si cambia nella configurazione del container.",
|
||||
"tetto" => $"Il tetto di spesa va scritto in euro, da 0 a {Anubis.News.NewsModelSettings.MaxCap:0}, per esempio 0,50.",
|
||||
|
||||
_ => PasswordMessages.For(Errore),
|
||||
};
|
||||
|
||||
// A key of SPEC 13.5 that is not a broker's: its state, a field to replace it, a button to take it away. Never the value.
|
||||
private RenderFragment DataKey(string name, string label)
|
||||
{
|
||||
var status = _dataKeys.GetValueOrDefault(name) ?? new SecretStatus(name, false, false, null);
|
||||
var id = "k-" + name.ToLowerInvariant();
|
||||
return @<div class="data-key">
|
||||
<p><strong>@label</strong>: @KeyState(status).</p>
|
||||
@if (status.FromEnvironment)
|
||||
{
|
||||
<p class="hint">Si cambia nella configurazione del container (@name).</p>
|
||||
}
|
||||
else if (!Shell.IsDemo)
|
||||
{
|
||||
<form method="post" action="/azioni/chiavi-dati/@name" class="form-inline">
|
||||
<AntiforgeryToken />
|
||||
<label for="@id">@(status.IsSet ? "Nuova chiave" : "Chiave")</label>
|
||||
<input id="@id" name="chiave" type="password" autocomplete="off" spellcheck="false" maxlength="512" required />
|
||||
<button class="btn btn-small" type="submit">Salva</button>
|
||||
</form>
|
||||
@if (status.IsSet)
|
||||
{
|
||||
<form method="post" action="/azioni/chiavi-dati/@name/togli" class="form-inline">
|
||||
<AntiforgeryToken />
|
||||
<button class="btn btn-small btn-danger" type="submit" data-confirm="Tolgo la chiave: quello che la usa smette di funzionare finché non ne metti un'altra. Confermi?">Togli la chiave</button>
|
||||
</form>
|
||||
}
|
||||
}
|
||||
</div>;
|
||||
}
|
||||
|
||||
private string KeyState(SecretStatus status) => status switch
|
||||
{
|
||||
{ FromEnvironment: true } => "Dalle variabili d'ambiente",
|
||||
|
||||
Reference in new issue
Block a user