ci / test (postgres) (push) Successful in 3m33s
ci / test (sqlite) (push) Successful in 4m16s
ci / image (push) Successful in 2m55s
ci / test (postgres) (pull_request) Successful in 3m42s
ci / test (sqlite) (pull_request) Successful in 4m36s
ci / image (pull_request) Successful in 2m2s
The analyst of SPEC 10.2 point 5 sends the fresh stories about held and candidate instruments to Anthropic, an OpenAI-compatible service or Ollama, eight to a request, over plain HTTP with no SDK. The news text travels as escaped JSON data; only the appendix B schema is kept, instruments not already linked are dropped, and a verdict can only add a restriction. Each request goes out only if its worst-case cost still fits under the daily cap; verdicts are cached by content hash. Without a key nothing is asked and the rules work as before. ADR 0014 point 15. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
236 lines
9.9 KiB
Plaintext
236 lines
9.9 KiB
Plaintext
@inherits LoadedComponent
|
|
@page "/notizie"
|
|
@inject AnubisHost Host
|
|
@inject ShellData Shell
|
|
@using Anubis.News
|
|
|
|
<PageTitle>Notizie e mercato · Anubis</PageTitle>
|
|
|
|
@{
|
|
var v = _view;
|
|
var rows = Filtered(v.Board.Rows).ToList();
|
|
var count = _filter switch
|
|
{
|
|
"effetto" => v.Board.Active,
|
|
"posizioni" => v.Board.OnPositions,
|
|
_ => v.Board.Read,
|
|
};
|
|
var shown = _all ? rows : rows.Take(Shown).ToList();
|
|
}
|
|
<p class="lead page-lead">@Lead(v)</p>
|
|
|
|
<div class="news-columns">
|
|
<section class="panel news-panel" aria-labelledby="letto">
|
|
<div class="panel-head">
|
|
<h2 id="letto">Cosa ho letto e cosa ne ho fatto</h2>
|
|
<nav class="segmented" aria-label="Filtro delle notizie">
|
|
<a class="@(_filter == "effetto" ? "on" : null)" href="/notizie?filtro=effetto" aria-current="@(_filter == "effetto" ? "page" : null)">Con effetto, @v.Board.Active</a>
|
|
<a class="@(_filter == "posizioni" ? "on" : null)" href="/notizie?filtro=posizioni" aria-current="@(_filter == "posizioni" ? "page" : null)">Sulle tue posizioni, @v.Board.OnPositions</a>
|
|
<a class="@(_filter == "tutte" ? "on" : null)" href="/notizie?filtro=tutte" aria-current="@(_filter == "tutte" ? "page" : null)">Tutte, @v.Board.Read</a>
|
|
</nav>
|
|
</div>
|
|
@if (rows.Count == 0)
|
|
{
|
|
<p class="note news-empty">@Empty(v)</p>
|
|
}
|
|
else
|
|
{
|
|
<ul class="news-rows">
|
|
@foreach (var n in shown)
|
|
{
|
|
<li>
|
|
<p class="news-meta">
|
|
<span>@Format.ShortDate(n.At, Shell.Now, Shell.Zone)@(n.Publisher.Length > 0 ? ", da " + n.Publisher : "")</span>
|
|
<span class="tag tag-strong">@n.About</span>
|
|
@if (n.SingleSource)
|
|
{
|
|
<span class="tag tag-outline">Una sola fonte</span>
|
|
}
|
|
</p>
|
|
<h3 class="news-title">@n.Title</h3>
|
|
@if (n.Summary is { } summary)
|
|
{
|
|
<p class="news-summary"><span class="sr-only">Riassunto del modello linguistico: </span>@summary</p>
|
|
}
|
|
<p class="news-facts">
|
|
<span class="tone @(n.Direction < 0 ? "loss" : n.Direction > 0 ? "gain" : null)">
|
|
@if (n.Direction == 0)
|
|
{
|
|
<span class="tone-flat" aria-hidden="true"></span>
|
|
}
|
|
else
|
|
{
|
|
<Arrow Up="@(n.Direction > 0)" />
|
|
}
|
|
<span class="tone-text">@n.Tone</span>
|
|
</span>
|
|
<span class="importance">
|
|
<span class="importance-bars" aria-hidden="true">
|
|
@for (var i = 1; i <= 5; i++)
|
|
{
|
|
<span class="@(i <= n.Importance ? "on" : null)"></span>
|
|
}
|
|
</span>
|
|
Importanza @n.Importance su 5
|
|
</span>
|
|
</p>
|
|
@if (n.Active)
|
|
{
|
|
<p class="notice notice-attention"><Icon Name="alert" Size="16" /><span><strong>Cosa ho fatto:</strong> @Inline(n.Action)</span></p>
|
|
}
|
|
else
|
|
{
|
|
<p class="news-action"><strong>Cosa ho fatto:</strong> @Inline(n.Action)</p>
|
|
}
|
|
</li>
|
|
}
|
|
</ul>
|
|
@if (!_all && count > shown.Count)
|
|
{
|
|
<div class="news-more"><a class="btn" href="/notizie?filtro=@_filter&tutte=1">Mostra le altre @(count - shown.Count)</a></div>
|
|
}
|
|
}
|
|
</section>
|
|
|
|
<div class="journal-side news-side">
|
|
<section class="panel" aria-labelledby="umore">
|
|
<h2 id="umore">Umore del mercato</h2>
|
|
<ul class="gauges">
|
|
@foreach (var g in v.Mood)
|
|
{
|
|
<li>
|
|
<div class="gauge-head">
|
|
<span>@g.Label</span>
|
|
@if (g.Value is { } value)
|
|
{
|
|
<span><strong>@value</strong> @g.Words</span>
|
|
}
|
|
else
|
|
{
|
|
<span class="muted">non ancora letto</span>
|
|
}
|
|
</div>
|
|
<div class="gauge-track @(g.Centered ? "centered" : null)" aria-hidden="true">
|
|
@if (g.Position is { } position)
|
|
{
|
|
<span class="gauge-dot" style="left: @Css(position * 100)%"></span>
|
|
}
|
|
</div>
|
|
<div class="gauge-ends"><span>@g.Left</span><span>@g.Right</span></div>
|
|
@if (g.Stale is { } stale)
|
|
{
|
|
<p class="hint">Ultimo valore @stale.</p>
|
|
}
|
|
</li>
|
|
}
|
|
</ul>
|
|
<p class="note gauges-note">Sono indizi che il modello tiene in conto. Da soli non fanno comprare né vendere.</p>
|
|
<p class="hint">@Anubis.Data.FearGreed.Attribution.</p>
|
|
</section>
|
|
|
|
<section class="panel" aria-labelledby="calendario">
|
|
<h2 id="calendario">In calendario</h2>
|
|
@if (v.Calendar.Count == 0)
|
|
{
|
|
<p class="note">Nessun evento importante nei prossimi giorni.@(Shell.IsDemo || v.Collecting ? "" : " Il calendario si scarica con i dati di mercato.")</p>
|
|
}
|
|
else
|
|
{
|
|
<ul class="calendar-list">
|
|
@foreach (var e in v.Calendar)
|
|
{
|
|
<li>
|
|
<span class="muted">@e.When</span>
|
|
<strong>@e.Title</strong>
|
|
<span class="@(e.Matters ? "attention-text" : "muted")">@e.Effect</span>
|
|
</li>
|
|
}
|
|
</ul>
|
|
}
|
|
</section>
|
|
|
|
<section class="plain" aria-labelledby="fonti">
|
|
<h2 id="fonti">Da dove leggo</h2>
|
|
@if (v.Sources.Count == 0)
|
|
{
|
|
<p class="note">Non leggo ancora nessuna fonte. Le notizie si scaricano con i dati di mercato.</p>
|
|
}
|
|
else
|
|
{
|
|
<ul class="source-list">
|
|
@foreach (var s in v.Sources)
|
|
{
|
|
<li>
|
|
<span class="@(s.Ok ? "gain" : "loss")"><Icon Name="@(s.Ok ? "check" : "alert")" Size="16" /></span>
|
|
<span>@s.Name</span>
|
|
<span class="muted">@s.Frequency</span>
|
|
</li>
|
|
}
|
|
</ul>
|
|
}
|
|
<p class="note">@v.Spending</p>
|
|
<p class="hint"><a href="/impostazioni#notizie">Fonti e regole nelle impostazioni</a></p>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
|
|
@code {
|
|
/// <summary>The rows shown before "Mostra le altre", as in the mockup.</summary>
|
|
private const int Shown = 6;
|
|
|
|
private NewsView _view = null!;
|
|
private string _filter = "posizioni";
|
|
private bool _all;
|
|
|
|
[CascadingParameter]
|
|
public HttpContext? HttpContext { get; set; }
|
|
|
|
[SupplyParameterFromQuery(Name = "filtro")]
|
|
public string? Filtro { get; set; }
|
|
|
|
[SupplyParameterFromQuery(Name = "tutte")]
|
|
public string? Tutte { get; set; }
|
|
|
|
protected override async Task LoadAsync()
|
|
{
|
|
var ct = HttpContext?.RequestAborted ?? CancellationToken.None;
|
|
_view = await NewsView.LoadAsync(Host, Shell, ct);
|
|
|
|
// Without positions the default filter would be empty: then all the news.
|
|
_filter = Filtro is "effetto" or "posizioni" or "tutte" ? Filtro : _view.Board.OnPositions > 0 ? "posizioni" : "tutte";
|
|
_all = Tutte == "1";
|
|
}
|
|
|
|
private IEnumerable<NewsBoardRow> Filtered(IEnumerable<NewsBoardRow> rows) => _filter switch
|
|
{
|
|
"effetto" => rows.Where(r => r.Active),
|
|
"posizioni" => rows.Where(r => r.OnPositions),
|
|
_ => rows,
|
|
};
|
|
|
|
private static string Lead(NewsView v)
|
|
{
|
|
var read = v.Board.Read == 1 ? "1 notizia letta" : $"{v.Board.Read} notizie lette";
|
|
var active = v.Board.Active switch
|
|
{
|
|
0 => "nessuna con un effetto in corso",
|
|
1 => "1 con un effetto in corso",
|
|
var n => $"{n} con un effetto in corso",
|
|
};
|
|
return $"{read} nelle ultime 24 ore, {active}.";
|
|
}
|
|
|
|
private string Empty(NewsView v) => _filter switch
|
|
{
|
|
"effetto" => "Nessuna notizia ha un effetto in corso: compro e vendo come dicono le strategie.",
|
|
"posizioni" => "Nessuna notizia sulle tue posizioni nelle ultime 24 ore.",
|
|
_ when !v.Collecting && !Shell.IsDemo => "Non leggo ancora notizie: la raccolta parte con i dati di mercato. Le fonti si scelgono nelle impostazioni.",
|
|
_ => "Nessuna notizia nelle ultime 24 ore.",
|
|
};
|
|
|
|
// "Niente. Confermano…" reads "niente. Confermano…" after "Cosa ho fatto:".
|
|
private static string Inline(string text) => text.Length == 0 ? text : char.ToLowerInvariant(text[0]) + text[1..];
|
|
|
|
private static string Css(double value) => value.ToString("0.##", CultureInfo.InvariantCulture);
|
|
}
|