mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-21 07:26:48 +00:00
* 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>
60 lines
1.9 KiB
Go
60 lines
1.9 KiB
Go
//go:build !mock_test_off
|
|
|
|
// This will build if build tag mock_test_off is not parsed and will try to mock
|
|
// all tests in _test.go
|
|
package bybit
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/thrasher-corp/gocryptotrader/currency"
|
|
"github.com/thrasher-corp/gocryptotrader/exchanges/asset"
|
|
testexch "github.com/thrasher-corp/gocryptotrader/internal/testing/exchange"
|
|
)
|
|
|
|
var mockTests = true
|
|
|
|
func TestMain(m *testing.M) {
|
|
e = new(Exchange)
|
|
if err := testexch.Setup(e); err != nil {
|
|
log.Fatalf("Bybit Setup error: %s", err)
|
|
}
|
|
|
|
e.SetCredentials("mock", "tester", "", "", "", "") // Hack for UpdateAccountInfo test
|
|
|
|
if err := testexch.MockHTTPInstance(e); err != nil {
|
|
log.Fatalf("Bybit MockHTTPInstance error: %s", err)
|
|
}
|
|
|
|
if err := e.UpdateTradablePairs(context.Background()); err != nil {
|
|
log.Fatalf("Bybit unable to UpdateTradablePairs: %s", err)
|
|
}
|
|
|
|
setEnabledPair := func(assetType asset.Item, pair currency.Pair) {
|
|
okay, err := e.IsPairEnabled(pair, assetType)
|
|
if !okay || err != nil {
|
|
err = e.CurrencyPairs.EnablePair(assetType, pair)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
spotTradablePair = currency.Pair{Base: currency.BTC, Quote: currency.USDT}
|
|
usdtMarginedTradablePair = currency.Pair{Base: currency.NewCode("10000LADYS"), Quote: currency.USDT}
|
|
usdcMarginedTradablePair = currency.Pair{Base: currency.ETH, Quote: currency.PERP}
|
|
inverseTradablePair = currency.Pair{Base: currency.ADA, Quote: currency.USD}
|
|
optionsTradablePair = currency.Pair{Base: currency.BTC, Delimiter: currency.DashDelimiter, Quote: currency.NewCode("26NOV24-92000-C")}
|
|
|
|
setEnabledPair(asset.Spot, spotTradablePair)
|
|
setEnabledPair(asset.USDTMarginedFutures, usdtMarginedTradablePair)
|
|
setEnabledPair(asset.USDCMarginedFutures, usdcMarginedTradablePair)
|
|
setEnabledPair(asset.CoinMarginedFutures, inverseTradablePair)
|
|
setEnabledPair(asset.Options, optionsTradablePair)
|
|
|
|
os.Exit(m.Run())
|
|
}
|