orderbook: Check assignment of time values and reject if not set (#1318)

* orderbook: Check assignment of time values and reject if not set.

* linter: fix

* buffer: additional linter winter fixter

* Implement through pending exchanges

* finished push

* linty: minty

* gomod: tidy

* thrasher: nits

* glorious: nits

* orderbook: purge type now in favour of external call allocation

* orderbook: push last param

* orderbook: only 1 unlock call is needed

---------

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
This commit is contained in:
Ryan O'Hara-Reid
2023-09-07 11:00:16 +10:00
committed by GitHub
parent 20143886ca
commit ad9de19d47
31 changed files with 726 additions and 327 deletions

View File

@@ -3461,7 +3461,10 @@ func TestGetOrderbookMovement(t *testing.T) {
{Price: 13, Amount: 1},
{Price: 14, Amount: 1},
}
depth.LoadSnapshot(bid, ask, 0, time.Time{}, true)
err = depth.LoadSnapshot(bid, ask, 0, time.Now(), true)
if err != nil {
t.Fatal(err)
}
_, err = s.GetOrderbookMovement(context.Background(), req)
if err.Error() != "quote amount invalid" {
@@ -3571,7 +3574,10 @@ func TestGetOrderbookAmountByNominal(t *testing.T) {
{Price: 13, Amount: 1},
{Price: 14, Amount: 1},
}
depth.LoadSnapshot(bid, ask, 0, time.Time{}, true)
err = depth.LoadSnapshot(bid, ask, 0, time.Now(), true)
if err != nil {
t.Fatal(err)
}
nominal, err := s.GetOrderbookAmountByNominal(context.Background(), req)
if !errors.Is(err, nil) {
@@ -3674,7 +3680,10 @@ func TestGetOrderbookAmountByImpact(t *testing.T) {
{Price: 13, Amount: 1},
{Price: 14, Amount: 1},
}
depth.LoadSnapshot(bid, ask, 0, time.Time{}, true)
err = depth.LoadSnapshot(bid, ask, 0, time.Now(), true)
if err != nil {
t.Fatal(err)
}
req.ImpactPercentage = 9.090909090909092
impact, err := s.GetOrderbookAmountByImpact(context.Background(), req)