tf_deep_rl_trader icon indicating copy to clipboard operation
tf_deep_rl_trader copied to clipboard

how to print the number of long and short trade when an episode is finished?

Open greg2paris opened this issue 5 years ago • 0 comments

Hi, thank you again for your work. I have tried to put the number of trades inside the episode_finished function, but i cant find a good solution to do it. This is what I tried :

def episode_finished(r):
    reward = "%.6f" % (r.episode_rewards[-1])
    print("Finished episode {ep} of {totalep} after {ts} timesteps (reward: {reward})".format(ep=r.episode, ts=r.episode_timestep,
                                                                                 reward=reward, totalep=episodes_number))
    #print("with {l} long position and {s} short".format(l=long, s=short))
    #print("with {l} long position and short".format(l=n_long))
    #print("info:", info)
    
    if np.mean(r.episode_rewards[-1]) > 0 :
        r.agent.save_model(SAVE_DIR, append_timestep=False)
    return True

greg2paris avatar Apr 13 '19 11:04 greg2paris