Exemple #1
0
        public static List <string> FilterByIgnoreCoins(
            this List <string> symbols,
            IgnoreCoinSettings[] ignoreCoinSettings,
            ExchangerEnum exchanger)
        {
            if (symbols == null || !symbols.Any())
            {
                return(symbols);
            }

            var ignoreSymbol = ignoreCoinSettings.FirstOrDefault(ss => ss.Exchanger.Equals(exchanger.ToString()));

            if (ignoreSymbol == null)
            {
                return(symbols);
            }

            symbols.RemoveAll(s => ignoreSymbol.Symbols.Contains(SymbolHelper.ToGlobalSymbol(s, exchanger)));
            return(symbols);
        }
Exemple #2
0
        public static List <ExchangeSymbol> FillExchangerSymbols(
            this List <ExchangeSymbol> globalSymbols,
            ExchangerEnum exchanger,
            List <string> symbols)
        {
            if (symbols == null || !symbols.Any())
            {
                return(globalSymbols);
            }

            switch (exchanger)
            {
            default:
            {
                return(globalSymbols);
            }

            case ExchangerEnum.Binance:
            {
                foreach (var globalSymbol in globalSymbols)
                {
                    foreach (var symbol in symbols)
                    {
                        if (SymbolHelper.ToGlobalSymbol(symbol, ExchangerEnum.Binance)
                            .Equals(globalSymbol.GlobalSymbol))
                        {
                            globalSymbol.Binance = symbol;
                        }
                    }
                }

                return(globalSymbols);
            }

            case ExchangerEnum.Bittrex:
            {
                foreach (var globalSymbol in globalSymbols)
                {
                    foreach (var symbol in symbols)
                    {
                        if (SymbolHelper.ToGlobalSymbol(symbol, ExchangerEnum.Bittrex)
                            .Equals(globalSymbol.GlobalSymbol))
                        {
                            globalSymbol.Bittrex = symbol;
                        }
                    }
                }

                return(globalSymbols);
            }

            case ExchangerEnum.HitBtc:
            {
                foreach (var globalSymbol in globalSymbols)
                {
                    foreach (var symbol in symbols)
                    {
                        if (SymbolHelper.ToGlobalSymbol(symbol, ExchangerEnum.HitBtc)
                            .Equals(globalSymbol.GlobalSymbol))
                        {
                            globalSymbol.HitBtc = symbol;
                        }
                    }
                }

                return(globalSymbols);
            }

            case ExchangerEnum.KuCoin:
            {
                foreach (var globalSymbol in globalSymbols)
                {
                    foreach (var symbol in symbols)
                    {
                        if (SymbolHelper.ToGlobalSymbol(symbol, ExchangerEnum.KuCoin)
                            .Equals(globalSymbol.GlobalSymbol))
                        {
                            globalSymbol.KuCoin = symbol;
                        }
                    }
                }

                return(globalSymbols);
            }

            case ExchangerEnum.Cryptopia:
            {
                foreach (var globalSymbol in globalSymbols)
                {
                    foreach (var symbol in symbols)
                    {
                        if (SymbolHelper.ToGlobalSymbol(symbol, ExchangerEnum.Cryptopia)
                            .Equals(globalSymbol.GlobalSymbol))
                        {
                            globalSymbol.Cryptopia = symbol;
                        }
                    }
                }

                return(globalSymbols);
            }

            case ExchangerEnum.Yobit:
            {
                foreach (var globalSymbol in globalSymbols)
                {
                    foreach (var symbol in symbols)
                    {
                        if (SymbolHelper.ToGlobalSymbol(symbol, ExchangerEnum.Yobit)
                            .Equals(globalSymbol.GlobalSymbol))
                        {
                            globalSymbol.Yobit = symbol;
                        }
                    }
                }

                return(globalSymbols);
            }

            case ExchangerEnum.Okex:
            {
                foreach (var globalSymbol in globalSymbols)
                {
                    foreach (var symbol in symbols)
                    {
                        if (SymbolHelper.ToGlobalSymbol(symbol, ExchangerEnum.Okex)
                            .Equals(globalSymbol.GlobalSymbol))
                        {
                            globalSymbol.Okex = symbol;
                        }
                    }
                }

                return(globalSymbols);
            }

            case ExchangerEnum.Huobi:
            {
                foreach (var globalSymbol in globalSymbols)
                {
                    foreach (var symbol in symbols)
                    {
                        if (SymbolHelper.ToGlobalSymbol(symbol, ExchangerEnum.Huobi)
                            .Equals(globalSymbol.GlobalSymbol))
                        {
                            globalSymbol.Huobi = symbol;
                        }
                    }
                }

                return(globalSymbols);
            }

            case ExchangerEnum.Gate:
            {
                foreach (var globalSymbol in globalSymbols)
                {
                    foreach (var symbol in symbols)
                    {
                        if (SymbolHelper.ToGlobalSymbol(symbol, ExchangerEnum.Gate)
                            .Equals(globalSymbol.GlobalSymbol))
                        {
                            globalSymbol.Gate = symbol;
                        }
                    }
                }

                return(globalSymbols);
            }

            case ExchangerEnum.Upbit:
            {
                foreach (var globalSymbol in globalSymbols)
                {
                    foreach (var symbol in symbols)
                    {
                        if (SymbolHelper.ToGlobalSymbol(symbol, ExchangerEnum.Upbit)
                            .Equals(globalSymbol.GlobalSymbol))
                        {
                            globalSymbol.Upbit = symbol;
                        }
                    }
                }

                return(globalSymbols);
            }
            }
        }