You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have two issues while running the code, first one is when I try to run a basic environment. After performing the first action, I receive the following error :
ValueError: too many values to unpack (expected 4)
and when I print the output of env.step(action) :
"No key received:Server Control mode: received <{'action': 'hold'}>"
from btgym import BTgymEnv from policy_gradient import PolicyGradient import numpy as np env = BTgymEnv(filename='../examples/data/DAT_ASCII_EURUSD_M1_2016.csv',) done = False while not done: action = env.action_space.sample() obs, reward, done, info = env.step(action) print(reward)
Second issue is related to the rewards, the are equal to 0 whatever the actions I choose.
The text was updated successfully, but these errors were encountered:
Due to Gym API convention it is essential to call env.reset() before taking steps. Try this way:
from btgym import BTgymEnv
env = BTgymEnv(filename='../examples/data/DAT_ASCII_EURUSD_M1_2016.csv',)
done = False
init_obs = env.reset()
while not done:
action = env.action_space.sample()
obs, reward, done, info = env.step(action)
print('action: {}\nreward: {}\ninfo: {}'.format(action, reward, info))
env.close()
Anyway error message you receive trying to run uninitialised environment should be more informative. Need to sort it out.
As for zero-reward, see related question: #27 .
Pay attention to broker message part of info output when running script above - you'll see 'ORDER FAILED with status: Margin', cause no sufficient cash has been set.
I have two issues while running the code, first one is when I try to run a basic environment. After performing the first action, I receive the following error :
ValueError: too many values to unpack (expected 4)
and when I print the output of env.step(action) :
"No key received:Server Control mode: received <{'action': 'hold'}>"
from btgym import BTgymEnv from policy_gradient import PolicyGradient import numpy as np env = BTgymEnv(filename='../examples/data/DAT_ASCII_EURUSD_M1_2016.csv',) done = False while not done: action = env.action_space.sample() obs, reward, done, info = env.step(action) print(reward)
Second issue is related to the rewards, the are equal to 0 whatever the actions I choose.
The text was updated successfully, but these errors were encountered: