def test_OptimizeParamsWithEvents(self): """[summary]Check optimized-params are ordered by performance """ createdf.connectandsave(num_data=300) opt = ai.Optimize(eval("Candle_1h")) optimizedparamswithevents = opt.OptimizeParamsWithEvent() print(optimizedparamswithevents)
def test_OptimizeEma(self): createdf.connectandsave(num_data=500) opt = ai.Optimize(eval("Candle_1h")) events, performance, bestperiod1, bestperiod2 = opt.OptimizeEma() print(events) print(f"bestperiods={bestperiod1, bestperiod2}") self.assertEqual(performance >= 0, True)
def test_OptimizeParams(self): """[summary]Check optimized-params are ordered by performance """ createdf.connectandsave() opt = ai.Optimize(eval("Candle_1h")) optimizedparams = opt.OptimizeParams() print(optimizedparams) ks = optimizedparams.keys() length = len(list(ks)) for i in range(length - 1): k_1 = list(ks)[i] k_2 = list(ks)[i + 1] p_1 = optimizedparams[k_1]["performance"] p_2 = optimizedparams[k_2]["performance"] b = p_1 >= p_2 self.assertEqual(b, True)
def test_OptimizeRdi(self): createdf.connectandsave() opt = ai.Optimize(eval("Candle_1h")) events, performance, bestperiod, bestBuyThread, bestSellThreadd = opt.OptimizeRsi( ) self.assertEqual(performance >= 0, True)
def test_Optimize_Macd(self): createdf.connectandsave() opt = ai.Optimize(eval("Candle_1h")) events, performance, bestMacdFastPeriod, bestMacdSlowPeriod, bestMacdSignalPeriod = opt.OptimizeMacd( ) self.assertEqual(performance >= 0, True)
def test_Optimize_BB(self): createdf.connectandsave() opt = ai.Optimize(eval("Candle_1h")) events, performance, bestperiod1, bestperiod2 = opt.OptimizeBb() self.assertEqual(performance >= 0, True)