exchanges: Refactor UpdateTradablePairs method to remove forceUpdate parameter (#2043)

* Refactor UpdateTradablePairs method to remove forceUpdate parameter

- Updated the signature of UpdateTradablePairs in multiple exchange wrappers to remove the forceUpdate boolean parameter.
- Adjusted related test cases to reflect the change in method signature.
- Ensured that the UpdatePairs method calls within UpdateTradablePairs no longer reference the removed parameter.

* update exchange wrapper template

* linter: fix

* glorious: nits

* thrasher/glorious: nits

* Update exchanges/exchange_test.go

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

* Update exchanges/exchange_test.go

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

* Update exchanges/exchange_test.go

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

* fix things

* misc: fix

* Update exchanges/exchange_test.go

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

---------

Co-authored-by: shazbert <ryan.oharareid@thrasher.io>
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
This commit is contained in:
Ryan O'Hara-Reid
2025-09-22 12:20:23 +10:00
committed by GitHub
parent b4a272de02
commit 9f8b783c20
46 changed files with 179 additions and 223 deletions

View File

@@ -516,18 +516,14 @@ func (e *Exchange) FetchTradablePairs(ctx context.Context, a asset.Item) (curren
// UpdateTradablePairs updates the exchanges available pairs and stores
// them in the exchanges config
func (e *Exchange) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error {
func (e *Exchange) UpdateTradablePairs(ctx context.Context) error {
assets := e.GetAssetTypes(false)
for x := range assets {
pairs, err := e.FetchTradablePairs(ctx, assets[x])
if err != nil {
return err
}
if len(pairs) == 0 {
return errors.New("no tradable pairs found")
}
err = e.UpdatePairs(pairs, assets[x], false, forceUpdate)
if err != nil {
if err := e.UpdatePairs(pairs, assets[x], false); err != nil {
return err
}
}

View File

@@ -102,7 +102,7 @@ func TestSyncOrderbook(t *testing.T) {
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup must not error")
require.NoError(t, e.UpdateTradablePairs(t.Context(), false))
require.NoError(t, e.UpdateTradablePairs(t.Context()))
// Add dummy subscription so that it can be matched and a limit/level can be extracted for initial orderbook sync spot.
err := e.Websocket.AddSubscriptions(nil, &subscription.Subscription{Channel: subscription.OrderbookChannel, Interval: kline.HundredMilliseconds})
@@ -140,7 +140,7 @@ func TestApplyPendingUpdates(t *testing.T) {
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup must not error")
require.NoError(t, e.UpdateTradablePairs(t.Context(), false))
require.NoError(t, e.UpdateTradablePairs(t.Context()))
m := newWsOBUpdateManager(defaultWSSnapshotSyncDelay)
pair := currency.NewPair(currency.LTC, currency.USDT)
@@ -180,7 +180,7 @@ func TestApplyOrderbookUpdate(t *testing.T) {
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup must not error")
require.NoError(t, e.UpdateTradablePairs(t.Context(), false))
require.NoError(t, e.UpdateTradablePairs(t.Context()))
pair := currency.NewBTCUSDT()