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

+6
View File
@@ -68,6 +68,12 @@ public sealed class TradingRulesTests
Assert.IsTrue(stop.IsValid);
Assert.AreEqual(380.13m, stop.StopPrice);
// The Alpaca catalogue has no tick: 2 decimals from 1 $, 4 below, as Alpaca asks (else 422 sub-penny).
var asListed = Stock("MSFT") with { TickSize = null };
Assert.AreEqual(380.13m, OrderRules.Round(asListed, OrderSide.Sell, OrderKind.Stop, 1m, 400m, stopPrice: 380.123m).StopPrice);
Assert.AreEqual(0.4568m, OrderRules.Round(asListed, OrderSide.Sell, OrderKind.Stop, 10m, 0.5m, stopPrice: 0.45671m).StopPrice);
Assert.AreEqual(412.34m, OrderRules.Round(asListed, OrderSide.Buy, OrderKind.Limit, 1m, 412m, 412.345m).LimitPrice);
Assert.AreEqual((12m, 0.345m), OrderRules.SplitWhole(12.345m));
Assert.IsTrue(OrderRules.IsUnsellable(btc, 0.000005m, 60000m));
Assert.IsFalse(OrderRules.IsUnsellable(btc, 0.001m, 60000m));