Settle what the checks of the review fixes found
A difference that comes and goes no longer makes the account ask about a stop the user has already chosen on. The balance of the restrictions adds each period to what was published, so a change of capital does not rewrite the past. An image is published only under a tag that exists, and a file that is not part of it no longer marks it as unclean. refs #70 #74 #75 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d26d945818
commit
8d7efe425d
8 files changed
+199
-23
No files matched your search
@@ -329,11 +329,40 @@ public sealed class ReconcilerTests
|
||||
Assert.IsFalse(state.WaitsForUser(s.Rig.Clock.UtcNow, s.Reconciler.Grace), "It may still explain itself.");
|
||||
s.Rig.Clock.Advance(TimeSpan.FromMinutes(16));
|
||||
s.Broker.Missing.Clear();
|
||||
await s.Reconciler.ReconcileAsync(s.Manager, _none).ConfigureAwait(false);
|
||||
state = await s.Reconciler.StateAsync(s.Account.AccountId, _none).ConfigureAwait(false);
|
||||
Assert.AreEqual(DifferenceKinds.Stop, state.Differences.Single().Kind);
|
||||
Assert.IsTrue(state.WaitsForUser(s.Rig.Clock.UtcNow, s.Reconciler.Grace), "Gone too late.");
|
||||
Assert.AreNotEqual(Reconciler.StopReason, state.ModeReason);
|
||||
s.Broker.RefuseStops = false;
|
||||
Assert.AreEqual(AccountModes.Prudent, (await s.Reconciler.ReconcileAsync(s.Manager, _none).ConfigureAwait(false)).Mode);
|
||||
Assert.AreEqual(ReconcileResolution.Normal, await s.Reconciler.ResolveAsync(s.Manager, ReconcileChoice.Align, "test", _none).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(Category.Simulation)]
|
||||
public async Task ADifferenceThatComesAndGoesDoesNotMakeTheStopAwaitedAskAgain()
|
||||
{
|
||||
await using var s = await HoldingAsync().ConfigureAwait(false);
|
||||
var stop = (await s.Paper.GetOpenOrdersAsync(_none).ConfigureAwait(false)).Single();
|
||||
await s.Paper.CancelOrderAsync(stop.ClientOrderId, stop.Symbol, _none).ConfigureAwait(false);
|
||||
s.Broker.RefuseStops = true;
|
||||
await s.Reconciler.ReconcileAsync(s.Manager, _none).ConfigureAwait(false);
|
||||
s.Rig.Clock.Advance(TimeSpan.FromMinutes(16));
|
||||
Assert.AreEqual(ReconcileResolution.StopsMissing, await s.Reconciler.ResolveAsync(s.Manager, ReconcileChoice.Align, "test", _none).ConfigureAwait(false));
|
||||
|
||||
// Coin leaves the account and is back 5 minutes later, the stop still refused: the user has nothing to choose.
|
||||
s.Broker.Missing["BTC-EUR"] = 0.004m;
|
||||
await s.Reconciler.ReconcileAsync(s.Manager, _none).ConfigureAwait(false);
|
||||
s.Rig.Clock.Advance(TimeSpan.FromMinutes(5));
|
||||
s.Broker.Missing.Clear();
|
||||
await s.Reconciler.ReconcileAsync(s.Manager, _none).ConfigureAwait(false);
|
||||
Assert.AreEqual(Reconciler.StopReason, (await s.Reconciler.StateAsync(s.Account.AccountId, _none).ConfigureAwait(false)).ModeReason);
|
||||
s.Rig.Clock.Advance(TimeSpan.FromMinutes(20));
|
||||
s.Broker.RefuseStops = false;
|
||||
Assert.AreEqual(AccountModes.Normal, (await s.Reconciler.ReconcileAsync(s.Manager, _none).ConfigureAwait(false)).Mode);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(Category.Simulation)]
|
||||
public async Task AKeyThatMayWithdrawStopsPurchasesUntilItIsReplaced()
|
||||
|
||||
Reference in new issue
Block a user