Add the backtest baskets command and the basket family's report
`anubis backtest baskets` reruns the replica of appendix G on the 28 ECB crosses up to the research document's end, the G.5 control against chance, and a trial of the basket engine "come dal vivo" with the eToro costs on 20,000 USD, from 1999 to the chosen day on a grid fixed in BasketProtocol (generation A/B x distance 4/10 sigma). The plan is written to the trial register before the run, read back and run only if it is still the plan just written (a changed or re-hashed plan fails the trial), judged with every earlier basket_reversion trial counted, and recorded. --offline reads only the cached ECB zip and stops in Italian when it is missing. The report is written whatever the verdict; there is no outcome file. The report now labels max_positions and clock_window, reads its codes from BasketReasons and BasketModes, counts positions closed by the mandatory stop instead of listing them among refused entries, and no longer repeats the engine's own limitations. The generated report is committed: 13 of 13 binding replica rows inside the band, verdict not passed (net at double costs and DSR). refs #131 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d1ae650043
commit
3bee136c74
8 files changed
+830
-34
No files matched your search
@@ -152,6 +152,38 @@ public sealed class BasketReportTests
|
||||
StringAssert.Contains(none, "Stop sul valore del conto: 0");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(Category.Unit)]
|
||||
public void EveryCodeOfTheEngineHasAnItalianLabel()
|
||||
{
|
||||
var trial = _trial.Value;
|
||||
var notes = new Dictionary<string, int>(StringComparer.Ordinal)
|
||||
{
|
||||
[BasketReasons.PositionLimit] = 3,
|
||||
[BasketReasons.ClockWindow] = 4,
|
||||
[BasketReasons.MandatoryStop] = 6,
|
||||
[BasketReasons.GateOpenLoss] = 1,
|
||||
[BasketReasons.PausedUntilNextDay] = 1,
|
||||
[BasketReasons.DailyLossBlock] = 1,
|
||||
[BasketReasons.HalfSize] = 1,
|
||||
[BasketReasons.BelowVenueMinimum] = 1,
|
||||
[BasketReasons.MarginLimit] = 1,
|
||||
[BasketReasons.OppositePosition] = 1,
|
||||
[BasketReasons.CurrencyExposure] = 1,
|
||||
[BasketReasons.CostRule] = 1,
|
||||
[BasketReasons.RvolFilter] = 1,
|
||||
[BasketReasons.CorrelationLow] = 1,
|
||||
[BasketReasons.SwitchTripped] = 1,
|
||||
[BasketReasons.MaxOpenBaskets] = 1,
|
||||
};
|
||||
var text = Section(BasketReport.Markdown(Input(trial with { Report = trial.Report with { Notes = notes } })), "## Prova del motore a panieri");
|
||||
StringAssert.Contains(text, "| troppe posizioni aperte per la piattaforma | 3 |");
|
||||
StringAssert.Contains(text, "| fuori dalla finestra oraria | 4 |");
|
||||
StringAssert.Contains(text, "Posizioni chiuse dallo stop obbligatorio della piattaforma: 6.");
|
||||
var refusals = text[text.IndexOf("**Ingressi e mediazioni fermati o annotati**", StringComparison.Ordinal)..];
|
||||
Assert.IsFalse(refusals.Contains('`', StringComparison.Ordinal), "a code without a label: " + refusals);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(Category.Unit)]
|
||||
public void TheComparisonIsZeroNeverBuyAndHold()
|
||||
@@ -175,6 +207,9 @@ public sealed class BasketReportTests
|
||||
BasketReport.Markdown(Input(_trial.Value)),
|
||||
BasketReport.Markdown(Input(null, "Nessuna prova.")),
|
||||
File.ReadAllText(Path.Combine(Repo.Root.FullName, "src", "Anubis", "Backtest", "BasketReport.cs")),
|
||||
File.ReadAllText(Path.Combine(Repo.Root.FullName, "src", "Anubis", "Backtest", "BasketProtocol.cs")),
|
||||
File.ReadAllText(Path.Combine(Repo.Root.FullName, "src", "Anubis.Server", "BasketCommand.cs")),
|
||||
File.ReadAllText(Path.Combine(Repo.Root.FullName, "docs", "backtests", "basket_reversion.md")),
|
||||
};
|
||||
var text = texts[0];
|
||||
StringAssert.Contains(text, "535,5");
|
||||
|
||||
Reference in new issue
Block a user