@@ -202,24 +202,25 @@ public enum Match
202202 /// <returns>The <see cref="Match"/> member that represents the relation between the two pairs</returns>
203203 public static Match ComparePair ( this Symbol pairA , string baseCurrencyB , string quoteCurrencyB )
204204 {
205- var pairAValue = pairA . ID . Symbol ;
205+ var pairAValue = "" ;
206206
207207 // Check for a stablecoin between the currencies
208- if ( TryDecomposeCurrencyPair ( pairA , out var baseCurrencyA , out var quoteCurrencyA ) )
208+ if ( TryDecomposeCurrencyPair ( pairA , out var baseCurrencyA , out var quoteCurrencyA ) )
209209 {
210- var currencies = new string [ ] { baseCurrencyA , quoteCurrencyA , baseCurrencyB , quoteCurrencyB } ;
210+ pairAValue = string . Concat ( baseCurrencyA , "||" , quoteCurrencyA ) ;
211+ var currencies = new string [ ] { baseCurrencyA , quoteCurrencyA , baseCurrencyB , quoteCurrencyB } ;
211212 var isThereAnyMatch = false ;
212213
213214 // Compute all the potential stablecoins
214- var potentialStableCoins = new int [ ] [ ]
215+ var potentialStableCoins = new int [ ] [ ]
215216 {
216217 new int [ ] { 1 , 3 } ,
217218 new int [ ] { 1 , 2 } ,
218219 new int [ ] { 0 , 3 } ,
219220 new int [ ] { 0 , 2 }
220221 } ;
221222
222- foreach ( var pair in potentialStableCoins )
223+ foreach ( var pair in potentialStableCoins )
223224 {
224225 if ( Currencies . IsStableCoinWithoutPair ( currencies [ pair [ 0 ] ] + currencies [ pair [ 1 ] ] , pairA . ID . Market )
225226 || Currencies . IsStableCoinWithoutPair ( currencies [ pair [ 1 ] ] + currencies [ pair [ 0 ] ] , pairA . ID . Market ) )
@@ -234,16 +235,19 @@ public static Match ComparePair(this Symbol pairA, string baseCurrencyB, string
234235 // Update the value of pairAValue if there was a match
235236 if ( isThereAnyMatch )
236237 {
237- pairAValue = currencies [ 0 ] + currencies [ 1 ] ;
238+ pairAValue = string . Concat ( currencies [ 0 ] , "||" , currencies [ 1 ] ) ;
238239 }
239240 }
240241
241- if ( pairAValue == baseCurrencyB + quoteCurrencyB )
242+ var directPair = string . Concat ( baseCurrencyB , "||" , quoteCurrencyB ) ;
243+ var inversePair = string . Concat ( quoteCurrencyB , "||" , baseCurrencyB ) ;
244+
245+ if ( pairAValue == directPair )
242246 {
243247 return Match . ExactMatch ;
244248 }
245-
246- if ( pairAValue == quoteCurrencyB + baseCurrencyB )
249+
250+ if ( pairAValue == inversePair )
247251 {
248252 return Match . InverseMatch ;
249253 }
0 commit comments