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); }
public IndexHistoryController(IIndexHistoryRepository indexHistoryRepository, IFirstStateAfterResetTimeRepository firstStateAfterResetTimeRepository, IIndexCalculator indexCalculator) { _indexHistoryRepository = indexHistoryRepository; _firstStateAfterResetTimeRepository = firstStateAfterResetTimeRepository; _indexCalculator = indexCalculator; }
private void InitializeFirstStateAfterResetTimeRepository() { var indexFirstStateAfterResetTimeRepository = new Mock <IFirstStateAfterResetTimeRepository>(); indexFirstStateAfterResetTimeRepository.Setup(o => o.GetAsync()) .Returns(() => Task.FromResult(_resetTimestamp)); indexFirstStateAfterResetTimeRepository.Setup(o => o.SetAsync(It.IsAny <DateTime>())) .Returns((DateTime timestamp) => { _resetTimestamp = timestamp; return(Task.CompletedTask); }); _firstStateAfterResetTimeRepository = indexFirstStateAfterResetTimeRepository.Object; }