示例#1
0
        public QuoteService(IDownLoadService captureService, ITickerStore tickstore, IQuoteCaptureMemStore qcstore, IQuoteBasicMemStore qbstore, IQuoteBasicFileStore filestore,
                            bool isFillGap = false, int numBarsFillGap = 500, int limit = 500)
        {
            //_symbols = new HashSet<string>(symbols);
            _isFillGap      = isFillGap;
            _numBarsFillGap = numBarsFillGap;
            _limit          = limit;
            _tickStore      = tickstore;
            _qcStore        = qcstore;
            _qbStore        = qbstore;
            _fileStore      = filestore;
            _download       = captureService;

            _fileStore.OnQuoteSaved += (object sender, string exchange, string filename)
                                       => Console.WriteLine($"quote saved to {filename}");
            _tickStore.OnTickerUpdated              += _tickStore_OnTickerUpdated;
            _qcStore.OnQuoteCaptureDataAdded        += _qcStore_OnQuoteCaptureDataAdded;
            _qbStore.OnQuoteBasicDataAddedOrUpdated += _qbStore_OnQuoteBasicDataAddedOrUpdated;

            _timerSaveQuote.Interval = 1000;
            _timerSaveQuote.Elapsed += _timer_Elapsed;
            _timerSaveQuote.Start();

            this.ProcessInit();
            this.ProcessUpdate();

            //_consumer = consumer;
            //_consumer.OnReceiveBroadcast += _consumer_OnReceiveBroadcast;
        }
示例#2
0
        static void Main(string[] args)
        {
            IOptionService optionService = new OptionService();

            movingQueue = new List <MovingQueueItem>
            {
                new MovingQueueItem(optionService.SourcePath,
                                    optionService.WorkingSourcePath,
                                    optionService.SourcePatterns),
                new MovingQueueItem(optionService.SourcePath + optionService.SubDirForPhoto,
                                    optionService.WorkingSourcePath + optionService.SubDirForPhoto,
                                    optionService.PhotoPatterns)
            };

            downLoadService = new DownLoadService(600000, 1000, 1000, movingQueue, optionService);
            downLoadService.Start();
            while (Console.ReadKey().Key != ConsoleKey.Escape)
            {
            }
        }