public IndexCalculator(string indexName, TimeSpan indexCalculationInterval, ISettingsService settingsService, IIndexStateRepository indexStateRepository, IIndexHistoryRepository indexHistoryRepository, ITickPricesService tickPricesService, ICoinMarketCapService coinMarketCapService, ITickPricePublisher tickPricePublisher, IWarningRepository warningRepository, IFirstStateAfterResetTimeRepository firstStateAfterResetTimeRepository, IIndexHandler indexHandler, ILogFactory logFactory) { _lastRebuild = DateTime.UtcNow.Date; _allMarketCaps = new List <AssetMarketCap>(); _topAssets = new List <string>(); _lastTopAssetMarketCaps = new ConcurrentDictionary <string, decimal>(); _indexName = indexName; _trigger = new TimerTrigger(nameof(IndexCalculator), indexCalculationInterval, logFactory, TimerHandlerAsync); _settingsService = settingsService; _indexStateRepository = indexStateRepository; _indexHistoryRepository = indexHistoryRepository; _tickPricesService = tickPricesService; _coinMarketCapService = coinMarketCapService; _tickPricePublisher = tickPricePublisher; _warningRepository = warningRepository; _firstStateAfterResetTimeRepository = firstStateAfterResetTimeRepository; _indexHandler = indexHandler; _log = logFactory.CreateLog(this); }
private void InitializeIndexHandler() { var indexHandler = new Mock <IIndexHandler>(); indexHandler.Setup(o => o.HandleAsync(It.IsAny <IndexHistory>())); _indexHandler = indexHandler.Object; }
public IndexTickPriceSubscriber( SubscriberSettings settings, IIndexHandler indexHandler, ILogFactory logFactory) { _settings = settings; _indexHandler = indexHandler; _logFactory = logFactory; _log = logFactory.CreateLog(this); }
public async Task <object> Get([FromHeader(Name = "Content-Type")] string contentTypeHeader) { if (string.IsNullOrEmpty(contentTypeHeader)) { contentTypeHeader = new StringValues("application/json"); } HttpContext.Response.Headers.Add("Content-Type", contentTypeHeader); IIndexHandler handler = IndexHandler.GetInstance(contentTypeHeader); return(await handler.Get(_environment.EnvironmentName, HttpContext)); }
public void SetSuccessor(IIndexHandler successor) { this.successor = successor; }