I\'m trying out Rx because it seems like a good fit for our domain but the learning curve has taken me by surprise.
I need to knit together historical price data wit
A convenient way in terms of memory and trades overlapping (correctness).
Waiting for your feedback:
var tradeIds = new HashSet();
var replayQuotationTrades = new ReplaySubject();
var replaySubscription = _quotationTrades.Subscribe(replayQuotationTrades);
return _historyTrades
.DelaySubscription(TimeSpan.FromMilliseconds(500), _backgroundScheduler)
.Do(t => tradeIds.Add(t.TradeId))
.Finally(() => DisposeAndCompleteReplayStream(replaySubscription, replayQuotationTrades))
.Concat(replayQuotationTrades.Where(t => !tradeIds.Contains(t.TradeId)))
.Finally(tradeIds.Clear)
.Concat(_quotationTrades)
.Subscribe(observer);