Exemple #1
0
 protected BaseClient(ILog log, ExchangeProxySettings settings = null)
 {
     Log = log;
     if (settings?.Host == null)
     {
         httpClient = new HttpClient();
     }
     else
     {
         httpClient = new HttpClient(new HttpClientHandler
         {
             Proxy = new WebProxy($"{settings.Host}:{settings.Port}",
                                  true,
                                  new string [0],
                                  new NetworkCredential(settings.User, settings.Password))
         });
     }
 }
        private IEnumerable <FlexScheduler> GetSchedulers(ExchangeProxySettings proxySettings)
        {
            var service = new BlocktraderService(log, proxySettings);

            foreach (var exchange in new [] { ExchangeTitle.Binance, ExchangeTitle.Bitfinex, ExchangeTitle.Bitstamp })
            {
                var thisLog = log.ForContext(exchange.ToString());
                async Task <TimeSpan> DownloadTradesAsync()
                {
                    var trades = await service.GetCurrentTradeListsAsync(exchange, Ticker.BtcUsd)
                                 .ConfigureAwait(false);

                    var(filtered, timeSpan) = FilterTrades(exchange, trades, thisLog);

                    queues[exchange].Enqueue(filtered);

                    return(timeSpan);
                }

                yield return(new FlexScheduler(DownloadTradesAsync, thisLog));
            }
        }
 public BitstampClient(ILog log, ExchangeProxySettings settings = null) : base(log, settings)
 {
 }