AI4Finance-Foundation / FinRL

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

Timedelta depreciated on Papertrading demo #958

Open Seraphaious opened 1 year ago

Seraphaious commented 1 year ago

` 50 # filter opening time of the New York Stock Exchange (NYSE) (from 9:30 am to 4:00 pm) if time_interval < 1D 51 # from trepan.api import debug;debug() ---> 52 # filter opening time of the New York Stock Exchange (NYSE) (from 9:30 am to 4:00 pm) if time_interval < 1D 53 day_delta = 86400000000000 # pd.Timedelta('1D').delta == 86400000000000 54 if pd.to_timedelta(time_interval) < day_delta:

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

From the code

day_delta = 86400000000000 # pd.Timedelta('1D').delta == 86400000000000 if pd.to_timedelta(time_interval) < day_delta: NYSE_open_hour = "14:30" # in UTC NYSE_close_hour = "20:59" # in UTC data_df = barset.between_time(NYSE_open_hour, NYSE_close_hour) else: data_df = barset

EHSchmitt4395 commented 1 year ago

problem has to do with new pandas release,

in requirements it should prob get fixed to version b4 it

pandas==1.5.3

LunbiWa commented 1 year ago

Excuse me, is issue #958 resolved? I also encountered the same problem today

colab report error

Alpaca successfully connected


AttributeError Traceback (most recent call last)

in () ----> 1 train(start_date = '2022-08-25', 2 end_date = '2022-08-31', 3 ticker_list = ticker_list, 4 data_source = 'alpaca', 5 time_interval='1Min', 2 frames /usr/local/lib/python3.10/site-packages/finrl/meta/data_processors/processor_alpaca.py 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'
LunbiWa commented 1 year ago

chatGPT recommended changes:

image

LunbiWa commented 1 year ago

GPT4 recommended changes

image

LunbiWa commented 1 year ago

@XiaoYangLiu-FinRL please try it now