public async Task <(BestExchangeQuote bestBid, BestExchangeQuote bestAsk)> Get(CurrencyPair currencyPair)
        {
            var httpClient = new HttpClient();
            var httpRequestMessageService = new HttpRequestMessageService();
            var currencyPairService       = new CurrencyPairService();

            var bittrexExchange     = new BittrexExchange(httpClient, httpRequestMessageService, currencyPairService);
            var coinbaseProExchange = new CoinbaseProExchange(httpClient, httpRequestMessageService, currencyPairService);
            var krakenExchange      = new KrakenExchange(httpClient, httpRequestMessageService, currencyPairService);
            var poloniexExchange    = new PoloniexExchange(httpClient, httpRequestMessageService, currencyPairService);
            var binanceExchange     = new BinanceExchange(httpClient, httpRequestMessageService, currencyPairService);
            var bitfinexExchange    = new BitfinexExchange(httpClient, httpRequestMessageService, currencyPairService);
            var bitstampExchange    = new BitstampExchange(httpClient, httpRequestMessageService, currencyPairService);

            var exchangeResults = await Task.WhenAll(
                bittrexExchange.Get(currencyPair),
                coinbaseProExchange.Get(currencyPair),
                krakenExchange.Get(currencyPair),
                poloniexExchange.Get(currencyPair),
                binanceExchange.Get(currencyPair),
                bitfinexExchange.Get(currencyPair),
                bitstampExchange.Get(currencyPair));

            var result = arbitrageCalculator.Calculate(
                exchangeResults[0],
                exchangeResults[1],
                exchangeResults[2],
                exchangeResults[3],
                exchangeResults[4],
                exchangeResults[5],
                exchangeResults[6]);

            return(result);
        }
示例#2
0
        public async Task <(BestExchangeQuote bestBid, BestExchangeQuote bestAsk)> Get()
        {
            var httpClient = new HttpClient();
            var httpRequestMessageService = new HttpRequestMessageService();

            var bittrexExchange = new BittrexExchange(httpClient, httpRequestMessageService);
            var bittrexResult   = await bittrexExchange.Get();

            var gdaxExchange = new GdaxExchange(httpClient, httpRequestMessageService);
            var gdaxResult   = await gdaxExchange.Get();

            var coinExchangeExchange       = new CoinExchangeExchange(httpClient, httpRequestMessageService);
            var coinExchangeExchangeResult = await coinExchangeExchange.Get();

            var krakenExchange       = new CoinExchangeExchange(httpClient, httpRequestMessageService);
            var krakenExchangeResult = await krakenExchange.Get();

            var poloniexExchange       = new PoloniexExchange(httpClient, httpRequestMessageService);
            var poloniexExchangeResult = await poloniexExchange.Get();

            var binanceExchange       = new BinanceExchange(httpClient, httpRequestMessageService);
            var binanceExchangeResult = await binanceExchange.Get();

            var bitfinexExchange       = new BitfinexExchange(httpClient, httpRequestMessageService);
            var bitfinexExchangeResult = await bitfinexExchange.Get();

            var bitstampExchange       = new BitstampExchange(httpClient, httpRequestMessageService);
            var bitstampExchangeResult = await bitstampExchange.Get();

            var result = arbitrageCalculator.Calculate(
                bittrexResult,
                gdaxResult,
                coinExchangeExchangeResult,
                krakenExchangeResult,
                poloniexExchangeResult,
                binanceExchangeResult,
                bitfinexExchangeResult,
                bitstampExchangeResult);

            return(result);
        }