Closed lorrp1 closed 3 years ago
def my_process_data(df, window_size, frame_bound): prices = df.loc[:, 'NDX'].to_numpy() prices[frame_bound[0] - window_size] # validate index (TODO: Improve validation) prices = prices[frame_bound[0]-window_size:frame_bound[1]] signal_features = df.to_numpy()#np.column_stack((prices, diff)) return prices, signal_features class MyForexEnv(StocksEnv): def __init__(self, prices, signal_features, **kwargs): self._prices = prices self._signal_features = signal_features super().__init__(**kwargs) def _process_data(self): return self._prices, self._signal_features window_size = 30 start_index = window_size end_index = len(df) #env = MyForexEnv(df=df, window_size=10, frame_bound=(start_index, end_index)) prices, signal_features = my_process_data(df=df, window_size=window_size, frame_bound=(start_index, end_index)) env = MyForexEnv( prices, signal_features, df=df, window_size=window_size, frame_bound=(start_index, end_index)) env_maker = lambda: gym.make('env') env = DummyVecEnv([env_maker])
im trying using the extended env with strong baseline but i keep getting errors: TypeError: argument of type 'MyForexEnv' is not iterable or
class MyForexEnv(StocksEnv): def __init__(self, prices = prices, signal_features = signal_features, **kwargs): self._prices = prices self._signal_features = signal_features super().__init__(**kwargs) def _process_data(self): return self._prices, self._signal_features window_size = 30 start_index = window_size end_index = len(df) prices, signal_features = my_process_data(df=df, window_size=window_size, frame_bound=(start_index, end_index)) env_maker = lambda: gym.make(MyForexEnv,prices =prices, signal_features =signal_features, df=df, window_size=window_size, frame_bound=(start_index, end_index) ) env = DummyVecEnv([env_maker])
which returns: TypeError: argument of type 'type' is not iterable
TypeError: argument of type 'type' is not iterable
i have also tried using just the def in the new class definition to get the data but makes no difference. or:
class MyForexEnv(gym.ActionWrapper): def __init__(self, env, prices = prices, signal_features = signal_features, **kwargs): self.trade_fee_bid_percent = 0.05 self.trade_fee_ask_percent = 0.05 self._prices = prices self._signal_features = signal_features super(MyForexEnv, self).__init__(env) def _process_data(self): return self._prices, self._signal_features env = MyForexEnv(gym.make("stocks-v0"), prices, signal_features, df=df, window_size=window_size, frame_bound=(start_index, end_index))
still not working. any idea?
forgot the "lambda: "
using just the def in the new class definition to ge
Could you please share where exactly you forgot the lambda? I'm getting the same issue.
Edit Got it, env_maker = lambda: my_env
env_maker = lambda: my_env
im trying using the extended env with strong baseline but i keep getting errors: TypeError: argument of type 'MyForexEnv' is not iterable or
which returns:
TypeError: argument of type 'type' is not iterable
i have also tried using just the def in the new class definition to get the data but makes no difference. or:
still not working. any idea?