Created
September 20, 2023 04:36
-
-
Save gloriousCode/f30179c1ad95c371385075f999f041cc to your computer and use it in GitHub Desktop.
Hello shazbert!!! Hope you are having a lovely day
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/cmd/exchange_wrapper_standards/exchange_wrapper_standards_test.go b/cmd/exchange_wrapper_standards/exchange_wrapper_standards_test.go | |
index 01bc2af7a..c65db6949 100644 | |
--- a/cmd/exchange_wrapper_standards/exchange_wrapper_standards_test.go | |
+++ b/cmd/exchange_wrapper_standards/exchange_wrapper_standards_test.go | |
@@ -289,6 +289,8 @@ func generateMethodArg(ctx context.Context, t *testing.T, argGenerator *MethodAr | |
// Crypto Chain | |
input = reflect.ValueOf(cryptoChainPerExchange[exchName]) | |
} | |
+ case "MatchSymbolWithAvailablePairs", "MatchSymbolCheckEnabled": | |
+ input = reflect.ValueOf(argGenerator.AssetParams.Pair.Base.Lower().String() + argGenerator.AssetParams.Pair.Quote.Lower().String()) | |
default: | |
// OrderID | |
input = reflect.ValueOf("1337") | |
@@ -547,7 +549,7 @@ var acceptableErrors = []error{ | |
context.DeadlineExceeded, // If the context deadline is exceeded, it is not an error as only blockedCIExchanges use expired contexts by design | |
order.ErrPairIsEmpty, // Is thrown when the empty pair and asset scenario for an order submission is sent in the Validate() function | |
deposit.ErrAddressNotFound, // Is thrown when an address is not found due to the exchange requiring valid API keys | |
- currency.ErrPairNotFound, // Is thrown when a pair is not found in a pair matching function | |
+ currency.ErrSymbolStringEmpty, // Is thrown when a symbol string is empty for blank MatchSymbol func checks | |
} | |
// warningErrors will t.Log(err) when thrown to diagnose things, but not necessarily suggest | |
diff --git a/currency/manager.go b/currency/manager.go | |
index b1299fd88..33dfc7ec3 100644 | |
--- a/currency/manager.go | |
+++ b/currency/manager.go | |
@@ -26,12 +26,13 @@ var ( | |
// contained in the available pairs list and is not supported by the | |
// exchange for that asset type. | |
ErrPairNotContainedInAvailablePairs = errors.New("pair not contained in available pairs") | |
+ // ErrCurrencyPairEmpty is an error when a currency pair is empty | |
+ ErrSymbolStringEmpty = errors.New("symbol string is empty") | |
- errPairStoreIsNil = errors.New("pair store is nil") | |
- errPairFormatIsNil = errors.New("pair format is nil") | |
- errAssetNotFound = errors.New("asset type not found") | |
- errPairMatcherIsNil = errors.New("pair matcher is nil") | |
- errSymbolStringEmpty = errors.New("symbol string is empty") | |
+ errPairStoreIsNil = errors.New("pair store is nil") | |
+ errPairFormatIsNil = errors.New("pair format is nil") | |
+ errAssetNotFound = errors.New("asset type not found") | |
+ errPairMatcherIsNil = errors.New("pair matcher is nil") | |
) | |
// GetAssetTypes returns a list of stored asset types | |
@@ -63,7 +64,7 @@ func (p *PairsManager) Get(a asset.Item) (*PairStore, error) { | |
// Match returns a currency pair based on the supplied symbol and asset type | |
func (p *PairsManager) Match(symbol string, a asset.Item) (Pair, error) { | |
if symbol == "" { | |
- return EMPTYPAIR, errSymbolStringEmpty | |
+ return EMPTYPAIR, ErrSymbolStringEmpty | |
} | |
symbol = strings.ToLower(symbol) | |
p.m.RLock() | |
diff --git a/currency/manager_test.go b/currency/manager_test.go | |
index 8cd12d49e..606724c68 100644 | |
--- a/currency/manager_test.go | |
+++ b/currency/manager_test.go | |
@@ -96,8 +96,8 @@ func TestPairsManagerMatch(t *testing.T) { | |
p := &PairsManager{} | |
_, err := p.Match("", 1337) | |
- if !errors.Is(err, errSymbolStringEmpty) { | |
- t.Fatalf("received: '%v' but expected: '%v'", err, errSymbolStringEmpty) | |
+ if !errors.Is(err, ErrSymbolStringEmpty) { | |
+ t.Fatalf("received: '%v' but expected: '%v'", err, ErrSymbolStringEmpty) | |
} | |
_, err = p.Match("sillyBilly", 1337) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment