Fase 11 — Decisioni solo matematiche (#186)
ci / test (postgres) (push) Successful in 7m36s
ci / test (sqlite) (push) Successful in 6m41s
ci / image (push) Successful in 1m49s

News, the economic calendar and earnings dates no longer change any decision (ADR 0023, choices in ADR 0027). The outside rules are measured in the shadow; a switch in the settings turns them back on.

refs #116, refs #117

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #186.
This commit is contained in:
Alby96andClaude Opus 5.5 authored and Alby96 committed 2026-12-04 09:14:11 +01:00
1 parent ed22d1c8b5
commit 93cdf7850d
47 files changed
+1743 -169

No files matched your search

+6 -1
View File
@@ -99,9 +99,14 @@ internal sealed record StrategiesView(IReadOnlyList<StrategyCard> Cards, IReadOn
],
};
/// <summary>The lines of a strategy as the rules of the news are now: with them only measured the earnings change nothing (ADR 0023).</summary>
public static IReadOnlyList<string> RulesOf(string strategy, bool measured) =>
[.. (Rules.GetValueOrDefault(strategy) ?? []).Select(r => measured && r == "Salta i giorni prima delle trimestrali" ? "Trimestrali solo misurate: non salta i giorni prima" : r)];
public static async Task<StrategiesView> LoadAsync(AppServices services, IClock clock, bool liveAllowed, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(services);
var measured = await Anubis.News.ExternalRules.MeasuredAsync(services.Settings, cancellationToken).ConfigureAwait(false);
var stages = services.Trading?.Stages ?? new StageBook(services.Db, clock, TradingConsent.None, (_, _, _) => Task.FromResult(false));
var ledger = services.Trading?.Ledger ?? new Ledger(services.Db, clock);
var rate = (await new FxStore(services.Db, clock).LatestAsync("EUR", "USD", cancellationToken).ConfigureAwait(false))?.Rate ?? 0m;
@@ -212,7 +217,7 @@ internal sealed record StrategiesView(IReadOnlyList<StrategyCard> Cards, IReadOn
: null;
var flows = equity?.Flows ?? 0m;
cards.Add(new StrategyCard(stage, StrategyNames.Label(stage.Strategy, withMarket: true) + (stage.Strategy == StrategyNames.CryptoTrend ? "" : " USA"),
family?.Description ?? "", Rules.GetValueOrDefault(stage.Strategy) ?? [], account.Name ?? "—", account.Currency ?? "EUR", Eur(flows), Eur(result),
family?.Description ?? "", RulesOf(stage.Strategy, measured), account.Name ?? "—", account.Currency ?? "EUR", Eur(flows), Eur(result),
flows > 0m ? result / flows * 100m : 0m, worst, trades.Count, trades.Count(r => r >= 0m), symbols, [.. curve.Where(p => p.At >= since || stage.StageSince is null)],
requirements, StageBook.Phrase(stage.Strategy, next), toGo, summary, twinGap));
}