INNER CODE UNIT · Python
sec
adminho/trading-stock-thailand · DeepQ_trade.py:173
sec = datetime.timedelta(seconds=int(time.time() - start_time))
print ("\nCompilation Time : ", str(sec))
print("Training all episode finished!")
print("************************")
print("\n*********Runing on the best action**********")
print("Run agent")
env.reset() # reuse same environment with reset to start trading
terminate = False
s_t = env.first_state
log_agent = []
while(terminate != True):
a_t, qscore = agent.getBestAction(s_t)
_, s_t, terminate = env.step(a_t)
log_agent.append( np.append(qscore, a_t))
port = env.getPortfolio()
file_pic, file_csv, gain = port.report(episode= "agent_run")