You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if here is the best place to ask a question.
In the _calculate_reward function, the reward does not seem to consider when shorting. Trade is true, but it does not add reward when we short and price goes down or remove reward if price goes up when shorting.
if trade:
current_price = self.prices[self._current_tick]
last_trade_price = self.prices[self._last_trade_tick]
price_diff = current_price - last_trade_price
if self._position == Positions.Long:
step_reward += price_diff
Shouldn't it be changed to:
if trade:
current_price = self.prices[self._current_tick]
last_trade_price = self.prices[self._last_trade_tick]
price_diff = current_price - last_trade_price
if self._position == Positions.Long:
step_reward += price_diff
else:
step_reward -= price_diff # Change here to account for shorting
The text was updated successfully, but these errors were encountered:
Basically in the Stocks Market, we don't trade short. We buy a stock at a low price and sell it at a high price. So I implemented the reward function as you see. But you can inherit the StocksEnv and change the reward function in the way you have mentioned and maybe you get better results.
Or you can do it in a simpler way if you don't want to use inheritance:
Not sure if here is the best place to ask a question.
In the
_calculate_reward
function, the reward does not seem to consider when shorting. Trade is true, but it does not add reward when we short and price goes down or remove reward if price goes up when shorting.Shouldn't it be changed to:
The text was updated successfully, but these errors were encountered: