コード例 #1
0
        public async Task LoadBuilder(bool test = false)
        {
            _exchangeApis = await _xchApiBldr.Get();

            _exchangeHubs = new List <IExchangeHubRepository>();

            if (!test)
            {
                foreach (var api in _exchangeApis)
                {
                    if (api.Exchange == Exchange.Binance)
                    {
                        _exchangeHubs.Add(new ExchangeHubRepository(ExchangeHub.Contracts.Exchange.Binance, api.ApiKey, api.ApiSecret));
                    }
                    else if (api.Exchange == Exchange.Bittrex)
                    {
                        _exchangeHubs.Add(new ExchangeHubRepository(ExchangeHub.Contracts.Exchange.Bittrex, api.ApiKey, api.ApiSecret));
                    }
                    else if (api.Exchange == Exchange.CoinbasePro)
                    {
                        _exchangeHubs.Add(new ExchangeHubRepository(ExchangeHub.Contracts.Exchange.CoinbasePro, api.ApiKey, api.ApiSecret, api.ApiExtra));
                    }
                    else if (api.Exchange == Exchange.KuCoin)
                    {
                        _exchangeHubs.Add(new ExchangeHubRepository(ExchangeHub.Contracts.Exchange.KuCoin, api.ApiKey, api.ApiSecret));
                    }
                }
                if (_currentHub == null)
                {
                    _currentHub      = _exchangeHubs[0];
                    _currentExchange = _currentHub.GetExchange();
                }
            }
        }
コード例 #2
0
 public async Task <IEnumerable <Business.Contracts.Trade.ExchangeApi> > GetExchangeApis()
 {
     return(await _exchangeApiBuilder.Get());
 }