AI4Finance-Foundation / AI4Finance-Foundation/FinRL

Issue with the StockTradingEnv for 1m ticker data

Đang mở
#722 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
Jupyter Notebook
Star
16.3k
Fork
3.5k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I've been trying to train a model with 1m of tick data for the DOW_30 Index. Everything works perfectly fine for daily data, but when I do the same steps for 1m, I get errors. I've resolved the errors in the feature engineering by making modifications locally, as it looks like there was no support for 1m data.

raw data - https://www.dropbox.com/s/sdhzjl7jv5oaada/raw_dow30_2022-09-11_2022-09-18_1m.csv?dl=0
feature engineered data (without turbulence index) - https://www.dropbox.com/s/ohtdcsh01e88j3y/fe_dow30_2022-09-11_2022-09-18_1m.csv?dl=0

```python
from finrl.config import INDICATORS
from finrl.meta.env_stock_trading.env_stocktrading import StockTradingEnv

stock_dimension = len(train.tic.unique())
state_space = 1 + 2*stock_dimension + len(INDICATORS)*stock_dimension
buy_cost_list = sell_cost_list = [0.001] * stock_dimension
num_stock_shares = [0] * stock_dimension

env_kwargs = {
"hmax": 100,
"initial_amount": 1000000,
"num_stock_shares": num_stock_shares,
"buy_cost_pct": buy_cost_list,
"sell_cost_pct": sell_cost_list,
"state_space": state_space,
"stock_dim": stock_dimension,
"tech_indicator_list": INDICATORS,
"action_space": stock_dimension,
"reward_scaling": 1e-4
}

e_train_gym = StockTradingEnv(df = train, **env_kwargs)
```

**Error** - AttributeError: 'numpy.float64' object has no attribute 'values'

On digging deeper, it looks like the error is coming while initializing the state in the **_StockTradingEnv_** class under **__initiate_state_** function. It looks like it's expecting an array **_self.data.close.values.tolist()_** but as per the initial declaration **_self.data = self.df.loc[self.day, :]_**, a scalar value is coming.

Please let me know if I'm doing anything wrong. Also, help me with any existing implementation on 1m data.

Thank you
Lokesh Soni

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.