mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Update Base5ActionRLEnv.py
Addition of action_space_type to support Discrete and Box action spaces.
This commit is contained in:
parent
07fba3abb0
commit
dc5766fb10
|
@ -24,10 +24,16 @@ class Base5ActionRLEnv(BaseEnvironment):
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
self.action_space_type = action_space_type
|
||||||
self.actions = Actions
|
self.actions = Actions
|
||||||
|
|
||||||
def set_action_space(self):
|
def set_action_space(self):
|
||||||
self.action_space = spaces.Discrete(len(Actions))
|
if self.action_space_type == "Discrete":
|
||||||
|
self.action_space = spaces.Discrete(len(Actions))
|
||||||
|
elif self.action_space_type == "Box":
|
||||||
|
self.action_space = spaces.Box(low=-1, high=1, shape=(1,))
|
||||||
|
else:
|
||||||
|
raise ValueError(f"Unknown action space type: {self.action_space_type}")
|
||||||
|
|
||||||
def step(self, action: int):
|
def step(self, action: int):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user