Config: AssetEnabled upgrade (#1735)

* Config: Move assetEnabled upgrade to Version management

* Assets: Do not error on asset not enabled, or disabled

This became more messy with Disabling something that's defaulted to
disabled.
Taking an idealogical stance against erroring that what you want to have
done is already done.

* CurrencyManager: Set AssetEnabled when StorePairs(enabled)

* RPCServer: Fix tests expecting StoreAssetPairFormat to enable the asset

Also assertifies

* Bitfinex: Fix tests for MarginFunding subs

* GCTWrapper: Improve TestMain clarity

* BTSE: Add futures to testconfig

* Exchanges: Rename StoreAssetPairStore

Previously we were calling it "Format", but accepting everything from
the PairStore.
We were also defaulting to turning the Asset on.

Now callers need to get their AssetEnabled set as they want it, so
there's no magic

This change also moves responsibility for error wrapping outside to the
caller.

* Config: AssetEnabled upgrade should respect assetTypes

Previously we ignored the field and just turned on everything.
I think that was because we couldn't get at the old value.
In either case, we have the option to do better, and respect the
assetEnabled value

* Config: Improve exchange config version upgrade error messages
This commit is contained in:
Gareth Kirwan
2025-03-17 17:47:37 +07:00
committed by GitHub
parent 2a11c94dc4
commit 16d2d9f35a
41 changed files with 717 additions and 884 deletions

View File

@@ -11,7 +11,6 @@ import (
"github.com/gofrs/uuid"
"github.com/thrasher-corp/gocryptotrader/common"
"github.com/thrasher-corp/gocryptotrader/common/convert"
"github.com/thrasher-corp/gocryptotrader/config"
"github.com/thrasher-corp/gocryptotrader/currency"
"github.com/thrasher-corp/gocryptotrader/database"
@@ -924,7 +923,7 @@ func createDHM(t *testing.T) (*DataHistoryManager, *datahistoryjob.DataHistoryJo
b.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{
Available: currency.Pairs{cp, cp2},
Enabled: currency.Pairs{cp, cp2},
AssetEnabled: convert.BoolPtr(true)}
AssetEnabled: true}
err = em.Add(exch)
if !errors.Is(err, nil) {
t.Fatalf("received: '%v' but expected: '%v'", err, nil)
@@ -940,7 +939,7 @@ func createDHM(t *testing.T) (*DataHistoryManager, *datahistoryjob.DataHistoryJo
b.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{
Available: currency.Pairs{cp, cp2},
Enabled: currency.Pairs{cp, cp2},
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Uppercase: true},
RequestFormat: &currency.PairFormat{Uppercase: true},
}

View File

@@ -46,14 +46,14 @@ func CreateTestBot(tb testing.TB) *Engine {
pairs1 := map[asset.Item]*currency.PairStore{
asset.Spot: {
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
Available: currency.Pairs{cp1},
Enabled: currency.Pairs{cp1},
},
}
pairs2 := map[asset.Item]*currency.PairStore{
asset.Spot: {
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
Available: currency.Pairs{cp2},
Enabled: currency.Pairs{cp2},
},
@@ -372,7 +372,7 @@ func TestGetSpecificAvailablePairs(t *testing.T) {
Name: testExchange,
CurrencyPairs: &currency.PairsManager{Pairs: map[asset.Item]*currency.PairStore{
asset.Spot: {
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
Enabled: currency.Pairs{currency.NewPair(currency.BTC, currency.USD), currency.NewPair(currency.BTC, c)},
Available: currency.Pairs{currency.NewPair(currency.BTC, currency.USD), currency.NewPair(currency.BTC, c)},
ConfigFormat: &currency.PairFormat{
@@ -717,7 +717,7 @@ func TestGetExchangeNamesByCurrency(t *testing.T) {
Name: bf,
CurrencyPairs: &currency.PairsManager{Pairs: map[asset.Item]*currency.PairStore{
asset.Spot: {
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
Enabled: currency.Pairs{btcjpy},
Available: currency.Pairs{btcjpy},
ConfigFormat: &currency.PairFormat{
@@ -950,7 +950,7 @@ func (f fakeDepositExchange) GetDepositAddress(_ context.Context, _ currency.Cod
func createDepositEngine(opts *fakeDepositExchangeOpts) *Engine {
ps := currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
Enabled: currency.Pairs{
currency.NewPair(currency.BTC, currency.USDT),
currency.NewPair(currency.XRP, currency.USDT),

View File

@@ -807,12 +807,12 @@ func TestProcessOrders(t *testing.T) {
},
Pairs: map[asset.Item]*currency.PairStore{
asset.Spot: {
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
Enabled: pairs,
Available: pairs,
},
asset.Futures: {
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
Enabled: pairs,
Available: pairs,
},
@@ -831,12 +831,12 @@ func TestProcessOrders(t *testing.T) {
},
Pairs: map[asset.Item]*currency.PairStore{
asset.Spot: {
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
Enabled: pairs,
Available: pairs,
},
asset.Futures: {
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
Enabled: pairs,
Available: pairs,
},
@@ -1522,14 +1522,14 @@ func TestGetOpenFuturesPosition(t *testing.T) {
b.Enabled = true
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
b.CurrencyPairs.Pairs[asset.Futures] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
RequestFormat: &currency.PairFormat{Delimiter: "-"},
ConfigFormat: &currency.PairFormat{Delimiter: "-"},
Available: currency.Pairs{cp},
Enabled: currency.Pairs{cp},
}
b.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Delimiter: "/"},
RequestFormat: &currency.PairFormat{Delimiter: "/"},
Available: currency.Pairs{cp},
@@ -1616,14 +1616,14 @@ func TestProcessFuturesPositions(t *testing.T) {
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
b.CurrencyPairs.Pairs[asset.Futures] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
RequestFormat: &currency.PairFormat{Delimiter: "-"},
ConfigFormat: &currency.PairFormat{Delimiter: "-"},
Available: currency.Pairs{cp, cp2},
Enabled: currency.Pairs{cp, cp2},
}
b.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Delimiter: "/"},
RequestFormat: &currency.PairFormat{Delimiter: "/"},
Available: currency.Pairs{cp, cp2},

View File

@@ -25,7 +25,6 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/thrasher-corp/gocryptotrader/common"
"github.com/thrasher-corp/gocryptotrader/common/convert"
"github.com/thrasher-corp/gocryptotrader/common/key"
"github.com/thrasher-corp/gocryptotrader/config"
"github.com/thrasher-corp/gocryptotrader/currency"
@@ -485,7 +484,7 @@ func RPCTestSetup(t *testing.T) *Engine {
b.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{
Available: currency.Pairs{cp},
Enabled: currency.Pairs{cp},
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Uppercase: true},
RequestFormat: &currency.PairFormat{Uppercase: true}}
err = em.Add(exch)
@@ -504,7 +503,7 @@ func RPCTestSetup(t *testing.T) *Engine {
b.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{
Available: currency.Pairs{cp},
Enabled: currency.Pairs{cp},
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Uppercase: true},
RequestFormat: &currency.PairFormat{Uppercase: true}}
err = em.Add(exch)
@@ -1268,7 +1267,7 @@ func TestGetAccountInfo(t *testing.T) {
b.Enabled = true
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
b.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
}
fakeExchange := fExchange{
IBotExchange: exch,
@@ -1296,7 +1295,7 @@ func TestUpdateAccountInfo(t *testing.T) {
b.Enabled = true
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
b.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
}
fakeExchange := fExchange{
IBotExchange: exch,
@@ -1342,7 +1341,7 @@ func TestGetOrders(t *testing.T) {
b.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{
Available: currency.Pairs{cp},
Enabled: currency.Pairs{cp},
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Uppercase: true},
RequestFormat: &currency.PairFormat{Uppercase: true}}
err = em.Add(exch)
@@ -1452,7 +1451,7 @@ func TestGetOrder(t *testing.T) {
b.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{
Available: currency.Pairs{cp},
Enabled: currency.Pairs{cp},
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Uppercase: true},
RequestFormat: &currency.PairFormat{Uppercase: true}}
err = em.Add(exch)
@@ -1534,97 +1533,53 @@ func TestCheckVars(t *testing.T) {
t.Parallel()
var e exchange.IBotExchange
err := checkParams("Binance", e, asset.Spot, currency.NewPair(currency.BTC, currency.USDT))
if !errors.Is(err, errExchangeNotLoaded) {
t.Errorf("expected %v, got %v", errExchangeNotLoaded, err)
}
assert.ErrorIs(t, err, errExchangeNotLoaded, "checkParams should error correctly")
e = &binance.Binance{}
err = checkParams("Binance", e, asset.Spot, currency.NewPair(currency.BTC, currency.USDT))
if !errors.Is(err, errExchangeNotEnabled) {
t.Errorf("expected %v, got %v", errExchangeNotEnabled, err)
}
assert.ErrorIs(t, err, errExchangeNotEnabled, "checkParams should error correctly")
e.SetEnabled(true)
err = checkParams("Binance", e, asset.Spot, currency.NewPair(currency.BTC, currency.USDT))
if !errors.Is(err, currency.ErrPairManagerNotInitialised) {
t.Errorf("expected %v, got %v", currency.ErrPairManagerNotInitialised, err)
}
assert.ErrorIs(t, err, currency.ErrPairManagerNotInitialised, "checkParams should error correctly")
fmt1 := currency.PairStore{
RequestFormat: &currency.PairFormat{Uppercase: true},
ConfigFormat: &currency.PairFormat{
Delimiter: currency.DashDelimiter,
Uppercase: true,
},
}
coinFutures := currency.PairStore{
RequestFormat: &currency.PairFormat{
Uppercase: true,
Delimiter: currency.UnderscoreDelimiter,
},
ConfigFormat: &currency.PairFormat{
Uppercase: true,
Delimiter: currency.UnderscoreDelimiter,
},
}
usdtFutures := currency.PairStore{
RequestFormat: &currency.PairFormat{
Uppercase: true,
},
ConfigFormat: &currency.PairFormat{
Uppercase: true,
Delimiter: currency.DashDelimiter,
},
}
err = e.GetBase().StoreAssetPairFormat(asset.Spot, fmt1)
if err != nil {
t.Error(err)
}
err = e.GetBase().StoreAssetPairFormat(asset.Margin, fmt1)
if err != nil {
t.Error(err)
}
err = e.GetBase().StoreAssetPairFormat(asset.CoinMarginedFutures, coinFutures)
if err != nil {
t.Error(err)
}
err = e.GetBase().StoreAssetPairFormat(asset.USDTMarginedFutures, usdtFutures)
if err != nil {
t.Error(err)
b := e.GetBase()
for _, a := range []asset.Item{asset.Spot, asset.Margin, asset.CoinMarginedFutures, asset.USDTMarginedFutures} {
ps := currency.PairStore{
AssetEnabled: true,
RequestFormat: &currency.PairFormat{Uppercase: true},
ConfigFormat: &currency.PairFormat{Delimiter: currency.DashDelimiter, Uppercase: true},
}
switch a {
case asset.CoinMarginedFutures:
ps.RequestFormat = &currency.PairFormat{Uppercase: true, Delimiter: currency.UnderscoreDelimiter}
ps.ConfigFormat = &currency.PairFormat{Uppercase: true, Delimiter: currency.UnderscoreDelimiter}
case asset.USDTMarginedFutures:
ps.ConfigFormat = &currency.PairFormat{Uppercase: true, Delimiter: currency.DashDelimiter}
}
require.NoError(t, b.SetAssetPairStore(a, ps), "SetAssetPairStore must not error")
}
err = checkParams("Binance", e, asset.Spot, currency.NewPair(currency.BTC, currency.USDT))
if !errors.Is(err, errCurrencyPairInvalid) {
t.Errorf("expected %v, got %v", errCurrencyPairInvalid, err)
}
assert.ErrorIs(t, err, errCurrencyPairInvalid, "checkParams should error correctly")
var data = []currency.Pair{
{Delimiter: currency.DashDelimiter, Base: currency.BTC, Quote: currency.USDT},
}
err = e.GetBase().CurrencyPairs.StorePairs(asset.Spot, data, false)
if err != nil {
t.Fatal(err)
}
err = b.CurrencyPairs.StorePairs(asset.Spot, data, false)
require.NoError(t, err, "StorePairs must not error")
err = checkParams("Binance", e, asset.Spot, currency.NewPair(currency.BTC, currency.USDT))
if !errors.Is(err, errCurrencyNotEnabled) {
t.Errorf("expected %v, got %v", errCurrencyNotEnabled, err)
}
require.ErrorIs(t, err, errCurrencyNotEnabled, "checkParams must error correctly")
err = e.GetBase().CurrencyPairs.EnablePair(
asset.Spot,
currency.Pair{Delimiter: currency.DashDelimiter, Base: currency.BTC, Quote: currency.USDT},
)
if err != nil {
t.Error(err)
}
err = b.CurrencyPairs.EnablePair(asset.Spot, currency.Pair{Delimiter: currency.DashDelimiter, Base: currency.BTC, Quote: currency.USDT})
require.NoError(t, err, "EnablePair must not error")
err = checkParams("Binance", e, asset.Spot, currency.NewPair(currency.BTC, currency.USDT))
if err != nil {
t.Error(err)
}
require.NoError(t, err, "checkParams must not error")
}
func TestParseEvents(t *testing.T) {
@@ -1704,7 +1659,7 @@ func TestRPCServerUpsertDataHistoryJob(t *testing.T) {
b.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{
Available: currency.Pairs{cp},
Enabled: currency.Pairs{cp},
AssetEnabled: convert.BoolPtr(true)}
AssetEnabled: true}
err = em.Add(exch)
if !errors.Is(err, nil) {
t.Fatalf("received: '%v' but expected: '%v'", err, nil)
@@ -1974,7 +1929,7 @@ func TestGetManagedOrders(t *testing.T) {
b.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{
Available: currency.Pairs{cp},
Enabled: currency.Pairs{cp},
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Uppercase: true},
RequestFormat: &currency.PairFormat{Uppercase: true}}
err = em.Add(exch)
@@ -2277,7 +2232,7 @@ func TestCurrencyStateTradingPair(t *testing.T) {
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
b.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.EMPTYFORMAT,
Available: currency.Pairs{cp},
Enabled: currency.Pairs{cp},
@@ -2323,14 +2278,14 @@ func TestGetFuturesPositionsOrders(t *testing.T) {
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
b.CurrencyPairs.Pairs[asset.Futures] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
RequestFormat: &currency.PairFormat{Delimiter: "-"},
ConfigFormat: &currency.PairFormat{Delimiter: "-"},
Available: currency.Pairs{cp},
Enabled: currency.Pairs{cp},
}
b.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Delimiter: "/"},
RequestFormat: &currency.PairFormat{Delimiter: "/"},
Available: currency.Pairs{cp},
@@ -2405,13 +2360,13 @@ func TestGetCollateral(t *testing.T) {
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
b.CurrencyPairs.Pairs[asset.Futures] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.EMPTYFORMAT,
Available: currency.Pairs{cp},
Enabled: currency.Pairs{cp},
}
b.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.EMPTYFORMAT,
Available: currency.Pairs{cp},
Enabled: currency.Pairs{cp},
@@ -2530,13 +2485,13 @@ func TestGetTechnicalAnalysis(t *testing.T) {
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
b.CurrencyPairs.Pairs[asset.Futures] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{},
Available: currency.Pairs{cp},
Enabled: currency.Pairs{cp},
}
b.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{},
Available: currency.Pairs{cp},
Enabled: currency.Pairs{cp},
@@ -2802,7 +2757,7 @@ func TestGetMarginRatesHistory(t *testing.T) {
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
b.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{},
Available: currency.Pairs{cp},
Enabled: currency.Pairs{cp},
@@ -2945,7 +2900,7 @@ func TestGetFundingRates(t *testing.T) {
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
err = b.CurrencyPairs.Store(asset.Futures, &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
RequestFormat: &currency.PairFormat{Delimiter: "-"},
ConfigFormat: &currency.PairFormat{Delimiter: "-"},
Available: currency.Pairs{cp},
@@ -2956,7 +2911,7 @@ func TestGetFundingRates(t *testing.T) {
}
err = b.CurrencyPairs.Store(asset.Spot, &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Delimiter: "/"},
RequestFormat: &currency.PairFormat{Delimiter: "/"},
Available: currency.Pairs{cp},
@@ -3053,7 +3008,7 @@ func TestGetLatestFundingRate(t *testing.T) {
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
err = b.CurrencyPairs.Store(asset.Futures, &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
RequestFormat: &currency.PairFormat{Delimiter: "-"},
ConfigFormat: &currency.PairFormat{Delimiter: "-"},
Available: currency.Pairs{cp},
@@ -3063,7 +3018,7 @@ func TestGetLatestFundingRate(t *testing.T) {
t.Fatal(err)
}
err = b.CurrencyPairs.Store(asset.Spot, &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Delimiter: "/"},
RequestFormat: &currency.PairFormat{Delimiter: "/"},
Available: currency.Pairs{cp},
@@ -3158,14 +3113,14 @@ func TestGetManagedPosition(t *testing.T) {
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
b.CurrencyPairs.Pairs[asset.Futures] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
RequestFormat: &currency.PairFormat{Delimiter: "-"},
ConfigFormat: &currency.PairFormat{Delimiter: "-"},
Available: currency.Pairs{cp, cp2},
Enabled: currency.Pairs{cp, cp2},
}
b.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Delimiter: "/"},
RequestFormat: &currency.PairFormat{Delimiter: "/"},
Available: currency.Pairs{cp, cp2},
@@ -3301,14 +3256,14 @@ func TestGetAllManagedPositions(t *testing.T) {
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
b.CurrencyPairs.Pairs[asset.Futures] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
RequestFormat: &currency.PairFormat{Delimiter: "-"},
ConfigFormat: &currency.PairFormat{Delimiter: "-"},
Available: currency.Pairs{cp, cp2},
Enabled: currency.Pairs{cp, cp2},
}
b.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Delimiter: "/"},
RequestFormat: &currency.PairFormat{Delimiter: "/"},
Available: currency.Pairs{cp, cp2},
@@ -3407,7 +3362,7 @@ func TestGetOrderbookMovement(t *testing.T) {
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
b.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Delimiter: "/"},
RequestFormat: &currency.PairFormat{Delimiter: "/"},
Available: currency.Pairs{cp},
@@ -3520,7 +3475,7 @@ func TestGetOrderbookAmountByNominal(t *testing.T) {
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
b.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Delimiter: "/"},
RequestFormat: &currency.PairFormat{Delimiter: "/"},
Available: currency.Pairs{cp},
@@ -3626,7 +3581,7 @@ func TestGetOrderbookAmountByImpact(t *testing.T) {
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
b.CurrencyPairs.Pairs[asset.Spot] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Delimiter: "/"},
RequestFormat: &currency.PairFormat{Delimiter: "/"},
Available: currency.Pairs{cp},
@@ -3734,7 +3689,7 @@ func TestChangePositionMargin(t *testing.T) {
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
b.CurrencyPairs.Pairs[asset.USDTMarginedFutures] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Delimiter: "/"},
RequestFormat: &currency.PairFormat{Delimiter: "/"},
Available: currency.Pairs{cp},
@@ -3797,7 +3752,7 @@ func TestSetLeverage(t *testing.T) {
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
b.CurrencyPairs.Pairs[asset.USDTMarginedFutures] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Delimiter: "/"},
RequestFormat: &currency.PairFormat{Delimiter: "/"},
Available: currency.Pairs{cp},
@@ -3875,7 +3830,7 @@ func TestGetLeverage(t *testing.T) {
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
b.CurrencyPairs.Pairs[asset.USDTMarginedFutures] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Delimiter: "/"},
RequestFormat: &currency.PairFormat{Delimiter: "/"},
Available: currency.Pairs{cp},
@@ -3955,7 +3910,7 @@ func TestSetMarginType(t *testing.T) {
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
b.CurrencyPairs.Pairs[asset.USDTMarginedFutures] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Delimiter: "/"},
RequestFormat: &currency.PairFormat{Delimiter: "/"},
Available: currency.Pairs{cp},
@@ -4015,7 +3970,7 @@ func TestSetCollateralMode(t *testing.T) {
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
b.CurrencyPairs.Pairs[asset.USDTMarginedFutures] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
ConfigFormat: &currency.PairFormat{Delimiter: "/"},
RequestFormat: &currency.PairFormat{Delimiter: "/"},
Available: currency.Pairs{cp},
@@ -4064,7 +4019,7 @@ func TestGetCollateralMode(t *testing.T) {
b.Enabled = true
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
b.CurrencyPairs.Pairs[asset.USDTMarginedFutures] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
}
fakeExchange := fExchange{
@@ -4107,7 +4062,7 @@ func TestGetOpenInterest(t *testing.T) {
b.Enabled = true
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
b.CurrencyPairs.Pairs[asset.USDTMarginedFutures] = &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
}
fakeExchange := fExchange{
@@ -4288,7 +4243,7 @@ func TestGetCurrencyTradeURL(t *testing.T) {
b.Enabled = true
b.CurrencyPairs.Pairs = make(map[asset.Item]*currency.PairStore)
err = b.CurrencyPairs.Store(asset.Spot, &currency.PairStore{
AssetEnabled: convert.BoolPtr(true),
AssetEnabled: true,
Enabled: []currency.Pair{currency.NewPair(currency.BTC, currency.USDT)},
Available: []currency.Pair{currency.NewPair(currency.BTC, currency.USDT)},
RequestFormat: &currency.PairFormat{Uppercase: true},