mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-07 23:16:53 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user