sixth version

This commit is contained in:
2026-06-08 09:41:20 +00:00
parent 2d57c4ff1f
commit 8a552dec56
25 changed files with 545 additions and 130 deletions
+36 -7
View File
@@ -288,6 +288,34 @@ func TestNonZeroCommissionQuarantinesInstrumentAndHalts(t *testing.T) {
}
}
func TestEntryInstrumentPreTradeRejectsQuarantineAndCommission(t *testing.T) {
s := Scheduler{cfg: Config{RequireZeroCommission: true}}
err := s.checkEntryInstrumentBeforeOrder(domain.Instrument{
InstrumentUID: "uid",
Ticker: "TRUR",
Enabled: true,
Quarantine: true,
Lot: 1,
MinPriceIncrement: decimal.NewFromInt(1),
Currency: "RUB",
}, domain.TradingStatusNormal)
if err == nil {
t.Fatal("expected quarantine rejection")
}
err = s.checkEntryInstrumentBeforeOrder(domain.Instrument{
InstrumentUID: "uid",
Ticker: "TRUR",
Enabled: true,
Lot: 1,
MinPriceIncrement: decimal.NewFromInt(1),
Currency: "RUB",
ExpectedCommissionBpsPerSide: decimal.NewFromInt(1),
}, domain.TradingStatusNormal)
if err == nil || err.Error() != signalengine.ReasonCommission {
t.Fatalf("err=%v, want commission rejection", err)
}
}
func TestPreTradeDailyLossBreachHalts(t *testing.T) {
ctx := context.Background()
repo := testutil.NewMemoryRepository()
@@ -481,13 +509,14 @@ func TestPlaceEntryRejectsWideSpreadBeforeOrder(t *testing.T) {
repo := testutil.NewMemoryRepository()
tradeDate := time.Date(2026, 6, 6, 0, 0, 0, 0, time.UTC)
instrument := domain.Instrument{
InstrumentUID: "uid",
Ticker: "TRUR",
ClassCode: "TQTF",
Enabled: true,
Lot: 1,
MinPriceIncrement: decimal.RequireFromString("0.01"),
Currency: "RUB",
InstrumentUID: "uid",
Ticker: "TRUR",
ClassCode: "TQTF",
Enabled: true,
Lot: 1,
MinPriceIncrement: decimal.RequireFromString("0.01"),
Currency: "RUB",
FreeOrderLimitPerDay: -1,
}
if err := repo.UpsertInstrument(ctx, instrument); err != nil {
t.Fatal(err)