/// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="logFactory">The <see cref="ILogFactory"/> instance.</param>
 /// <param name="historyRep">The <see cref="ICandlesHistoryRepository"/> instance.</param>
 /// <param name="component">Component name for log.</param>
 // ReSharper disable once MemberCanBeProtected.Global
 public CandlesCheckerSilent(
     ILogFactory logFactory,
     ICandlesHistoryRepository historyRep, string component)
 {
     Log = logFactory.CreateLog(component);
     _candlesHistoryRepository = historyRep;
 }
 public CandlesManager(
     ICandlesCacheService candlesCacheService,
     ICandlesHistoryRepository candlesHistoryRepository)
 {
     _candlesCacheService      = candlesCacheService;
     _candlesHistoryRepository = candlesHistoryRepository;
 }
        public TradesMigrationService(
            ICandlesHistoryRepository candlesHistoryRepository,
            TradesMigrationHealthService tradesMigrationHealthService,
            ILogFactory logFactory,
            IHealthNotifier healthNotifier,
            string sqlConnString,
            int sqlQueryBatchSize,
            TimeSpan sqlTimeout,
            int candlesPersistenceQueueMaxSize
            )
        {
            _candlesHistoryRepository     = candlesHistoryRepository ?? throw new ArgumentNullException(nameof(candlesHistoryRepository));
            _tradesMigrationHealthService = tradesMigrationHealthService ?? throw new ArgumentNullException(nameof(tradesMigrationHealthService));
            _logFactory     = logFactory;
            _healthNotifier = healthNotifier;

            if (logFactory == null)
            {
                throw new ArgumentNullException(nameof(logFactory));
            }

            _log = logFactory.CreateLog(this);

            _sqlConnString     = sqlConnString;
            _sqlQueryBatchSize = sqlQueryBatchSize;
            _sqlTimeout        = sqlTimeout;
            _candlesPersistenceQueueMaxSize = Convert.ToInt32(candlesPersistenceQueueMaxSize * 1.1);  // Safe reserve
        }
