Skip to content

Commit 02d4115

Browse files
committed
update
1 parent 6793831 commit 02d4115

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

tf2.0/keras_trader.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,13 @@ def step(self, action):
184184
# get current value before performing the action
185185
prev_val = self._get_val()
186186

187+
# perform the trade
188+
self._trade(action)
189+
187190
# update price, i.e. go to the next day
188191
self.cur_step += 1
189192
self.stock_price = self.stock_price_history[self.cur_step]
190193

191-
# perform the trade
192-
self._trade(action)
193-
194194
# get the new value after taking the action
195195
cur_val = self._get_val()
196196

tf2.0/mlp_trader.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,13 @@ def step(self, action):
165165
# get current value before performing the action
166166
prev_val = self._get_val()
167167

168+
# perform the trade
169+
self._trade(action)
170+
168171
# update price, i.e. go to the next day
169172
self.cur_step += 1
170173
self.stock_price = self.stock_price_history[self.cur_step]
171174

172-
# perform the trade
173-
self._trade(action)
174-
175175
# get the new value after taking the action
176176
cur_val = self._get_val()
177177

tf2.0/rl_trader.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,13 @@ def step(self, action):
177177
# get current value before performing the action
178178
prev_val = self._get_val()
179179

180+
# perform the trade
181+
self._trade(action)
182+
180183
# update price, i.e. go to the next day
181184
self.cur_step += 1
182185
self.stock_price = self.stock_price_history[self.cur_step]
183186

184-
# perform the trade
185-
self._trade(action)
186-
187187
# get the new value after taking the action
188188
cur_val = self._get_val()
189189

@@ -411,4 +411,4 @@ def play_one_episode(agent, env, is_train):
411411

412412

413413
# save portfolio value for each episode
414-
np.save(f'{rewards_folder}/{args.mode}.npy', portfolio_value)
414+
np.save(f'{rewards_folder}/{args.mode}.npy', portfolio_value)

0 commit comments

Comments
 (0)