tenth version
Deploy / Test, build and deploy (push) Successful in 1m46s

This commit is contained in:
2026-06-08 14:58:56 +00:00
parent 20cc8506ad
commit 7626c1b831
17 changed files with 917 additions and 27 deletions
+17
View File
@@ -26,6 +26,23 @@ func TestAverageAdverseSlippageBpsUsesLocalQuoteMid(t *testing.T) {
}
}
func TestAverageAdverseSlippageBpsPrefersFillQuoteMid(t *testing.T) {
orders := []domain.Order{{
InstrumentUID: "uid",
Side: domain.SideBuy,
LimitPrice: decimal.NewFromInt(100),
FilledLots: 1,
AvgFillPrice: decimal.NewFromFloat(102),
RawStateJSON: `{"local":{"local_quote":{"mid":"100"},"fill_quotes":[{"mid":"101"}]}}`,
UpdatedAt: time.Now().UTC(),
}}
got := AverageAdverseSlippageBps(orders, 0)
want := decimal.NewFromInt(10_000).Div(decimal.NewFromInt(101))
if got.Sub(want).Abs().GreaterThan(decimal.NewFromFloat(0.000001)) {
t.Fatalf("slippage=%s, want fill-mid based slippage", got)
}
}
func TestAverageAdverseSlippageBpsFallsBackToLimit(t *testing.T) {
orders := []domain.Order{{
InstrumentUID: "uid",