public IObservable <IEnumerable <TradeDto> > GetTradesStream()
 {
     return(_serviceClient.CreateStreamOperation <NothingDto, TradesDto>("getTradesStream", new NothingDto())
            .Where(x => x.IsStateOfTheWorld || x.Trades.All(t => t.Status != TradeStatusDto.Pending)) // A bit of a hack to get around the fact that old clients don't like the way the new server provides two responses for each trade
            .Select(x => x.Trades)
            .Do(x => _log.InfoFormat("Subscribed to trades and received {0} trades.", x.Count)));
 }
示例#2
0
        public IObservable <PriceDto> GetSpotStream(string currencyPair)
        {
            if (string.IsNullOrEmpty(currencyPair))
            {
                throw new ArgumentException("currencyPair");
            }

            var request = new GetSpotStreamRequestDto {
                Symbol = currencyPair
            };

            _log.Info($"Subscribing to prices for ccy pair {currencyPair}");

            return(_serviceClient.CreateStreamOperation <GetSpotStreamRequestDto, PriceDto>("getPriceUpdates", request));
        }
示例#3
0
 public IObservable <IEnumerable <CurrencyPairUpdateDto> > GetCurrencyPairUpdatesStream()
 {
     return(_serviceClient.CreateStreamOperation <NothingDto, CurrencyPairUpdatesDto>("getCurrencyPairUpdatesStream", new NothingDto())
            .Select(x => x.Updates)
            .Do(x => _log.InfoFormat("Subscribed to currency pairs and received {0} currency pairs.", x.Count)));
 }