Adaptive.ReactiveTrader.Server.Blotter.BlotterServiceHost.GetTradesStream C# (CSharp) Метод

GetTradesStream() приватный Метод

private GetTradesStream ( IRequestContext context, IMessage message ) : System.Threading.Tasks.Task
context IRequestContext
message IMessage
Результат System.Threading.Tasks.Task
        private async Task GetTradesStream(IRequestContext context, IMessage message)
        {
            Log.Debug("Received GetTradesStream from {username}", context.UserSession.Username ?? "<UNKNOWN USER>");
            var replyTo = message.ReplyTo;

            var endPoint = await _broker.GetPrivateEndPoint<TradesDto>(replyTo);

            _subscription = _service.GetTradesStream()
                .Select(x =>
                {
                    if (x.IsStateOfTheWorld && x.Trades.Count > MaxSotwTrades)
                    {
                        return new TradesDto(new List<TradeDto>(x.Trades.Skip(x.Trades.Count - MaxSotwTrades)), true, false);
                    }
                    return x;
                })
                .Do(o =>
                {
                    Log.Debug(
                        $"Sending trades update to {replyTo}. Count: {o.Trades.Count}. IsStateOfTheWorld: {o.IsStateOfTheWorld}. IsStale: {o.IsStale}");
                })
                .TakeUntil(endPoint.TerminationSignal)
                .Finally(() => Log.Debug("Tidying up subscription from {replyTo}.", replyTo))
                .Subscribe(endPoint);
        }