def grade_symbol(self, symbol: str, output: OUTPUT_TYPE) -> SymbolGrade: """Assigns a pass/fail grade depending on whether the model output is True/False.""" # Fail the symbol if it has no output if output is None or not output: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.FAIL) else: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.PASS)
def grade_symbol(self, symbol: str, output: OUTPUT_TYPE) -> SymbolGrade: """ Always assigns a passing grade. """ # Assign a passing grade if the symbol is to be ignored. if output is LongShortFavor.NOT_APPLICABLE: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.PASS) # TEMPORARY: Always assign a passing grade. return SymbolGrade(symbol, self.model_type, SymbolGradeValue.PASS)
def grade_symbol(self, symbol: str, output: OUTPUT_TYPE) -> SymbolGrade: """Returns a grade based on % of profit targets that yield profit in simulation.""" # Fail the symbol if it has no output if output is None: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.FAIL) # Fail the symbol if the median of median daily profits is negligible if median(output.target_med_pct_profits) < 0.05: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.FAIL) # Fail the symbol if the median of average daily profits is negligible if median(output.target_avg_pct_profits) < 0.05: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.FAIL) # Assign the symbol a higher grade for higher profits profits = median(output.target_avg_pct_profits) if profits < 0.07: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.RISKY) elif profits < 0.09: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.UNPROMISING) elif profits < 0.12: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.SATISFACTORY) elif profits < 0.15: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.GOOD) elif profits < 0.2: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.GREAT) else: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.EXCELLENT)
def grade_symbol(self, symbol: str, output: AbstractForgetfulModel.OUTPUT_TYPE) -> SymbolGrade: # Fail the symbol if it has no output if output is None: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.FAIL) # Assign a good grade if strongest percent dip is not too little or too much # Essentially the sweet spot is anywhere between 0.1% and 0.3% if output < 0.025 or output > 0.5: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.FAIL) elif output < 0.05 or output > 0.45: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.RISKY) elif output < 0.075 or output > 0.4: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.UNPROMISING) elif output < 0.125 or output > 0.35: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.GOOD) elif output < 0.15 or output > 0.3: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.GREAT) else: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.EXCELLENT)
def grade_symbol(self, symbol: str, output: OUTPUT_TYPE) -> SymbolGrade: """Assigns a good grade to a high momentum value.""" # Fail the symbol if it has no output if output is None: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.FAIL) # Fail the symbol if price is trending strongly downward if output < -0.5: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.FAIL) # Assign a bad grade if price is trending moderately downward elif output < -0.2: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.RISKY) # Assign a mediocre grade if price is trending somewhat downward elif output < -0.09: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.UNPROMISING) # Assign a neutral grade if price trending flat or up & down elif output < 0.09: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.SATISFACTORY) # Assign a good grade if price is trending somewhat upward elif output < 0.15: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.GOOD) # Assign a great grade if price is trending strongly upward elif output < 0.5: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.GREAT) # Assign a mediocre grade if price is trending strongly upward (because we likely won't catch a price dip) else: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.UNPROMISING)
def grade_symbol(self, symbol: str, output: any) -> SymbolGrade: """Passes the symbol if its average daily price spread is at least 0.8%. Fails otherwise.""" if output is None or output < 0.008: return SymbolGrade(symbol, self.model_type, SymbolGradeValue.FAIL) return SymbolGrade(symbol, self.model_type, SymbolGradeValue.PASS)
def grade_symbol(self, symbol: str, output: OUTPUT_TYPE) -> SymbolGrade: """Returns whether the symbol passed all Breakout1Model checks.""" return SymbolGrade(symbol, self.model_type, SymbolGradeValue.PASS) if output.get_val('status') == 'VIABLE' \ else SymbolGrade(symbol, self.model_type, SymbolGradeValue.FAIL)