AI4Finance-Foundation / FinRL

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

Error encountered when running practical tutorial #978

Open RandyChen233 opened 1 year ago

RandyChen233 commented 1 year ago

Hi,

I was trying to run the following tutorial notebook, but the following error was encountered:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[<ipython-input-20-092cc71585f7>](https://localhost:8080/#) in <cell line: 1>()
----> 1 data = DP.download_data(start_date = '2021-10-04', 
      2                        end_date = '2021-10-08',
      3                        ticker_list = ticker_list,
      4                        time_interval= '5Min')

1 frames
[/usr/local/lib/python3.9/site-packages/finrl/meta/data_processor.py](https://localhost:8080/#) in download_data(self, ticker_list, start_date, end_date, time_interval)
     35         self, ticker_list, start_date, end_date, time_interval
     36     ) -> pd.DataFrame:
---> 37         df = self.processor.download_data(
     38             ticker_list=ticker_list,
     39             start_date=start_date,

[/usr/local/lib/python3.9/site-packages/finrl/meta/data_processors/processor_alpaca.py](https://localhost:8080/#) in download_data(self, ticker_list, start_date, end_date, time_interval)
     50         # filter opening time of the New York Stock Exchange (NYSE) (from 9:30 am to 4:00 pm) if time_interval < 1D
     51         day_delta = 86400000000000  # pd.Timedelta('1D').delta == 86400000000000
---> 52         if pd.Timedelta(time_interval).delta < day_delta:
     53             NYSE_open_hour = "14:30"  # in UTC
     54             NYSE_close_hour = "20:59"  # in UTC

AttributeError: 'Timedelta' object has no attribute 'delta'

Is there something wrong with the data query?

joshwigginton commented 1 year ago

Same issue running on colab. Running on local jupyter notebook just gives warning:

data = DP.download_data(start_date = '2021-10-04', end_date = '2021-10-08', ticker_list = ticker_list, time_interval= '1Min')

/home/fin/anaconda3/lib/python3.10/site-packages/finrl/meta/data_processors/processor_alpaca.py:52: FutureWarning: Timedelta.delta is deprecated and will be removed in a future version. if pd.Timedelta(time_interval).delta < day_delta:

eugene933 commented 1 year ago

Same issue

ErikBaer commented 1 year ago

got the same problem on Colab

zhongguojie1998 commented 1 year ago

Just change pd.Timedelta(time_interval).delta to pd.Timedelta(time_interval).value

uzairnz commented 1 year ago

Solution above didn’t work for me can you elaborate more