AI4Finance-Foundation / FinRL-Meta

FinRL­-Meta: Dynamic datasets and market environments for FinRL.
https://ai4finance.org
MIT License
1.24k stars 576 forks source link

row of dataframe decreased after ".add_technical_indicator(config.INDICATORS)" in FinRL_China_A_Share_Market.py #164

Open JPZ4-5 opened 2 years ago

JPZ4-5 commented 2 years ago

FinRL_China_A_Share_Market.py worked perfectly when trying ticket_list = CSI_300_TICKER. However, when I was trying to use all shares in China Main Board,the number of row of the dataframe decreased after "ts_processor.add_technical_indicator(config.INDICATORS)". It was 5678553 rows x 9 columns after ts_processor.clean_data(), and it decreased to 22071 rows x 18 columns after ts_processor.add_technical_indicator(config.INDICATORS). After then, it sayed as below:

len(train.tic.unique()): 0 train.tic.unique(): [] train.head(): Empty DataFrame Columns: [tic, date, index, unnamed: 0, open, high, low, close, volume, day, macd, boll_ub, boll_lb, rsi_30, cci_30, dx_30, close_30_sma, close_60_sma] Index: [] train.shape: (0, 18) Stock Dimension: 0, State Space: 1

and:

len(train.tic.unique()): 0 train.tic.unique(): [] train.head(): Empty DataFrame Columns: [tic, date, index, unnamed: 0, open, high, low, close, volume, day, macd, boll_ub, boll_lb, rsi_30, cci_30, dx_30, close_30_sma, close_60_sma] Index: [] train.shape: (0, 18) Stock Dimension: 0, State Space: 1

pandas had raised KeyError:0

How to fix it ? By the way, it seems that there is no "finrl_meta.data_processors.processor_tusharepro" in the folder, are there any diffenrences between it and "finrl_meta.data_processors.tushare"?

zhumingpassional commented 2 years ago

Can you set a smaller number of stocks and print the dataframe and see the difference betweent them?

processor_tusharepro should be replaced by tushare

dykw666 commented 1 year ago

同样的问题,似乎在运行ts_processor.add_technical_indicator(config.INDICATORS)后,数据的时间范围减少了

zhumingpassional commented 1 year ago

@dykw666 数据的时间范围减少,可能是因为假期、周末,也可能是数据缺失 get_trading_days返回的一致吗?如果是一致的,那么应该是正确的。

dykw666 commented 1 year ago

@zhumingpassional 感谢您的回复,你们创造了一个很好的项目。 5923ce2684a7383a31f61204049bd20 在添加技术指标后 1fa24f68dbf304f4b45a764039e3ab0 可以看到并不是因为非交易日的原因,数据由9万条变为1万多条,对此我很疑惑

dykw666 commented 1 year ago

我仅仅增加了ticket_list 37bac48a8656718b38e4a590bb17249