private void InitializeTickPricePublisher() { var tickPricePublisher = new Mock <ITickPricePublisher>(); tickPricePublisher.Setup(o => o.Publish(It.IsAny <Contract.IndexTickPrice>())) .Callback((Contract.IndexTickPrice indexTickPrice) => { AssertPublishedIndex(indexTickPrice); _step++; }); _tickPricePublisher = tickPricePublisher.Object; }
public FakeExchange( IBalancesService balancesService, IClientOrdersService clientOrdersService, IOrderBookPublisher orderBookPublisher, ITickPricePublisher tickPricePublisher, bool matchExternalOrderBooks, string exchangeName) { _balancesService = balancesService; _clientOrdersService = clientOrdersService; _orderBookPublisher = orderBookPublisher; _tickPricePublisher = tickPricePublisher; _matchExternalOrderBooks = matchExternalOrderBooks; _exchangeName = exchangeName; }
public IndexCalculator(string indexName, string shortIndexName, bool isShortIndexEnabled, 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; _shortIndexName = shortIndexName; _isShortIndexEnabled = isShortIndexEnabled; _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 MyPeriodicalHandler(ILogFactory logFactory, IFxGeteRestClient fxGeteRestClient, ITickPricePublisher pricePublisher, TimeSpan interval) { _fxGeteRestClient = fxGeteRestClient; _pricePublisher = pricePublisher; _timerTrigger = new TimerTrigger(nameof(MyPeriodicalHandler), interval, logFactory); _timerTrigger.Triggered += Execute; _nextForcePush = DateTime.UtcNow; }