Skip to content

Commit a2a8a6a

Browse files
committed
Add asset_held to account_history.
1 parent a7e8ff7 commit a2a8a6a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/env/TradingEnv.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __init__(self,
6464
self.n_discrete_actions: int = kwargs.get('n_discrete_actions', 24)
6565
self.action_space = spaces.Discrete(self.n_discrete_actions)
6666

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

@@ -124,6 +124,7 @@ def _take_action(self, action: int):
124124
self.net_worths.append(current_net_worth)
125125
self.account_history = self.account_history.append({
126126
'balance': self.balance,
127+
'asset_held': self.asset_held,
127128
'asset_bought': asset_bought,
128129
'purchase_cost': purchase_cost,
129130
'asset_sold': asset_sold,
@@ -202,6 +203,7 @@ def reset(self):
202203

203204
self.account_history = pd.DataFrame([{
204205
'balance': self.balance,
206+
'asset_held': self.asset_held,
205207
'asset_bought': 0,
206208
'purchase_cost': 0,
207209
'asset_sold': 0,

0 commit comments

Comments
 (0)