Improve typehints / reduce warnings from mypy
This commit is contained in:
parent
81fd2e588f
commit
bdfedb5fcb
@ -103,7 +103,7 @@ class Base4ActionRLEnv(BaseEnvironment):
|
|||||||
|
|
||||||
return observation, step_reward, self._done, info
|
return observation, step_reward, self._done, info
|
||||||
|
|
||||||
def is_tradesignal(self, action: int):
|
def is_tradesignal(self, action: int) -> bool:
|
||||||
"""
|
"""
|
||||||
Determine if the signal is a trade signal
|
Determine if the signal is a trade signal
|
||||||
e.g.: agent wants a Actions.Long_exit while it is in a Positions.short
|
e.g.: agent wants a Actions.Long_exit while it is in a Positions.short
|
||||||
@ -117,7 +117,7 @@ class Base4ActionRLEnv(BaseEnvironment):
|
|||||||
(action == Actions.Long_enter.value and self._position == Positions.Long) or
|
(action == Actions.Long_enter.value and self._position == Positions.Long) or
|
||||||
(action == Actions.Long_enter.value and self._position == Positions.Short))
|
(action == Actions.Long_enter.value and self._position == Positions.Short))
|
||||||
|
|
||||||
def _is_valid(self, action: int):
|
def _is_valid(self, action: int) -> bool:
|
||||||
"""
|
"""
|
||||||
Determine if the signal is valid.
|
Determine if the signal is valid.
|
||||||
e.g.: agent wants a Actions.Long_exit while it is in a Positions.short
|
e.g.: agent wants a Actions.Long_exit while it is in a Positions.short
|
||||||
|
@ -141,7 +141,7 @@ class Base5ActionRLEnv(BaseEnvironment):
|
|||||||
else:
|
else:
|
||||||
return self._current_tick - self._last_trade_tick
|
return self._current_tick - self._last_trade_tick
|
||||||
|
|
||||||
def is_tradesignal(self, action: int):
|
def is_tradesignal(self, action: int) -> bool:
|
||||||
"""
|
"""
|
||||||
Determine if the signal is a trade signal
|
Determine if the signal is a trade signal
|
||||||
e.g.: agent wants a Actions.Long_exit while it is in a Positions.short
|
e.g.: agent wants a Actions.Long_exit while it is in a Positions.short
|
||||||
|
@ -200,13 +200,13 @@ class BaseEnvironment(gym.Env):
|
|||||||
return 0.
|
return 0.
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def is_tradesignal(self, action: int):
|
def is_tradesignal(self, action: int) -> bool:
|
||||||
"""
|
"""
|
||||||
Determine if the signal is a trade signal. This is
|
Determine if the signal is a trade signal. This is
|
||||||
unique to the actions in the environment, and therefore must be
|
unique to the actions in the environment, and therefore must be
|
||||||
inherited.
|
inherited.
|
||||||
"""
|
"""
|
||||||
return
|
return True
|
||||||
|
|
||||||
def _is_valid(self, action: int) -> bool:
|
def _is_valid(self, action: int) -> bool:
|
||||||
"""
|
"""
|
||||||
|
@ -38,7 +38,7 @@ class BaseReinforcementLearningModel(IFreqaiModel):
|
|||||||
User created Reinforcement Learning Model prediction class
|
User created Reinforcement Learning Model prediction class
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs) -> None:
|
||||||
super().__init__(config=kwargs['config'])
|
super().__init__(config=kwargs['config'])
|
||||||
self.max_threads = min(self.freqai_info['rl_config'].get(
|
self.max_threads = min(self.freqai_info['rl_config'].get(
|
||||||
'cpu_count', 1), max(int(self.max_system_threads / 2), 1))
|
'cpu_count', 1), max(int(self.max_system_threads / 2), 1))
|
||||||
|
Loading…
Reference in New Issue
Block a user