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

@@ -30,7 +30,7 @@ type CustomEx struct {
}
// Setup is a mock method for CustomEx
func (c *CustomEx) Setup(_ *config.Exchange) error {
func (c *CustomEx) Setup(*config.Exchange) error {
return nil
}
@@ -53,62 +53,62 @@ func (c *CustomEx) SetEnabled(bool) {
}
// ValidateAPICredentials is a mock method for CustomEx
func (c *CustomEx) ValidateAPICredentials(_ context.Context, _ asset.Item) error {
func (c *CustomEx) ValidateAPICredentials(context.Context, asset.Item) error {
return nil
}
// UpdateTickers is a mock method for CustomEx
func (c *CustomEx) UpdateTickers(_ context.Context, _ asset.Item) error {
func (c *CustomEx) UpdateTickers(context.Context, asset.Item) error {
return nil
}
// UpdateTicker is a mock method for CustomEx
func (c *CustomEx) UpdateTicker(_ context.Context, _ currency.Pair, _ asset.Item) (*ticker.Price, error) {
func (c *CustomEx) UpdateTicker(context.Context, currency.Pair, asset.Item) (*ticker.Price, error) {
return nil, nil
}
// UpdateOrderbook is a mock method for CustomEx
func (c *CustomEx) UpdateOrderbook(_ context.Context, _ currency.Pair, _ asset.Item) (*orderbook.Book, error) {
func (c *CustomEx) UpdateOrderbook(context.Context, currency.Pair, asset.Item) (*orderbook.Book, error) {
return nil, nil
}
// FetchTradablePairs is a mock method for CustomEx
func (c *CustomEx) FetchTradablePairs(_ context.Context, _ asset.Item) (currency.Pairs, error) {
func (c *CustomEx) FetchTradablePairs(context.Context, asset.Item) (currency.Pairs, error) {
return nil, nil
}
// UpdateTradablePairs is a mock method for CustomEx
func (c *CustomEx) UpdateTradablePairs(_ context.Context, _ bool) error {
func (c *CustomEx) UpdateTradablePairs(context.Context) error {
return nil
}
// GetEnabledPairs is a mock method for CustomEx
func (c *CustomEx) GetEnabledPairs(_ asset.Item) (currency.Pairs, error) {
func (c *CustomEx) GetEnabledPairs(asset.Item) (currency.Pairs, error) {
return nil, nil
}
// GetAvailablePairs is a mock method for CustomEx
func (c *CustomEx) GetAvailablePairs(_ asset.Item) (currency.Pairs, error) {
func (c *CustomEx) GetAvailablePairs(asset.Item) (currency.Pairs, error) {
return nil, nil
}
// UpdateAccountInfo is a mock method for CustomEx
func (c *CustomEx) UpdateAccountInfo(_ context.Context, _ asset.Item) (account.Holdings, error) {
func (c *CustomEx) UpdateAccountInfo(context.Context, asset.Item) (account.Holdings, error) {
return account.Holdings{}, nil
}
// SetPairs is a mock method for CustomEx
func (c *CustomEx) SetPairs(_ currency.Pairs, _ asset.Item, _ bool) error {
func (c *CustomEx) SetPairs(currency.Pairs, asset.Item, bool) error {
return nil
}
// GetAssetTypes is a mock method for CustomEx
func (c *CustomEx) GetAssetTypes(_ bool) asset.Items {
func (c *CustomEx) GetAssetTypes(bool) asset.Items {
return nil
}
// GetRecentTrades is a mock method for CustomEx
func (c *CustomEx) GetRecentTrades(_ context.Context, _ currency.Pair, _ asset.Item) ([]trade.Data, error) {
func (c *CustomEx) GetRecentTrades(context.Context, currency.Pair, asset.Item) ([]trade.Data, error) {
return nil, nil
}
@@ -133,7 +133,7 @@ func (c *CustomEx) GetServerTime(context.Context, asset.Item) (time.Time, error)
}
// GetFeeByType is a mock method for CustomEx
func (c *CustomEx) GetFeeByType(_ context.Context, _ *exchange.FeeBuilder) (float64, error) {
func (c *CustomEx) GetFeeByType(context.Context, *exchange.FeeBuilder) (float64, error) {
return 0.0, nil
}
@@ -153,42 +153,42 @@ func (c *CustomEx) FormatWithdrawPermissions() string {
}
// SupportsWithdrawPermissions is a mock method for CustomEx
func (c *CustomEx) SupportsWithdrawPermissions(_ uint32) bool {
func (c *CustomEx) SupportsWithdrawPermissions(uint32) bool {
return false
}
// GetAccountFundingHistory is a mock method for CustomEx
func (c *CustomEx) GetAccountFundingHistory(_ context.Context) ([]exchange.FundingHistory, error) {
func (c *CustomEx) GetAccountFundingHistory(context.Context) ([]exchange.FundingHistory, error) {
return nil, nil
}
// SubmitOrder is a mock method for CustomEx
func (c *CustomEx) SubmitOrder(_ context.Context, _ *order.Submit) (*order.SubmitResponse, error) {
func (c *CustomEx) SubmitOrder(context.Context, *order.Submit) (*order.SubmitResponse, error) {
return nil, nil
}
// ModifyOrder is a mock method for CustomEx
func (c *CustomEx) ModifyOrder(_ context.Context, _ *order.Modify) (*order.ModifyResponse, error) {
func (c *CustomEx) ModifyOrder(context.Context, *order.Modify) (*order.ModifyResponse, error) {
return nil, nil
}
// CancelOrder is a mock method for CustomEx
func (c *CustomEx) CancelOrder(_ context.Context, _ *order.Cancel) error {
func (c *CustomEx) CancelOrder(context.Context, *order.Cancel) error {
return nil
}
// CancelBatchOrders is a mock method for CustomEx
func (c *CustomEx) CancelBatchOrders(_ context.Context, _ []order.Cancel) (*order.CancelBatchResponse, error) {
func (c *CustomEx) CancelBatchOrders(context.Context, []order.Cancel) (*order.CancelBatchResponse, error) {
return nil, nil
}
// CancelAllOrders is a mock method for CustomEx
func (c *CustomEx) CancelAllOrders(_ context.Context, _ *order.Cancel) (order.CancelAllResponse, error) {
func (c *CustomEx) CancelAllOrders(context.Context, *order.Cancel) (order.CancelAllResponse, error) {
return order.CancelAllResponse{}, nil
}
// GetOrderInfo is a mock method for CustomEx
func (c *CustomEx) GetOrderInfo(_ context.Context, _ string, _ currency.Pair, _ asset.Item) (*order.Detail, error) {
func (c *CustomEx) GetOrderInfo(context.Context, string, currency.Pair, asset.Item) (*order.Detail, error) {
return nil, nil
}
@@ -198,37 +198,37 @@ func (c *CustomEx) GetDepositAddress(_ context.Context, _ currency.Code, _, _ st
}
// GetOrderHistory is a mock method for CustomEx
func (c *CustomEx) GetOrderHistory(_ context.Context, _ *order.MultiOrderRequest) (order.FilteredOrders, error) {
func (c *CustomEx) GetOrderHistory(context.Context, *order.MultiOrderRequest) (order.FilteredOrders, error) {
return nil, nil
}
// GetWithdrawalsHistory is a mock method for CustomEx
func (c *CustomEx) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) ([]exchange.WithdrawalHistory, error) {
func (c *CustomEx) GetWithdrawalsHistory(context.Context, currency.Code, asset.Item) ([]exchange.WithdrawalHistory, error) {
return []exchange.WithdrawalHistory{}, nil
}
// GetActiveOrders is a mock method for CustomEx
func (c *CustomEx) GetActiveOrders(_ context.Context, _ *order.MultiOrderRequest) (order.FilteredOrders, error) {
func (c *CustomEx) GetActiveOrders(context.Context, *order.MultiOrderRequest) (order.FilteredOrders, error) {
return []order.Detail{}, nil
}
// WithdrawCryptocurrencyFunds is a mock method for CustomEx
func (c *CustomEx) WithdrawCryptocurrencyFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error) {
func (c *CustomEx) WithdrawCryptocurrencyFunds(context.Context, *withdraw.Request) (*withdraw.ExchangeResponse, error) {
return nil, nil
}
// WithdrawFiatFunds is a mock method for CustomEx
func (c *CustomEx) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error) {
func (c *CustomEx) WithdrawFiatFunds(context.Context, *withdraw.Request) (*withdraw.ExchangeResponse, error) {
return nil, nil
}
// WithdrawFiatFundsToInternationalBank is a mock method for CustomEx
func (c *CustomEx) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error) {
func (c *CustomEx) WithdrawFiatFundsToInternationalBank(context.Context, *withdraw.Request) (*withdraw.ExchangeResponse, error) {
return nil, nil
}
// SetHTTPClientUserAgent is a mock method for CustomEx
func (c *CustomEx) SetHTTPClientUserAgent(_ string) error {
func (c *CustomEx) SetHTTPClientUserAgent(string) error {
return nil
}
@@ -238,7 +238,7 @@ func (c *CustomEx) GetHTTPClientUserAgent() (string, error) {
}
// SetClientProxyAddress is a mock method for CustomEx
func (c *CustomEx) SetClientProxyAddress(_ string) error {
func (c *CustomEx) SetClientProxyAddress(string) error {
return nil
}
@@ -258,7 +258,7 @@ func (c *CustomEx) GetBase() *exchange.Base {
}
// SupportsAsset is a mock method for CustomEx
func (c *CustomEx) SupportsAsset(_ asset.Item) bool {
func (c *CustomEx) SupportsAsset(asset.Item) bool {
return false
}
@@ -298,17 +298,17 @@ func (c *CustomEx) SupportsWebsocket() bool {
}
// SubscribeToWebsocketChannels is a mock method for CustomEx
func (c *CustomEx) SubscribeToWebsocketChannels(_ subscription.List) error {
func (c *CustomEx) SubscribeToWebsocketChannels(subscription.List) error {
return nil
}
// UnsubscribeToWebsocketChannels is a mock method for CustomEx
func (c *CustomEx) UnsubscribeToWebsocketChannels(_ subscription.List) error {
func (c *CustomEx) UnsubscribeToWebsocketChannels(subscription.List) error {
return nil
}
// IsAssetWebsocketSupported is a mock method for CustomEx
func (c *CustomEx) IsAssetWebsocketSupported(_ asset.Item) bool {
func (c *CustomEx) IsAssetWebsocketSupported(asset.Item) bool {
return false
}
@@ -318,12 +318,12 @@ func (c *CustomEx) FlushWebsocketChannels() error {
}
// AuthenticateWebsocket is a mock method for CustomEx
func (c *CustomEx) AuthenticateWebsocket(_ context.Context) error {
func (c *CustomEx) AuthenticateWebsocket(context.Context) error {
return nil
}
// GetOrderExecutionLimits is a mock method for CustomEx
func (c *CustomEx) GetOrderExecutionLimits(_ asset.Item, _ currency.Pair) (limits.MinMaxLevel, error) {
func (c *CustomEx) GetOrderExecutionLimits(asset.Item, currency.Pair) (limits.MinMaxLevel, error) {
return limits.MinMaxLevel{}, nil
}
@@ -333,17 +333,17 @@ func (c *CustomEx) CheckOrderExecutionLimits(_ asset.Item, _ currency.Pair, _, _
}
// UpdateOrderExecutionLimits is a mock method for CustomEx
func (c *CustomEx) UpdateOrderExecutionLimits(_ context.Context, _ asset.Item) error {
func (c *CustomEx) UpdateOrderExecutionLimits(context.Context, asset.Item) error {
return nil
}
// GetHistoricalFundingRates returns funding rates for a given asset and currency for a time period
func (c *CustomEx) GetHistoricalFundingRates(_ context.Context, _ *fundingrate.HistoricalRatesRequest) (*fundingrate.HistoricalRates, error) {
func (c *CustomEx) GetHistoricalFundingRates(context.Context, *fundingrate.HistoricalRatesRequest) (*fundingrate.HistoricalRates, error) {
return nil, nil
}
// GetLatestFundingRates returns the latest funding rates data
func (c *CustomEx) GetLatestFundingRates(_ context.Context, _ *fundingrate.LatestRateRequest) ([]fundingrate.LatestRateResponse, error) {
func (c *CustomEx) GetLatestFundingRates(context.Context, *fundingrate.LatestRateRequest) ([]fundingrate.LatestRateResponse, error) {
return nil, nil
}