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
If your historical and live data are both time-or-scheduler-based, that is, the event stream looks like this over time:
|----------------------------------------------------> time
h h h h h h historical
l l l l l l live
You can use a simple TakeUntil construct:
var historicalStream = ;
var liveStream = ;
var mergedWithoutOverlap =
// pull from historical
historicalStream
// until we start overlapping with live
.TakeUntil(liveStream)
// then continue with live data
.Concat(liveStream);
If you get all your historical data all at once, like a IEnumerable, you can use a combination of StartWith and your other logic:
var historicalData = ;
var liveData = ;
var mergedWithOverlap =
// the observable is the "long running" feed
liveData
// But we'll inject the historical data in front of it
.StartWith(historicalData)
// Perform filtering based on your needs
.Where( .... );