def plot(self): with open(self.save_path + '_history_profits.json', mode='w') as fp: json.dump(self.env.trader.history_profits, fp, indent=True) with open(self.save_path + '_baseline_profits.json', mode='w') as fp: json.dump(self.env.trader.history_baselines, fp, indent=True) data_ploter.plot_profits_series(self.env.trader.history_baselines, self.env.trader.history_profits, self.save_path)
def eval_and_plot(self): s = self.env.reset('eval') while True: a = self.predict(s) a = self.get_a_indices(a) s_next, r, status, info = self.env.forward(a) s = s_next if status == self.env.Done: self.env.trader.log_asset(0) break data_ploter.plot_profits_series( self.env.trader.history_baseline_profits, self.env.trader.history_profits, self.save_path)
def eval_and_plot(self): s = self.env.reset('eval') while True: a = self.predict(s) s_next, r, status, info = self.env.forward(a) s = s_next if status == self.env.Done: self.env.trader.log_asset(0) break with open(self.save_path + '_history_profits.json', mode='w') as fp: json.dump(self.env.trader.history_profits, fp, indent=True) with open(self.save_path + '_baseline_profits.json', mode='w') as fp: json.dump(self.env.trader.history_baseline_profits, fp, indent=True) data_ploter.plot_profits_series( self.env.trader.history_baseline_profits, self.env.trader.history_profits, self.save_path)