示例#1
0
        public BackTestWorker(IBaseData baseData, string stockId, Action <string> writeToLogAction, Action <Exception> writeToErrorLogAction, bool alwaysRun = true)
            : base(baseData)
        {
            _baseData = baseData;
            _stockId  = stockId;

            _startDate = baseData.CurrentTime;
            _endDate   = DateTime.Now;

            _writeToLogAction      = writeToLogAction;
            _writeToErrorLogAction = writeToErrorLogAction;

            // create StorageSpace
            _storage = new CurrentPriceStorage();

            // create Turtle Database
            _turtleDbOperations  = new TurtleDatabaseOperations(baseData.SystemConfig.SystemInfo.ProductionTurtleDBConnectionString);
            _memoryDbOperations  = new MemoryDatabaseOperations();
            _prepareMemoryDbTask = Task.Run(() => PrepareMemoryDatabaseAsync());

            //
            _stockPriceNotificationChecker = BaseData.CreateStockPriceNotificationChecker();

            // create EmailService and EmailTemplateProvider
            _logger = BaseData.GetLogger();
            _notificationService          = new BackTestNotificationService(_logger);
            _notificationTemplateProvider = new BackTestNotificationTemplateProvider();
        }
示例#2
0
 public BaseData(CountryKind country, IDateTimeTool2 variableDateTimeTool, ITurtleLogger logger, ISystemConfig systemConfig)
 {
     Country       = country;
     _dateTimeTool = variableDateTimeTool;
     _logger       = logger;
     SystemConfig  = systemConfig;
 }
示例#3
0
 public BaseData(CountryKind country, ITurtleLogger logger, ISystemConfig systemConfig, bool runInTestMode = false)
 {
     Country       = country;
     _dateTimeTool = DateTimeFactory.GenerateDateTimeTool(country);
     _logger       = logger;
     SystemConfig  = systemConfig;
     RunInTestMode = runInTestMode;
 }
示例#4
0
        public static IBaseData CreateBaseDataWithVariableDateTimeTool(CountryKind country, DateTime startDate, ITurtleLogger logger, ISystemConfig systemConfig)
        {
            VariableDateTimeTool dateTool = new VariableDateTimeTool();

            dateTool.SetTime(startDate);

            return(new BaseData(country, dateTool, logger, systemConfig));
        }
示例#5
0
 public static IBaseData CreateBaseData(CountryKind country, ITurtleLogger logger, ISystemConfig systemConfig, bool runInTestMode = false)
 {
     return(new BaseData(country, logger, systemConfig, runInTestMode));
 }
 public BackTestNotificationService(ITurtleLogger logger)
 {
     _records = new List <BackTestBuySellRecord>();
     _logger  = logger;
 }
示例#7
0
 public TurtleEmailService(ITurtleLogger logger, ISMTPInfo smtpInfo)
 {
     _logger   = logger;
     _smtpInfo = smtpInfo;
 }