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:
1 parent
4c4f848d80
commit
60d5ebbc05
10 files changed
+169
-30
No files matched your search
@@ -49,7 +49,7 @@ public sealed class AccountsScreenTests
|
||||
CollectionAssert.AreEqual(new byte[] { 0xEF, 0xBB, 0xBF }, bytes[..3], "Excel reads the accents only with the BOM.");
|
||||
var lines = System.Text.Encoding.UTF8.GetString(bytes[3..]).Split('\n', StringSplitOptions.RemoveEmptyEntries);
|
||||
Assert.HasCount(11, lines);
|
||||
StringAssert.StartsWith(lines[1], "BTC/EUR;Bitcoin;okx;crypto_trend;0.0182;68950;71420;EUR;1299.84;44.95;66180;", lines[1]);
|
||||
StringAssert.StartsWith(lines[1], "BTC/EUR;Bitcoin;okx;crypto_trend;0,0182;68950;71420;EUR;1299,84;44,95;66180;", lines[1]);
|
||||
|
||||
var settings = await server.TextAsync("/impostazioni");
|
||||
StringAssert.Contains(settings, "Conti e chiavi");
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in new issue
Block a user