mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-19 14:21:15 +00:00
improve typing, improve docstrings, ensure global tests pass
This commit is contained in:
@@ -19,7 +19,15 @@ class ReinforcementLearner(BaseReinforcementLearningModel):
|
||||
"""
|
||||
|
||||
def fit(self, data_dictionary: Dict[str, Any], dk: FreqaiDataKitchen, **kwargs):
|
||||
|
||||
"""
|
||||
User customizable fit method
|
||||
:params:
|
||||
data_dictionary: dict = common data dictionary containing all train/test
|
||||
features/labels/weights.
|
||||
dk: FreqaiDatakitchen = data kitchen for current pair.
|
||||
:returns:
|
||||
model: Any = trained model to be used for inference in dry/live/backtesting
|
||||
"""
|
||||
train_df = data_dictionary["train_features"]
|
||||
total_timesteps = self.freqai_info["rl_config"]["train_cycles"] * len(train_df)
|
||||
|
||||
@@ -59,7 +67,15 @@ class ReinforcementLearner(BaseReinforcementLearningModel):
|
||||
"""
|
||||
|
||||
def calculate_reward(self, action):
|
||||
|
||||
"""
|
||||
An example reward function. This is the one function that users will likely
|
||||
wish to inject their own creativity into.
|
||||
:params:
|
||||
action: int = The action made by the agent for the current candle.
|
||||
:returns:
|
||||
float = the reward to give to the agent for current step (used for optimization
|
||||
of weights in NN)
|
||||
"""
|
||||
# first, penalize if the action is not valid
|
||||
if not self._is_valid(action):
|
||||
return -2
|
||||
|
||||
Reference in New Issue
Block a user