Closed rektosaure closed 3 years ago
Yes, it is expecting a data frame and it is possible with more than one stock. Probably you can navigate to /usr/local/lib/python3.7/dist-packages/finrl/neo_finrl/env_stock_trading/env_stocktrading.py and substitute this
if self.turbulence_threshold is not None:
if len(self.df.tic.unique()) == 1:
self.turbulence = self.data[self.risk_indicator_col]
elif len(self.df.tic.unique()) > 1:
self.turbulence = self.data[self.risk_indicator_col].values[0]
self.state = self._update_state()
Thank you
Hi,
Stocks models, including ensemble method, don't work with single stock in StockTradingEnv. It fails when running prediction and using turbulence_threshold:
e_trade_gym = StockTradingEnv(df = trade, turbulence_threshold = 70, risk_indicator_col='vix', **env_kwargs)
df_account_value, df_actions = DRLAgent.DRL_prediction( model=trained_agent, environment = e_trade_gym)
AttributeError Traceback (most recent call last)