separate RL install from general FAI install, update docs

This commit is contained in:
robcaulk
2022-10-05 15:58:54 +02:00
parent 9c73411ac2
commit 936ca24482
6 changed files with 29 additions and 16 deletions

View File

@@ -2,7 +2,6 @@ import logging
from pathlib import Path
from typing import Any, Dict
import numpy as np
import torch as th
from freqtrade.freqai.data_kitchen import FreqaiDataKitchen
@@ -81,7 +80,6 @@ class ReinforcementLearner(BaseReinforcementLearningModel):
return -2
pnl = self.get_unrealized_profit()
rew = np.sign(pnl) * (pnl + 1)
factor = 100
# reward agent for entering trades
@@ -109,12 +107,12 @@ class ReinforcementLearner(BaseReinforcementLearningModel):
if action == Actions.Long_exit.value and self._position == Positions.Long:
if pnl > self.profit_aim * self.rr:
factor *= self.rl_config['model_reward_parameters'].get('win_reward_factor', 2)
return float(rew * factor)
return float(pnl * factor)
# close short
if action == Actions.Short_exit.value and self._position == Positions.Short:
if pnl > self.profit_aim * self.rr:
factor *= self.rl_config['model_reward_parameters'].get('win_reward_factor', 2)
return float(rew * factor)
return float(pnl * factor)
return 0.