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

+18
View File
@@ -118,6 +118,24 @@ internal sealed class StockRig : IAsyncDisposable
Engine = new LiveEngine(Rig.Db, Rig.Clock, Rig.Ledger, _stages, id => id == Alpaca.AccountId ? Manager : null, Rig.QuoteAsync, _calendar) { Learning = learning };
}
/// <summary>
/// The engine again with news, calendar and earnings only measured (ADR 0023): the earnings calendar, the learning and the
/// gate it asks for the shadow.
/// </summary>
/// <paramref name="measuredAt"/> says whether they were measured at an instant (the change log); without it, always.
public void UseMeasured(Func<DateOnly, CancellationToken, Task<EarningsView?>> earnings, Learning.LearningDesk learning, News.IEntryGate? gate = null,
Func<DateTimeOffset, bool>? measuredAt = null)
{
Engine.Dispose();
Engine = new LiveEngine(Rig.Db, Rig.Clock, Rig.Ledger, _stages, id => id == Alpaca.AccountId ? Manager : null, Rig.QuoteAsync, _calendar)
{
Earnings = earnings,
Learning = learning,
Gate = gate,
RulesMeasured = (at, _) => Task.FromResult(measuredAt?.Invoke(at) ?? true),
};
}
/// <summary>The engine again, with the rules of SPEC 10.5 on single purchases.</summary>
public void UseGate(News.IEntryGate gate)
{