Write the manuals and fix what following them found
The manual, the runbook and the go-live list are written and checked claim by claim against the code, and the installation is done from zero by following them on both engines. That found real defects, now fixed: - with SQLite a missing database file left no way to restore a backup: the choices appear, and the file is created only by the user's choice; - an account whose difference vanished after the 15 minutes stayed prudent with no button, a missing stop could be left out for good, and a choice made while the broker was silent used old numbers; - after "Ferma tutto" the positions could not be closed without restarting; - a refused key looked like a silent broker: it has its own notice now; - the split of the capital between the strategies of a broker (SPEC 13.5) could not be changed from the interface. refs #72 #68 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2257c3e16c
commit
24e20584d4
28 files changed
+1147
-57
No files matched your search
@@ -21,6 +21,7 @@
|
||||
"chiavi" => "Chiavi verificate e salvate: possono fare ordini e non possono prelevare. Il motore è ripartito e le usa.",
|
||||
"chiavi-tolte" => "Chiavi tolte: quel conto torna al simulatore interno per le strategie che non hanno ancora storia sul conto di prova.",
|
||||
"capitale" => "Capitale affidato aggiornato e diviso tra le strategie.",
|
||||
"quote" => "Ripartizione del capitale salvata.",
|
||||
"limiti" => "Limiti di rischio salvati.",
|
||||
"rischio" => "Impostazione del rischio salvata.",
|
||||
"telegram" => "Telegram funziona: ti ho mandato un messaggio di prova e ho salvato token e chat.",
|
||||
@@ -76,7 +77,7 @@
|
||||
|
||||
<section class="panel" id="conti">
|
||||
<h2>Conti e chiavi</h2>
|
||||
<p class="hint">In questa fase uso solo denaro finto: il simulatore interno è sempre acceso e, con le chiavi dei conti di prova, le strategie passano ai conti di prova dei broker. Le chiavi di conti veri non servono e non vanno inserite.</p>
|
||||
<p class="hint">Questa versione usa solo denaro finto: il simulatore interno è sempre acceso. Con le chiavi di prova di Alpaca le strategie azionarie che non hanno ancora movimenti passano al conto di prova; le crypto restano nel simulatore interno. Le chiavi di conti veri non servono e non vanno inserite.</p>
|
||||
@foreach (var b in _brokers)
|
||||
{
|
||||
<h3>@b.Title</h3>
|
||||
@@ -141,9 +142,30 @@
|
||||
<AntiforgeryToken />
|
||||
<label for="euro-@b.Broker">Nuovo importo in euro</label>
|
||||
<input id="euro-@b.Broker" name="euro" inputmode="decimal" autocomplete="off" value="@(b.Entrusted is { } cur ? Format.Quantity(cur.AmountEur) : "")" required />
|
||||
@if (b.Live)
|
||||
{
|
||||
<RaiseFields />
|
||||
}
|
||||
<button class="btn btn-small" type="submit">Salva</button>
|
||||
</form>
|
||||
<p class="hint">Si divide tra le strategie del conto secondo le quote@(b.Broker == Venues.Alpaca ? ", in dollari al cambio BCE del giorno" : ""). Ridurlo non vende nulla: se una strategia ha investito più di quanto le resterebbe, aspetto che venda.</p>
|
||||
@if (b.Strategies.Count > 1)
|
||||
{
|
||||
<h4>Ripartizione tra le strategie di @b.Short</h4>
|
||||
<form method="post" action="/azioni/quote/@b.Broker" class="form-grid">
|
||||
<AntiforgeryToken />
|
||||
@foreach (var s in b.Strategies)
|
||||
{
|
||||
<label>@StrategyNames.Label(s.Strategy, withMarket: true) (%)<input name="quota-@s.Strategy" inputmode="decimal" autocomplete="off" value="@Format.Quantity(s.Share * 100m)" required /></label>
|
||||
}
|
||||
@if (b.Live)
|
||||
{
|
||||
<RaiseFields />
|
||||
}
|
||||
<button class="btn btn-small" type="submit">Salva la ripartizione</button>
|
||||
</form>
|
||||
<p class="hint">Insieme devono fare 100. La quota cambia la dimensione delle prossime operazioni: non vende quello che è già comprato. I parametri delle strategie invece non si toccano da qui: sono quelli provati nel test, e un cambio passa da una nuova prova in Laboratorio.</p>
|
||||
}
|
||||
}
|
||||
}
|
||||
</section>
|
||||
@@ -170,7 +192,7 @@
|
||||
<h3>Protezione day trade</h3>
|
||||
<form method="post" action="/azioni/rischio/@Anubis.Risk.RiskSettings.PdtGuard.Key" class="form-inline">
|
||||
<AntiforgeryToken />
|
||||
<label for="pdt">Per un conto Alpaca sotto i 25.000 $: al massimo 3 operazioni aperte e chiuse in giornata ogni 5 sedute.</label>
|
||||
<label for="pdt">Se Alpaca applica ancora al tuo conto la regola sulle operazioni in giornata (PDT): al massimo 3 operazioni aperte e chiuse in giornata ogni 5 sedute.</label>
|
||||
<select id="pdt" name="valore" data-autosubmit>
|
||||
<option value="off" selected="@(_pdt == "off")">Spenta</option>
|
||||
<option value="on" selected="@(_pdt == "on")">Accesa</option>
|
||||
@@ -641,7 +663,7 @@
|
||||
private sealed record BrokerKey(string Name, string Label, SecretStatus Status);
|
||||
|
||||
private sealed record BrokerSetup(string Broker, string Title, string Short, IReadOnlyList<BrokerKey> Keys, AccountState? State, EntrustedCapital? Entrusted,
|
||||
IReadOnlyList<StrategyCapital> Strategies);
|
||||
IReadOnlyList<StrategyCapital> Strategies, bool Live);
|
||||
private sealed record LimitField(string Key, string Label, string Value, bool ReadOnly);
|
||||
private readonly List<LimitField> _limits = [];
|
||||
private SettingValue _taxMethod = new(Anubis.Trading.TaxExport.MethodSetting.Key, "lifo", false, null);
|
||||
@@ -717,7 +739,8 @@
|
||||
|
||||
_pdt = (await services.Settings.GetAsync(Anubis.Risk.RiskSettings.PdtGuard.Key, ct)).Value;
|
||||
_scenarios = (await services.Settings.GetAsync(Anubis.Risk.Scenarios.Setting.Key, ct)).Value;
|
||||
_anyLive = await (services.Trading?.Stages ?? new StageBook(services.Db, Clock, TradingConsent.None, (_, _, _) => Task.FromResult(false))).AnyLiveAsync(null, ct);
|
||||
var stages = services.Trading?.Stages ?? new StageBook(services.Db, Clock, TradingConsent.None, (_, _, _) => Task.FromResult(false));
|
||||
_anyLive = await stages.AnyLiveAsync(null, ct);
|
||||
|
||||
_backups = services.Backups.List();
|
||||
_telegramToken = await services.Secrets.StatusAsync(Anubis.Notifications.TelegramSettings.TokenSecret, ct);
|
||||
@@ -738,7 +761,7 @@
|
||||
|
||||
var demoAccount = await services.Db.ReadAsync(s => s.FirstOrDefaultAsync("SELECT id FROM accounts WHERE broker = @b AND environment = 'demo'", r => (Guid?)r.Id("id"), ("b", broker)), ct);
|
||||
var state = demoAccount is { } id ? await reconciler.StateAsync(id, ct) : null;
|
||||
_brokers.Add(new BrokerSetup(broker, title, name, keys, state, await capital.EntrustedAsync(broker, ct), await capital.StrategiesAsync(broker, ct)));
|
||||
_brokers.Add(new BrokerSetup(broker, title, name, keys, state, await capital.EntrustedAsync(broker, ct), await capital.StrategiesAsync(broker, ct), await stages.AnyLiveAsync(broker, ct)));
|
||||
}
|
||||
var user = HttpContext!.User;
|
||||
_hasSecondFactor = CurrentUser.HasSecondFactor(user);
|
||||
@@ -770,6 +793,7 @@
|
||||
"importo" => "Scrivi un importo in euro, per esempio 4000 o 1.500,50.",
|
||||
"cambio" => "Manca ancora il cambio euro/dollaro della BCE: lo scarico ogni giorno, riprova più tardi.",
|
||||
"capitale" => "Una strategia ha investito più di quanto le resterebbe: potrò ridurre il capitale quando avrà venduto.",
|
||||
"quote" => "Le quote vanno da 0 a 100 e insieme fanno 100: per esempio 60 e 40. Non ho cambiato nulla.",
|
||||
"limite" => "Un limite non è valido: controlla che ogni valore sia un numero dentro il suo intervallo.",
|
||||
"ordine-limiti" => "Il dimezzamento sul calo dal massimo deve venire prima dell'interruttore, e la perdita di un giorno non può superare quella di una settimana.",
|
||||
"frase-rischio" => $"Una strategia usa soldi veri: per aggiungere rischio scrivi la frase «{StageBook.RaisePhrase}». Non ho cambiato nulla.",
|
||||
|
||||
Reference in new issue
Block a user