def recreate_all_codes(self, codes, create_start_date, end):
     DB_CLIENT.remove_all_from(self.repo_name())
     DB_CLIENT.create_index_for_collection_with_date_and_code(
         self.repo_name())
     start = date_time_utils.Date.from_str(create_start_date)
     end = date_time_utils.Date.from_str(end)
     executor.execute_tasks(codes, self.update_for_single_code,
                            start.as_str(), end.as_str())
    def recreate_all_codes(self, start_date, end):
        DB_CLIENT.remove_all_from(self.repo_name_for_backtest())
        DB_CLIENT.remove_all_from(self.repo_name_for_trade())
        DB_CLIENT.create_index_for_collection_with_date_and_code(self.repo_name_for_backtest())
        DB_CLIENT.create_index_for_collection_with_date_and_code(self.repo_name_for_trade())

        code_list = SECURITY_DATA_READ_SERVICE.read_security_codes()
        start = date_time_utils.Date.from_str(start_date)
        end = date_time_utils.Date.from_str(end)
        executor.execute_tasks(code_list, self.update_for_single_code, start.as_str(), end.as_str())
Exemple #3
0
 def refetch_and_save_bars(self,
                           typ: SeType,
                           freq: SeFreq = SeFreq.DAY,
                           codes=None):
     if codes is None:
         if self.__confirm_drop():
             self.drop_bar_repo(typ, freq)
             print('删除完成。')
             codes = self.read_security_codes(typ)
         else:
             print("操作已取消。")
             return
     else:
         DB_CLIENT.remove_all_from(typ.repo_name(freq),
                                   query={'code': {
                                       '$in': codes
                                   }})
     DB_CLIENT.create_index(typ.repo_name(freq), freq.keys_to_index())
     end = date_time_utils.Date()
     start = date_time_utils.Date.from_str(MIN_START_TIME)
     executor.execute_tasks(codes, self.do_fetch_and_save_bars, typ,
                            start.as_str(), end.as_str(), freq)
 def remove_all(self, codes):
     DB_CLIENT.remove_all_from(self.repo_name(),
                               query={'code': {
                                   '$in': codes
                               }})