コード例 #1
0
        private IEnumerable <IObservable <TickPrice> > GetFeeds()
        {
            foreach (var input in _settings.Inputs.Where(x => x.Enabled))
            {
                var settings = new RabbitMqSubscriptionSettings
                {
                    ConnectionString = _settings.RabbitMq,
                    ExchangeName     = input.Exchanger,
                    QueueName        = $"{input.Exchanger}.synthetic-fiat-{Guid.NewGuid()}",
                    IsDurable        = false
                };

                var ticks = RmqHelper.ReadAsJson <TickPrice>(settings, _logFactory)
                            .Share();

                foreach (var crypto in input.Crypto)
                {
                    foreach (var fiat in _settings.Fiat)
                    {
                        var(source, target) = ParseFiatAsset(fiat.Asset);

                        yield return(ProduceFiatTickPrices(
                                         ticks,
                                         input.Name,
                                         crypto,
                                         source,
                                         target,
                                         fiat.Decimals));
                    }
                }
            }
        }
コード例 #2
0
        private IObservable <OrderBook> GetBitstampOrderbooks()
        {
            var settings = new RabbitMqSubscriptionSettings
            {
                ConnectionString = _settings.RabbitMq,
                ExchangeName     = _settings.OrderBooksExchanger,
                QueueName        = $"lykke.exchangeconnector.orderBooks.bitstamp.synthetic-fiat-{Guid.NewGuid()}",
                IsDurable        = false
            };

            return(RmqHelper.ReadAsJson <OrderBook>(settings, _logFactory));
        }
コード例 #3
0
        private IObservable <TickPrice> GetLykkeTickPrices()
        {
            var settings = new RabbitMqSubscriptionSettings
            {
                ConnectionString = _settings.RabbitMq,
                ExchangeName     = _settings.FiatTickPricesExchanger,
                QueueName        = $"{_settings.FiatTickPricesExchanger}.lykke.synthetic-fiat-{Guid.NewGuid()}",
                IsDurable        = false
            };

            var allTicks = RmqHelper.ReadAsJson <TickPrice>(settings, _logFactory);

            if (string.IsNullOrWhiteSpace(_settings.FiatTicksSourceFilter))
            {
                return(allTicks);
            }

            return(allTicks.Where(x => x.Source.Equals(
                                      _settings.FiatTicksSourceFilter,
                                      StringComparison.InvariantCultureIgnoreCase)));
        }