Пример #1
0
        public async Task <ITickers> GetTicker([FromBody] CompositeStockExchangeObject compositeStockExchangeObject)
        {
            decimal exchangeRate = compositeStockExchangeObject.ExchangeRate;

            Common.StockExchange.Types.StockExchange selectedStockExchange = compositeStockExchangeObject.StockExchange;
            string selectedPairs = compositeStockExchangeObject.SelectedPairs;

            IStockExchanges stockExchanges;

            switch (selectedStockExchange)
            {
            case Common.StockExchange.Types.StockExchange.Binance:
                stockExchanges = new Binance();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            case Common.StockExchange.Types.StockExchange.Bitfinex:
                stockExchanges = new Bitfinex();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            case Common.StockExchange.Types.StockExchange.Bitmex:
                stockExchanges = new Bitmex();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            case Common.StockExchange.Types.StockExchange.Bitstamp:
                stockExchanges = new Bitstamp();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            case Common.StockExchange.Types.StockExchange.Bittrex:
                stockExchanges = new Bittrex();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            case Common.StockExchange.Types.StockExchange.Cex:
                stockExchanges = new Cex();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            case Common.StockExchange.Types.StockExchange.Exmo:
                stockExchanges = new Exmo();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            case Common.StockExchange.Types.StockExchange.Gdax:
                stockExchanges = new Gdax();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            case Common.StockExchange.Types.StockExchange.Gemini:
                stockExchanges = new Gemini();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            case Common.StockExchange.Types.StockExchange.Kraken:
                stockExchanges = new Kraken();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            case Common.StockExchange.Types.StockExchange.Poloniex:
                stockExchanges = new Poloniex();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            case Common.StockExchange.Types.StockExchange.QuadrigaCx:
                stockExchanges = new QuadrigaCx();
                return(await stockExchanges.GetTickers(selectedPairs, exchangeRate));

            default:
                throw new NullStockExchangeException("Invalid StockExchange Selection");
            }
        }