Esempio n. 1
0
 def _setupSaver(self):
     ''' setup Saver '''
     saverName = self.__config.getOption(CONF_OUTPUT_SECTION, CONF_SAVER)
     setting = self.__config.getSection(CONF_OUTPUT_SECTION)
     if saverName:
         self.__saver = StateSaverFactory.createStateSaver(
             saverName, setting, "%s_%s" %
             (self.__symbol,
              self.__config.getOption(CONF_STRATEGY, CONF_STRATEGY_NAME)))
Esempio n. 2
0
 def _setupSaver(self):
     ''' setup Saver '''
     saverName = self.__config.getOption(CONF_OUTPUT_SECTION, CONF_SAVER)
     setting = self.__config.getSection(CONF_OUTPUT_SECTION)
     if saverName:
         self.__saver = StateSaverFactory.createStateSaver(saverName,
                                                           setting,
                                                           "%s_%s" % (self.__symbol,
                                                                      self.__config.getOption(CONF_STRATEGY, CONF_STRATEGY_NAME)))
Esempio n. 3
0
 def _setupSaver(self):
     ''' setup Saver '''
     saverName = self.__config.getOption(CONF_ULTRAFINANCE_SECTION, CONF_SAVER)
     outputDbPrefix = self.__config.getOption(CONF_ULTRAFINANCE_SECTION, CONF_OUTPUT_DB_PREFIX)
     if saverName:
         self.__saver = StateSaverFactory.createStateSaver(saverName,
                                                           {'db': outputDbPrefix + getBackTestResultDbName(self.__symbols,
                                                                                                           self.__config.getOption(CONF_ULTRAFINANCE_SECTION, CONF_STRATEGY_NAME),
                                                                                                           self.__startTickDate,
                                                                                                           self.__endTradeDate)})
Esempio n. 4
0
 def _setupSaver(self):
     ''' setup Saver '''
     saverName = self.__config.getOption(CONF_ULTRAFINANCE_SECTION, CONF_SAVER)
     outputDb = self.__config.getOption(CONF_ULTRAFINANCE_SECTION, CONF_OUTPUT_DB)
     if saverName:
         self.__saver = StateSaverFactory.createStateSaver(saverName,
                                                           {'db': outputDb},
                                                           getBackTestTableName(self.__symbols,
                                                                                self.__config.getOption(
                                                                                    CONF_ULTRAFINANCE_SECTION,
                                                                                    CONF_STRATEGY_NAME)))
Esempio n. 5
0
    def __getFirstSaver(self):
        ''' get first saver, create it if not exist'''
        saverName = self.__config.getOption(CONF_ULTRAFINANCE_SECTION, CONF_SAVER)
        outputDb = self.__config.getOption(CONF_ULTRAFINANCE_SECTION, CONF_OUTPUT_DB)
        if saverName and len(self.__symbolLists) > 0:
            self.__firstSaver = StateSaverFactory.createStateSaver(saverName,
                                                                   {'db': outputDb},
                                                                   getBackTestTableName(self.__symbolLists[0],
                                                                                        self.__config.getOption(
                                                                                            CONF_ULTRAFINANCE_SECTION,
                                                                                            CONF_STRATEGY_NAME)))

        return self.__firstSaver
Esempio n. 6
0
 def _setupSaver(self):
     ''' setup Saver '''
     saverName = self.__config.getOption(CONF_ULTRAFINANCE_SECTION,
                                         CONF_SAVER)
     outputDbPrefix = self.__config.getOption(CONF_ULTRAFINANCE_SECTION,
                                              CONF_OUTPUT_DB_PREFIX)
     if saverName:
         self.__saver = StateSaverFactory.createStateSaver(
             saverName, {
                 'db':
                 outputDbPrefix + getBackTestResultDbName(
                     self.__symbols,
                     self.__config.getOption(CONF_ULTRAFINANCE_SECTION,
                                             CONF_STRATEGY_NAME),
                     self.__startTickDate, self.__endTradeDate)
             })
Esempio n. 7
0
 def __getSaver(self, tableName):
     ''' get create it if not exist'''
     outputDb = self.settings["backtest.output_db_prefix"] + tableName
     saver = StateSaverFactory.createStateSaver("sql", {'db': outputDb})
     return saver
Esempio n. 8
0
 def __getSaver(self, tableName):
     ''' get create it if not exist'''
     outputDb = self.settings["backtest.output_db_prefix"] + tableName
     saver = StateSaverFactory.createStateSaver("sql", {'db': outputDb})
     return saver