Closed javimontero closed 2 years ago
This code should work.
# pip install gym-anytrading ray 'ray[rllib]'
import gym
from gym_anytrading.envs import ForexEnv
from gym_anytrading.datasets import FOREX_EURUSD_1H_ASK
import ray
from ray.rllib.agents import ppo
from ray.tune.registry import register_env
def env_creator(env_config):
return ForexEnv(
df=FOREX_EURUSD_1H_ASK,
window_size=12,
frame_bound=(12, len(FOREX_EURUSD_1H_ASK))
)
ray.init()
register_env('my_env', env_creator)
trainer = ppo.PPOTrainer(env='my_env')
while True:
print(trainer.train())
Thanks, this has inspired me to try out ray. Rgds KM
On Fri, 29 Oct 2021 at 18:39, Mohammad Amin Haghpanah < @.***> wrote:
This code should work.
pip install gym-anytrading ray 'ray[rllib]'
import gymfrom gym_anytrading.envs import ForexEnvfrom gym_anytrading.datasets import FOREX_EURUSD_1H_ASK import rayfrom ray.rllib.agents import ppofrom ray.tune.registry import register_env
def env_creator(env_config): return ForexEnv( df=FOREX_EURUSD_1H_ASK, window_size=12, frame_bound=(12, len(FOREX_EURUSD_1H_ASK)) )
ray.init()register_env('my_env', env_creator)trainer = ppo.PPOTrainer(env='my_env') while True: print(trainer.train())
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/AminHP/gym-anytrading/issues/52#issuecomment-954888379, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7JXSZET62KHHJKFJ5DDDLUJLE4DANCNFSM5GXHK5SA .
--
Kudakwashe Mafutah [image: https://]about.me/kmafutah https://about.me/kmafutah?promo=email_sig&utm_source=product&utm_medium=email_sig&utm_campaign=edit_panel&utm_content=plaintext
I am struggling on how to use this environment with Ray's RLLIB.
Any idea or sample?