Ejemplo n.º 1
0
        public override async Task GetExchangeData(CancellationToken ct)
        {
            ExchangeData = new Dictionary <string, CryptoCoin> ( );

            while (!ct.IsCancellationRequested)
            {
                try
                {
                    var data = await TickerUrl.GetJsonAsync <Root> (ct);

                    Update(data.Result.Btc, "BTC");
                    Update(data.Result.Bch, "BCH");
                    Update(data.Result.Eth, "ETH");
                    Update(data.Result.Ltc, "LTC");
                }
                catch (FlurlHttpException e)
                {
                    if (e.InnerException is TaskCanceledException)
                    {
                        throw e.InnerException;
                    }
                }

                await Task.Delay(2000, ct);
            }
        }
Ejemplo n.º 2
0
        protected override async Task GetExchangeDataAsync(CancellationToken ct)
        {
            while (!ct.IsCancellationRequested)
            {
                var data = await TickerUrl.GetJsonAsync <List <CoinDeltaCoin> > (ct).ConfigureAwait(false);

                foreach (var datum in data)
                {
                    var market = datum.MarketName.Replace("-", "");
                    Update(datum, market.ToUpper( ));
                }

                await Task.Delay(PollingRate, ct).ConfigureAwait(false);
            }
        }
Ejemplo n.º 3
0
        public override async Task GetExchangeData(CancellationToken ct)
        {
            ExchangeData = new ConcurrentDictionary <CryptoCoinId, CryptoCoin>();

            while (!ct.IsCancellationRequested)
            {
                var data = await TickerUrl.GetJsonAsync <List <HitbtcCoin> >(ct).ConfigureAwait(false);

                var hitbtcObject = data;

                foreach (var datum in data)
                {
                    var s = datum.Symbol;
                    if (!s.EndsWith("USD"))
                    {
                        continue;
                    }
                    var symbol = s.Replace("USD", "");
                    if (symbol == "BCC")
                    {
                        symbol = "BCH";
                    }
                    //if ( !AllowedSymbols.Contains ( symbol ) ) continue;
                    Update(datum, symbol);
                }

                await Task.Delay(60000).ConfigureAwait(false);



                //foreach (PropertyInfo propertyInfo in bitbnsObject.GetType().GetProperties())
                //{

                //    var propertyName = propertyInfo.Name;
                //    var temp = propertyInfo.GetValue(bitbnsObject);
                //    Update(temp, propertyName.ToUpper(), "Bitbns");

                //}

                //await Task.Delay(60000, ct).ConfigureAwait(false);
            }
        }
Ejemplo n.º 4
0
        public override async Task GetExchangeData(CancellationToken ct)
        {
            ExchangeData = new Dictionary <string, CryptoCoin> ( );

            while (!ct.IsCancellationRequested)
            {
                var data = await TickerUrl.GetJsonAsync <List <CoinDeltaCoin> > (ct);

                foreach (var datum in data)
                {
                    var marketname = datum.MarketName.Split('-');
                    if (marketname[1] == "inr" && KnownSymbols.Contains(marketname[0].ToUpper( )))
                    {
                        Update(datum, marketname[0].ToUpper( ));
                    }
                }

                await Task.Delay(60000, ct);
            }
        }
Ejemplo n.º 5
0
        public override async Task GetExchangeData(CancellationToken ct)
        {
            ExchangeData = new ConcurrentDictionary <CryptoCoinId, CryptoCoin>();

            while (!ct.IsCancellationRequested)
            {
                var data = await TickerUrl.GetJsonAsync <BitbnsCoin>(ct).ConfigureAwait(false);

                var bitbnsObject = data;

                foreach (PropertyInfo propertyInfo in bitbnsObject.GetType().GetProperties())
                {
                    var propertyName = propertyInfo.Name;
                    var temp         = propertyInfo.GetValue(bitbnsObject);
                    Update(temp, propertyName.ToUpper(), "Bitbns");
                }

                await Task.Delay(60000, ct).ConfigureAwait(false);
            }
        }
Ejemplo n.º 6
0
        public override async Task GetExchangeData(CancellationToken ct)
        {
            ExchangeData = new ConcurrentDictionary <CryptoCoinId, CryptoCoin> ( );

            while (!ct.IsCancellationRequested)
            {
                try
                {
                    var data = await TickerUrl.GetJsonAsync <Root> (ct).ConfigureAwait(false);

                    var krakenObject = data.Result;
                    foreach (PropertyInfo propertyInfo in krakenObject.GetType().GetProperties())
                    {
                        var propertyName = propertyInfo.Name;
                        var temp         = propertyInfo.GetValue(krakenObject);
                        Update(temp, propertyName.ToUpper(), "Kraken");
                    }

                    await Task.Delay(60000, ct).ConfigureAwait(false);

                    //               Update( data.Result.Btc, "BTC" );
                    //Update ( data.Result.Bch, "BCH" );
                    //Update ( data.Result.Eth, "ETH" );
                    //Update ( data.Result.Ltc, "LTC" );
                }
                catch (FlurlHttpException e)
                {
                    if (e.InnerException is TaskCanceledException)
                    {
                        throw e.InnerException;
                    }
                }

                await Task.Delay(2000, ct).ConfigureAwait(false);
            }
        }