MCPcopy
hub / github.com/notadamking/RLTrader / reset

Method reset

lib/env/TradingEnv.py:193–215  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

191 return obs
192
193 def reset(self):
194 self.data_provider.reset_ohlcv_index()
195
196 self.balance = self.initial_balance
197 self.net_worths = [self.initial_balance]
198 self.timestamps = []
199 self.asset_held = 0
200 self.current_step = 0
201
202 self.reward_strategy.reset_reward()
203
204 self.account_history = pd.DataFrame([{
205 'balance': self.balance,
206 'asset_held': self.asset_held,
207 'asset_bought': 0,
208 'purchase_cost': 0,
209 'asset_sold': 0,
210 'sale_revenue': 0,
211 }])
212 self.trades = []
213 self.rewards = [0]
214
215 return self._next_observation()
216
217 def step(self, action):
218 self._take_action(action)

Callers 2

optimize_paramsMethod · 0.80
testMethod · 0.80

Calls 3

_next_observationMethod · 0.95
reset_ohlcv_indexMethod · 0.45
reset_rewardMethod · 0.45

Tested by

no test coverage detected