示例#4
0
        public CandlesCacheInitalizationService(
            ICandlesCacheSemaphore cacheSem,
            ILogFactory logFactory,
            IAssetPairsManager assetPairsManager,
            IClock clock,
            ICandlesCacheService candlesCacheService,
            ICandlesHistoryRepository candlesHistoryRepository,
            Dictionary <CandleTimeInterval, int> amountOfCandlesToStore,
            MarketType marketType,
            DateTime minDate)
        {
            _cacheSem = cacheSem ?? throw new ArgumentNullException(nameof(cacheSem));

            if (logFactory == null)
            {
                throw new ArgumentNullException(nameof(logFactory));
            }

            _log = logFactory.CreateLog(this);
            _assetPairsManager        = assetPairsManager ?? throw new ArgumentNullException(nameof(assetPairsManager));
            _clock                    = clock ?? throw new ArgumentNullException(nameof(clock));
            _candlesCacheService      = candlesCacheService ?? throw new ArgumentNullException(nameof(candlesCacheService));
            _candlesHistoryRepository = candlesHistoryRepository ?? throw new ArgumentNullException(nameof(candlesHistoryRepository));
            _amountOfCandlesToStore   = amountOfCandlesToStore;
            _marketType               = marketType;
            _minDate                  = minDate;

            InitializationState = CacheInitializationState.Idle;
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="log">The <see cref="ILog"/> instance.</param>
 /// <param name="historyRep">The <see cref="ICandlesHistoryRepository"/> instance.</param>
 // ReSharper disable once MemberCanBeProtected.Global
 public CandlesCheckerSilent(
     ILog log,
     ICandlesHistoryRepository historyRep)
 {
     Log = log;
     _candlesHistoryRepository = historyRep;
 }
 public CandlesHistoryController(
     ICandlesManager candlesManager,
     IAssetPairsManager assetPairsManager,
     ICandlesHistoryRepository candlesHistoryRepository,
     Dictionary <string, string> candleHistoryAssetConnections)
 {
     _candlesManager                = candlesManager;
     _assetPairsManager             = assetPairsManager;
     _candlesHistoryRepository      = candlesHistoryRepository;
     _candleHistoryAssetConnections = candleHistoryAssetConnections;
 }
 public MidPriceFixManager(
     IAssetPairsManager assetPairsManager,
     ICandlesHistoryRepository candlesHistoryRepository,
     ICandlesFiltrationService candlesFiltrationService,
     ILogFactory logFactory
     )
 {
     _assetPairsManager        = assetPairsManager;
     _candlesHistoryRepository = candlesHistoryRepository;
     _candlesFiltrationService = candlesFiltrationService;
     _log = logFactory.CreateLog(this);
 }
        /// <inheritdoc />
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="log">The <see cref="T:Common.Log.ILog" /> instance.</param>
        /// <param name="clock">The <see cref="T:Lykke.Job.CandlesHistoryWriter.Core.Services.IClock" /> instance.</param>
        /// <param name="historyRep">The <see cref="T:Lykke.Job.CandlesHistoryWriter.Core.Domain.Candles.ICandlesHistoryRepository" /> instance.</param>
        /// <param name="notificationTimeout">The timeout in seconds between log notifications for the same asset pair.</param>
        public CandlesChecker(
            ILog log,
            IClock clock,
            ICandlesHistoryRepository historyRep,
            TimeSpan notificationTimeout) : base(
                log,
                historyRep)
        {
            _clock = clock;
            _notificationTimeout = notificationTimeout;

            _knownUnsupportedAssetPairs = new Dictionary <string, DateTime>();
        }
        public CandlesFiltrationManager(
            IAssetPairsManager assetPairsManager,
            ICandlesHistoryRepository candlesHistoryRepository,
            ICandlesFiltrationService candlesFiltrationService,
            ILog log
            )
        {
            _assetPairsManager        = assetPairsManager;
            _candlesHistoryRepository = candlesHistoryRepository;
            _candlesFiltrationService = candlesFiltrationService;
            _log = log;

            Health = null;
        }
示例#10
0
 public RedisCacheTruncator(
     ICandlesHistoryRepository historyRepository,
     IDatabase database,
     MarketType market,
     TimeSpan cacheCleanupPeriod,
     int amountOfCandlesToStore,
     ILog log)
     : base(nameof(RedisCacheTruncator), (int)cacheCleanupPeriod.TotalMilliseconds, log)
 {
     _historyRepository      = historyRepository;
     _database               = database;
     _market                 = market;
     _amountOfCandlesToStore = amountOfCandlesToStore;
 }
示例#11
0
        public CandlesPersistenceQueue(
            ICandlesHistoryRepository repository,
            ILog log,
            IHealthService healthService,
            PersistenceSettings settings) :

            base(nameof(CandlesPersistenceQueue), log)
        {
            _repository        = repository;
            _log               = log;
            _healthService     = healthService;
            _settings          = settings;
            _candlesToDispatch = new ConcurrentQueue <ICandle>();
        }
        public CandlesPersistenceQueue(
            ICandlesHistoryRepository repository,
            ILogFactory logFactory,
            IHealthService healthService,
            PersistenceSettings settings) :

            base(logFactory, nameof(CandlesPersistenceQueue))
        {
            _repository        = repository;
            _log               = logFactory.CreateLog(this);
            _healthService     = healthService;
            _settings          = settings;
            _candlesToDispatch = new ConcurrentQueue <ICandle>();
        }
示例#13
0
 public CandlesCacheInitalizationService(
     ILog log,
     IAssetPairsManager assetPairsManager,
     IClock clock,
     ICandlesCacheService candlesCacheService,
     ICandlesHistoryRepository candlesHistoryRepository,
     int amountOfCandlesToStore)
 {
     _log = log;
     _assetPairsManager        = assetPairsManager;
     _clock                    = clock;
     _candlesCacheService      = candlesCacheService;
     _candlesHistoryRepository = candlesHistoryRepository;
     _amountOfCandlesToStore   = amountOfCandlesToStore;
 }
示例#14
0
 public CandlesCacheInitalizationService(
     ILog log,
     IAssetPairsManager assetPairsManager,
     IClock clock,
     ICandlesCacheService candlesCacheService,
     ICandlesHistoryRepository candlesHistoryRepository,
     ICandlesAmountManager candlesAmountManager,
     ICandlesShardValidator candlesShardValidator)
 {
     _log = log;
     _assetPairsManager        = assetPairsManager;
     _clock                    = clock;
     _candlesCacheService      = candlesCacheService;
     _candlesHistoryRepository = candlesHistoryRepository;
     _candlesAmountManager     = candlesAmountManager;
     _candlesShardValidator    = candlesShardValidator;
 }
            public TradesProcessor(TradesMigrationHealthService healthService, ICandlesHistoryRepository historyRepo, string assetPairId, int persistenceQueueMaxSize, DateTime?upperDateLimit)
            {
                _healthService = healthService ?? throw new ArgumentNullException(nameof(healthService));
                _historyRepo   = historyRepo ?? throw new ArgumentNullException(nameof(_historyRepo));
                _assetPairId   = !string.IsNullOrWhiteSpace(assetPairId)
                    ? assetPairId
                    : throw new ArgumentNullException(nameof(assetPairId));
                _persistenceQueueMaxSize = persistenceQueueMaxSize;
                _upperDateLimit          = upperDateLimit;

                _persistenceCandleQueue = new Dictionary <CandleTimeInterval, List <ICandle> >();
                foreach (var si in Candles.Constants.DbStoredIntervals)
                {
                    _persistenceCandleQueue.Add(si, new List <ICandle>(_persistenceQueueMaxSize));
                }

                _activeCandles = new Dictionary <CandleTimeInterval, ICandle>();
            }
示例#16
0
        public RedisCacheCaretaker(
            ICandlesHistoryRepository historyRepository,
            ICandlesCacheService redisCacheService,
            ICandlesCacheInitalizationService cacheInitalizationService,
            TimeSpan cacheCheckupPeriod,
            Dictionary <CandleTimeInterval, int> amountOfCandlesToStore,
            MarketType marketType,
            ILogFactory logFactory)
        {
            _historyRepository         = historyRepository ?? throw new ArgumentNullException(nameof(historyRepository));
            _redisCacheService         = redisCacheService ?? throw new ArgumentNullException(nameof(redisCacheService));
            _cacheInitalizationService = cacheInitalizationService ?? throw new ArgumentNullException(nameof(cacheInitalizationService));
            _amountOfCandlesToStore    = amountOfCandlesToStore;
            _marketType = marketType;

            _maintainTicker            = new TimerTrigger(nameof(RedisCacheCaretaker), cacheCheckupPeriod, logFactory);
            _maintainTicker.Triggered += MaintainTickerOnTriggered;
        }
示例#17
0
        public TradesMigrationService(
            ICandlesHistoryRepository candlesHistoryRepository,
            TradesMigrationHealthService tradesMigrationHealthService,
            ILog log,
            string sqlConnString,
            int sqlQueryBatchSize,
            TimeSpan sqlTimeout,
            int candlesPersistenceQueueMaxSize
            )
        {
            _candlesHistoryRepository     = candlesHistoryRepository ?? throw new ArgumentNullException(nameof(candlesHistoryRepository));
            _tradesMigrationHealthService = tradesMigrationHealthService ?? throw new ArgumentNullException(nameof(tradesMigrationHealthService));
            _log = log ?? throw new ArgumentNullException(nameof(log));

            _sqlConnString     = sqlConnString;
            _sqlQueryBatchSize = sqlQueryBatchSize;
            _sqlTimeout        = sqlTimeout;
            _candlesPersistenceQueueMaxSize = Convert.ToInt32(candlesPersistenceQueueMaxSize * 1.1);  // Safe reserve
        }
        public CandlesMigrationManager(
            IHealthService healthService,
            MigrationCandlesGenerator candlesGenerator,
            IMissedCandlesGenerator missedCandlesGenerator,
            ICandlesHistoryMigrationService candlesHistoryMigrationService,
            ICandlesPersistenceQueue candlesPersistenceQueue,
            IAssetPairsManager assetPairsManager,
            ICandlesHistoryRepository candlesHistoryRepository,
            ILogFactory logFactory,
            MigrationSettings settings)
        {
            _candlesGenerator               = candlesGenerator;
            _missedCandlesGenerator         = missedCandlesGenerator;
            _candlesHistoryMigrationService = candlesHistoryMigrationService;
            _candlesPersistenceQueue        = candlesPersistenceQueue;
            _assetPairsManager              = assetPairsManager;
            _candlesHistoryRepository       = candlesHistoryRepository;
            _logFactory    = logFactory;
            _settings      = settings;
            _healthService = healthService;

            _assetManagers       = new Dictionary <string, AssetPairMigrationManager>();
            _assetHealthServices = new Dictionary <string, AssetPairMigrationTelemetryService>();
        }
示例#19
0
 public CandlesFiltrationService(ICandlesHistoryRepository candlesHistoryRepository)
 {
     _candlesHistoryRepository = candlesHistoryRepository;
 }