AI4Finance-Foundation / FinRL

FinRL: Financial Reinforcement Learning. 🔥
https://ai4finance.org
MIT License
9.73k stars 2.37k forks source link

NameError: name 'convert_interval' is not defined #964

Open zhangxianwei2015 opened 1 year ago

zhangxianwei2015 commented 1 year ago

Describe the bug Traceback (most recent call last): File "workspace/finrl/ai4finance/FinRL/finrl/main.py", line 149, in raise SystemExit(main()) File "workspace/finrl/ai4finance/FinRL/finrl/main.py", line 68, in main train( File "workspace/finrl/ai4finance/FinRL/finrl/train.py", line 31, in train data = dp.download_data(ticker_list, start_date, end_date, time_interval) File "workspace/finrl/ai4finance/FinRL/finrl/meta/data_processor.py", line 37, in download_data df = self.processor.download_data( File "workspace/finrl/ai4finance/FinRL/finrl/meta/data_processors/processor_yahoofinance.py", line 84, in download_data time_interval = convert_interval(time_interval) NameError: name 'convert_interval' is not defined

To Reproduce Steps to reproduce the behavior: run main.py

Expected behavior No Error

zhangxianwei2015 commented 1 year ago

Should add a 'self' to the function?

_def convert_interval(self, timeinterval: str) -> str:

Candy-Zhao commented 1 year ago

I think so because of the following error I encountered today:

TypeError Traceback (most recent call last) 1 dp = YahooFinanceProcessor() ----> 2 df = dp.download_data(start_date = '2008-01-01', 3 end_date = '2021-10-31', 4 ticker_list = config_tickers.DOW_30_TICKER, time_interval='1D')

File /usr/local/lib/python3.9/site-packages/finrl/meta/data_processors/processor_yahoofinance.py:84, in YahooFinanceProcessor.download_data(self, ticker_list, start_date, end_date, time_interval) 81 def download_data( 82 self, ticker_list: list[str], start_date: str, end_date: str, time_interval: str 83 ) -> pd.DataFrame: ---> 84 time_interval = self.convert_interval(time_interval) 86 self.start = start_date 87 self.end = end_date

TypeError: convert_interval() takes 1 positional argument but 2 were given

Should add a 'self' to the function?

_def convert_interval(self, timeinterval: str) -> str: