Skip to content

Commit

Permalink
Add asset_held to account_history.
Browse files Browse the repository at this point in the history
  • Loading branch information
notadamking committed Jul 11, 2019
1 parent a7e8ff7 commit a2a8a6a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/env/TradingEnv.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __init__(self,
self.n_discrete_actions: int = kwargs.get('n_discrete_actions', 24)
self.action_space = spaces.Discrete(self.n_discrete_actions)

self.n_features = 5 + len(self.data_provider.columns)
self.n_features = 6 + len(self.data_provider.columns)
self.obs_shape = (1, self.n_features)
self.observation_space = spaces.Box(low=0, high=1, shape=self.obs_shape, dtype=np.float16)

Expand Down Expand Up @@ -124,6 +124,7 @@ def _take_action(self, action: int):
self.net_worths.append(current_net_worth)
self.account_history = self.account_history.append({
'balance': self.balance,
'asset_held': self.asset_held,
'asset_bought': asset_bought,
'purchase_cost': purchase_cost,
'asset_sold': asset_sold,
Expand Down Expand Up @@ -202,6 +203,7 @@ def reset(self):

self.account_history = pd.DataFrame([{
'balance': self.balance,
'asset_held': self.asset_held,
'asset_bought': 0,
'purchase_cost': 0,
'asset_sold': 0,
Expand Down

0 comments on commit a2a8a6a

Please sign in to comment.