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
Hello,
I'm still getting acquainted with OpenAI Gym, so I'm not entirely sure about this issue, but it's possible that for each step, the _next_observation method is sending the next (future) 5 candles information, instead of the last five candles.
def _next_observation(self):
# Get the stock data points for the last 5 days and scale to between 0-1
frame = np.array([
self.df.loc[self.current_step: self.current_step +
5, 'Open'].values / MAX_SHARE_PRICE,
self.df.loc[self.current_step: self.current_step +
5, 'High'].values / MAX_SHARE_PRICE,
self.df.loc[self.current_step: self.current_step +
5, 'Low'].values / MAX_SHARE_PRICE,
self.df.loc[self.current_step: self.current_step +
5, 'Close'].values / MAX_SHARE_PRICE,
self.df.loc[self.current_step: self.current_step +
5, 'Volume'].values / MAX_NUM_SHARES,
])
This is the first 6 days of the dataframe (AAPL.csv):
Index
Date
Open
High
Low
Close
Volume
0
1998-01-02
13.63
16.25
13.50
16.25
6411700.0
1
1998-01-05
16.50
16.56
15.19
15.88
5820300.0
2
1998-01-06
15.94
20.00
14.75
18.94
16182800.0
3
1998-01-07
18.81
19.00
17.31
17.50
9300200.0
4
1998-01-08
17.44
18.62
16.94
18.19
6910900.0
5
1998-01-09
18.12
19.37
17.50
18.19
7915600.0
Setting the self.current_step to 0, and printing the frame array:
If you check the DF you will see that those are the next 5 future prices/volume for the next steps. Logic applies to all following steps as well, not limited to step 0.
The text was updated successfully, but these errors were encountered:
Hello,
I'm still getting acquainted with OpenAI Gym, so I'm not entirely sure about this issue, but it's possible that for each step, the _next_observation method is sending the next (future) 5 candles information, instead of the last five candles.
This is the first 6 days of the dataframe (AAPL.csv):
Setting the
self.current_step
to 0, and printing theframe
array:If we remove the normalization:
If you check the DF you will see that those are the next 5 future prices/volume for the next steps. Logic applies to all following steps as well, not limited to step 0.
The text was updated successfully, but these errors were encountered: