Merge pull request #7836 from freqtrade/fix-fees-rl

fix fees RL
This commit is contained in:
Matthias 2022-12-02 06:15:20 +01:00 committed by GitHub
commit 8a078a328e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -194,12 +194,12 @@ class BaseEnvironment(gym.Env):
if self._position == Positions.Neutral: if self._position == Positions.Neutral:
return 0. return 0.
elif self._position == Positions.Short: elif self._position == Positions.Short:
current_price = self.add_exit_fee(self.prices.iloc[self._current_tick].open)
last_trade_price = self.add_entry_fee(self.prices.iloc[self._last_trade_tick].open)
return (last_trade_price - current_price) / last_trade_price
elif self._position == Positions.Long:
current_price = self.add_entry_fee(self.prices.iloc[self._current_tick].open) current_price = self.add_entry_fee(self.prices.iloc[self._current_tick].open)
last_trade_price = self.add_exit_fee(self.prices.iloc[self._last_trade_tick].open) last_trade_price = self.add_exit_fee(self.prices.iloc[self._last_trade_tick].open)
return (last_trade_price - current_price) / last_trade_price
elif self._position == Positions.Long:
current_price = self.add_exit_fee(self.prices.iloc[self._current_tick].open)
last_trade_price = self.add_entry_fee(self.prices.iloc[self._last_trade_tick].open)
return (current_price - last_trade_price) / last_trade_price return (current_price - last_trade_price) / last_trade_price
else: else:
return 0. return 0.