Closed mhdmyz closed 1 year ago
Impressive codes. Thanks.
Another developer submitted a PR in finrl, which also revises alpaca processor. Have you compared your version with it? He used pd.Timestamp(date, tz=NY) to update the date. https://github.com/AI4Finance-Foundation/FinRL/pull/691/files
Since date must be timezone naive, you'll get the same error if you define a timezone.
To fix the following issue the suggested change has to be made:
Traceback (most recent call last):
Input In [1] in <cell line: 44> dp.clean_data()
File ~/FinRL-Meta/finrl_meta/data_processor.py:72 in clean_data self.processor.clean_data()
File ~/FinRL-Meta/finrl_meta/data_processors/yahoofinance.py:82 in clean_data trading_days = self.get_trading_days(start=self.start_date, end=self.end_date)
File ~/FinRL-Meta/finrl_meta/data_processors/yahoofinance.py:281 in get_trading_days df = nyse.sessions_in_range(pd.Timestamp(start, tz=pytz.UTC),
File /opt/homebrew/Caskroom/miniforge/base/envs/py39/lib/python3.9/site-packages/exchange_calendars/exchange_calendar.py:2168 in sessions_in_range slc = self._get_sessions_slice(start, end, _parse)
File /opt/homebrew/Caskroom/miniforge/base/envs/py39/lib/python3.9/site-packages/exchange_calendars/exchange_calendar.py:2145 in _get_sessions_slice start, end = self._parse_start_end_dates(start, end, _parse)
File /opt/homebrew/Caskroom/miniforge/base/envs/py39/lib/python3.9/site-packages/exchange_calendars/exchange_calendar.py:2141 in _parse_start_end_dates return parse_date(start, "start", self), parse_date(end, "end", self)
File /opt/homebrew/Caskroom/miniforge/base/envs/py39/lib/python3.9/site-packages/exchange_calendars/calendar_helpers.py:378 in parse_date raise ValueError(
ValueError: Parameter
start
received with timezone defined as 'UTC' although a Date must be timezone naive.