An independent review of the phase found nine defects. The ones that could lose money or orders: - Exits at the close of equity_meanrev are now planned orders written in the same transaction that claims the decision, so a restart can neither lose them nor send them twice. A sell with a deadline starts aggressive. - Resume also finds a planned order not yet linked to its execution (restart between sending and linking) and closes it before re-planning. - An account is "ready" only after adopting the guard's stops, checking the key, reconciling, resuming and aligning stops. Until then nothing is decided on it or sent to it, and the loop retries its startup each minute. The guard's note is deleted only when every stop it placed is in the ledger. - Each account's turn is cut after 45 s (60 s for a retried startup), so a slow broker no longer silences the heartbeat until the guard kills a healthy engine; the beat is also withheld when the scheduler has been silent for 30 minutes. Smaller ones: a stock decision made after the open is marked late; the Telegram loops survive unexpected errors; a long absence is shown on the Panoramica until "Ho visto" (SPEC 5.6); plain-http heartbeats are only accepted to home-network addresses; the soak report gives a daily close 30 minutes to be decided before expecting it. ADR 0012 point 12 records these choices; #51 and the two screen criteria are ticked in the roadmap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3d174931e9
commit
2185a0b36b
16 files changed
+397
-90
No files matched your search
@@ -71,6 +71,8 @@ public sealed class LiveEngineTests
|
||||
var last = LiveFrom.AddDays(13);
|
||||
await using var live = await LiveRig.CreateAsync(LiveFrom, last).ConfigureAwait(false);
|
||||
var restarted = false;
|
||||
var waited = false;
|
||||
(int Runs, int Sent) before = default;
|
||||
for (var day = LiveFrom; day <= last; day = day.AddDays(1))
|
||||
{
|
||||
var index = day.DayNumber - LiveFrom.DayNumber;
|
||||
@@ -90,6 +92,25 @@ public sealed class LiveEngineTests
|
||||
}
|
||||
,
|
||||
|
||||
// The account has not finished its startup (the broker did not answer it): for three minutes nothing is
|
||||
// decided or sent on it, then the decision is made late.
|
||||
5 => async minute =>
|
||||
{
|
||||
var runs = (await live.Rig.QueryAsync("SELECT run_key FROM engine_runs", r => r.Text("run_key")).ConfigureAwait(false)).Count;
|
||||
if (minute == 0)
|
||||
{
|
||||
before = (runs, live.Sent.Count);
|
||||
}
|
||||
else if (minute == 3)
|
||||
{
|
||||
Assert.AreEqual(before, (runs, live.Sent.Count), "Nothing is decided or sent on an account not started.");
|
||||
waited = true;
|
||||
}
|
||||
|
||||
live.AccountStarted = minute >= 3;
|
||||
}
|
||||
,
|
||||
|
||||
// The process dies with a purchase working at the broker and starts again.
|
||||
11 => async minute =>
|
||||
{
|
||||
@@ -118,6 +139,7 @@ public sealed class LiveEngineTests
|
||||
}
|
||||
|
||||
Assert.IsTrue(restarted, "The run must restart halfway through an order.");
|
||||
Assert.IsTrue(waited, "The run must hold an account not started.");
|
||||
Assert.AreEqual(1, live.Restarts);
|
||||
Assert.IsGreaterThan(0, live.Failures, "The faults must have hit the work.");
|
||||
|
||||
|
||||
Reference in new issue
Block a user