developersajidbashir commited on
Commit
fce63f5
·
verified ·
1 Parent(s): 21f0d1d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -54,7 +54,7 @@ class TradingEnv(gym.Env):
54
  elif action == 2:
55
  reward = self.data['close'].iloc[self.current_step - 1] - self.data['close'].iloc[self.current_step]
56
 
57
- return self._get_observation(), reward, done, {}
58
 
59
  def fetch_data(symbol='ETH', tsym='USD', start_date='2021-01-01', api_key='YOUR_API_KEY'):
60
  start_date = datetime.strptime(start_date, '%Y-%m-%d')
@@ -92,7 +92,7 @@ def load_or_train_model(env):
92
  return model
93
 
94
  def run_model(model, env, data):
95
- obs = env.reset()
96
  dates = data.index[50:]
97
  prices = data['close'][50:]
98
  emas = data['EMA'][50:]
@@ -101,7 +101,7 @@ def run_model(model, env, data):
101
  for date, price, ema in zip(dates, prices, emas):
102
  action, _ = model.predict(obs)
103
  actions.append(action[0])
104
- obs, _, done, _ = env.step(action)
105
  if done:
106
  break
107
 
 
54
  elif action == 2:
55
  reward = self.data['close'].iloc[self.current_step - 1] - self.data['close'].iloc[self.current_step]
56
 
57
+ return self._get_observation(), reward, done, {}, {}
58
 
59
  def fetch_data(symbol='ETH', tsym='USD', start_date='2021-01-01', api_key='YOUR_API_KEY'):
60
  start_date = datetime.strptime(start_date, '%Y-%m-%d')
 
92
  return model
93
 
94
  def run_model(model, env, data):
95
+ obs, _ = env.reset()
96
  dates = data.index[50:]
97
  prices = data['close'][50:]
98
  emas = data['EMA'][50:]
 
101
  for date, price, ema in zip(dates, prices, emas):
102
  action, _ = model.predict(obs)
103
  actions.append(action[0])
104
+ obs, _, done, _, _ = env.step(action)
105
  if done:
106
  break
107