orderbook: flatpack map and mutex to rwmutex (#1909)

* orderbook: flatpack map and mutex to rwmutex

* glorious: benchmark

* Update exchanges/orderbook/orderbook.go

Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>

* Update exchanges/orderbook/orderbook_types.go

Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>

* Update exchanges/orderbook/orderbook_types.go

Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>

* Update exchanges/orderbook/orderbook_types.go

Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>

* gk: nits

* linter: fix

* Update exchanges/orderbook/orderbook_test.go

Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>

* Update exchanges/orderbook/orderbook_test.go

Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>

* thrasher-: nits

* okx: fix tests/thrasher niterino

* gk: nits

---------

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
This commit is contained in:
Ryan O'Hara-Reid
2025-05-29 12:31:27 +10:00
committed by GitHub
parent a5b638bfb7
commit 8fa6179f65
5 changed files with 92 additions and 115 deletions

View File

@@ -4470,13 +4470,13 @@ func TestWsProcessOrderbook5(t *testing.T) {
require.NoError(t, err)
required := currency.NewPairWithDelimiter("OKB", "USDT", "-")
got, err := orderbook.Get("okx", required, asset.Spot)
got, err := orderbook.Get(ok.Name, required, asset.Spot)
require.NoError(t, err)
require.Len(t, got.Asks, 5)
require.Len(t, got.Bids, 5)
// Book replicated to margin
got, err = orderbook.Get("okx", required, asset.Margin)
got, err = orderbook.Get(ok.Name, required, asset.Margin)
require.NoError(t, err)
require.Len(t, got.Asks, 5)
assert.Len(t, got.Bids, 5)