Fix 4ac update_total_profit

_update_total_profit() must be executed before "self._position = Positions.Neutral" because _update_total_profit() calls get_unrealized_profit(), which returns 0 if position is neutral and total_profit is not updated
This commit is contained in:
stm 2022-11-26 23:35:20 +03:00 committed by GitHub
parent b52f05923a
commit 51d21b413d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,8 +73,8 @@ class Base4ActionRLEnv(BaseEnvironment):
trade_type = "short"
self._last_trade_tick = self._current_tick
elif action == Actions.Exit.value:
self._position = Positions.Neutral
self._update_total_profit()
self._position = Positions.Neutral
trade_type = "neutral"
self._last_trade_tick = None
else: