mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-18 07:26:50 +00:00
exchanges/websocket: Allow configuration of orderbook publish period (#805)
* Allow configuration of orderbook publish period For some applications that import GCT it's more interesting to be immediately notified of an exchange orderbook update instead of only getting notified every 10 seconds. This option allows that to happen while keeping the previous default. * exchanges: allow configuration of orderbook update period
This commit is contained in:
@@ -712,22 +712,22 @@ func TestGetOrderbook(t *testing.T) {
|
||||
func TestSetup(t *testing.T) {
|
||||
t.Parallel()
|
||||
w := Orderbook{}
|
||||
err := w.Setup(0, false, false, false, false, true, "", nil)
|
||||
err := w.Setup(0, false, false, false, false, true, 0, "", nil)
|
||||
if !errors.Is(err, errUnsetExchangeName) {
|
||||
t.Fatalf("expected error %v but received %v", errUnsetExchangeName, err)
|
||||
}
|
||||
|
||||
err = w.Setup(0, false, false, false, false, false, "test", nil)
|
||||
err = w.Setup(0, false, false, false, false, false, 0, "test", nil)
|
||||
if !errors.Is(err, errUnsetDataHandler) {
|
||||
t.Fatalf("expected error %v but received %v", errUnsetDataHandler, err)
|
||||
}
|
||||
|
||||
err = w.Setup(0, true, false, false, false, true, "test", make(chan interface{}))
|
||||
err = w.Setup(0, true, false, false, false, true, 0, "test", make(chan interface{}))
|
||||
if !errors.Is(err, errIssueBufferEnabledButNoLimit) {
|
||||
t.Fatalf("expected error %v but received %v", errIssueBufferEnabledButNoLimit, err)
|
||||
}
|
||||
|
||||
err = w.Setup(1337, true, true, true, true, false, "test", make(chan interface{}))
|
||||
err = w.Setup(1337, true, true, true, true, false, 0, "test", make(chan interface{}))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -1002,7 +1002,7 @@ func TestUpdateByIDAndAction(t *testing.T) {
|
||||
func TestFlushOrderbook(t *testing.T) {
|
||||
t.Parallel()
|
||||
w := &Orderbook{}
|
||||
err := w.Setup(5, false, false, false, false, false, "test", make(chan interface{}, 2))
|
||||
err := w.Setup(5, false, false, false, false, false, 0, "test", make(chan interface{}, 2))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user