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
+1
View File
@@ -114,6 +114,7 @@ func Compute(instrument domain.Instrument, candles []domain.Candle, tradeDate ti
rawEdgeBps := decimal.NewFromFloat(short.Mean).Mul(decimal.NewFromInt(10_000))
commission := roundTripCommissionBps(instrument, cfg)
expectedCost := spread.SpreadBps.
Add(spread.SpreadBps).
Add(cfg.EntrySlippageBps).
Add(cfg.ExitSlippageBps).
Add(commission).
+4 -4
View File
@@ -41,8 +41,8 @@ func TestComputeExpectedCostIncludesCommissionAndSlippage(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if !got.ExpectedCostBps.Equal(decimal.NewFromInt(22)) {
t.Fatalf("expected cost=%s, want 22", got.ExpectedCostBps)
if !got.ExpectedCostBps.Equal(decimal.NewFromInt(32)) {
t.Fatalf("expected cost=%s, want 32", got.ExpectedCostBps)
}
if !got.EntryIntervalVolume.Equal(decimal.NewFromInt(10000)) || !got.ExitIntervalVolume.Equal(decimal.NewFromInt(9000)) {
t.Fatalf("interval volumes were not preserved: %+v", got)
@@ -66,8 +66,8 @@ func TestComputeExpectedCostFallsBackToConfigCommission(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if !got.ExpectedCostBps.Equal(decimal.NewFromInt(24)) {
t.Fatalf("expected cost=%s, want 24", got.ExpectedCostBps)
if !got.ExpectedCostBps.Equal(decimal.NewFromInt(34)) {
t.Fatalf("expected cost=%s, want 34", got.ExpectedCostBps)
}
}