Record the course the user chose on 2 December 2026 and make the container the only form of Anubis. - ADR 0021-0026: new roadmap (phases 10-24, readings per phase, the spec-to-ADR table, merge and tag only after the user's yes), Docker only, maths-only decisions, bans turned into limits on margin accounts, eToro Demo as currency venue and forward tests, strategy championship. ROADMAP rewritten from phase 10; STATE, CLAUDE.md, SVILUPPO, README, API-NOTES and the manuals without the desktop. - Remove the desktop: Anubis.Desktop, Anubis.Setup, deploy/windows, release-win and desktop-win, config.toml, PlatformKind, ANUBIS_PLATFORM, DPAPI with the ProtectedData package and the first-run wizard. Outside a container the server needs --data-dir, listens on 127.0.0.1 only and refuses foreign hosts; server and guard refuse --platform desktop with an Italian message and exit code 2. The demo keeps its key in a file and its error-page choices need no startup password. The diagnostics report says where the server runs from its own environment. - Lighter image: restore and publish for linux-x64 only, and leave out the Windows libraries ONNX Runtime copies anyway (829 MB to 410 MB on disk, /app from 282 MB to 42 MB). Rotating Docker logs in the Unraid template, the manual and the compose; backtest and learning run as one-shot commands. tasks dev uses artifacts/dev-data. refs #113 #114 #115 #78 #80 #81 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
60 lines
3.2 KiB
C#
60 lines
3.2 KiB
C#
using System.Collections;
|
|
using System.Globalization;
|
|
using Anubis.Brokers;
|
|
using Anubis.Core;
|
|
using Anubis.Learning;
|
|
|
|
namespace Anubis.Server;
|
|
|
|
/// <summary>
|
|
/// "anubis learning base": the first model (SPEC 11.2, issue #63). It rebuilds the examples of <c>crypto_trend</c> on the
|
|
/// history that "anubis backtest base" already downloaded and converted, trains, and writes the validation report and the
|
|
/// file that travels with the program. It never uses the network. The stock strategies wait for the Alpaca history.
|
|
/// </summary>
|
|
internal static class LearningCommand
|
|
{
|
|
private const string Usage =
|
|
"Uso: anubis learning base [--to AAAA-MM-GG] [--out docs/learning]\n" +
|
|
" Usa gli storici già scaricati da 'anubis backtest base', senza rete. Opzioni comuni: [--data-dir <cartella>, obbligatoria fuori dal container]";
|
|
|
|
public static async Task<int> RunAsync(string[] args, TextWriter? output = null, IReadOnlyDictionary<string, string?>? environment = null)
|
|
{
|
|
output ??= Console.Out;
|
|
if (args.Length < 1 || args[0] != "base")
|
|
{
|
|
await output.WriteLineAsync(Usage).ConfigureAwait(false);
|
|
return 2;
|
|
}
|
|
|
|
var rest = args[1..].ToList();
|
|
environment ??= Environment.GetEnvironmentVariables().Cast<DictionaryEntry>().ToDictionary(e => (string)e.Key, e => e.Value as string, StringComparer.Ordinal);
|
|
var config = ServerOptions.Parse([.. rest], environment).LoadConfig(environment);
|
|
var now = new SystemClock().UtcNow;
|
|
var to = Option(rest, "--to") is { } t ? DateOnly.ParseExact(t, "yyyy-MM-dd", CultureInfo.InvariantCulture) : new DateOnly(now.Year, now.Month, 1).AddDays(-1);
|
|
var outDir = Path.GetFullPath(Option(rest, "--out") ?? Path.Combine("docs", "learning"));
|
|
try
|
|
{
|
|
Directory.CreateDirectory(outDir);
|
|
var file = await FirstModel.BuildAsync(config.Data.Research, to, null, CancellationToken.None).ConfigureAwait(false);
|
|
await File.WriteAllTextAsync(Path.Combine(outDir, "first-model.json"), FirstModel.ToJson(file)).ConfigureAwait(false);
|
|
await File.WriteAllTextAsync(Path.Combine(outDir, "first-model.md"),
|
|
FirstModel.Markdown(file, "anubis learning base --to " + to.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture))).ConfigureAwait(false);
|
|
await output.WriteLineAsync(string.Create(CultureInfo.InvariantCulture, $"{file.Examples.Count} esempi, {file.Examples.Count(e => e.IsLabelled)} con un esito. ")
|
|
+ (file.Report is { } report ? report.Reason : "Nessun modello: esempi troppo pochi.")).ConfigureAwait(false);
|
|
await output.WriteLineAsync("Rapporto scritto in " + outDir).ConfigureAwait(false);
|
|
return 0;
|
|
}
|
|
catch (Exception ex) when (ex is IOException or InvalidOperationException or FormatException or UnauthorizedAccessException or InvalidDataException)
|
|
{
|
|
await output.WriteLineAsync("Non riuscito: " + Redactor.Redact(ex.Message)).ConfigureAwait(false);
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
private static string? Option(List<string> args, string name)
|
|
{
|
|
var index = args.IndexOf(name);
|
|
return index >= 0 && index < args.Count - 1 ? args[index + 1] : null;
|
|
}
|
|
}
|