Document Phase 3; fix CSV decimals and Alpaca price steps (refs #33 #31 #32 #27)

ADR 0009 records the Phase 3 choices; API-NOTES gains the verified trading
facts and what Anubis does with each; ROADMAP and STATE mark the phase done
with the live-demo conformance waiting for the user's keys.

Two defects found while writing the notes:
- The positions CSV used dot decimals; SPEC 13 asks for decimal commas.
  Trailing zeros are dropped so both engines give the same text.
- Alpaca's catalogue has no tick, so limit and stop prices were sent
  unrounded and would get 422 "sub-penny". OrderRules.TickOf applies
  Alpaca's rule (2 decimals from 1 $, 4 below) to orders, stops and the
  simulator's own check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-10 21:24:38 +01:00
1 parent 4c4f848d80
commit 60d5ebbc05
10 files changed
+169 -30

No files matched your search

+3 -2
View File
@@ -151,7 +151,7 @@ internal sealed record AccountsView(
return new AccountsView(cards, rows.Select(r => r.Row).ToList(), pending, others, alpacaStops, residueRows, slices, fx?.Rate, fx?.Date, fxEffect, market.Open, market.Next);
}
/// <summary>The positions as CSV for a spreadsheet: semicolons, dot decimals, one row per position.</summary>
/// <summary>The positions as CSV for an Italian spreadsheet (SPEC 13): semicolons, decimal commas, no thousands separator, one row per position.</summary>
public string Csv(string? broker)
{
var text = new StringBuilder("strumento;nome;conto;strategia;quantita;prezzo_medio;prezzo_ora;valuta;valore_eur;risultato_eur;stop;aperta_il\n");
@@ -164,7 +164,8 @@ internal sealed record AccountsView(
return text.ToString();
static string Number(decimal value) => value.ToString(CultureInfo.InvariantCulture);
// Trailing zeros dropped, so both database engines give the same text.
static string Number(decimal value) => (value / 1.000000000000000000000000000000000m).ToString(CultureInfo.InvariantCulture).Replace('.', ',');
static string Clean(string value) => value.Replace(';', ',').Replace('\n', ' ');
}