Skip to content

Commit bd9730e

Browse files
committed
Fix generated_space
1 parent ece8e03 commit bd9730e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tensortrade/exchanges/live/ccxt_exchange.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ def generated_space(self) -> Space:
105105
low = np.array([0, low_price, low_price, low_price * low_volume])
106106
high = np.array([1, high_price, high_volume, high_price * high_volume])
107107

108-
low = [lambda x: max(np.finfo(self._dtype).min, x) for x in low]
109-
high = [lambda x: min(np.finfo(self._dtype).max, x) for x in high]
108+
low = np.asarray([max(np.finfo(self._dtype).min, x) for x in low], dtype=self._dtype)
109+
high = np.asarray([min(np.finfo(self._dtype).max, x) for x in high], dtype=self._dtype)
110110

111111
return Box(low=low, high=high, dtype=self._dtype)
112112

tensortrade/exchanges/simulated/simulated_exchange.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ def generated_space(self) -> Space:
119119
high = np.array([self._max_trade_price, ] *
120120
(len(self._observation_columns) - 1) + [self._max_trade_amount, ])
121121

122-
low = [lambda x: max(np.finfo(self._dtype).min, x) for x in low]
123-
high = [lambda x: min(np.finfo(self._dtype).max, x) for x in high]
122+
low = np.asarray([max(np.finfo(self._dtype).min, x) for x in low], dtype=self._dtype)
123+
high = np.asarray([min(np.finfo(self._dtype).max, x) for x in high], dtype=self._dtype)
124124

125125
return Box(low=low, high=high, dtype=self._dtype)
126126

0 commit comments

Comments
 (0)