private async Task <Dictionary <SubscriptionInfo, StockQueryResult> > GetSubscriptionNeedRefreshing(IList <SubscriptionInfo> subscriptions)
        {
            var results = new Dictionary <SubscriptionInfo, StockQueryResult>();

            foreach (var info in subscriptions)
            {
                IQueryContext queryContext = info.Query.CreateContext(_contextFactory);

                StockQueryResult queryResult = await queryContext.GetCachedQueryResult(info.Query.SymbolId);

                bool queryNeedsRefresh = queryResult == null || info.Query.FunctionType.IsExpired(queryResult.Data.LastUpdated, DateTime.UtcNow);

                if (queryNeedsRefresh)
                {
                    results.Add(info, queryResult);
                }
            }

            return(results);
        }
예제 #2
0
 internal void RegisterLoser(StockQueryResult entry)
 {
     _loser = entry;
 }
예제 #3
0
 internal void RegisterGainer(StockQueryResult entry)
 {
     _gainer = entry;
 }
예제 #4
0
 internal void RegisterActive(StockQueryResult entry)
 {
     _active = entry;
 }
예제 #5
0
 private Task <List <StockQueryResult> > Get(StockQueryResult result)
 {
     return(Task.FromResult(new List <StockQueryResult> {
         result
     }));
 }
 public void PublishStockQueuedResponse(StockQueryResult message)
 {
     this.Publish(message, this._connectionSettings.StockRequestCalculationResponseQueu, "amq.fanout");
 }