Exemplo n.º 1
0
 def delete_wrong_lines_from_trades_log(self):
     file_path = self.get_file_path_for_log_type(LOGT.TRADES)
     line_to_keep_list = []
     with open(file_path, 'r') as file:
         for line in file.readlines():
             log_line = FileLogLine(line)
             if log_line.is_valid:
                 if log_line.step == 'Sell':
                     comment_obj = LogComment(log_line.comment)
                     if comment_obj.result not in ['', '-100.00%']:
                         line_to_keep_list.append(line)
                 else:
                     line_to_keep_list.append(line)
     self.__replace_file_when_changed__(file_path, line_to_keep_list)
Exemplo n.º 2
0
 def __add_trade_line_to_data_dict__(data_dict, line: str):
     log_line = FileLogLine(line)
     if log_line.step != 'Sell':
         return
     comment_obj = LogComment(log_line.comment)
     if comment_obj.result == '':
         return
     data_dict[DC.PATTERN_RANGE_BEGIN_DT].append(log_line.date_time)
     data_dict[DC.SELL_TIME].append(log_line.time)
     data_dict['Process'].append(log_line.process)
     data_dict['Step'].append(log_line.step)
     data_dict[DC.TICKER_ID].append(comment_obj.symbol)
     data_dict[DC.PATTERN_TYPE].append(comment_obj.pattern)
     data_dict[DC.TRADE_STRATEGY].append(comment_obj.strategy)
     data_dict[DC.PATTERN_RANGE_BEGIN_TIME].append(comment_obj.start)
     data_dict[DC.PATTERN_RANGE_END_TIME].append(comment_obj.end)
     data_dict[DC.TRADE_PROCESS].append(comment_obj.trade_type)
     data_dict[DC.TRADE_RESULT_PCT].append(comment_obj.result_pct)
     data_dict[DC.TRADE_RESULT].append(comment_obj.result_summary)
     data_dict[DC.TRADE_RESULT_ID].append(comment_obj.result_id)
 def __get_pattern_type_from_comment__(comment: str):
     return LogComment(comment).get_value_for_log_column(LOGDC.PATTERN)
 def __get_symbol_from_comment__(comment: str):
     return LogComment(comment).get_value_for_log_column(LOGDC.SYMBOL)